MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Admin (Diskussion | Beiträge) (Der Seiteninhalt wurde durch einen anderen Text ersetzt: „→Das folgende JavaScript wird für alle Benutzer geladen.: “) |
Keine Bearbeitungszusammenfassung |
||
(29 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
/* Das folgende JavaScript wird für alle Benutzer geladen. */ | /* 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"); |
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");