MediaWiki:Common.js
Jump to navigation
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ $('.tbbox-logo').wrap('<a href="/wiki/Main_Page"></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>'); }); } // Duelcalc - n3mesis if($("#calcDuelExp").length!==0){var context=$("#calcDuelExp");var input_character_level=$('<input type="number" style="width:150px;" class="west" placeholder="Your duel level" 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;} calcDuelExp();}).appendTo(context.find(".character_level"));var input_oponent_level=$('<input type="number" style="width:150px;" class="west" placeholder="Opponents duel level" 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;} calcDuelExp();}).appendTo(context.find(".oponent_level"));var input_duel_motivation=$('<input type="number" style="width:150px;" class="west" placeholder="Duel motivation" min="0" max="100">').bind("propertychange keyup input paste",function(){if(this.value>100){this.value=100;}else if(this.value<0){this.value=0;} calcDuelExp();}).appendTo(context.find(".duel_motivation"));function calcDuelExp(){var oponent_lvl=parseInt(input_oponent_level.val()),char_lvl=parseInt(input_character_level.val()),duel_mot=parseInt(input_duel_motivation.val());if(isNaN(oponent_lvl)||isNaN(char_lvl)||isNaN(duel_mot)){context.find(".result").html("");}else{var getduelexp=(((oponent_lvl*7)-(5*char_lvl)+5)*(duel_mot/100));var getexp=(getduelexp*3);var loseduelexp=(getduelexp/3);context.find(".result").html("If you win you will get "+getduelexp+" duelexp and "+getexp+" exp.<br/>If you lose you will lose "+loseduelexp+" duelexp.");if(!(isNaN(char_lvl))){context.find(".result1").html("");}else{var maxduellvl=(Math.ceil(char_lvl*1.4));var minduellvl=(Math.floor(char_lvl/1.4));context.find(".result1").html("Maximum duellevel "+maxduellvl+" and minimum duellevel: "+minduellvl);}}}}