Popup.js: Revizyonlar arasındaki fark
Değişiklik özeti yok |
Değişiklik özeti yok |
||
135. satır: | 135. satır: | ||
}, | }, | ||
initPage: | initPage: | ||
function () { if (1 === $("#input_level").length) var t = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" min="0" max="150">').bind("propertychange keyup input paste", function () { this.value > 150 ? this.value = 150 : 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 (1 === $("#input_search").length) $('<input type="search" class="west" placeholder="' + westui.lang.input_search + '">').bind("propertychange keyup input paste", function () { var t = this.value.toLowerCase(); "" === t ? $(".item_container").show() : ($(".item_container").hide(), $(".item_container").filter(function () { return $(this).attr("data-popup").toLowerCase().indexOf(t) > -1 }).show()) }).appendTo($("#input_search")); 1 === $("#switch").length && ($("#fire").hide(), $("#switch").on("click", function () { $("#melee, #fire").toggle() })), 1 === $("#switch_prod").length && ($("#prod2").hide(), $("#switch_prod").on("click", function () { $("#prod, #prod2").toggle() })), westui.config.plain_popup && new RegExp(mw.config.get("wgFormattedNamespaces")[10] + ":Item_*").test(mw.config.get("wgPageName")) && 1 === $(".item_container").length && ($("#mw-content-text").append('<center><div id="popup_plain" class="popup_window"><div class="popup_front"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div></div><div id="popup_plain_contents" class="popup_contents"></div></div></center>'), $("#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 }), westui.config.link_on_dblclick && $(".item_container img").on("dblclick", function () { window.location = "/wiki/" + $(this).parent().attr("data-link") }) }, popup: { content: "", delay: 200, active: !1, show: function (t) { westui.popup.content = westui.popup.createPopup($(t).attr("data-popup"), $(t).attr("data-cdn-cat"), $(t).attr("data-cdn-img"), 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") }, createPopup: function (t, e, i, a) { t = JSON.parse(t); var s = '<div class="popup_image"><img src="' + westui.config.cdn + "/images/items/" + t.cdn_cat + "/" + t.cdn_img + '.png"/></div><div class="popup_divider"></div><p class="popup_name">' + t.name + '</p><p class="popup_type">' + t.type + "</p><br/>", n = !1; if (a >= 1 && a <= 5 && (n = !0, t.auc = !1), t.dmg_min && t.dmg_max && (n && (t.dmg_min += Math.round(Math.max(1, .1 * t.dmg_min * a)), t.dmg_max += Math.round(Math.max(1, .1 * t.dmg_max * a))), s += '<p class="popup_dmg">' + t.dmg_min + "-" + t.dmg_max + " " + westui.lang.damages + "</p>"), t.text) { for (var p = 0; p < t.text.length; p++)s += '<p class="popup_text">' + t.text[p] + "</p>"; s += "<br/>" } for (var o in westui.lang.popup) { var l = 0; for (var c in westui.lang.popup[o]) if (t.hasOwnProperty(c)) { l++; var r = ""; t[c] < 0 ? $("#input_level input").val() > 0 ? (t[c] = Math.ceil($("#input_level input").val() * -t[c]), n && (t[c] += Math.round(Math.max(1, .1 * t[c] * a)))) : (t[c] = -t[c], r = " (" + westui.lang.per_level + ")", n && (t[c] = Math.round(1e6 * (1 * t[c] + Math.round(Math.max(1, 1e3 * t[c] * a)) / 1e4)) / 1e6)) : n && (t[c] < 1 ? t[c] = Math.round(1e6 * (1 * t[c] + Math.round(Math.max(1, 1e3 * t[c] * a)) / 1e4)) / 1e6 : t[c] += Math.round(Math.max(1, .1 * t[c] * a))), s += westui.lang.popup[o][c].replace("#1", t[c]).replace("#2", r) } l > 0 && (s += "<br/>") } if (t.textjob) { for (p = 0; p < t.textjob.length; p++)s += '<p class="popup_txtgreen">' + t.textjob[p] + "</p>"; s += "<br/>" } if (t.bonus) { for (p = 0; p < t.bonus.length; p++)s += '<p class="popup_bonus">' + t.bonus[p] + "</p>"; s += "<br/>" } if (t.jobs) { s += '<div style="text-align:center;"><table class="popup_job">'; for (p = 0; p < t.jobs.length; p++)s += '<tr><td><img src="' + westui.config.cdn + "/images/jobs/" + t.jobs[p][1] + '.png"/></td><td><span> ' + t.jobs[p][0] + "</span></td></tr>"; s += "</table></div>" } if (t.craft) { s += '<div style="text-align:center;"><table class="popup_crafteditem"><tr><td><img src="' + westui.config.cdn + "/images/crafting/profsymbol_" + t.craft.id + '_small.png"/></td><td><table><tr>'; for (p = 0; p < t.craft.req.length; p++)s += '<td><img style="width:36px;height:36px;" src="' + westui.config.cdn + "/images/items/yield/" + t.craft.req[p][0] + '.png"/></td>'; s += "</tr><tr>"; for (p = 0; p < t.craft.req.length; p++)s += "<td><span>x" + t.craft.req[p][1] + "</span></td>"; s += "</tr></table></td></tr></table></div>" } return s += '<div class="popup_infos">', t.hspd && (n && (t.hspd += Math.round(Math.max(1, .1 * t.hspd * a))), s += '<p class="popup_speed">' + westui.lang.speed + ": +" + t.hspd + "%</p><br/>"), t.set && (s += '<p><a class="popup_set" href="/wiki/' + t.set + '">' + t.set + "</a></p><br/>"), t.sp ? s += '<img src="' + westui.config.img_buyprice + '"/>' + t.bp + ' <img src="' + westui.config.img_sellprice + '"/> ' + t.sp + "<br/><br/>" : s += "<i>" + westui.lang.unsalable + "</i><br/><br/>", t.lvl && (s += westui.lang.level + " <b>" + t.lvl + "</b><br/>"), t.sex && (0 == t.sex ? s += '<img src="' + westui.config.img_male + '"/> ' : s += '<img src="' + westui.config.img_female + '"/> '), 1 == t.auc ? s += '<span class="popup_txtgreen">' + westui.lang.auction + "</span><br/>" : s += '<span class="popup_txtred">' + westui.lang.not_auction + "</span><br/>", 0 == t.upg ? s += '<span class="popup_txtred">' + westui.lang.not_upgrade + "</span><br/>" : s += '<span class="popup_txtgreen">' + westui.lang.upgrade + "</span><br/>", s += '<br/><p class="popup_id">[item=<b>' + t.id + "</b>]</p></div>", s }, 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, c = 20, r = 20; i = o + n + r > a ? o - n - r + (t.pageX - t.clientX) : o + r + (t.pageX - t.clientX), e = l + p + c > s ? s - p + (t.pageY - t.clientY) : l + c + (t.pageY - t.clientY), westui.popup.getEl().css({ top: e, left: i }) }, init: function () { $("body").append('<div id="popup_window" class="popup_window"><div class="popup_front"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div></div><div id="popup_contents" class="popup_contents"></div></div>'), $(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: { bonus: { extra_set_bonus: {} }, data: {}, itemStatus: {}, getData: function () { $(".set_container").each(function () { var t = $(this).attr("data-set-id"); westui.set_calc.itemStatus[t] = {}, westui.set_calc.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"); westui.set_calc.data[t].set[e] = {}, $(this).find(".set_bonus").each(function () { key = $(this).attr("data-type"), 0 !== $(this).find(".calc").length ? westui.set_calc.data[t].set[e][key] = -parseFloat($(this).find(".calc").attr("id")) : westui.set_calc.data[t].set[e][key] = parseFloat($(this).find(".val").text()), westui.config.set_bonus.hasOwnProperty(key) || (westui.set_calc.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")); for (var i in $(this).is(":hidden") ? westui.set_calc.itemStatus[t][e.id] = !1 : westui.set_calc.itemStatus[t][e.id] = 0, e) e.hasOwnProperty(i) && (westui.config.set_bonus.hasOwnProperty(i) || westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(i)) && (westui.set_calc.data[t].items[i] || (westui.set_calc.data[t].items[i] = {}), westui.set_calc.data[t].items[i][e.id] = e[i]) }) }) }, calc: function () { if (0 === $("#input_level").length | "" !== $("#input_level input").val()) { var t = parseInt($("#input_level input").val()); for (var e in total = {}, westui.set_calc.data) { for (var i in westui.set_calc.data[e].items) for (var a in westui.set_calc.data[e].items[i]) if (!1 !== westui.set_calc.itemStatus[e][a]) { lvl = westui.set_calc.itemStatus[e][a], total[i] || (total[i] = 0); var s = westui.set_calc.data[e].items[i][a]; westui.set_calc.data[e].items[i][a] < 0 ? (s = -s, westui.set_calc.itemStatus[e][a] > 0 ? total[i] += Math.ceil(s * t) + Math.round(Math.max(1, .1 * Math.ceil(s * t) * lvl)) : total[i] += Math.ceil(s * t)) : westui.set_calc.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, .1 * s * lvl)) : total[i] += s } var n = 0; for (var a in westui.set_calc.itemStatus[e]) !1 !== westui.set_calc.itemStatus[e][a] && n++; for (var i in westui.set_calc.data[e].set[n]) total[i] || (total[i] = 0), westui.set_calc.data[e].set[n][i] < 0 ? total[i] += Math.ceil(-westui.set_calc.data[e].set[n][i] * t) : total[i] += westui.set_calc.data[e].set[n][i] } var p = '<center><table class="infoSet"><caption><br><big><b>' + westui.lang.total + "</b></big></caption><tbody><tr><td></center>"; for (var i in westui.config.set_bonus) total.hasOwnProperty(i) && (p += '<div class="set_bonus tooltip_container"><img src="' + westui.config.set_bonus[i].img + '"><b>+' + total[i] + (-1 !== ["xp", "money", "luck", "spd", "regen", "drop"].indexOf(i) ? "%" : "") + '</b><div class="tooltip_outer"><div class="tooltip"><div class="tt_bg_tl"></div><div class="tt_bg_tr"></div><div class="tt_bg_bl"></div><div class="tt_bg_br"></div><div id="tooltip_content">' + westui.config.set_bonus[i].name + "</div></div></div></div>"); for (var i in westui.set_calc.bonus.extra_set_bonus) total.hasOwnProperty(i) && (p += '<div class="set_bonus tooltip_container"><img src="' + westui.set_calc.bonus.extra_set_bonus[i].img + '"><b>+' + total[i] + (-1 !== ["xp", "money", "luck", "spd", "regen", "drop"].indexOf(i) ? "%" : "") + '</b><div class="tooltip_outer"><div class="tooltip"><div class="tt_bg_tl"></div><div class="tt_bg_tr"></div><div class="tt_bg_bl"></div><div class="tt_bg_br"></div><div id="tooltip_content">' + westui.set_calc.bonus.extra_set_bonus[i].name + "</div></div></div></div>"); $("#set_calc").html(p) } else $("#set_calc").html("") }, initEvents: function () { $(".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") ? 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").bind("propertychange keyup input paste", function () { westui.set_calc.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") ? 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() }) }, init: function () { westui.set_calc.initEvents(), westui.set_calc.getData(), $("# | function () { if (1 === $("#input_level").length) var t = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" min="0" max="150">').bind("propertychange keyup input paste", function () { this.value > 150 ? this.value = 150 : 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 (1 === $("#input_search").length) $('<input type="search" class="west" placeholder="' + westui.lang.input_search + '">').bind("propertychange keyup input paste", function () { var t = this.value.toLowerCase(); "" === t ? $(".item_container").show() : ($(".item_container").hide(), $(".item_container").filter(function () { return $(this).attr("data-popup").toLowerCase().indexOf(t) > -1 }).show()) }).appendTo($("#input_search")); 1 === $("#switch").length && ($("#fire").hide(), $("#switch").on("click", function () { $("#melee, #fire").toggle() })), 1 === $("#switch_prod").length && ($("#prod2").hide(), $("#switch_prod").on("click", function () { $("#prod, #prod2").toggle() })), westui.config.plain_popup && new RegExp(mw.config.get("wgFormattedNamespaces")[10] + ":Item_*").test(mw.config.get("wgPageName")) && 1 === $(".item_container").length && ($("#mw-content-text").append('<center><div id="popup_plain" class="popup_window"><div class="popup_front"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div></div><div id="popup_plain_contents" class="popup_contents"></div></div></center>'), $("#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 }), westui.config.link_on_dblclick && $(".item_container img").on("dblclick", function () { window.location = "/wiki/" + $(this).parent().attr("data-link") }) }, popup: { content: "", delay: 200, active: !1, show: function (t) { westui.popup.content = westui.popup.createPopup($(t).attr("data-popup"), $(t).attr("data-cdn-cat"), $(t).attr("data-cdn-img"), 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") }, createPopup: function (t, e, i, a) { t = JSON.parse(t); var s = '<div class="popup_image"><img src="' + westui.config.cdn + "/images/items/" + t.cdn_cat + "/" + t.cdn_img + '.png"/></div><div class="popup_divider"></div><p class="popup_name">' + t.name + '</p><p class="popup_type">' + t.type + "</p><br/>", n = !1; if (a >= 1 && a <= 5 && (n = !0, t.auc = !1), t.dmg_min && t.dmg_max && (n && (t.dmg_min += Math.round(Math.max(1, .1 * t.dmg_min * a)), t.dmg_max += Math.round(Math.max(1, .1 * t.dmg_max * a))), s += '<p class="popup_dmg">' + t.dmg_min + "-" + t.dmg_max + " " + westui.lang.damages + "</p>"), t.text) { for (var p = 0; p < t.text.length; p++)s += '<p class="popup_text">' + t.text[p] + "</p>"; s += "<br/>" } for (var o in westui.lang.popup) { var l = 0; for (var c in westui.lang.popup[o]) if (t.hasOwnProperty(c)) { l++; var r = ""; t[c] < 0 ? $("#input_level input").val() > 0 ? (t[c] = Math.ceil($("#input_level input").val() * -t[c]), n && (t[c] += Math.round(Math.max(1, .1 * t[c] * a)))) : (t[c] = -t[c], r = " (" + westui.lang.per_level + ")", n && (t[c] = Math.round(1e6 * (1 * t[c] + Math.round(Math.max(1, 1e3 * t[c] * a)) / 1e4)) / 1e6)) : n && (t[c] < 1 ? t[c] = Math.round(1e6 * (1 * t[c] + Math.round(Math.max(1, 1e3 * t[c] * a)) / 1e4)) / 1e6 : t[c] += Math.round(Math.max(1, .1 * t[c] * a))), s += westui.lang.popup[o][c].replace("#1", t[c]).replace("#2", r) } l > 0 && (s += "<br/>") } if (t.textjob) { for (p = 0; p < t.textjob.length; p++)s += '<p class="popup_txtgreen">' + t.textjob[p] + "</p>"; s += "<br/>" } if (t.bonus) { for (p = 0; p < t.bonus.length; p++)s += '<p class="popup_bonus">' + t.bonus[p] + "</p>"; s += "<br/>" } if (t.jobs) { s += '<div style="text-align:center;"><table class="popup_job">'; for (p = 0; p < t.jobs.length; p++)s += '<tr><td><img src="' + westui.config.cdn + "/images/jobs/" + t.jobs[p][1] + '.png"/></td><td><span> ' + t.jobs[p][0] + "</span></td></tr>"; s += "</table></div>" } if (t.craft) { s += '<div style="text-align:center;"><table class="popup_crafteditem"><tr><td><img src="' + westui.config.cdn + "/images/crafting/profsymbol_" + t.craft.id + '_small.png"/></td><td><table><tr>'; for (p = 0; p < t.craft.req.length; p++)s += '<td><img style="width:36px;height:36px;" src="' + westui.config.cdn + "/images/items/yield/" + t.craft.req[p][0] + '.png"/></td>'; s += "</tr><tr>"; for (p = 0; p < t.craft.req.length; p++)s += "<td><span>x" + t.craft.req[p][1] + "</span></td>"; s += "</tr></table></td></tr></table></div>" } return s += '<div class="popup_infos">', t.hspd && (n && (t.hspd += Math.round(Math.max(1, .1 * t.hspd * a))), s += '<p class="popup_speed">' + westui.lang.speed + ": +" + t.hspd + "%</p><br/>"), t.set && (s += '<p><a class="popup_set" href="/wiki/' + t.set + '">' + t.set + "</a></p><br/>"), t.sp ? s += '<img src="' + westui.config.img_buyprice + '"/>' + t.bp + ' <img src="' + westui.config.img_sellprice + '"/> ' + t.sp + "<br/><br/>" : s += "<i>" + westui.lang.unsalable + "</i><br/><br/>", t.lvl && (s += westui.lang.level + " <b>" + t.lvl + "</b><br/>"), t.sex && (0 == t.sex ? s += '<img src="' + westui.config.img_male + '"/> ' : s += '<img src="' + westui.config.img_female + '"/> '), 1 == t.auc ? s += '<span class="popup_txtgreen">' + westui.lang.auction + "</span><br/>" : s += '<span class="popup_txtred">' + westui.lang.not_auction + "</span><br/>", 0 == t.upg ? s += '<span class="popup_txtred">' + westui.lang.not_upgrade + "</span><br/>" : s += '<span class="popup_txtgreen">' + westui.lang.upgrade + "</span><br/>", s += '<br/><p class="popup_id">[item=<b>' + t.id + "</b>]</p></div>", s }, 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, c = 20, r = 20; i = o + n + r > a ? o - n - r + (t.pageX - t.clientX) : o + r + (t.pageX - t.clientX), e = l + p + c > s ? s - p + (t.pageY - t.clientY) : l + c + (t.pageY - t.clientY), westui.popup.getEl().css({ top: e, left: i }) }, init: function () { $("body").append('<div id="popup_window" class="popup_window"><div class="popup_front"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div></div><div id="popup_contents" class="popup_contents"></div></div>'), $(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: { bonus: { extra_set_bonus: {} }, data: {}, itemStatus: {}, getData: function () { $(".set_container").each(function () { var t = $(this).attr("data-set-id"); westui.set_calc.itemStatus[t] = {}, westui.set_calc.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"); westui.set_calc.data[t].set[e] = {}, $(this).find(".set_bonus").each(function () { key = $(this).attr("data-type"), 0 !== $(this).find(".calc").length ? westui.set_calc.data[t].set[e][key] = -parseFloat($(this).find(".calc").attr("id")) : westui.set_calc.data[t].set[e][key] = parseFloat($(this).find(".val").text()), westui.config.set_bonus.hasOwnProperty(key) || (westui.set_calc.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")); for (var i in $(this).is(":hidden") ? westui.set_calc.itemStatus[t][e.id] = !1 : westui.set_calc.itemStatus[t][e.id] = 0, e) e.hasOwnProperty(i) && (westui.config.set_bonus.hasOwnProperty(i) || westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(i)) && (westui.set_calc.data[t].items[i] || (westui.set_calc.data[t].items[i] = {}), westui.set_calc.data[t].items[i][e.id] = e[i]) }) }) }, calc: function () { if (0 === $("#input_level").length | "" !== $("#input_level input").val()) { var t = parseInt($("#input_level input").val()); for (var e in total = {}, westui.set_calc.data) { for (var i in westui.set_calc.data[e].items) for (var a in westui.set_calc.data[e].items[i]) if (!1 !== westui.set_calc.itemStatus[e][a]) { lvl = westui.set_calc.itemStatus[e][a], total[i] || (total[i] = 0); var s = westui.set_calc.data[e].items[i][a]; westui.set_calc.data[e].items[i][a] < 0 ? (s = -s, westui.set_calc.itemStatus[e][a] > 0 ? total[i] += Math.ceil(s * t) + Math.round(Math.max(1, .1 * Math.ceil(s * t) * lvl)) : total[i] += Math.ceil(s * t)) : westui.set_calc.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, .1 * s * lvl)) : total[i] += s } var n = 0; for (var a in westui.set_calc.itemStatus[e]) !1 !== westui.set_calc.itemStatus[e][a] && n++; for (var i in westui.set_calc.data[e].set[n]) total[i] || (total[i] = 0), westui.set_calc.data[e].set[n][i] < 0 ? total[i] += Math.ceil(-westui.set_calc.data[e].set[n][i] * t) : total[i] += westui.set_calc.data[e].set[n][i] } var p = '<center><table class="infoSet"><caption><br><big><b>' + westui.lang.total + "</b></big></caption><tbody><tr><td></center>"; for (var i in westui.config.set_bonus) total.hasOwnProperty(i) && (p += '<div class="set_bonus tooltip_container"><img src="' + westui.config.set_bonus[i].img + '"><b>+' + total[i] + (-1 !== ["xp", "money", "luck", "spd", "regen", "drop"].indexOf(i) ? "%" : "") + '</b><div class="tooltip_outer"><div class="tooltip"><div class="tt_bg_tl"></div><div class="tt_bg_tr"></div><div class="tt_bg_bl"></div><div class="tt_bg_br"></div><div id="tooltip_content">' + westui.config.set_bonus[i].name + "</div></div></div></div>"); for (var i in westui.set_calc.bonus.extra_set_bonus) total.hasOwnProperty(i) && (p += '<div class="set_bonus tooltip_container"><img src="' + westui.set_calc.bonus.extra_set_bonus[i].img + '"><b>+' + total[i] + (-1 !== ["xp", "money", "luck", "spd", "regen", "drop"].indexOf(i) ? "%" : "") + '</b><div class="tooltip_outer"><div class="tooltip"><div class="tt_bg_tl"></div><div class="tt_bg_tr"></div><div class="tt_bg_bl"></div><div class="tt_bg_br"></div><div id="tooltip_content">' + westui.set_calc.bonus.extra_set_bonus[i].name + "</div></div></div></div>"); $("#set_calc").html(p) } else $("#set_calc").html("") }, initEvents: function () { $(".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") ? 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").bind("propertychange keyup input paste", function () { westui.set_calc.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") ? 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() }) }, init: function () { westui.set_calc.initEvents(), westui.set_calc.getData(), $("#append-total-here").append('<div id="set_calc"></div>'), 0 === $("#input_level").length && westui.set_calc.calc() } }, sorting: { | ||
sortItems: function (t) { function e(e) { var i = JSON.parse($(e).attr("data-popup")), a = $("#input_level input").val(); a = a || 150; 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(".number").length ? s ? $(e).find(".number").html("") : $(e).find(".number").html(n) : s || $(e).append('<p class="number">' + n + "</p>") } $(".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)) }) }, | sortItems: function (t) { function e(e) { var i = JSON.parse($(e).attr("data-popup")), a = $("#input_level input").val(); a = a || 150; 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(".number").length ? s ? $(e).find(".number").html("") : $(e).find(".number").html(n) : s || $(e).append('<p class="number">' + n + "</p>") } $(".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 id='input_search'><select id='sort_items' class='west'><option selected disabled>Sırala :</option>"; for (var e in westui.config.sorting) t += "<option value='" + westui.config.sorting[e] + "'>" + e + "</option>"; t += "</select></div>", $("div#sort_items").html(t), $("select#sort_items").on("change", function () { westui.sorting.sortItems(JSON.parse($(this).find("option:selected").attr("value"))) }) } } | init: function () { if (1 === $("div#sort_items").length) { var t = "<div id='input_search'><select id='sort_items' class='west'><option selected disabled>Sırala :</option>"; for (var e in westui.config.sorting) t += "<option value='" + westui.config.sorting[e] + "'>" + e + "</option>"; t += "</select></div>", $("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() } | }, 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(); | }, westui.init(); |
12.39, 22 Eylül 2022 tarihindeki hâli
westui = {
lang: { input_level: "Seviyeniz", input_search: "Ara", damages: "Hasar", per_level: "Seviye başına", speed: "Hız", level: "Seviye", unsalable: "Satılamaz", auction: "Açık arttırmaya koyulabilir", not_auction: "Açık arttırmaya koyulamaz", not_upgrade: "Geliştirilemez", upgrade: "Geliştirilebilir", total: "Toplam", popup: { dmg: {
dmglvl: '
+ #1 Hasar#2
'
}, skills: {
str: '
+ #1 Güç#2
', mob: '
+ #1 Hareket#2
', dex: '
+ #1 Beceri#2
', cha: '
+ #1 Karizma#2
', con: '
+ #1 Kurma#2
', vig: '
+ #1 Vurma gücü#2
', tou: '
+ #1 Dayanıklılık#2
', sta: '
+ #1 Sebat#2
', hea: '
+ #1 Hayat puanı#2
', rid: '
+ #1 Ata binme#2
', ref: '
+ #1 Refleks#2
', dod: '
+ #1 Savulma#2
', hid: '
+ #1 Saklanma#2
', swi: '
+ #1 Yüzme#2
', aim: '
+ #1 Nişan#2
', sho: '
+ #1 Atış#2
', pit: '
+ #1 Tuzak kurma#2
', fin: '
+ #1 El Çabukluğu#2
', rep: '
+ #1 Tamir#2
', lea: '
+ #1 Yönetme#2
', tac: '
+ #1 Taktik#2
', tra: '
+ #1 Ticaret#2
', ani: '
+ #1 Hayvan bilgisi#2
', app: '
+ #1 Görünüm#2
'
}, fb: {
fbdef: '
+ #1 Savunma (Kale savaşı bonusu)#2
', fboff: '
+ #1 Saldırı (Kale savaşı bonusu)#2
', fbres: '
+ #1 Direnç (Kale savaşı bonusu)#2
', fbdefs: '
+ #1 Savunma (Kale savaşı sektör bonusu)#2
', fboffs: '
+ #1 Saldırı (Kale savaşı sektör bonusu)#2
', fbdmgs: '
+ #1 Hasar (Kale savaşı sektör bonusu)#2
'
}, special: {
xp: '
+ #1% Çalışmalar, düellolar ve kale savaşlarından kazanılan tecrübe#2
', money: '
+ #1% Çalışmalar ve düellolardan kazanılan para#2
', luck: '
+ #1% daha fazla şans#2
', regen: '
+ #1% Yenilenme#2
', drop: '
+ #1% Ürün bulma şansı#2
', labor_pts: '
+ #1 Çalışma puanı#2
', spd: '
+ #1% Hız#2
'
} } }, config: { enable_set_calc: !0, plain_popup: !0, redirect_on_dblclick: !1, link_on_dblclick: !0, enable_sorting: !0, cdn: "https://westzz.innogamescdn.com", img_buyprice: "/images/5/57/Buy_price.png", img_sellprice: "/images/f/fc/Sell_price.png", img_male: "/images/c/c5/Gender_m.png", img_female: "/images/4/41/Gender_f.png", set_bonus: { str: { name: "Güç", img: "/images/thumb/8/8b/Strength.png/40px-Strength.png" }, mob: { name: "Hareket", img: "/images/thumb/5/5a/Mobility.png/40px-Mobility.png" }, dex: { name: "Beceri", img: "/images/thumb/0/0d/Dexterity.png/40px-Dexterity.png" }, cha: { name: "Karizma", img: "/images/thumb/c/c9/Charisma.png/40px-Charisma.png" }, con: { name: "Kurma", img: "/images/thumb/3/37/Construction.png/40px-Construction.png" }, vig: { name: "Vurma", img: "/images/thumb/9/90/Skill_Punch.png/40px-Skill_Punch.png" }, tou: { name: "Dayanıklılık", img: "/images/thumb/f/f8/Skill_Tough.png/40px-Skill_Tough.png" }, sta: { name: "Sebat", img: "/images/thumb/8/8d/Stamina.png/40px-Stamina.png" }, hea: { name: "Hayat puanı Points", img: "/images/thumb/9/94/Health.png/40px-Health.png" }, rid: { name: "Ata binme", img: "/images/thumb/7/78/Hbr.png/40px-Hbr.png" }, ref: { name: "Refleks", img: "/images/thumb/e/e9/Skill_Reflex.png/40px-Skill_Reflex.png" }, dod: { name: "Savulma", img: "/images/thumb/0/07/Skill_Dodge.png/40px-Skill_Dodge.png" }, hid: { name: "Saklanma", img: "/images/thumb/9/97/Hiding.png/40px-Hiding.png" }, swi: { name: "Yüzme", img: "/images/thumb/f/f4/Swimming.png/40px-Swimming.png" }, aim: { name: "Nişan", img: "/images/thumb/5/53/Skill_Aim.png/40px-Skill_Aim.png" }, sho: { name: "Atış", img: "/images/thumb/7/73/Skill_Shot.png/40px-Skill_Shot.png" }, pit: { name: "Tuzak kurma", img: "/images/thumb/e/e1/Trapping.png/40px-Trapping.png" }, fin: { name: "El çabukluğu", img: "/images/thumb/1/18/Fms.png/40px-Fms.png" }, rep: { name: "Tamir", img: "/images/thumb/d/d5/Repairing.png/40px-Repairing.png" }, lea: { name: "Yönetme", img: "/images/thumb/4/44/Leadership.png/40px-Leadership.png" }, tac: { name: "Taktik", img: "/images/thumb/9/91/Skill_Tactic.png/40px-Skill_Tactic.png" }, tra: { name: "Ticaret", img: "/images/thumb/f/f3/Skill_Trading.png/40px-Skill_Trading.png" }, ani: { name: "Hayvan bilgisi", img: "/images/thumb/9/9d/AnimalInstinct.png/40px-AnimalInstinct.png" }, app: { name: "Görünüm", img: "/images/thumb/4/4c/Skill_Appearance.png/40px-Skill_Appearance.png" }, fbdef: { name: "Savunma (Kale savaşı bonusu)", img: "/images/8/82/Set_Fb_defense.png" }, fboff: { name: "Saldırı (Kale savaşı bonusu)", img: "/images/3/30/Set_Fb_offense.png" }, fbres: { name: "Direnme (Kale savaşı bonusu)", img: "/images/4/4b/Resistance.png" }, fbdefs: { name: "Savunma (Kale savaşı sektör bonusu)", img: "/images/1/1a/Set_Fb_defense_sec.png" }, fboffs: { name: "Saldırı (Kale savaşı sektör bonusu)", img: "/images/f/fe/Set_Fb_offense_sec.png" }, fbdmgs: { name: "Hasar (Kale savaşı sektör bonusu)", img: "/images/b/b3/Damages_sector.png" }, xp: { name: "Çalışma, düello ve kale savaşlarından kazanılan tecrübe (%)", img: "/images/7/71/Set_xp.png" }, money: { name: "Çalışma ve düellolardan kazanılan para (%)", img: "/images/d/df/Set_money.png" }, luck: { name: "Şans", img: "/images/c/c1/Set_luck.png" }, regen: { name: "Yenilenme", img: "/images/5/53/Regeneration.png" }, drop: { name: "Eşya düşürme şansı", img: "/images/thumb/b/b8/Drop.png/40px-Drop.png" }, spd: { name: "Hız", img: "/images/thumb/1/1a/QuarterHorse.png/40px-QuarterHorse.png" }, labor_pts: { name: "Çalışma puanı (tüm çalışmalar)", img: "/images/5/5e/Labor_pts.png" } }, sorting: { Güç: '{"str":1}', Hareket: '{"mob":1}', Beceri: '{"dex":1}', Karizma: '{"cha":1}', Kurma: '{"str":1,"con":1}', Vurma: '{"str":1,"vig":1}', Dayanıklılık: '{"str":1,"tou":1}', Sebat: '{"str":1,"sta":1}', "Hayat Puanı": '{"str":1,"hea":1}', "Ata Binme": '{"mob":1,"rid":1}', Refleks: '{"mob":1,"ref":1}', Savulma: '{"mob":1,"dod":1}', Saklanma: '{"mob":1,"hid":1}', Yüzme: '{"mob":1,"swi":1}', Nisan: '{"dex":1,"aim":1}', Atış: '{"dex":1,"sho":1}', "Tuzak Kurma": '{"dex":1,"pit":1}', "El Çabukluğu": '{"dex":1,"fin":1}', Tamir: '{"dex":1,"rep":1}', Yönetme: '{"cha":1,"lea":1}', Taktik: '{"cha":1,"tac":1}', Ticaret: '{"cha":1,"tra":1}', "Hayvan Bilgisi": '{"cha":1,"ani":1}', Görünüm: '{"cha":1,"app":1}', "Bina geliştirme çalışma puanı": '{"str":3,"con":3,"dex":1,"rep":1,"cha":1,"lea":1}', "Çalışma, düello ve kale savaşlarından kazanılan tecrübe (%)": '{"xp":1}', "Çalışma ve düellolardan kazanılan para (%)": '{"money":1}', "daha fazla şans (%)": '{"luck":1}', "Yenilenme (%)": '{"regen":1}', "Ürün bulma şansı (%)": '{"drop":1}', "Hız (%)": '{"spd":1,"hspd":1,"mob":1,"rid":1}', "Ortalama Hasar": '{"dmg_min":0.5,"dmg_max":0.5,"dmglvl":1}', "En Yüksek Hasar": '{"dmg_max":1,"dmglvl":1}', "Geliştirilebilir Eşya": '{"bool":true,"upg":1}', "Geliştirilemez eşya": '{"bool":true,"upg":0}', "Açık Arttırmaya Koyulabilir": '{"bool":true,"auc":1}', "Açık Arttırmaya Koyulamayaz": '{"bool":true,"auc":0}' } }, initPage:
function () { if (1 === $("#input_level").length) var t = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" min="0" max="150">').bind("propertychange keyup input paste", function () { this.value > 150 ? this.value = 150 : 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 (1 === $("#input_search").length) $('<input type="search" class="west" placeholder="' + westui.lang.input_search + '">').bind("propertychange keyup input paste", function () { var t = this.value.toLowerCase(); "" === t ? $(".item_container").show() : ($(".item_container").hide(), $(".item_container").filter(function () { return $(this).attr("data-popup").toLowerCase().indexOf(t) > -1 }).show()) }).appendTo($("#input_search")); 1 === $("#switch").length && ($("#fire").hide(), $("#switch").on("click", function () { $("#melee, #fire").toggle() })), 1 === $("#switch_prod").length && ($("#prod2").hide(), $("#switch_prod").on("click", function () { $("#prod, #prod2").toggle() })), westui.config.plain_popup && new RegExp(mw.config.get("wgFormattedNamespaces")[10] + ":Item_*").test(mw.config.get("wgPageName")) && 1 === $(".item_container").length && ($("#mw-content-text").append('
'), $("#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 }), westui.config.link_on_dblclick && $(".item_container img").on("dblclick", function () { window.location = "/wiki/" + $(this).parent().attr("data-link") }) }, popup: { content: "", delay: 200, active: !1, show: function (t) { westui.popup.content = westui.popup.createPopup($(t).attr("data-popup"), $(t).attr("data-cdn-cat"), $(t).attr("data-cdn-img"), 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") }, createPopup: function (t, e, i, a) { t = JSON.parse(t); var s = '
' + t.name + '
' + t.type + "
", n = !1; if (a >= 1 && a <= 5 && (n = !0, t.auc = !1), t.dmg_min && t.dmg_max && (n && (t.dmg_min += Math.round(Math.max(1, .1 * t.dmg_min * a)), t.dmg_max += Math.round(Math.max(1, .1 * t.dmg_max * a))), s += '
' + t.dmg_min + "-" + t.dmg_max + " " + westui.lang.damages + "
"), t.text) { for (var p = 0; p < t.text.length; p++)s += '
' + t.text[p] + "
"; s += "
" } for (var o in westui.lang.popup) { var l = 0; for (var c in westui.lang.popup[o]) if (t.hasOwnProperty(c)) { l++; var r = ""; t[c] < 0 ? $("#input_level input").val() > 0 ? (t[c] = Math.ceil($("#input_level input").val() * -t[c]), n && (t[c] += Math.round(Math.max(1, .1 * t[c] * a)))) : (t[c] = -t[c], r = " (" + westui.lang.per_level + ")", n && (t[c] = Math.round(1e6 * (1 * t[c] + Math.round(Math.max(1, 1e3 * t[c] * a)) / 1e4)) / 1e6)) : n && (t[c] < 1 ? t[c] = Math.round(1e6 * (1 * t[c] + Math.round(Math.max(1, 1e3 * t[c] * a)) / 1e4)) / 1e6 : t[c] += Math.round(Math.max(1, .1 * t[c] * a))), s += westui.lang.popup[o][c].replace("#1", t[c]).replace("#2", r) } l > 0 && (s += "
") } if (t.textjob) { for (p = 0; p < t.textjob.length; p++)s += '
' + t.textjob[p] + "
"; s += "
" } if (t.bonus) { for (p = 0; p < t.bonus.length; p++)s += '
' + t.bonus[p] + "
"; s += "
" } if (t.jobs) { s += '
<img src="' + westui.config.cdn + "/images/jobs/" + t.jobs[p][1] + '.png"/> | ' + t.jobs[p][0] + " |
" } if (t.craft) { s += '
<img src="' + westui.config.cdn + "/images/crafting/profsymbol_" + t.craft.id + '_small.png"/> | '; for (p = 0; p < t.craft.req.length; p++)s += ''; s += ""; for (p = 0; p < t.craft.req.length; p++)s += ""; s += "
|
" } return s += '
' + westui.lang.speed + ": +" + t.hspd + "%
"), t.set && (s += '
<a class="popup_set" href="/wiki/' + t.set + '">' + t.set + "</a>
"), t.sp ? s += '<img src="' + westui.config.img_buyprice + '"/>' + t.bp + ' <img src="' + westui.config.img_sellprice + '"/> ' + t.sp + "
" : s += "" + westui.lang.unsalable + "
", t.lvl && (s += westui.lang.level + " " + t.lvl + "
"), t.sex && (0 == t.sex ? s += '<img src="' + westui.config.img_male + '"/> ' : s += '<img src="' + westui.config.img_female + '"/> '), 1 == t.auc ? s += '' + westui.lang.auction + "
" : s += '' + westui.lang.not_auction + "
", 0 == t.upg ? s += '' + westui.lang.not_upgrade + "
" : s += '' + westui.lang.upgrade + "
", s += '
[item=' + t.id + "]
", s }, 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, c = 20, r = 20; i = o + n + r > a ? o - n - r + (t.pageX - t.clientX) : o + r + (t.pageX - t.clientX), e = l + p + c > s ? s - p + (t.pageY - t.clientY) : l + c + (t.pageY - t.clientY), 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: { bonus: { extra_set_bonus: {} }, data: {}, itemStatus: {}, getData: function () { $(".set_container").each(function () { var t = $(this).attr("data-set-id"); westui.set_calc.itemStatus[t] = {}, westui.set_calc.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"); westui.set_calc.data[t].set[e] = {}, $(this).find(".set_bonus").each(function () { key = $(this).attr("data-type"), 0 !== $(this).find(".calc").length ? westui.set_calc.data[t].set[e][key] = -parseFloat($(this).find(".calc").attr("id")) : westui.set_calc.data[t].set[e][key] = parseFloat($(this).find(".val").text()), westui.config.set_bonus.hasOwnProperty(key) || (westui.set_calc.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")); for (var i in $(this).is(":hidden") ? westui.set_calc.itemStatus[t][e.id] = !1 : westui.set_calc.itemStatus[t][e.id] = 0, e) e.hasOwnProperty(i) && (westui.config.set_bonus.hasOwnProperty(i) || westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(i)) && (westui.set_calc.data[t].items[i] || (westui.set_calc.data[t].items[i] = {}), westui.set_calc.data[t].items[i][e.id] = e[i]) }) }) }, calc: function () { if (0 === $("#input_level").length | "" !== $("#input_level input").val()) { var t = parseInt($("#input_level input").val()); for (var e in total = {}, westui.set_calc.data) { for (var i in westui.set_calc.data[e].items) for (var a in westui.set_calc.data[e].items[i]) if (!1 !== westui.set_calc.itemStatus[e][a]) { lvl = westui.set_calc.itemStatus[e][a], total[i] || (total[i] = 0); var s = westui.set_calc.data[e].items[i][a]; westui.set_calc.data[e].items[i][a] < 0 ? (s = -s, westui.set_calc.itemStatus[e][a] > 0 ? total[i] += Math.ceil(s * t) + Math.round(Math.max(1, .1 * Math.ceil(s * t) * lvl)) : total[i] += Math.ceil(s * t)) : westui.set_calc.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, .1 * s * lvl)) : total[i] += s } var n = 0; for (var a in westui.set_calc.itemStatus[e]) !1 !== westui.set_calc.itemStatus[e][a] && n++; for (var i in westui.set_calc.data[e].set[n]) total[i] || (total[i] = 0), westui.set_calc.data[e].set[n][i] < 0 ? total[i] += Math.ceil(-westui.set_calc.data[e].set[n][i] * t) : total[i] += westui.set_calc.data[e].set[n][i] } var p = '
"; for (var i in westui.config.set_bonus) total.hasOwnProperty(i) && (p += ' <img src="' + westui.config.set_bonus[i].img + '">+' + total[i] + (-1 !== ["xp", "money", "luck", "spd", "regen", "drop"].indexOf(i) ? "%" : "") + ' "); for (var i in westui.set_calc.bonus.extra_set_bonus) total.hasOwnProperty(i) && (p += '' + westui.config.set_bonus[i].name + " <img src="' + westui.set_calc.bonus.extra_set_bonus[i].img + '">+' + total[i] + (-1 !== ["xp", "money", "luck", "spd", "regen", "drop"].indexOf(i) ? "%" : "") + ' "); $("#set_calc").html(p) } else $("#set_calc").html("") }, initEvents: function () { $(".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") ? 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").bind("propertychange keyup input paste", function () { westui.set_calc.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") ? 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() }) }, init: function () { westui.set_calc.initEvents(), westui.set_calc.getData(), $("#append-total-here").append(''), 0 === $("#input_level").length && westui.set_calc.calc() } }, sorting: {
sortItems: function (t) { function e(e) { var i = JSON.parse($(e).attr("data-popup")), a = $("#input_level input").val(); a = a || 150; 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(".number").length ? s ? $(e).find(".number").html("") : $(e).find(".number").html(n) : s || $(e).append('' + westui.set_calc.bonus.extra_set_bonus[i].name + " ' + 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 = "<select id='sort_items' class='west'><option selected disabled>Sırala :</option>"; for (var e in westui.config.sorting) t += "<option value='" + westui.config.sorting[e] + "'>" + e + "</option>"; t += "</select> ", $("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(); |