MediaWiki:Common.js
Jump to navigation
Notă: După publicare, trebuie să treceți peste memoria cache a navigatorului pentru a putea vedea modificările:
- Firefox / Safari: Țineți apăsat pe Shift în timp ce faceți clic pe Reîncărcare ori apăsați Ctrl-F5 sau Ctrl-R (⌘-R pe un sistem Mac);
- Google Chrome: Apăsați Ctrl-Shift-R (⌘-Shift-R pe un sistem Mac);
- Internet Explorer / Edge: Țineți apăsat pe Ctrl în timp ce faceți clic pe Reîmprosptare sau apăsați Ctrl-F5;
- Opera: Apăsați Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ $('.tbbox-logo').wrap('<a href="/wiki/Pagina_principal%C4%83"></a>'); if ($('.item_container').length!==0) { $('.item_container').each(function() { $(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + '?1">'); }); $.getScript("/wiki/Popup.js?action=raw"); } $(window).scroll(function() { if ($(this).scrollTop() > 300) { $('#back-top').fadeIn(); } else { $('#back-top').fadeOut(); } }); // Scroll body to top on click $('#back-top a').click(function() { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); // Embed youtube videos if ($('.youtube_video').length !== 0) { $('.youtube_video').each(function() { $(this).html('<iframe width="100%" height="100%" src="https://www.youtube.com/embed/' + $(this).attr('data-id') + '?cc_load_policy=1&cc_lang_pref=' + $(this).attr('data-subtitles') + '" frameborder="0" allowfullscreen></iframe>'); }); } //Configuration du tri des diacritique dans les tables de class "sortable" mw.config.set( 'tableSorterCollation', {'à':'a', 'â':'a', 'æ':'ae', 'é':'e', 'è':'e', 'ê':'e', 'î':'i', 'ï':'i', 'ô':'o', 'œ':'oe', 'û':'u', 'ç':'c', } ); if ($('#calcLvlLoss').length !== 0) { var context = $('#calcLvlLoss'); var input_character_level = $('<input type="number" style="width:150px;" class="west" placeholder="Nivel" min="0" max="150">').bind("propertychange keyup input paste", function() { if (this.value > 150) { this.value = 150; } else if (this.value < 0) { this.value = 0; } calcLvlLoss(); }).appendTo(context.find(".character_level")); var input_duel_level = $('<input type="number" style="width:150px;" class="west" placeholder="Nivelul duelului" min="0" max="450">').bind("propertychange keyup input paste", function() { if (this.value > 450) { this.value = 450; } else if (this.value < 0) { this.value = 0; } calcLvlLoss(); }).appendTo(context.find(".duel_level")); function calcLvlLoss() { var duel_lvl = parseInt(input_duel_level.val()), char_lvl = parseInt(input_character_level.val()); if (isNaN(duel_lvl) || isNaN(char_lvl) || duel_lvl < char_lvl) { context.find('.result').html(''); } else { var getXp = function(lvl) { return Math.ceil(Math.pow((lvl) / 0.1, 1 / 0.6)); }, getLvl = function(xp, perc) { return char_lvl + Math.floor(Math.pow(xp * (perc || 1), 0.6) * 0.1); }; var minXp = getXp(duel_lvl - char_lvl), maxXp = duel_lvl === 450 ? '∞' : getXp(duel_lvl + 1 - char_lvl), minLvl = getLvl(minXp, 0.9), maxLvl = duel_lvl === 450 ? 450 : getLvl(maxXp, 0.9); context.find('.result').html('Experiența de duel actuală: ' + minXp + ' - ' + maxXp + '<br/>Nivelul de duel după utilizarea poțiunii: ' + minLvl + (maxLvl > minLvl ? ' - ' + maxLvl : '')); } } } //Quest Locator - Criminus var myDiv = document.getElementById("quest_giver_form"); //Create array of options to be added var myDiv = document.getElementById("quest_giver_form"); //Create array of options to be added var array = [ "-- Alege --", "Adjunct permanent", "Alan Pinkerton", "Albia râului", "Andy", "Applepie Annie", ]; //Create and append select list var selectList = document.createElement("select"); selectList.setAttribute("id", "mySelect"); myDiv.appendChild(selectList); //Create and append the options for (var i = 0; i < array.length; i++) { var option = document.createElement("option"); option.setAttribute("value", i); option.text = array[i]; selectList.appendChild(option); } selectList.onchange = function() { var index = this.selectedIndex; for (var i = 1; i < array.length; i++) document.getElementById("quest_giver_" + i).style.display = "none"; if(!index) return; document.getElementById("quest_giver_" + index).style.display = "block"; }