MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus Bergisches Wiki
Wechseln zu: Navigation, Suche
 
Zeile 1: Zeile 1:
 
$(window).load(function() {
 
$(window).load(function() {
 +
  var getSectionCharacters = function() {
 +
    return $("#wikiEditor-section-characters .index div");
 +
  }
  
   if ($(".tab-characters a").length > 0) { // => Skript greift nur im Edit-Mode
+
   var filterDelete = function(sectionCharacters) {
 +
    return sectionCharacters.filter("div[rel!='latin'][rel!='symbols']");
 +
  }
  
    $(".tab-characters a").click(function() {  
+
  $(".tab-characters a").click(function() {  
      sectionCharactersCreationListener(100);
+
    sectionCharactersCreationListener(100);
    });
+
  });
  
    sectionCharactersCreationListener = function(delay) {
+
  sectionCharactersCreationListener = function(delay) {
      var sectionCharactersAll = $("#wikiEditor-section-characters .index div");
+
    var sectionCharactersAll = getSectionCharacters();
  
      console.log("sectionCharactersCreationListener: " + (new Date()).getMilliseconds() + "/" + sectionCharactersAll.length);
+
    console.log("sectionCharactersCreationListener: " + (new Date()).getMilliseconds() + "/" + sectionCharactersAll.length);
  
      if (sectionCharactersAll.length > 0) {
+
    if (sectionCharactersAll.length > 0) {
        var sectionCharacters = sectionCharactersAll.filter("div[rel!='latin'][rel!='symbols']");
+
      var sectionCharacters = filterDelete(sectionCharactersAll);
        sectionCharacters.remove();
+
      sectionCharacters.remove();
      } else if (delay > 0) {
+
    } else {
        setTimeout(sectionCharactersCreationListener, delay);
+
      setTimeout(sectionCharactersCreationListener, delay);
      }
+
    }
    };
+
  };
  
    sectionCharactersCreationListener(0);
+
  var sectionCharactersAll = getSectionCharacters();
   }
+
   var sectionCharacters = filterDelete(sectionCharactersAll);
 +
  sectionCharacters.remove();
 
});
 
});

Aktuelle Version vom 3. Februar 2015, 15:32 Uhr

$(window).load(function() {
  var getSectionCharacters = function() {
    return $("#wikiEditor-section-characters .index div");
  }

  var filterDelete = function(sectionCharacters) {
    return sectionCharacters.filter("div[rel!='latin'][rel!='symbols']");
  }

  $(".tab-characters a").click(function() { 
    sectionCharactersCreationListener(100);
  });

  sectionCharactersCreationListener = function(delay) {
    var sectionCharactersAll = getSectionCharacters();

    console.log("sectionCharactersCreationListener: " + (new Date()).getMilliseconds() + "/" + sectionCharactersAll.length);

    if (sectionCharactersAll.length > 0) {
      var sectionCharacters = filterDelete(sectionCharactersAll);
      sectionCharacters.remove();
    } else {
      setTimeout(sectionCharactersCreationListener, delay);
    }
  };

  var sectionCharactersAll = getSectionCharacters();
  var sectionCharacters = filterDelete(sectionCharactersAll);
  sectionCharacters.remove();
});