MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus Bergisches Wiki
Zeile 4: | Zeile 4: | ||
$(".tab-characters a").click(function() { | $(".tab-characters a").click(function() { | ||
− | sectionCharactersCreationListener(100); | + | sectionCharactersCreationListener(100, 1000); |
}); | }); | ||
− | sectionCharactersCreationListener = function(delay) { | + | sectionCharactersCreationListener = function(delay, recursions) { |
var sectionCharactersAll = $("#wikiEditor-section-characters .index div"); | var sectionCharactersAll = $("#wikiEditor-section-characters .index div"); | ||
Zeile 15: | Zeile 15: | ||
var sectionCharacters = sectionCharactersAll.filter("div[rel!='latin'][rel!='symbols']"); | var sectionCharacters = sectionCharactersAll.filter("div[rel!='latin'][rel!='symbols']"); | ||
sectionCharacters.remove(); | sectionCharacters.remove(); | ||
− | } else { | + | } else if (recursions > 0) { |
− | setTimeout(sectionCharactersCreationListener, delay); | + | setTimeout(sectionCharactersCreationListener, delay, recursions - 1); |
} | } | ||
}; | }; | ||
Zeile 22: | Zeile 22: | ||
if ($("#wikiEditor-section-characters .index div").length > 0) // Greift nur, wenn Characters-Sektion bereits auf ist | if ($("#wikiEditor-section-characters .index div").length > 0) // Greift nur, wenn Characters-Sektion bereits auf ist | ||
{ | { | ||
− | sectionCharactersCreationListener(100); | + | sectionCharactersCreationListener(100, 10); |
} | } | ||
} | } | ||
}); | }); |
Version vom 3. Februar 2015, 15:29 Uhr
$(window).load(function() { if ($(".tab-characters a").length > 0) { // => Skript greift nur im Edit-Mode $(".tab-characters a").click(function() { sectionCharactersCreationListener(100, 1000); }); sectionCharactersCreationListener = function(delay, recursions) { var sectionCharactersAll = $("#wikiEditor-section-characters .index div"); console.log("sectionCharactersCreationListener: " + (new Date()).getMilliseconds() + "/" + sectionCharactersAll.length); if (sectionCharactersAll.length > 0) { var sectionCharacters = sectionCharactersAll.filter("div[rel!='latin'][rel!='symbols']"); sectionCharacters.remove(); } else if (recursions > 0) { setTimeout(sectionCharactersCreationListener, delay, recursions - 1); } }; if ($("#wikiEditor-section-characters .index div").length > 0) // Greift nur, wenn Characters-Sektion bereits auf ist { sectionCharactersCreationListener(100, 10); } } });