-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheve-ui.min.js
1 lines (1 loc) · 24.3 KB
/
eve-ui.min.js
1
"use strict";var eveui,eveui_user_agent=eveui_user_agent||"For source website, see referrer. For library, see https://github.com/quiescens/eve-ui/ r:0.9.8",eveui_accept_language=eveui_accept_language,eveui_preload_initial=eveui_preload_initial||50,eveui_preload_interval=eveui_preload_interval||10,eveui_mode=eveui_mode||"multi_window",eveui_allow_edit=eveui_allow_edit||!1,eveui_show_fitstats=eveui_show_fitstats||!1,eveui_fit_selector=eveui_fit_selector||'[href^="fitting:"],[data-dna]',eveui_item_selector=eveui_item_selector||'[href^="item:"],[data-itemid]',eveui_char_selector=eveui_char_selector||'[href^="char:"],[data-charid]',eveui_corp_selector=eveui_corp_selector||'[href^="corp:"],[data-corpid]',eveui_esi_endpoint=eveui_esi_endpoint||function(e){return"https://esi.evetech.net"+e},eveui_urlify=eveui_urlify||function(e){return"fitting:"+encodeURI(e)},eveui_imageserver=eveui_imageserver||function(e){return e.startsWith("Character")?"https://imageserver.eveonline.com/"+encodeURI(e)+".jpg":"https://imageserver.eveonline.com/"+encodeURI(e)+".png"},eveui_style=eveui_style||"<style>.eveui_window{position:fixed;line-height:1;background:#eee;color:#000;border:1px solid;opacity:.95;display:flex;flex-direction:column}.eveui_modal_overlay{cursor:pointer;position:fixed;background:#000;top:0;left:0;right:0;bottom:0;z-index:10;opacity:.5}.eveui_title{width:100%;background:#ccc;cursor:move;white-space:nowrap;margin-right:2em}.eveui_scrollable{padding-right:17px;text-align:left;overflow:auto}.eveui_content{display:inline-block;margin:2px;max-width:40em}.eveui_content .eveui_title{display:flex}.eveui_content table{border-collapse:collapse}.eveui_content td{vertical-align:top;padding:0 2px}.eveui_content .eveui_edit{display:none}.eveui_content.eveui_edit .eveui_edit{display:inline-block}.eveui_edit .eveui_edit_icon{display:none}.eveui_itemselect{width:100%;position:absolute}.eveui_itemselect input{width:100%;min-width:20em;padding:0}.eveui_rowcontent{position:relative}.eveui_flexgrow{flex-grow:1}.eveui_fit_header{align-items:center}.eveui_fit_stats{background:#eee;white-space:nowrap;position:absolute;margin-left:19px;border:1px solid;padding:2px;line-height:1;font-size:90%}.eveui_line_spacer{line-height:.5em}.eveui_right{text-align:right}.eveui_icon{display:inline-block;margin:1px;vertical-align:middle;height:1em;width:1em;background-position:center;background-repeat:no-repeat;background-size:contain}.eveui_item_icon{height:20px;width:20px}.eveui_ship_icon{height:32px;width:32px}.eveui_close_icon{cursor:pointer;position:absolute;top:0;right:0;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0uOTMgMi4zNDNMMi4zNDIuOTI5IDE1LjA3IDEzLjY1NmwtMS40MTQgMS40MTR6Ii8+PHBhdGggZD0iTTIuMzQzIDE1LjA3TC45MjkgMTMuNjU4IDEzLjY1Ni45M2wxLjQxNCAxLjQxNHoiLz48L3N2Zz4=)}.eveui_info_icon{cursor:pointer;background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMjQiIHdpZHRoPSI4OTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQ0OCAzODRjMzUgMCA2NC0yOSA2NC02NHMtMjktNjQtNjQtNjQtNjQgMjktNjQgNjQgMjkgNjQgNjQgNjR6bTAtMzIwQzIwMSA2NCAwIDI2NSAwIDUxMnMyMDEgNDQ4IDQ0OCA0NDggNDQ4LTIwMSA0NDgtNDQ4UzY5NSA2NCA0NDggNjR6bTAgNzY4Yy0xNzcgMC0zMjAtMTQzLTMyMC0zMjBzMTQzLTMyMCAzMjAtMzIwIDMyMCAxNDMgMzIwIDMyMC0xNDMgMzIwLTMyMCAzMjB6bTY0LTMyMGMwLTMyLTMyLTY0LTY0LTY0aC02NGMtMzIgMC02NCAzMi02NCA2NGg2NHYxOTJjMCAzMiAzMiA2NCA2NCA2NGg2NGMzMiAwIDY0LTMyIDY0LTY0aC02NFY1MTJ6Ii8+PC9zdmc+)}.eveui_plus_icon{cursor:pointer;background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMjQiIHdpZHRoPSI2NDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTM4NCA0NDhWMTkySDI1NnYyNTZIMHYxMjhoMjU2djI1NmgxMjhWNTc2aDI1NlY0NDhIMzg0eiIgLz4KPC9zdmc+Cg==)}.eveui_minus_icon{cursor:pointer;background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMjQiIHdpZHRoPSI1MTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTAgNDQ4djEyOGg1MTJWNDQ4SDB6IiAvPgo8L3N2Zz4K)}.eveui_more_icon{cursor:pointer;background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMjQiIHdpZHRoPSI3NjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTAgNTc2aDEyOHYtMTI4aC0xMjh2MTI4eiBtMC0yNTZoMTI4di0xMjhoLTEyOHYxMjh6IG0wIDUxMmgxMjh2LTEyOGgtMTI4djEyOHogbTI1Ni0yNTZoNTEydi0xMjhoLTUxMnYxMjh6IG0wLTI1Nmg1MTJ2LTEyOGgtNTEydjEyOHogbTAgNTEyaDUxMnYtMTI4aC01MTJ2MTI4eiIgLz4KPC9zdmc+Cg==)}.eveui_edit_icon{cursor:pointer;background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMjQiIHdpZHRoPSI4OTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTcwNCA2NEw1NzYgMTkybDE5MiAxOTIgMTI4LTEyOEw3MDQgNjR6TTAgNzY4bDAuNjg4IDE5Mi41NjJMMTkyIDk2MGw1MTItNTEyTDUxMiAyNTYgMCA3Njh6TTE5MiA4OTZINjRWNzY4aDY0djY0aDY0Vjg5NnoiIC8+Cjwvc3ZnPgo=)}.eveui_copy_icon{cursor:pointer;background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwMjQiIHdpZHRoPSI4OTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTcwNCA4OTZoLTY0MHYtNTc2aDY0MHYxOTJoNjR2LTMyMGMwLTM1LTI5LTY0LTY0LTY0aC0xOTJjMC03MS01Ny0xMjgtMTI4LTEyOHMtMTI4IDU3LTEyOCAxMjhoLTE5MmMtMzUgMC02NCAyOS02NCA2NHY3MDRjMCAzNSAyOSA2NCA2NCA2NGg2NDBjMzUgMCA2NC0yOSA2NC02NHYtMTI4aC02NHYxMjh6IG0tNTEyLTcwNGMyOSAwIDI5IDAgNjQgMHM2NC0yOSA2NC02NCAyOS02NCA2NC02NCA2NCAyOSA2NCA2NCAzMiA2NCA2NCA2NCAzMyAwIDY0IDAgNjQgMjkgNjQgNjRoLTUxMmMwLTM5IDI4LTY0IDY0LTY0eiBtLTY0IDUxMmgxMjh2LTY0aC0xMjh2NjR6IG00NDgtMTI4di0xMjhsLTI1NiAxOTIgMjU2IDE5MnYtMTI4aDMyMHYtMTI4aC0zMjB6IG0tNDQ4IDI1NmgxOTJ2LTY0aC0xOTJ2NjR6IG0zMjAtNDQ4aC0zMjB2NjRoMzIwdi02NHogbS0xOTIgMTI4aC0xMjh2NjRoMTI4di02NHoiIC8+Cjwvc3ZnPgo=)}.copy_only{position:absolute;display:inline-block;line-height:0;font-size:0}.nocopy::after{content:attr(data-content)}.whitespace_nowrap{white-space:nowrap}.float_left{float:left}.float_right{float:right}.eveui_indent{margin-left:.5em;display:inline-block}</style>";!function(e){let t,i,n=jQuery,a=0,o=0,s=null,r=0,c=0,u=100,d=eveui_preload_initial;e.cache={};let l,v=0,_=0,p=0,h=[1,.8691,.5706,.283,.106,.03];function g(){C(),L("/v1/markets/prices"),t=setTimeout(A,eveui_preload_interval)}function f(e=" "){let t=n(`<span class="eveui_window"><div class="eveui_title">${e}</div><span class="eveui_icon eveui_close_icon" /><span class="eveui_scrollable"><span class="eveui_content">Loading...</span></span></span>`);return"modal"===eveui_mode&&0===n(".eveui_modal_overlay").length&&(n("body").append('<div class="eveui_modal_overlay" />'),t.attr("data-eveui-modal",1)),t.css("z-index",u++),t.css("left",a+10),t.css("top",o-10),t}function m(e,t){let i={},n={},a={},o={},s={},r={},c={},u=e.split(":"),d=parseInt(u.shift()),l=H("/v3/universe/types/"+d);l.hiSlots=0,l.medSlots=0,l.lowSlots=0;for(let e in l.dogma_attributes){let t=H("/v3/universe/types/"+d).dogma_attributes[e];switch(t.attribute_id){case 14:l.hiSlots=t.value;break;case 13:l.medSlots=t.value;break;case 12:l.lowSlots=t.value;break;case 1137:l.rigSlots=t.value;break;case 1367:l.maxSubSystems=t.value}}e:for(let e in u){if(0===u[e].length)continue;let t=u[e].split(";"),d=t[0],v=parseInt(t[1]);if(d.endsWith("_")){c[d=d.slice(0,-1)]=v;continue}let _=H("/v3/universe/types/"+d);for(let e in _.dogma_attributes){let t=_.dogma_attributes[e];switch(t.attribute_id){case 1272:r[d]=v;continue e;case 1374:l.hiSlots+=t.value;break;case 1375:l.medSlots+=t.value;break;case 1376:l.lowSlots+=t.value}}for(let e in _.dogma_effects){switch(_.dogma_effects[e].effect_id){case 12:i[d]=v;continue e;case 13:n[d]=v;continue e;case 11:a[d]=v;continue e;case 2663:o[d]=v;continue e;case 3772:s[d]=v;continue e}}c[d]=v}function v(e,t){let i="",n=0;for(let a in e){let o=H("/v3/universe/types/"+a);n+=e[a],i+=t?`<tr class="copy_only"><td>${(o.name+"<br />").repeat(e[a])}`:`<tr class="copy_only"><td>${o.name} x${e[a]}<br />`,i+=`<tr class="nocopy" data-eveui-itemid="${a}"><td><img src="${eveui_imageserver("Type/"+a+"_32")}" class="eveui_icon eveui_item_icon" /><td class="eveui_right">${e[a]}<td colspan="2"><div class="eveui_rowcontent">${o.name}</div><td class="eveui_right whitespace_nowrap"><span data-itemid="${a}" class="eveui_icon eveui_info_icon" /><span class="eveui_icon eveui_plus_icon eveui_edit" /><span class="eveui_icon eveui_minus_icon eveui_edit" /><span class="eveui_icon eveui_more_icon eveui_edit" />`}return void 0!==t&&(t>n&&(i+=`<tr class="nocopy"><td class="eveui_icon eveui_item_icon" /><td class="eveui_right whitespace_nowrap">${t-n}<td colspan="2"><div class="eveui_rowcontent">Empty</div><td class="eveui_right"><span class="eveui_icon eveui_more_icon eveui_edit" />`),n>t&&(i+=`<tr class="nocopy"><td class="eveui_icon eveui_item_icon" /><td class="eveui_right">${t-n}<td><div class="eveui_rowcontent">Excess</div>`)),i}return`<span class="float_right"><eveui type="fit_stats" key="${e}" /></span><table class="eveui_fit_table"><thead><tr class="eveui_fit_header" data-eveui-itemid="${d}"><td colspan="2"><img src="${eveui_imageserver("Type/"+d+"_32")}" class="eveui_icon eveui_ship_icon" /><td><div class="eveui_rowcontent"><span class="eveui_startcopy" />[<a target="_blank" href="${eveui_urlify(e)}">${l.name}, ${t||l.name}</a>]<br/></div><td class="eveui_right whitespace_nowrap nocopy" colspan="2">${eveui_allow_edit?'<span class="eveui_icon eveui_edit_icon" />':""}<span class="eveui_icon eveui_copy_icon" /><span data-itemid="${d}" class="eveui_icon eveui_info_icon" /><span class="eveui_icon eveui_edit" /><span class="eveui_icon eveui_edit" /><span class="eveui_icon eveui_more_icon eveui_edit" /></thead><tbody class="whitespace_nowrap">${v(i,l.hiSlots)}<tr><td class="eveui_line_spacer"> ${v(n,l.medSlots)}<tr><td class="eveui_line_spacer"> ${v(a,l.lowSlots)}<tr><td class="eveui_line_spacer"> ${v(o,l.rigSlots)}<tr><td class="eveui_line_spacer"> ${v(s,l.maxSubSystems)}<tr><td class="eveui_line_spacer"> ${v(r)}<tr><td class="eveui_line_spacer"> ${v(c)}</tbody></table><span class="eveui_endcopy" />`}function w(e,t){let i=f("Fit");return i.addClass("fit_window"),i.attr("data-eveui-dna",e),n("body").append(i),n(window).trigger("resize"),$(e).done(function(){i.find(".eveui_content ").html(m(e,t)),n(window).trigger("resize")}).fail(function(){i.remove()}),i}function y(e){let t=H("/v3/universe/types/"+e),i=`<img src="${eveui_imageserver("Type/"+e+"_64")}" class="float_right" />${t.name}<br />${t.description}<hr /><table class="whitespace_nowrap">`;var a;i+=`<tr><td>Approx price<td>${j((a=e,n.grep(H("/v1/markets/prices"),function(e){return e.type_id==a})[0]).average_price)}<tr><td> `;for(let e in t.dogma_attributes){let n=t.dogma_attributes[e];i+=`<tr><td><eveui key="/v1/dogma/attributes/${n.attribute_id}" path="display_name,name">attribute:${n.attribute_id}</eveui><td> ${n.value}`}return i+="</table>"}function M(e){let t=f("Item");return t.attr("data-eveui-itemid",e),t.addClass("item_window"),n("body").append(t),L("/v3/universe/types/"+e).done(function(){t.find(".eveui_content").html(y(e)),n(window).trigger("resize")}).fail(function(){t.remove()}),n(window).trigger("resize"),t}function N(e){let t=H("/v5/characters/"+e);return`<table><tr><td colspan="2"><img class="float_left" src="${eveui_imageserver("Character/"+e+"_128")}" height="128" width="128" />${t.name}<hr /><img class="float_left" src="${eveui_imageserver("Corporation/"+t.corporation_id+"_64")}" height="64" width="64" />Member of <a href="corp:${t.corporation_id}"><eveui key="/v5/corporations/${t.corporation_id}" path="name">${t.corporation_id}</eveui></a><tr><td>Bio:<td>${t.description.replace(/<font[^>]+>/g,"<font>")}</table>`}function b(e){let t=f("Character");return t.attr("data-eveui-charid",e),t.addClass("char_window"),n("body").append(t),L("/v5/characters/"+e).done(function(){t.find(".eveui_content").html(N(e)),n(window).trigger("resize")}).fail(function(){t.remove()}),n(window).trigger("resize"),t}function T(e){let t=H("/v5/corporations/"+e);return`<table><tr><td colspan="2"><img class="float_left" src="${eveui_imageserver("Corporation/"+e+"_128")}" height="128" width="128" />${t.name}<hr /><img class="float_left" src="${eveui_imageserver("Alliance/"+t.alliance_id+"_64")}" height="64" width="64" />Member of <eveui key="/v4/alliances/${t.alliance_id}" path="name">${t.alliance_id}</eveui><tr><td>Bio:<td>${t.description.replace(/<font[^>]+>/g,"<font>")}</table>`}function I(e){let t=f("Corporation");return t.attr("data-eveui-corpid",e),t.addClass("corp_window"),n("body").append(t),L("/v5/corporations/"+e).done(function(){t.find(".eveui_content").html(T(e)),n(window).trigger("resize")}).fail(function(){t.remove()}),n(window).trigger("resize"),t}function x(e){let t="";return t=`<span class="eveui_fit_stats">Approx. total price: ${j(function(e){let t=e.split(":"),i=0;for(let e in t){if(0===t[e].length)continue;let a=t[e].split(";"),o=a[0],s=parseInt(a[1])||1;i+=n.grep(H("/v1/markets/prices"),function(e){return e.type_id==o})[0].average_price*s}return i}(e))}<br />Gun DPS: ${j(function(e){let t=0,i=e.replace(/:+$/,"").split(":");for(let e in i){let n=i[e].split(";"),a=n[0],o=parseInt(n[1])||1,s=H("/v3/universe/types/"+a),r={};for(let e in s.dogma_attributes)r[s.dogma_attributes[e].attribute_id]=s.dogma_attributes[e].value;let c={53:"energy",55:"projectile",74:"hybrid"};if(s.group_id in c){let e=0,n=r[64],a=r[51]/1e3,s=[],c=[],u={};u[r[604]]=1,u[r[605]]=1;for(let t in i){let n=i[t].split(";"),a=n[0],o=parseInt(n[1])||1,r=H("/v3/universe/types/"+a),d={};for(let e in r.dogma_attributes)d[r.dogma_attributes[e].attribute_id]=r.dogma_attributes[e].value;if(r.group_id in u){let t=0;t+=d[114],t+=d[116],t+=d[117],(t+=d[118])>e&&(e=t)}if(204 in d)for(let e=0;e<o;e++)c.push(d[204]);switch(r.group_id){case 302:if(64 in d)for(let e=0;e<o;e++)s.push(d[64])}}a*=.9,a*=.8,c.sort(function(e,t){return e-t});for(let e in c)a*=1-(1-c[e])*h[e];n*=1.15,n*=1.25,n*=1.1,n*=1.375,s.sort(function(e,t){return t-e});for(let e in s)n*=1+(s[e]-1)*h[e];t+=e*n/a*o}}return t}(e))}<br />Missile DPS: ?<br />Drone DPS: ?<br /></span>`}function j(e){if(isNaN(e))return"n/a";let t="";return e>1e9&&(t="B",e/=1e9),e>1e6&&(t="M",e/=1e6),e>1e3&&(t="K",e/=1e3),`${e.toFixed(2)}${t}`}function C(){D();let e="[data-eveui-expand]";"expand_all"===eveui_mode&&(e="*"),n(eveui_fit_selector).filter(e).each(function(){let e=n(this);if(e.closest(".eveui_content").length>0)return;let t=e.attr("data-dna")||this.href.substring(this.href.indexOf(":")+1);$(t).done(function(){let i=n(this).text().trim(),a=n(`<span class="eveui_content eveui_fit">${m(t,i)}</span>`);a.attr("data-eveui-dna",t),e=e.replaceWith(a)})}),n(eveui_item_selector).filter(e).each(function(){let e=n(this);if(e.closest(".eveui_content").length>0)return;let t=e.attr("data-itemid")||this.href.substring(this.href.indexOf(":")+1);L("/v3/universe/types/"+t).done(function(){e.replaceWith(`<span class="eveui_content eveui_item">${y(t)}</span>`)})}),n(eveui_char_selector).filter(e).each(function(){let e=n(this);if(e.closest(".eveui_content").length>0)return;let t=e.attr("data-charid")||this.href.substring(this.href.indexOf(":")+1);L("/v5/characters/"+t).done(function(){e.replaceWith(`<span class="eveui_content eveui_char">${N(t)}</span>`)})})}function D(){n("eveui[type=fit_stats]").filter(":not([state])").each(function(){let e=n(this),t=e.attr("key");eveui_show_fitstats&&L("/v1/markets/prices").done(function(){e.html(x(t))}),e.attr("state","done")}),n("eveui:not([type])").filter(":not([state])").each(function(){let e=n(this),t=e.attr("key");e.attr("state","loading"),L(t).done(function(){let i=H(t);n.each(e.attr("path").split(","),function(t,a){let o=function(e,t){let i=e;return n.each(t.split("."),function(e,t){i=i[t]}),i}(i,a);if(o)return e.html(o),e.attr("state","done"),!1})})})}function A(){t=setTimeout(A,5e3),v>0||d>0&&n(eveui_fit_selector).not("[data-eveui-cached]").each(function(e){let i=n(this),a=$(i.data("dna")||this.href.substring(this.href.indexOf(":")+1));if("resolved"!==a.state())return d--,a.done(function(){clearTimeout(t),t=setTimeout(A,eveui_preload_interval)}),!1;i.attr("data-eveui-cached",1)})}function z(e){let t={headers:{"Accept-Language":eveui_accept_language},data:{user_agent:eveui_user_agent}};return n.extend(!0,t,e),n.ajax(t)}function $(e){let t=[],i=e.split(":");for(let e in i){if(0===i[e].length)continue;let n=i[e].split(";")[0];n.endsWith("_")&&(n=n.slice(0,-1)),t.push(L("/v3/universe/types/"+n))}return n.when.apply(null,t)}function L(t){let i,a=t.startsWith("/v3/universe/types")||t.startsWith("/v1/dogma/attributes");i=eveui_esi_endpoint(t+"/"),t=(eveui_accept_language||navigator.languages[0])+t;return"object"==typeof e.cache[t]?"function"==typeof e.cache[t].promise?e.cache[t]:n.Deferred().resolve():p>50?n.Deferred().reject():(v++,e.cache[t]=z({url:i,dataType:"json",cache:!a}).done(function(i){if(i.path=t,e.cache[t]=i,l&&a){l.transaction("cache","readwrite").objectStore("cache").put(i)}}).fail(function(i){i.status>=500&&setTimeout(function(){delete e.cache[t]},1e4),p++,setTimeout(function(){p--},6e4)}).always(function(){v--}))}function H(t){return t=(eveui_accept_language||navigator.languages[0])+t,e.cache[t]}n("head").append(eveui_style),n(document).on("click",".eveui_window .eveui_close_icon",function(e){n(this).parent().remove(),0===n(".eveui_window").length&&n(".eveui_modal_overlay").remove()}),n(document).on("click",".eveui_modal_overlay",function(e){n(".eveui_window").remove(),n(this).remove()}),n(document).on("click",eveui_fit_selector,function(e){if(e.preventDefault(),d=eveui_preload_initial,this.eveui_window&&document.contains(this.eveui_window[0]))return void this.eveui_window.remove();let t=n(this).attr("data-dna")||this.href.substring(this.href.indexOf(":")+1),i=n(this).attr("data-title")||n(this).text().trim();switch(eveui_mode){case"expand":case"expand_all":n(this).attr("data-eveui-expand",1),C();break;default:this.eveui_window=w(t,i)}}),n(document).on("click",eveui_item_selector,function(e){if(e.preventDefault(),this.eveui_window&&document.contains(this.eveui_window[0]))return void this.eveui_window.remove();let t=n(this).attr("data-itemid")||this.href.substring(this.href.indexOf(":")+1);switch(eveui_mode){case"expand":case"expand_all":n(this).attr("data-eveui-expand",1),C();break;default:this.eveui_window=M(t)}}),n(document).on("click",eveui_char_selector,function(e){if(e.preventDefault(),this.eveui_window&&document.contains(this.eveui_window[0]))return void this.eveui_window.remove();let t=n(this).attr("data-charid")||this.href.substring(this.href.indexOf(":")+1);switch(eveui_mode){case"expand":case"expand_all":n(this).attr("data-eveui-expand",1),C();break;default:this.eveui_window=b(t)}}),n(document).on("click",eveui_corp_selector,function(e){if(e.preventDefault(),this.eveui_window&&document.contains(this.eveui_window[0]))return void this.eveui_window.remove();let t=n(this).attr("data-corpid")||this.href.substring(this.href.indexOf(":")+1);switch(eveui_mode){case"expand":case"expand_all":n(this).attr("data-eveui-expand",1),C();break;default:this.eveui_window=I(t)}}),n(document).on("click",".eveui_minus_icon",function(e){e.preventDefault();let t=n(this).closest("[data-eveui-itemid]").attr("data-eveui-itemid"),i=n(this).closest("[data-eveui-dna]").attr("data-eveui-dna"),a=new RegExp(":"+t+";(\\d+)"),o=parseInt(i.match(a)[1])-1;i=o>0?i.replace(a,":"+t+";"+o):i.replace(a,""),n(this).closest("[data-eveui-dna]").attr("data-eveui-dna",i),$(i).done(function(){n(`.eveui_window[data-eveui-dna="${i}"]`).find(".eveui_content ").html(m(i)),n(window).trigger("resize")})}),n(document).on("click",".eveui_plus_icon",function(e){e.preventDefault();let t=n(this).closest("[data-eveui-itemid]").attr("data-eveui-itemid"),i=n(this).closest("[data-eveui-dna]").attr("data-eveui-dna"),a=new RegExp(`:${t};(\\d+)`),o=parseInt(i.match(a)[1])+1;i=o>0?i.replace(a,`:${t};${o}`):i.replace(a,""),n(this).closest("[data-eveui-dna]").attr("data-eveui-dna",i),$(i).done(function(){n(`.eveui_window[data-eveui-dna="${i}"]`).find(".eveui_content ").html(m(i)),n(window).trigger("resize")})}),n(document).on("click",".eveui_edit_icon",function(e){e.preventDefault(),n(this).closest(".eveui_content").addClass("eveui_edit"),n(this).remove()}),n(document).on("click",".eveui_more_icon",function(e){e.preventDefault();let t=n(this).closest("[data-eveui-itemid]").attr("data-eveui-itemid");if(this.eveui_itemselect&&document.contains(this.eveui_itemselect[0]))return void this.eveui_itemselect.remove();n(".eveui_itemselect").remove();let i=n(`<span class="eveui_itemselect"><input type="text" list="eveui_itemselect" placeholder="${n(this).closest("[data-eveui-itemid]").find(".eveui_rowcontent").text()}" /><datalist id="eveui_itemselect" /></span>`);if(i.css("z-index",u++),this.eveui_itemselect=i,n(this).closest("tr").find(".eveui_rowcontent").prepend(this.eveui_itemselect),i.find("input").focus(),void 0===t)return;let a=performance.now();L("/v3/universe/types/"+t).done(function(){let e=H("/v3/universe/types/"+t).market_group_id;L("/v1/markets/groups/"+e).done(function(){if(!(a>_))return;_=a;let t=H("/v1/markets/groups/"+e),i=n(".eveui_itemselect datalist");$(t.types.join(":")).done(function(){t.types.sort(function(e,t){return H("/v3/universe/types/"+e).name.localeCompare(H("/v3/universe/types/"+t).name)});for(let e of t.types)i.append(`<option label="${H("/v3/universe/types/"+e).name}">(${e})</option>`)})})})}),n(document).on("input",".eveui_itemselect input",function(e){let t=n(this).closest(".eveui_itemselect"),i=n(this).val();if("("===i.slice(0,1)&&")"===i.slice(-1)){i=i.slice(1,-1);let e=n(this).closest("[data-eveui-itemid]").attr("data-eveui-itemid"),t=n(this).closest("[data-eveui-dna]").attr("data-eveui-dna");if(void 0===e)t=`${t.slice(0,-2)}:${i};1::`;else{let n=new RegExp(`^${e}:`);t=t.replace(n,`${i}:`),n=new RegExp(`:${e};`),t=t.replace(n,`:${i};`)}n(this).closest("[data-eveui-dna]").attr("data-eveui-dna",t),$(t).done(function(){n(`.eveui_window[data-eveui-dna="${t}"]`).find(".eveui_content ").html(m(t)),n(window).trigger("resize")}),n(".eveui_itemselect").remove()}else{if(i.length<3)return;let e=performance.now();z({url:eveui_esi_endpoint("/v1/search/"),cache:!0,data:{search:n(this).val(),categories:"inventorytype"}}).done(function(i){void 0!==i.inventorytype&&z({url:eveui_esi_endpoint("/v1/universe/names/"),cache:!0,method:"POST",contentType:"application/json",data:JSON.stringify({ids:i.inventorytype.slice(0,50)})}).done(function(i){if(!(e>_))return;_=e;let n=t.find("datalist");i.sort(function(e,t){return e.name.localeCompare(t.name)}),n.empty();for(let e in i)n.append(`<option label="${i[e].name}">(${i[e].id})</option>`)})})}}),n(document).on("click",function(e){n(e.target).closest(".eveui_itemselect,.eveui_more_icon").length>0||n(".eveui_itemselect").remove()}),n(document).on("click",".eveui_copy_icon",function(e){!function(e){n(".nocopy").hide(),n(".copyonly").show();let t=window.getSelection(),i=document.createRange();e.find(".eveui_startcopy").length?(i.setStart(e.find(".eveui_startcopy")[0],0),i.setEnd(e.find(".eveui_endcopy")[0],0)):i.selectNodeContents(e[0]);t.removeAllRanges(),t.addRange(i),document.execCommand("copy"),t.removeAllRanges(),n(".nocopy").show(),n(".copyonly").hide()}(n(this).closest(".eveui_content"))}),n(document).on("mousedown",".eveui_window",function(e){n(this).css("z-index",u++)}),n(document).on("mousedown",".eveui_title",function(e){e.preventDefault(),s=n(this).parent(),r=a-s.position().left,c=o-s.position().top,s.css("z-index",u++)}),n(document).on("mousemove",function(e){a=e.clientX,o=e.clientY,null!==s&&(s.css("left",a-r),s.css("top",o-c))}),n(document).on("mouseup",function(e){s=null}),n(window).on("resize",function(e){if(n(".eveui_window").each(function(){let e=n(this),t=e.find(".eveui_content");t.height()>window.innerHeight-50?e.css("height",window.innerHeight-50):e.css("height",""),t.width()>window.innerWidth-40?e.css("width",window.innerWidth-40):e.css("width",""),e[0].getBoundingClientRect().bottom>window.innerHeight&&e.css("top",window.innerHeight-e.height()-25),e[0].getBoundingClientRect().right>window.innerWidth&&e.css("left",window.innerWidth-e.width()-10)}),"modal"===eveui_mode){let e=n("[data-eveui-modal]");e.css("top",window.innerHeight/2-e.height()/2),e.css("left",window.innerWidth/2-e.width()/2)}}),function t(){z({url:eveui_esi_endpoint("/v1/status/"),dataType:"json",cache:!0}).done(function(t){if(i=t.server_version,indexedDB){let t=indexedDB.open("eveui",i);t.onupgradeneeded=function(e){let i=t.result;i.objectStoreNames.contains("cache")&&i.deleteObjectStore("cache"),i.createObjectStore("cache",{keyPath:"path"})},t.onsuccess=function(){(l=t.result).transaction("cache","readonly").objectStore("cache").getAll().onsuccess=function(t){n.each(t.target.result,function(t,i){e.cache[i.path]=i}),n(document).ready(g)}}}else n(document).ready(g);setInterval(D,100)}).fail(function(e){setTimeout(t,1e4)})}(),e.format_fit=m,e.fit_window=w,e.format_item=y,e.item_window=M,e.format_char=N,e.char_window=b,e.format_corp=T,e.corp_window=I,e.format_fitstats=x,e.expand=C}(eveui||(eveui={}));