MediaWiki:Common.js: Difference between revisions
Jump to navigation
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
$('.tbbox-logo'). | $('.tbbox-logo').after('<div id="search_live_item"><div class="search_item"><p id="1">Nume obiect sau ID</p</div><div class="audio-arrow-box" id="audio-arrow-box"><div class="popup-container" id="popup-container"><div class="load_items"><span id="2">Load items here</span></div></div></div></div></div>'); | ||
$('.search_item p').each(function() { | |||
var id = $(this).attr('id'); | |||
var phrase = $(this).text(); | |||
$(this).attr('data-url') + | var newInput="<input type='text' id='live_search_item' name='search_item' value='"+phrase+"' class='search_item' />"; | ||
$(this).replaceWith(newInput); | |||
}); | |||
$(document).ready( | |||
} | function(){ | ||
$("#search_live_item").click(function () { | |||
$("#audio-arrow-box").fadeToggle(); | |||
}); | |||
$("#search_live_item").focusout(function () { | |||
$("#audio-arrow-box").fadeToggle(); | |||
}); | |||
}); | |||
$("#live_search_item").on("keyup", function() { | |||
var value = $(this).val(); | |||
$(".item").each(function() { | |||
$row = $(this); | |||
var id = $.map($row.find('span .item_container'), function(element) { | |||
return $(element).attr("data-popup") | |||
}).join(' '); | |||
if (id.toLowerCase().indexOf(value.toLowerCase()) < 0) { | |||
$row.hide(); | |||
} else { | |||
$row.show(); | |||
} | |||
}); | |||
}); | |||
$('#live_search_item').each(function(k, v){ | |||
var obj = $(this); | |||
obj.keyup(function(){ | |||
if(obj.val().length >= 4){ | |||
$(".load_items").show(); | |||
} else { | |||
$(".load_items").hide(); | |||
} | |||
}); | |||
}); | |||
$(document).ready( function() { | |||
$("#live_search_item").focus( function() { | |||
if ( $(this).val()=="Nume obiect sau ID") { | |||
$(this).val(''); | |||
} | |||
}); | |||
$("#live_search_item").blur( function() { | |||
if ( $(this).val()=="") { | |||
$(this).val('Nume obiect sau ID'); | |||
} | |||
}); | |||
}); | |||
jQuery(document).ready(function($) { | |||
$.getScript("https://the-west.tools/js/en_itemdatabase.js?action=raw", function() { | |||
$('.load_items span').each(function() { | |||
var ide = $(this).attr('id'); | |||
$(this).replaceWith(loadItems); | |||
}); | |||
$('.item_container').each(function() { | |||
$(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + '?1">'); | |||
}); | |||
if ($('.item_container').length) { | |||
$('.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 () { | $(window).scroll(function () { |
Revision as of 01:48, 17 October 2022
/* Any JavaScript here will be loaded for all users on every page load. */ $('.tbbox-logo').after('<div id="search_live_item"><div class="search_item"><p id="1">Nume obiect sau ID</p</div><div class="audio-arrow-box" id="audio-arrow-box"><div class="popup-container" id="popup-container"><div class="load_items"><span id="2">Load items here</span></div></div></div></div></div>'); $('.search_item p').each(function() { var id = $(this).attr('id'); var phrase = $(this).text(); var newInput="<input type='text' id='live_search_item' name='search_item' value='"+phrase+"' class='search_item' />"; $(this).replaceWith(newInput); }); $(document).ready( function(){ $("#search_live_item").click(function () { $("#audio-arrow-box").fadeToggle(); }); $("#search_live_item").focusout(function () { $("#audio-arrow-box").fadeToggle(); }); }); $("#live_search_item").on("keyup", function() { var value = $(this).val(); $(".item").each(function() { $row = $(this); var id = $.map($row.find('span .item_container'), function(element) { return $(element).attr("data-popup") }).join(' '); if (id.toLowerCase().indexOf(value.toLowerCase()) < 0) { $row.hide(); } else { $row.show(); } }); }); $('#live_search_item').each(function(k, v){ var obj = $(this); obj.keyup(function(){ if(obj.val().length >= 4){ $(".load_items").show(); } else { $(".load_items").hide(); } }); }); $(document).ready( function() { $("#live_search_item").focus( function() { if ( $(this).val()=="Nume obiect sau ID") { $(this).val(''); } }); $("#live_search_item").blur( function() { if ( $(this).val()=="") { $(this).val('Nume obiect sau ID'); } }); }); jQuery(document).ready(function($) { $.getScript("https://the-west.tools/js/en_itemdatabase.js?action=raw", function() { $('.load_items span').each(function() { var ide = $(this).attr('id'); $(this).replaceWith(loadItems); }); $('.item_container').each(function() { $(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + '?1">'); }); if ($('.item_container').length) { $('.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');});});} // As seen on https://bitbucket.org/cmcqueen1975/htmlfloatingtableheader/overview function UpdateTableHeaders() { $("div.divTableWithFloatingHeader").each(function() { var originalHeaderRow = $(".tableFloatingHeaderOriginal", this); var floatingHeaderRow = $(".tableFloatingHeader", this); var offset = $(this).offset(); var scrollTop = $(window).scrollTop(); if ((scrollTop > originalHeaderRow.offset().top) && (scrollTop < offset.top + $(this).height() - originalHeaderRow.height())) { floatingHeaderRow.css("visibility", "visible"); floatingHeaderRow.css("top", "0px"); // Copy cell widths from original header $("th", floatingHeaderRow).each(function(index) { var cellWidth = $("th", originalHeaderRow).eq(index).css('width'); $(this).css('width', cellWidth); }); // Copy row width from whole table floatingHeaderRow.css("width", $(this).css("width")); } else { floatingHeaderRow.css("visibility", "hidden"); floatingHeaderRow.css("top", "0px"); } }); }; $(function() { $("table.tableWithFloatingHeader").each(function() { $(this).wrap("<div class=\"divTableWithFloatingHeader\" style=\"position:relative\"></div>"); var cls = "tr.floatingHeader"; if($(cls, this).length == 0) { cls = "tr"; } var originalHeaderRow = $(cls, this).first(); var clonedHeaderRow = originalHeaderRow.clone().insertBefore(originalHeaderRow); clonedHeaderRow.addClass("tableFloatingHeader"); clonedHeaderRow.css("position", "fixed"); clonedHeaderRow.css("top", "0px"); clonedHeaderRow.css("left", $(this).offset().left); clonedHeaderRow.css("visibility", "hidden"); clonedHeaderRow.css("z-index", 1); originalHeaderRow.addClass("tableFloatingHeaderOriginal"); }); UpdateTableHeaders(); $(window).on('scroll', UpdateTableHeaders); $(window).on('resize', UpdateTableHeaders); }); (function($) { $(document).ready(function() { $('.radioButtonsHere').replaceWith('<center><input id="normal" type="radio" value="0" class="selectRadio" name="selectRadio"/> Normal Job <input id="silver" type="radio" value="50" class="selectRadio" name="selectRadio"/> Silver <input id="aura" type="radio" value="100" class="selectRadio" name="selectRadio"/> Gold</center>'); var multiplierValue = 1; var currentXPArray = []; var currentCashArray = []; $('.xp').each(function(index) { currentXPArray[index] = parseInt($(this).text()); }); $('.money').each(function(index) { var getNumber = $(this).text().replace(/[^0-9]/gi, ''); currentCashArray[index] = parseFloat(getNumber, 10); }); $("input[name='selectRadio']").change(function() { multiplierValue = $(this).val(); $('.xp').each(function(index) { var finalXP = currentXPArray[index] + (currentXPArray[index] * (multiplierValue / 100)); $(this).text(Math.round(finalXP)); $(this).css({ 'font-weight': 'bold' }); }); $('.money').each(function(index) { var finalCash = currentCashArray[index] + (currentCashArray[index] * (multiplierValue / 100)); var cashSymbol = "$ "; $(this).text(cashSymbol + Math.round(finalCash)); $(this).css({ 'font-weight': 'bold' }); }); }); $('.appImage').replaceWith('<img src="https://wiki.the-west.net/images/8/8c/Transparent.png" class="job_Type" style="position:absolute;margin-top:-6px;margin-left:-6px;" />'); $("input[name='selectRadio']").change( function(){ var $src = ""; if ($(this).val() == '50') { $src = "https://wiki.the-west.net/images/a/ac/Silverjob_small.png"; } else if ($(this).val() == '100') { $src = "https://wiki.the-west.net/images/a/a6/Goldjob_small.png"; } else{ $src = "https://wiki.the-west.net/images/8/8c/Transparent.png" $('.money').css({ 'font-weight': 'normal' }); $('.xp').css({ 'font-weight': 'normal' }); } $('.job_Type').attr('src',$src); }); }); })(jQuery);