Popup.js: Διαφορά μεταξύ των αναθεωρήσεων

Από Wiki The-West GR
Jump to navigation
Χωρίς σύνοψη επεξεργασίας
Χωρίς σύνοψη επεξεργασίας
Ετικέτα: Αναιρέθηκε
Γραμμή 1: Γραμμή 1:
westui
(

Αναθεώρηση της 00:02, 15 Δεκεμβρίου 2023

(westui={lang:{input_level:"Το επίπεδό σου",input_search:"Αναζήτηση: ID, Σετ ή Όνομα",damages:"Ζημιά",per_level:"ανά επίπεδο",speed:"Ταχύτητα",level:"Επίπεδο",unsalable:"Μη εμπορεύσιμο",useable:"(Χρησιμοποιήσιμο)",auction:"Με δυνατότητα δημοπρασίας",not_auction:"Χωρίς δυνατότητα δημοπρασίας",not_upgrade:"Χωρίς δυνατότητα αναβάθμισης",upgrade:"Με δυνατότητα αναβάθμισης",total:"Σύνολο",pts:"Πόντοι εργασίας",popup:{dmg:{dmglvl:["Ζημιά","","",""]},attributes:{str:["Δύναμη","2/2b/Skill_Δύναμη","",""],mob:["Επιδεξιότητα","4/4e/Skill_Επιδεξιότητα","",""],dex:["Κινητικότητα","2/25/Skill_Κινητικότητα","",""],cha:["Χαρισματικότητα","6/6b/Skill_Χαρισματικότητα","",""]},skills:{con:["Κατασκευή","1/1b/Skill_Κατασκευή","1",""],vig:["Σθένος","a/a1/Skill_Σθένος","1",""],tou:["Ανθεκτικότητα","d/d0/Skill_Ανθεκτικότητα","1",""],sta:["Αντοχή","0/0a/Skill_Αντοχή","1",""],hea:["Πόντοι Υγείας","4/48/Skill_Πόντοι_Υγείας","1",""],rid:["Ιππασία","b/bc/Skill_Ιππασία","1",""],ref:["Αντανακλαστικά","8/8d/Skill_Αντανακλαστικά","1",""],dod:["Αποφυγή","0/0d/Skill_Αποφυγή","1",""],hid:["Κρύψιμο","9/95/Skill_Κρύψιμο","1",""],swi:["Κολύμπι","5/5d/Skill_Κολύμπι","1",""],aim:["Στόχευση","b/b9/Skill_Στόχευση","1",""],sho:["Σημάδι","2/25/Skill_Σημάδι","1",""],pit:["Στήσιμο Παγίδων","8/87/Skill_Στήσιμο_Παγίδων","1",""],fin:["Εξαιρετικές Κινητικές Ικανότητες","4/43/Skill_Εξαιρετικές_Κινητικές_Ικανότητες","1",""],rep:["Επιδιόρθωση","a/a4/Skill_Επιδιόρθωση","1",""],lea:["Ηγεσία","d/d0/Skill_Ηγεσία","1",""],tac:["Τακτικές","5/51/Skill_Τακτικές","1",""],tra:["Εμπόριο","a/a8/Skill_Εμπόριο","1",""],ani:["Ζωώδες Ένστικτο","1/10/Skill_Ζωώδες_Ένστικτο","1",""],app:["Εμφάνιση","3/33/Skill_Εμφάνιση","1",""]},buffs:{xp:["Εμπειρία από δουλειές, μονομαχίες και μάχες οχυρού (%)","8/89/Skill_Set_Exp","",""],money:["Χρήματα από δουλειές και μονομαχίες (%)","9/9a/Skill_Set_Money","",""],luck:["Αυξημένη τύχη (%)","0/0f/Skill_Set_Luck","",""],drop:["Βελτιωμένη πιθανότητα εύρεσης (%)","2/25/Skill_Set_Drop","",""],regen:["Επαναφορά (%)","4/42/Skill_Set_Regen","",""],spd:["Ταχύτητα (%)","7/72/Skill_Set_Speed","",""],pray:["Προσευχή","0/0e/Skill_Set_Pray","",""]},fb_stats:{fbdef:["Άμυνα (Μπόνους μάχης οχυρού)","d/da/Skill_Set_Fb_defense","","6/62/Icon_Fb_defense"],fboff:["Επίθεση (Μπόνους μάχης οχυρού)","0/08/Skill_Set_Fb_offense","","0/07/Icon_Fb_offense"],fbdefs:["Άμυνα (Μπόνους τομέα μάχης οχυρού)","2/22/Skill_Set_Fb_defense_sec","","6/62/Icon_Fb_defense"],fboffs:["Επίθεση (Μπόνους τομέα μάχης οχυρού)","4/40/Skill_Set_Fb_offense_sec","","0/07/Icon_Fb_offense"],fbdmg:["Ζημιά (Μπόνους μάχης οχυρού)","e/e3/Skill_Set_Fb_dmg","","b/b5/Icon_Fb_dmg"],fbdmgs:["Ζημιά (Μπόνους τομέα μάχης οχυρού)","c/c9/Skill_Set_Fb_dmg_sec","","b/b5/Icon_Fb_dmg"],fbres:["Αντίσταση (Μπόνους μάχης οχυρού)","e/ed/Skill_Set_Fb_resist","","d/df/Icon_Fb_resist"],ddmg:["Ζημιά Μονομαχίας","c/cc/Skill_Set_Duel_dmg","",""]}}},config:{enable_set_calc:!0,plain_popup:!0,redirect_on_dblclick:!1,link_on_dblclick:!1,enable_sorting:!0,cdn:"//westgr.innogamescdn.com",media_cdn:"//media.innogamescdn.com/com_WEST_GR/wiki/event_offers",wiki:"wiki.the-west.gr/",twcalc:"tw-calc",events:{xmas:["1","Χριστούγεννα"],valentine:["2","Αγ. Βαλεντίνος"],easter:["3","Πάσχα"],independence:["4","Ημέρα Ανεξαρτησίας"],octoberfest:["5","Οκτόμπερφεστ"],dotd:["6","Ημέρα των Νεκρών"],cs:["9","Πώληση"]},img_buyprice:"/5/57/Buy_price.png",img_sellprice:"/f/fc/Sell_price.png",img_male:"/e/ed/Ανδρικό.png",img_female:"/b/b5/Γυναικείο.png",img_prof:["c/c0","c/c3","2/2d","9/9a","f/fc"],img_recipe:["b/b8","e/ec","7/77","b/b4","b/b4"],img_job:{all:["d/d1","Οποιαδήποτε εργασία"]},cat_img:'

'),$("#popup_plain").hide(),$("#popup_plain_contents").append(westui.popup.createPopup($(".item_container").attr("data-popup"),$(".item_container").attr("data-cdn-cat"),$(".item_container").attr("data-cdn-img"),0)),$("#popup_plain").slideDown()),westui.config.redirect_on_dblclick&&$(".item_container img").on("dblclick",function(){window.location="/wiki/"+mw.config.get("wgFormattedNamespaces")[10]+":Item="+JSON.parse($(this).parent().attr("data-popup")).id/1e3})},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,0.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,0.1*tc*a))));return '

"},createPopup:function(t,a){t=JSON.parse(t);var wl=westui.lang,wc=westui.config,upgraded_id=t.id+"00"+(a>=0?a:"0"),s=t.id?(s='

Shift+κλικ για αντιγραφή [item='+upgraded_id+']

'):(s="")+'

',p=!1,d=t.dmg&&t.dmg.split("-"),l=0,dmg_lvl=Math.ceil($("#input_level input").val()*(-t.dmglvl+0.1*(a||0)* -t.dmglvl));1==t.useable?(s+='

"):(s+="");for(const e in eventSets){for(const y in eventSets[e]){if(eventSets[e][y].includes(t.set)){s+='

";}}}if(t.typeW){for(n=0;n<t.typeW.length;n+=1){};s+='

"}if(t.type){for(n=0;n<t.type.length;n+=1){};s+='

"}if(t.unique){s+='

"}if((a>=1&&a<=5&&((p=!0),(t.auc=!1)),t.text)){if(t.unique||t.type!="Προϊόν"){s+="
"}for(var n=0;n<t.text.length;n+=1){s+='

"}s+=""}t.type||t.typeW||t.useable||t.text||t.unique?(s+="
"):(s+="");if((a>=1&&a<=5&&((p=!0),(t.auc=!1)),d&&(l=1)&&(p&&((d[0]=d[0]*1+Math.round(Math.max(1,0.1*d[0]*a))),(d[1]=d[1]*1+Math.round(Math.max(1,0.1*d[1]*a)))),(s+='

")))){if(!t.dmglvl&&d[0]){s+="
"}}if((a>=1&&a<=5&&((p=!0),(t.auc=!1)),t.dmg_min&&t.dmg_max&&(p&&((t.dmg_min=t.dmg_min*1+Math.round(Math.max(1,0.1*t.dmg_min*a))),(t.dmg_max=t.dmg_max*1+Math.round(Math.max(1,0.1*t.dmg_max*a)))),(s+='

")))){if(!t.dmglvl&&t.dmg_min){s+="
"}}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],"textjob"," "+wl.pts+t[m][1]?' προς '+t[m][1]:"");l=m}}l&&l!="dmglvl"&&(s+="
");if(t.bonus){s+='

';for(n of t.bonus){s+='

"}s+="
"}if(t.jobs){s+='

Από την εργασία:

';for(p in t.jobs){if(p=="req"){s+='"}else{var ji=wc.jobIcon(p,t.jobs[p]);s+='"}}s+="


"}if(t.craft){s+='

Χρειάζονται για την Δημιουργία:

"}t.recipe?(s+=""):t.craft?(s+="
"):(s+="");if(t.recipe){s+='

"}var upgLvL=a,upgItems=Math.pow(3,upgLvL),upgFees=(Math.pow(3,Number(upgLvL)+Number(1))-3-2*upgLvL)/4,upgTotal=t.bp*(upgItems+upgFees),upgPrice=upgTotal.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".");t.hspd||t.set||t.sp||t.bp||t.blding||t.lvl||t.cat||t.auc||t.upg?(s+='"):(s+="");return(s+="")},setPosition:function(t){var e,i,a=$(window).width(),s=$(window).height(),p=westui.popup.getEl().outerWidth(),n=westui.popup.getEl().outerHeight(),o=t.clientX,l=t.clientY;(i=o+p+10>a?o-p-10+(t.pageX-t.clientX):o+10+(t.pageX-t.clientX)),(e=l+n+10>s?s-n+(t.pageY-t.clientY):l+10+(t.pageY-t.clientY)),westui.popup.getEl().css({top:e,left:i})},copyToClipboard:function(element){var $temp=$("<input>");$("body").append($temp);$temp.val($(element).text()).select();document.execCommand("copy");$temp.remove()},init:function(){var wp=westui.popup,wc=westui.config;$("body").append(''),$(document).on("mouseenter",".item_container",function(t){wp.show(this),wp.setPosition(t)}),$(document).on("click",".item_container",function(t){if(t.shiftKey){wp.copyToClipboard(".popup_id")}if(t.altKey){var link="https://"+wc.wiki+"index.php?title=Πρότυπο:"+$(".popup_id").text().slice(0,-2).replace(/[\[\]]/gi,"")+"0&action=edit";window.open(link,"_blank")}if(t.ctrlKey){var link="https://"+wc.twcalc+".net/item/"+$(".popup_id").text().slice(0,-2).replace(/[A-Za-z\=\[\]]/gi,"")+"0";window.open(link,"_blank")}}),$(document).on("mouseleave",".item_container",function(){wp.hide()}),$(document).on("mousemove",".item_container",function(t){wp.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)),wp.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)),wp.show(t[0])})}},set_calc:{bonus:{extra_set_bonus:{}},data:{},itemStatus:{},getData:function(){var wsc=westui.set_calc,wc=westui.config;$(".set_container").each(function(){var t=$(this).attr("data-set-id");(wsc.itemStatus[t]={}),(wsc.data[t]={items:{},set:{}})}),$(".infoSet").each(function(){var t=$(this).attr("data-set-id");$(this).find(".infosetatt").each(function(){var e=$(this).attr("data-nb");(wsc.data[t].set[e]={}),$(this).find(".set_bonus").each(function(){(key=$(this).attr("data-type")),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())),wc.set_bonus.hasOwnProperty(key)||(wsc.bonus.extra_set_bonus[key]={img:$(this).find("img").attr("src"),name:$(this).find("#tooltip_content").text()})})})}),$(".set_container").each(function(){var t=$(this).attr("data-set-id");$(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 isJob=i.startsWith("Job_");e.hasOwnProperty(i)&&(wc.set_bonus.hasOwnProperty(i)||wsc.bonus.extra_set_bonus.hasOwnProperty(i)||(isJob&&(wsc.bonus.extra_set_bonus[i]={img:wc.jobIcon(i.replace("Job_",""))[0],name:e[i][1]})))&&(wsc.data[t].items[i]||(wsc.data[t].items[i]={}),(wsc.data[t].items[i][e.id]=isJob?e[i][0]:e[i]))}})})},calc:function(){var wsc=westui.set_calc,wc=westui.config;if((0===$("#input_level").length)|(""!==$("#input_level input").val())){var t=parseInt($("#input_level input").val());for(var e in((total={}),wsc.data)){for(var i in wsc.data[e].items){for(var a in wsc.data[e].items[i]){if(!1!==wsc.itemStatus[e][a]){(lvl=wsc.itemStatus[e][a]),total[i]||(total[i]=0);var s=wsc.data[e].items[i][a];wsc.data[e].items[i][a]<0?((s= -s),wsc.itemStatus[e][a]>0?(total[i]+=Math.ceil(s*t)+Math.round(Math.max(1,0.1*Math.ceil(s*t)*lvl))):(total[i]+=Math.ceil(s*t))):wsc.itemStatus[e][a]>0?(total[i]+=s<1?Math.round(1e6*(1*s+Math.round(Math.max(1,1e3*s*lvl))/1e4))/1e6:s+Math.round(Math.max(1,0.1*s*lvl))):(total[i]+=s)}}}var n=0;for(var a in wsc.itemStatus[e]){!1!==wsc.itemStatus[e][a]&&n++}for(var i in wsc.data[e].set[n]){total[i]||(total[i]=0),wsc.data[e].set[n][i]<0?(total[i]+=Math.ceil(-wsc.data[e].set[n][i]*t)):(total[i]+=wsc.data[e].set[n][i])}}var p='
<tbody>

'+westui.lang.total+"
";for(var i in wc.set_bonus){total.hasOwnProperty(i)&&(p+='
<img src="/images/'+wc.set_bonus[i].img+'.png" width="40px">
+'+total[i]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(i)?"%":"")+'
'+(wc.set_bonus[i].icon?'<img src="/images/'+wc.set_bonus[i].icon+'.png"> ':"")+wc.set_bonus[i].name+"
")}for(var z in wsc.bonus.extra_set_bonus){total.hasOwnProperty(z)&&(p+='
<img src="'+wsc.bonus.extra_set_bonus[z].img+'" width="40px">
+'+total[z]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(z)?"%":"")+'
'+(wsc.bonus.extra_set_bonus[z].icon?'<img src="/images/'+wsc.bonus.extra_set_bonus[z].icon+'.png"> ':"")+wsc.bonus.extra_set_bonus[z].name+"
")}$("#set_calc").html(p)}else{$("#set_calc").html("")}},initEvents:function(){var wsc=westui.set_calc;$(".item_container > img").on("click",function(){var t=$(this).closest(".item_container");t.toggleClass("item_off");var e=t.closest(".set_container").attr("data-set-id"),i=JSON.parse(t.attr("data-popup")).id;t.hasClass("item_off")||t.is(":hidden")?(wsc.itemStatus[e][i]=!1):(westui.set_calc.itemStatus[e][i]=parseInt(t.attr("data-lvl"))),wsc.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")||((wsc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.attr("data-lvl"))),wsc.calc())}),$("#input_level").bind("propertychange keyup input paste",function(){wsc.calc()}),$("#switch").on("click",function(){$("#melee, #fire").each(function(){var t=$(this).find(".item_container"),e=$(this).closest(".set_container").attr("data-set-id");$(this).is(":hidden")?(wsc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=!1):(wsc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.attr("data-lvl")))}),wsc.calc()})},init:function(){var wsc=westui.set_calc;wsc.initEvents(),wsc.getData(),$("#mw-content-text").append('
'),0===$("#input_level").length&&wsc.calc()}},sorting:{sortItems:function(t){function e(e){var i=JSON.parse($(e).attr("data-popup")),a=$("#input_level input").val();a=a||250;var s=-1!==Object.keys(t).indexOf("id")||(t.bool&&!0===t.bool),n=0;if(t.bool&&!0===t.bool){for(var p in((n=1),t)){"bool"!==p&&i[p]!==t[p]&&(n=0)}}else{for(var p in t){"id"===p?(n-=i[p]):(!i.lvl||i.lvl<=a)&&i[p]&&(i[p]<0?(n+=Math.ceil(-i[p]*a)*t[p]):(n+=i[p]*t[p]))}}$(e).attr("data-sort",n),0==n&&$(e).hide(),0!==$(e).find(".sortval").length?s?$(e).find(".sortval").html(""):$(e).find(".sortval").html(n):s||$(e).append('

'+n+"

")}$(".item_container").removeAttr("data-sort").show(),$("#mw-content-text").find(".sorting_hidden").hide(),$(".sorting_container").each(function(){$(this).find(".item_container").sort(function(t,i){return($(t).attr("data-sort")||e(t),$(i).attr("data-sort")||e(i),$(i).attr("data-sort")-$(t).attr("data-sort"))}).appendTo($(this))})},init:function(){if(1===$("div#sort_items").length){var t=""),$("div#sort_items").html(t),$("select#sort_items").on("change",function(){westui.sorting.sortItems(JSON.parse($(this).find("option:selected").attr("value")))})}}},init:function(){westui.initPage(),westui.popup.init(),westui.config.enable_sorting&&westui.sorting.init(),westui.config.enable_set_calc&&0!==$(".infoSet").length&&westui.set_calc.init()}}),westui.init();