MediaWiki:Common.js: Difference between revisions
Jump to navigation
No edit summary |
No edit summary |
||
Line 36: | Line 36: | ||
if($('#calcSpeed').length!==0){hide_spd_vip();var context=$('#calcSpeed');var input_horse_speed=$('<input type="number" style="width:150px;" class="west" placeholder="Horse speed" min="0" max="19900">').bind('propertychange keyup input paste',function(){if(this.value>19900){this.value=19900;}else if(this.value<0){this.value=0;} | if($('#calcSpeed').length!==0){hide_spd_vip();var context=$('#calcSpeed');var input_horse_speed=$('<input type="number" style="width:150px;" class="west" placeholder="Horse speed" min="0" max="19900">').bind('propertychange keyup input paste',function(){if(this.value>19900){this.value=19900;}else if(this.value<0){this.value=0;} | ||
calcSpeed();}).appendTo(context.find('.horse_speed'));var input_skill_horsebackriding=$('<input type="number" style="width:150px;" class="west" placeholder="horseback riding" min="0" max="9000">').bind('propertychange keyup input paste',function(){if(this.value>9000){this.value=9000;}else if(this.value<0){this.value=0;} | calcSpeed();}).appendTo(context.find('.horse_speed'));var input_skill_horsebackriding=$('<input type="number" style="width:150px;" class="west" placeholder="horseback riding" min="0" max="9000">').bind('propertychange keyup input paste',function(){if(this.value>9000){this.value=9000;}else if(this.value<0){this.value=0;} | ||
calcSpeed();}).appendTo(context.find('.skill_horsebackriding'));var input_gear_bonus=$('<input type="number" style="width:150px;" class="west" placeholder="Gear" min="0" max="900">').bind('propertychange keyup input paste',function(){if(this.value>900){this.value=900;}else if(this.value<0){this.value=0;} | calcSpeed();}).appendTo(context.find('.skill_horsebackriding'));var input_gear_bonus=$('<input type="number" style="width:150px;" class="west" placeholder="Gear speed in %" min="0" max="900">').bind('propertychange keyup input paste',function(){if(this.value>900){this.value=900;}else if(this.value<0){this.value=0;} | ||
calcSpeed();}).appendTo(context.find('.gear_bonus'));var input_speed_buff=$('<input type="number" style="width:150px;" class="west" placeholder="Buff" min="0" max="900">').bind('propertychange keyup input paste',function(){if(this.value>900){this.value=900;}else if(this.value<0){this.value=0;} | calcSpeed();}).appendTo(context.find('.gear_bonus'));var input_speed_buff=$('<input type="number" style="width:150px;" class="west" placeholder="Buff speed in %" min="0" max="900">').bind('propertychange keyup input paste',function(){if(this.value>900){this.value=900;}else if(this.value<0){this.value=0;} | ||
calcSpeed();}).appendTo(context.find('.speed_buff'));var OnOrNoClick=['<div class="tw_checkbox_no"></div>','<div class="tw_checkbox_on"></div>',];function hide_spd_lvl15(){document.getElementById('checked_lvl15').innerHTML='';document.getElementById('txt_spd_lvl15').innerHTML='';} | calcSpeed();}).appendTo(context.find('.speed_buff'));var OnOrNoClick=['<div class="tw_checkbox_no"></div>','<div class="tw_checkbox_on"></div>',];function hide_spd_lvl15(){document.getElementById('checked_lvl15').innerHTML='';document.getElementById('txt_spd_lvl15').innerHTML='';} | ||
function show_spd_lvl15(){document.getElementById('checked_lvl15').innerHTML=OnOrNoClick[0];document.getElementById('txt_spd_lvl15').innerHTML=' Under level 15?';} | function show_spd_lvl15(){document.getElementById('checked_lvl15').innerHTML=OnOrNoClick[0];document.getElementById('txt_spd_lvl15').innerHTML=' Under level 15?';} | ||
Line 50: | Line 50: | ||
duel_var=duel_var+1;document.getElementById('checked_dueler').innerHTML=OnOrNoClick[duel_var];duel_spd=duel_list[duel_var];calcSpeed();};var lvl15_var=0;var lvl15_spd=1;var lvl15_list=[1,51];checked_lvl15.onclick=function(){if(lvl15_var==1){lvl15_var=lvl15_var-2;show_spd_dueler();show_spd_prem();}else{hide_spd_dueler();hide_spd_prem();prem_var=0;prem_spd=1;} | duel_var=duel_var+1;document.getElementById('checked_dueler').innerHTML=OnOrNoClick[duel_var];duel_spd=duel_list[duel_var];calcSpeed();};var lvl15_var=0;var lvl15_spd=1;var lvl15_list=[1,51];checked_lvl15.onclick=function(){if(lvl15_var==1){lvl15_var=lvl15_var-2;show_spd_dueler();show_spd_prem();}else{hide_spd_dueler();hide_spd_prem();prem_var=0;prem_spd=1;} | ||
lvl15_var=lvl15_var+1;document.getElementById('checked_lvl15').innerHTML=OnOrNoClick[lvl15_var];lvl15_spd=lvl15_list[lvl15_var];calcSpeed();};var duelvip_var=0;var duelvip_spd=0;var duelvip_list=[0,0.1];checked_duelvip.onclick=function(){if(duelvip_var==1){duelvip_var=duelvip_var-2;} | lvl15_var=lvl15_var+1;document.getElementById('checked_lvl15').innerHTML=OnOrNoClick[lvl15_var];lvl15_spd=lvl15_list[lvl15_var];calcSpeed();};var duelvip_var=0;var duelvip_spd=0;var duelvip_list=[0,0.1];checked_duelvip.onclick=function(){if(duelvip_var==1){duelvip_var=duelvip_var-2;} | ||
duelvip_var=duelvip_var+1;document.getElementById('checked_duelvip').innerHTML=OnOrNoClick[duelvip_var];duelvip_spd=duelvip_list[duelvip_var];calcSpeed();};function calcSpeed(){var horse_spd=parseInt(input_horse_speed.val()),skill_rid=parseInt(input_skill_horsebackriding.val()),gear_spd=parseInt(input_gear_bonus.val()),buff_spd=parseInt(input_speed_buff.val());if(isNaN(horse_spd)||isNaN(skill_rid)||isNaN(gear_spd)||isNaN(buff_spd)){context.find('.result_spd').html('Enter <u>all</u> Values to calculate');}else{var speed=Math.round((100+horse_spd+skill_rid)*(1+gear_spd+buff_spd)*prem_spd*(duel_spd+duelvip_spd)*lvl15_spd);var mph=Math.round(4*(speed/100));context.find('.result_spd').html('Your movement speed is: '+ | duelvip_var=duelvip_var+1;document.getElementById('checked_duelvip').innerHTML=OnOrNoClick[duelvip_var];duelvip_spd=duelvip_list[duelvip_var];calcSpeed();};function calcSpeed(){var horse_spd=parseInt(input_horse_speed.val()),skill_rid=parseInt(input_skill_horsebackriding.val()),gear_spd=parseInt(input_gear_bonus.val()),buff_spd=parseInt(input_speed_buff.val());if(isNaN(horse_spd)||isNaN(skill_rid)||isNaN(gear_spd)||isNaN(buff_spd)){context.find('.result_spd').html('Enter <u>all</u> Values to calculate');}else{var speed=Math.round((100+horse_spd+skill_rid)*(1+gear_spd/100+buff_spd/100)*prem_spd*(duel_spd+duelvip_spd)*lvl15_spd);var mph=Math.round(4*(speed/100));context.find('.result_spd').html('Your movement speed is: '+ | ||
mph+' mph ('+ | mph+' mph ('+ | ||
speed+'%)');}}} | speed+'%)');}}} |
Revision as of 11:05, 6 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>'); }); } // 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.floor(char_lvl*1.4);var minduellvl=Math.ceil(char_lvl/1.4);context.find(".result1").html("Maximum duellevel: "+maxduellvl+"<br/>Minimum duellevel: "+minduellvl);}}} // SpeedCalc - n3mesis if($('#calcSpeed').length!==0){hide_spd_vip();var context=$('#calcSpeed');var input_horse_speed=$('<input type="number" style="width:150px;" class="west" placeholder="Horse speed" min="0" max="19900">').bind('propertychange keyup input paste',function(){if(this.value>19900){this.value=19900;}else if(this.value<0){this.value=0;} calcSpeed();}).appendTo(context.find('.horse_speed'));var input_skill_horsebackriding=$('<input type="number" style="width:150px;" class="west" placeholder="horseback riding" min="0" max="9000">').bind('propertychange keyup input paste',function(){if(this.value>9000){this.value=9000;}else if(this.value<0){this.value=0;} calcSpeed();}).appendTo(context.find('.skill_horsebackriding'));var input_gear_bonus=$('<input type="number" style="width:150px;" class="west" placeholder="Gear speed in %" min="0" max="900">').bind('propertychange keyup input paste',function(){if(this.value>900){this.value=900;}else if(this.value<0){this.value=0;} calcSpeed();}).appendTo(context.find('.gear_bonus'));var input_speed_buff=$('<input type="number" style="width:150px;" class="west" placeholder="Buff speed in %" min="0" max="900">').bind('propertychange keyup input paste',function(){if(this.value>900){this.value=900;}else if(this.value<0){this.value=0;} calcSpeed();}).appendTo(context.find('.speed_buff'));var OnOrNoClick=['<div class="tw_checkbox_no"></div>','<div class="tw_checkbox_on"></div>',];function hide_spd_lvl15(){document.getElementById('checked_lvl15').innerHTML='';document.getElementById('txt_spd_lvl15').innerHTML='';} function show_spd_lvl15(){document.getElementById('checked_lvl15').innerHTML=OnOrNoClick[0];document.getElementById('txt_spd_lvl15').innerHTML=' Under level 15?';} function hide_spd_vip(){document.getElementById('checked_duelvip').innerHTML='';document.getElementById('txt_spd_vip').innerHTML='';} function show_spd_vip(){document.getElementById('checked_duelvip').innerHTML=OnOrNoClick[0];document.getElementById('txt_spd_vip').innerHTML=' Character bonus?';} function hide_spd_dueler(){document.getElementById('checked_dueler').innerHTML='';document.getElementById('txt_spd_dueler').innerHTML='';} function show_spd_dueler(){document.getElementById('checked_dueler').innerHTML=OnOrNoClick[0];document.getElementById('txt_spd_dueler').innerHTML=' Dueler?';} function hide_spd_prem(){document.getElementById('checked_prem').innerHTML='';document.getElementById('txt_spd_prem').innerHTML='';} function show_spd_prem(){document.getElementById('checked_prem').innerHTML=OnOrNoClick[0];document.getElementById('txt_spd_prem').innerHTML=' Speed premium?';} var prem_var=0;var prem_spd=1;checked_prem.onclick=function(){if(prem_var==1){prem_var=prem_var-2;} prem_var=prem_var+1;document.getElementById('checked_prem').innerHTML=OnOrNoClick[prem_var];prem_spd=prem_var+1;calcSpeed();};var duel_var=0;var duel_spd=1;var duel_list=[1,1.1];checked_dueler.onclick=function(){if(duel_var==1){duel_var=duel_var-2;duelvip_var=0;duelvip_spd=0;hide_spd_vip();show_spd_lvl15();}else{hide_spd_lvl15();show_spd_vip();} duel_var=duel_var+1;document.getElementById('checked_dueler').innerHTML=OnOrNoClick[duel_var];duel_spd=duel_list[duel_var];calcSpeed();};var lvl15_var=0;var lvl15_spd=1;var lvl15_list=[1,51];checked_lvl15.onclick=function(){if(lvl15_var==1){lvl15_var=lvl15_var-2;show_spd_dueler();show_spd_prem();}else{hide_spd_dueler();hide_spd_prem();prem_var=0;prem_spd=1;} lvl15_var=lvl15_var+1;document.getElementById('checked_lvl15').innerHTML=OnOrNoClick[lvl15_var];lvl15_spd=lvl15_list[lvl15_var];calcSpeed();};var duelvip_var=0;var duelvip_spd=0;var duelvip_list=[0,0.1];checked_duelvip.onclick=function(){if(duelvip_var==1){duelvip_var=duelvip_var-2;} duelvip_var=duelvip_var+1;document.getElementById('checked_duelvip').innerHTML=OnOrNoClick[duelvip_var];duelvip_spd=duelvip_list[duelvip_var];calcSpeed();};function calcSpeed(){var horse_spd=parseInt(input_horse_speed.val()),skill_rid=parseInt(input_skill_horsebackriding.val()),gear_spd=parseInt(input_gear_bonus.val()),buff_spd=parseInt(input_speed_buff.val());if(isNaN(horse_spd)||isNaN(skill_rid)||isNaN(gear_spd)||isNaN(buff_spd)){context.find('.result_spd').html('Enter <u>all</u> Values to calculate');}else{var speed=Math.round((100+horse_spd+skill_rid)*(1+gear_spd/100+buff_spd/100)*prem_spd*(duel_spd+duelvip_spd)*lvl15_spd);var mph=Math.round(4*(speed/100));context.find('.result_spd').html('Your movement speed is: '+ mph+' mph ('+ speed+'%)');}}}