MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
KKeine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
(2 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
Zeile 2: | Zeile 2: | ||
//Popup item | //Popup item | ||
if ($('.item_container').length | if ($('.item_container').length || $('.set_icon').length) { | ||
$('.item_container').each(function() { | $('.item_container').each(function() { | ||
var url=$(this).attr('data-url'); | var url=$(this).attr('data-url'); | ||
Zeile 10: | Zeile 10: | ||
$.getScript("/wiki/Popup.js?action=raw"); | $.getScript("/wiki/Popup.js?action=raw"); | ||
} | } | ||
//set favicon | |||
$('head').append('<link rel="icon" href="https://www.google.com/s2/favicons?sz=64&domain=the-west.net" type="image/x-icon">'); | |||
mw.config.set('tableSorterCollation',{'ä':'ae','ö':'oe','ß':'ss','ü':'ue'}); | mw.config.set('tableSorterCollation',{'ä':'ae','ö':'oe','ß':'ss','ü':'ue'}); | ||
Zeile 21: | Zeile 24: | ||
currentAmountsArray[index] = parseInt($(this).text()); | currentAmountsArray[index] = parseInt($(this).text()); | ||
}); | }); | ||
$("#craft_nb").on('input | $("#craft_nb").on('input', function () { | ||
this.value > 9000 | this.value > 9000 | ||
? (this.value = 9000) | ? (this.value = 9000) | ||
Zeile 38: | Zeile 41: | ||
if ($('.input_calc.craft_search').length) | if ($('.input_calc.craft_search').length) | ||
$('<input type="text" class="west" style="width:180px;" id="craft_search" placeholder="Suche">').appendTo($('.craft_search')); | $('<input type="text" class="west" style="width:180px;" id="craft_search" placeholder="Suche">').appendTo($('.craft_search')); | ||
$("#craft_search").on(" | $("#craft_search").on("input", function() { | ||
var value = $(this).val(); | var value = $(this).val(); | ||
$("table tr").each(function(index) { | $("table tr").each(function(index) { | ||
Zeile 54: | Zeile 57: | ||
}); | }); | ||
}); | }); | ||
//craft spoilers | //craft spoilers | ||
var cTogg = $('div[class^="mw-customtoggle-"]'); | var cTogg = $('div[class^="mw-customtoggle-"]'); | ||
if (cTogg.length) | if (cTogg.length) | ||
cTogg.click(function(){$(this).toggleClass('toggle-expanded')}) | cTogg.click(function(){$(this).toggleClass('toggle-expanded')}) | ||
//Calculate box | //Calculate box |
Aktuelle Version vom 25. November 2023, 23:35 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */ //Popup item if ($('.item_container').length || $('.set_icon').length) { $('.item_container').each(function() { var url=$(this).attr('data-url'); $(this).append('<img src="//westde.innogamescdn.com/images/items/'+url+(url.indexOf('.png')<0?'.png':'')+'">'); }); $.getJSON("/wiki/Evsets.json?action=raw",function(e){evsets=e}); $.getScript("/wiki/Popup.js?action=raw"); } //set favicon $('head').append('<link rel="icon" href="https://www.google.com/s2/favicons?sz=64&domain=the-west.net" type="image/x-icon">'); mw.config.set('tableSorterCollation',{'ä':'ae','ö':'oe','ß':'ss','ü':'ue'}); //craft products count if ($('.input_calc.craft_nb').length) { $('<input type="number" class="west" style="width:80px;" id="craft_nb" value="1" max="9000">').appendTo($('.craft_nb')); var multiplierValue = 1; var currentAmountsArray = []; $('.number').each(function (index) { currentAmountsArray[index] = parseInt($(this).text()); }); $("#craft_nb").on('input', function () { this.value > 9000 ? (this.value = 9000) : this.value < 0 && (this.value = 0); multiplierValue = this.value; $('.number').each(function (index) { $(this).text(currentAmountsArray[index] * multiplierValue); }); $('.craft_extra').show(); $('.craft_extra .item_container').each(function () { $(this).children().addClass('OverlayItem'); }); }); } //craft live search - thanks to Criminus from RO if ($('.input_calc.craft_search').length) $('<input type="text" class="west" style="width:180px;" id="craft_search" placeholder="Suche">').appendTo($('.craft_search')); $("#craft_search").on("input", function() { var value = $(this).val(); $("table tr").each(function(index) { if (index !== 0) { $row = $(this); var id = $.map($row.find('td .item_container'), function(element) { return $(element).attr("data-popup") }).join(' '); if (id.toLowerCase().indexOf(value.toLowerCase()) < 0) { $row.hide(); } else { $row.show(); } } }); }); //craft spoilers var cTogg = $('div[class^="mw-customtoggle-"]'); if (cTogg.length) cTogg.click(function(){$(this).toggleClass('toggle-expanded')}) //Calculate box if ($('.calculate_box').length) $.getScript('/wiki/Calculate.js?action=raw'); //File overview when not logged in if (location.pathname.startsWith("/wiki/Datei:") && $("#ca-viewsource").length) $("#content").addClass("file_page");