MediaWiki:Common.js: Difference between revisions
Jump to navigation
No edit summary |
No edit summary |
||
Line 45: | Line 45: | ||
$.getScript('/wiki/Calculate.js?action=raw'); | $.getScript('/wiki/Calculate.js?action=raw'); | ||
}; | }; | ||
//crafting | |||
if($('.target_input').length){$('.target_input p').each(function(){var id=$(this).attr('id');var phrase=$(this).text();var newInput="<input type='number' name='input_new' value='"+ | |||
phrase+"' class='target' max='50000' min='' />";$(this).replaceWith(newInput);});var multiplierValue=1;var currentAmountsArray=[];$('.amount').each(function(index){currentAmountsArray[index]=parseInt($(this).text());});$("input[name='input_new']").on('input paste keyup',function(){this.value>50000?(this.value=50000):this.value<0&&(this.value=0);multiplierValue=this.value;$('.amount').each(function(index){$(this).text(currentAmountsArray[index]*multiplierValue);});$('.craft_extra').show();$('.craft_extra .item_container').each(function(){$(this).children().addClass('OverlayItem');});});} |
Revision as of 19:22, 18 May 2022
/* 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>' ); }); } //calculate box - n3mesis if ($('.calculate_box').length) { $.getScript('/wiki/Calculate.js?action=raw'); }; //crafting if($('.target_input').length){$('.target_input p').each(function(){var id=$(this).attr('id');var phrase=$(this).text();var newInput="<input type='number' name='input_new' value='"+ phrase+"' class='target' max='50000' min='' />";$(this).replaceWith(newInput);});var multiplierValue=1;var currentAmountsArray=[];$('.amount').each(function(index){currentAmountsArray[index]=parseInt($(this).text());});$("input[name='input_new']").on('input paste keyup',function(){this.value>50000?(this.value=50000):this.value<0&&(this.value=0);multiplierValue=this.value;$('.amount').each(function(index){$(this).text(currentAmountsArray[index]*multiplierValue);});$('.craft_extra').show();$('.craft_extra .item_container').each(function(){$(this).children().addClass('OverlayItem');});});}