Popup.js: Revizyonlar arasındaki fark
Değişiklik özeti yok Etiket: Elle geri alma |
Değişiklik özeti yok Etiket: Geri alındı |
||
1. satır: | 1. satır: | ||
westui={lang:{input_level:"Stufe",input_search:"Suche",damages:"Schaden",per_level:"pro Stufe",speed:"Geschwindigkeit" | |||
18.41, 26 Eylül 2023 tarihindeki hâli
westui={lang:{input_level:"Stufe",input_search:"Suche",damages:"Schaden",per_level:"pro Stufe",speed:"Geschwindigkeit",level:"Stufe",sellable:"Verkaufbar",auctionable:"Auktionierbar",upgradeable:"Veredelbar",total:"Total",aps:"Arbeitspunkte auf ",popup:{dmg:{dmg:["Schaden",],},attribute:{str:["Stärke","8/8b/Strength"],fle:["Beweglichkeit","d/db/Flexibility"],dex:["Geschicklichkeit","0/0d/Dexterity"],cha:["Charisma","c/c9/Charisma"],},skill:{bui:["Errichten","1/18/Build"],pun:["Schlagkraft","8/8f/Punch"],tou:["Zähigkeit","2/24/Tough"],end:["Ausdauer","0/0a/Endurance"],hea:["Lebenspunkte","9/94/Health"],rid:["Reiten","e/e4/Ride"],ref:["Reflex","b/b2/Reflex"],dod:["Ausweichen","b/b2/Dodge"],hid:["Verstecken","9/96/Hide"],swi:["Schwimmen","9/93/Swim"],aim:["Zielen","d/d4/Aim"],sho:["Schießen","d/dc/Shot"],pit:["Fallen stellen","6/67/Pitfall"],fin:["Fingerfertigkeit","b/b3/Finger_dexterity"],rep:["Reparieren","e/e2/Repair"],lea:["Leiten","4/44/Leadership"],tac:["Taktik","0/09/Tactic"],tra:["Handeln","d/d5/Trade"],ani:["Mit Tieren umgehen","2/21/Animal"],app:["Auftreten","0/00/Appearance"],},txtgreen:{exp:["Erfahrung für Arbeiten, Duelle und Fortkämpfe","0/0c/Set_exp"],dol:["Verdienst bei Arbeiten und Duellen","6/67/Set_dol"],luc:["Erhöhte Glückschance","f/f0/Set_luc"],dro:["Verbesserte Produktfundchance","3/36/Set_dro"],reg:["Regeneration im Hotel","9/97/Set_reg"],spe:["Geschwindigkeit","b/bc/Set_spe"],pra:["Beten","1/16/Set_pra"],},fb_stats:{def:["Multiplayer-Verteidigung","f/f3/Set_def"],off:["Multiplayer-Angriff","6/68/Set_off"],res:["Widerstand (Fortkampfbonus)","b/bf/Set_res"],dam:["Schaden","f/f4/Set_dam"],defs:["Verteidigung (Fortkampfsektorbonus)","e/e5/Set_defs"],offs:["Angriff (Fortkampfsektorbonus)","b/ba/Set_offs"],dams:["Schaden (Fortkampfsektorbonus)","e/e9/Set_dams"],}},not:function(s){return'Nicht '+s.toLowerCase();}},config:{link_on_click:!1,cdn:"//westde.innogamescdn.com",img_buyprice:"/images/5/57/Buy_price.png",img_sellprice:"/images/f/fc/Sell_price.png",img_prof:['c/c0','c/c3','2/2d','9/9a','f/fc'],img_job:{trader:['d/dc','Fahrender Händler'],tailor_t:['b/b8','Schneider'],gunsmith_t:['0/06','Büchsenmacher'],general_t:['9/98','Gemischtwaren'],all:['d/d1','Alle Arbeiten'],},img_m:"c/c5/Gender_m",img_f:"4/41/Gender_f",img_due:"b/bb/CharS_duelist",img_adv:"7/72/CharS_adventurer",img_wor:"2/2a/CharS_worker",img_sol:"5/5c/CharS_soldier",ev_ics:[['9/99','Valentinstags'],['5/57','Oster'],['e/e9','Unabhängigkeits'],['c/ce','Oktoberfest'],['e/ee','Tag_der_Toten'],['d/dc','Weihnachts'],['7/7d','Sale']],set_bonus:{},jobIcon:function(p,q){var wip=this.img_job[p],ji=wip?['/images/'+wip[0]+'/Job_',wip[1]+(q?p!='all'?' (Stufe '+q+')':q:)]:[this.cdn+'/images/jobs/',q];ji[0]+=p+'.png';return ji;}},initPage:function(){if($("#input_level").length) var t=$('<input type="number" style="width:80px;" class="west" placeholder="'+westui.lang.input_level+'" min="0" max="250">').on("propertychange keyup input paste",function(){this.value>250?this.value=250:this.value<0&&(this.value=0),$(".calc").each(function(){0===t.val()?($(this).html(this.id),$(".per_level_off").addClass("per_level").removeClass("per_level_off")):($(this).html(Math.ceil(Number(this.id)*t.val())),$(".per_level").addClass("per_level_off").removeClass("per_level"));});}).appendTo($("#input_level"));if($("#input_search").length){$('<input type="search" class="west" placeholder="'+westui.lang.input_search+'">').on("propertychange keyup input paste",function(){var t=this.value.toLowerCase();if($(".set_icon").length){""===t?($('.set_icon + br').show(),$(".set_icon").show(),$("h2").show(),$('img[alt*="IconB"]').show()):($('.set_icon + br').hide(),$(".set_icon").hide(),$("h2").hide(),$('img[alt*="IconB"]').hide(),$(".set_icon").filter(function(){return this.children[1].title.toLowerCase().indexOf(t)>-1;}).show());}else{""===t?$(".item_container").show():($(".item_container").hide(),$(".item_container").filter(function(){return $(this).attr("data-popup").toLowerCase().indexOf(t)>-1;}).show());}}).appendTo($("#input_search"));} $(".set_switch").length&&($(".set_fire").hide(),$(".set_switch").on("click",function(){$('.set_melee, .set_fire').toggle();})),$(".set_switchF").length&&($(".set_F").hide(),$(".set_switchF").on("click",function(){$('.set_F, .set_F + div').toggle();})),$(".item_container > img").on("click",function(){var loc=$(this).parent().attr("data-link");if(loc&&!$(".infoSet").length)
location.href='/wiki/'+loc;});},popup:{content:"",delay:200,active:!1,show:function(t){westui.popup.content=westui.popup.createPopup($(t),parseInt($(t).attr("data-lvl"))),westui.popup.active=!0,westui.popup.setTimeout(),westui.popup.getContainer().html(westui.popup.content);},hide:function(){westui.popup.getEl().css({display:"none",top:0,left:0}),westui.popup.active=!1,westui.popup.clearTimeout();},setTimeout:function(){westui.popup.clearTimeout(),westui.popup.timer=window.setTimeout(function(){westui.popup.getEl().css("display","block");},westui.popup.delay);},clearTimeout:function(){westui.popup.timer&&window.clearTimeout(westui.popup.timer);},getEl:function(){return $("#popup_window");},getContainer:function(){return $("#popup_contents");},getValue:function(n,a,tc,o,tn){var r="";tc<0?$("#input_level input").val()>0?(tc=Math.ceil($("#input_level input").val()* -tc),n&&(tc+=Math.round(Math.max(1,.1*tc*a)))):(tc=-tc,r=" ("+westui.lang.per_level+")",n&&(tc=Math.round(1e6*(1*tc+Math.round(Math.max(1,1e3*tc*a))/1e4))/1e6)):n&&(tc<1?tc=Math.round(1e6*(1*tc+Math.round(Math.max(1,1e3*tc*a))/1e4))/1e6:tc+=Math.round(Math.max(1,.1*tc*a)));return'
+ '+tc+tn+r+'
';},createPopup:function(t,a){a=a||0;t=JSON.parse(t.attr("data-popup"));var wl=westui.lang,wc=westui.config,s='
'+t.name+'
'+t.type+'
',n=!1,p=t.dmgr&&t.dmgr.split('-');if(t.txt)
s+='
'+t.txt+'
';a>=1&&a<=5&&(n=!0,t.auc=!1);var l=0;p&&(l=1)&&(n&&(p[0]=p[0]*1+Math.round(Math.max(1,.1*p[0]*a)),p[1]=p[1]*1+Math.round(Math.max(1,.1*p[1]*a))),s+='
'+p[0]+"-"+p[1]+' '+wl.damages+'
');for(var o in wl.popup){for(var c in wl.popup[o])
if(t.hasOwnProperty(c)){s+=westui.popup.getValue(n,a,t[c],o,(o=='txtgreen'&&c!='pra'?'% ':' ')+wl.popup[o][c][0]);l=o;l=='dmg'&&(s+='
');}}
for(var m in t){if(m.startsWith('job_')){s+=westui.popup.getValue(n,a,t[m][0],'txtgreen',' '+wl.aps+t[m][1]);l=m;}}
l&&l!='dmg'&&(s+='
');if(t.bonus){s+='
Effekt:
';for(p of t.bonus) s+='
'+p+'
';s+='
';}
if(t.jobs){s+='
';for(var q of t.jobs[p]){q=q.split(',');s+=' <img src="'+wc.cdn+'/images/items/'+(q[0].includes('/')?:'yield/')+q[0]+'.png"> '+(q[2]=='eqp'?:' ';}
s+=''+q[1]+' ')+' | |
<img src="'+ji[0]+'"> | '+ji[1]+' |
---|
';}
if(t.craft){s+='
<img src="/images/'+wc.img_prof[t.craft[0]]+'/Profsymbol_'+t.craft[0]+'.png"> | ';for(p=1;p<t.craft.length;p++){var u=t.craft[p].split(',');s+=' <img src="'+wc.cdn+"/images/items/yield/"+u[0]+'.png"> ';}
s+=''+u[1]+' |
---|
';}
t.spd&&(n&&(t.spd+=Math.round(Math.max(1,.1*t.spd*a))),s+='
'+wl.speed+': +'+t.spd+'%
'),t.set&&(s+='
'+t.set+"
"),(t.auc||t.sell)&&(s+='<img src="'+wc.img_buyprice+'"> $'+t.bp+' <img src="'+wc.img_sellprice+'"> $'+t.sp+'
'),s+=!t.sell?''+wl.not(wl.sellable)+'
':'
',t.sex&&(s+='<img src="/images/'+wc['img_'+t.sex]+'.png"> '),t.char&&(s+='<img src="/images/'+wc['img_'+t.char]+'.png"> '),t.lvl&&(s+=wl.level+" "+t.lvl+"
"),s+=''+(t.auc?wl.auctionable:wl.not(wl.auctionable))+'
';s+=''+(t.upg?wl.upgradeable:wl.not(wl.upgradeable))+'
';var ev=evsets[t.set];if(ev){var we=wc.ev_ics[ev[0]];s+='
<img src="/images/'+we[0]+'/Icon_'+we[1]+'.png"> '+(2000+ev[1]);} return s+='
[item='+t.id+'00'+a+' ]
';},setPosition:function(t){var e,i,a=$(window).width(),s=$(window).height(),n=westui.popup.getEl().outerWidth(),p=westui.popup.getEl().outerHeight(),o=t.clientX,l=t.clientY;i=o+n+20>a?o-n-20+(t.pageX-o):o+20+(t.pageX-o),e=l+p+20>s?s-p+(t.pageY-l):20+t.pageY,westui.popup.getEl().css({top:e,left:i});},init:function(){$("body").append('
'),$(document).on("mouseenter",".item_container",function(t){westui.popup.show(this),westui.popup.setPosition(t);}),$(document).on("mouseleave",".item_container",function(){westui.popup.hide();}),$(document).on("mousemove",".item_container",function(t){westui.popup.setPosition(t);}),$(".item_level").mousedown(function(t){t.preventDefault();}),$(document).on("click",".upgrade",function(){var t=$(this).closest(".item_container"),e=parseInt(t.attr("data-lvl"));5!==e&&(t.attr("data-lvl",e+1),t.find(".level").html(e+1)),westui.popup.show(t[0]);}),$(document).on("click",".downgrade",function(){var t=$(this).closest(".item_container"),e=parseInt(t.attr("data-lvl"));0!==e&&(t.attr("data-lvl",e-1),t.find(".level").html(e-1)),westui.popup.show(t[0]);});}},set_calc:{extra_set_bonus:{},data:{},itemStatus:{},getData:function(){var wsc=westui.set_calc;for(var o in westui.lang.popup){var l=westui.lang.popup[o];for(var c in l){var small=['attribute','skill'].includes(o)?['thumb/','/40px-'+l[c][1].split('/')[2]+'.png']:[,];westui.config.set_bonus[c]={name:l[c][0],img:'/images/'+small[0]+l[c][1]+'.png'+small[1]};}}
var t=0;$(".infoSet").each(function(){t++;wsc.itemStatus[t]={},wsc.data[t]={items:{},set:{}};$(this).find(".setbonusrow").each(function(){var e=$(this).attr("data-nb");wsc.data[t].set[e]={},$(this).find(".set_bonus").each(function(){var img=$(this).find("img").attr("src"),exp=img.match(/\/(Set_)?((Job_)?\w+)\.png/),key=(exp[1]||exp[3]?exp[2]:exp[2].substr(0,3)).toLowerCase();0!==$(this).find(".calc").length?wsc.data[t].set[e][key]=-parseFloat($(this).find(".calc").attr("id")):wsc.data[t].set[e][key]=parseFloat($(this).find(".val").text()),westui.config.set_bonus.hasOwnProperty(key)||(wsc.extra_set_bonus[key]={img:img,name:$(this).find("#tooltip_content").text()});});});});t=0;$(".set_container").each(function(){$(this).attr("data-set-id",++t);$(this).find(".item_container").each(function(){var e=JSON.parse($(this).attr("data-popup"));$(this).is(":hidden")?wsc.itemStatus[t][e.id]=!1:wsc.itemStatus[t][e.id]=0;for(var i in e){if(i=='dmg')
continue;var isj=i.startsWith('job_');e.hasOwnProperty(i)&&(westui.config.set_bonus.hasOwnProperty(i)||wsc.extra_set_bonus.hasOwnProperty(i)||isj&&(wsc.extra_set_bonus[i]={img:westui.config.jobIcon(i.replace('job_',))[0]+'" width="40',name:westui.lang.aps+e[i][1]}))&&(wsc.data[t].items[i]||(wsc.data[t].items[i]={}),wsc.data[t].items[i][e.id]=(isj?e[i][0]:e[i]));}});});},addBon:function(c,total,w,l){return total?('
'):;},isBon:function(c,total,w){var p=;if(total[c])
for(var l=0;l<2;l++) p+=this.addBon(c,total[c][l],w[c],l);return p;},lvlUp:function(upg,val){var d=val<1?3:-1;var e=!upg?0:Math.round(Math.max(1,val*Math.pow(10,d)*upg))/Math.pow(10,d+1);return val+e;},calc:function(){var wsc=westui.set_calc,lvl=$("#input_level input").val()*1,total={},key;for(var e in wsc.data){for(var i in wsc.data[e].items) for(var k in wsc.data[e].items[i]){var upg=wsc.itemStatus[e][k];if(!1!==upg){total[i]||(total[i]=[0,0]);var bi=wsc.data[e].items[i][k];key=0;if(bi<0){bi*=-1;key=1;} bi=wsc.lvlUp(upg,(lvl&&key?Math.ceil(bi*lvl):bi));if(key&&!lvl) total[i][1]+=bi;else total[i][0]+=bi;}} var n=0;for(var a in wsc.itemStatus[e]) !1!==wsc.itemStatus[e][a]&&n++;for(var b in wsc.data[e].set[n]){var bs=wsc.data[e].set[n][b];key=0;total[b]||(total[b]=[0,0]);if(bs<0){bs*=-1;key=1;} bs=lvl&&key?Math.ceil(bs*lvl):bs;if(key&&!lvl) total[b][1]+=bs;else total[b][0]+=bs;}}
var p='
<tbody>";for(var c in westui.config.set_bonus)
p+=wsc.isBon(c,total,westui.config.set_bonus);for(var d in wsc.extra_set_bonus) p+=wsc.isBon(d,total,wsc.extra_set_bonus);$("#set_calc").html(p);},initEvents:function(){$(".item_container > img").on("click",function(e){var t=$(this).closest(".item_container");t.toggleClass("item_off");e=t.closest(".set_container").attr("data-set-id"),i=JSON.parse(t.attr("data-popup")).id;t.hasClass("item_off")||t.is(":hidden")?westui.set_calc.itemStatus[e][i]=!1:westui.set_calc.itemStatus[e][i]=parseInt(t.attr("data-lvl")),westui.set_calc.calc();}),$(document).on("click",".upgrade, .downgrade",function(){var t=$(this).closest(".item_container"),e=t.closest(".set_container").attr("data-set-id");t.hasClass("item_off")||t.is(":hidden")||(westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.attr("data-lvl")),westui.set_calc.calc());}),$("#input_level").on("propertychange keyup input paste",function(){westui.set_calc.calc();}),$(".set_switch, .set_switchF").on("click",function(){$(".set_melee, .set_F").each(function(){$(this).parent().find(".item_container").each(function(){var t=$(this);e=t.closest(".set_container").attr("data-set-id");t.hasClass("item_off")||t.is(":hidden")?westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=!1:westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.attr("data-lvl"));});}),westui.set_calc.calc();});},dragElement:function(elmnt){var p=[0,0,0,0];elmnt.onmousedown=dragMouseDown;var first=0;function dragMouseDown(e){e=e||window.event;e.preventDefault();p[3]=e.clientX;p[4]=e.clientY;if(!first){first=1;$("#set_calc").css({position:'fixed',margin:0});elmnt.style.top=(elmnt.offsetTop-document.documentElement.scrollTop-20)+"px";} document.onmousemove=elementDrag;document.onmouseup=closeDragElement;} function elementDrag(e){e=e||window.event;e.preventDefault();p[1]=p[3]-e.clientX;p[2]=p[4]-e.clientY;p[3]=e.clientX;p[4]=e.clientY;elmnt.style.top=(elmnt.offsetTop-p[2])+"px";elmnt.style.left=(elmnt.offsetLeft-p[1])+"px";} function closeDragElement(){document.onmouseup=null;document.onmousemove=null;}},init:function(){westui.set_calc.initEvents(),westui.set_calc.getData(),$("dl + p").after(''),westui.set_calc.dragElement($("#set_calc")[0]),westui.set_calc.calc();}},init:function(){westui.initPage(),$('.item_container').length&&westui.popup.init(),$('.infoSet').length&&westui.set_calc.init();}},westui.init(); |