- JS/CSS files for next release
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
[PATHFINDER]
|
||||
NAME = Pathfinder
|
||||
; installed version (used for CSS/JS cache busting)
|
||||
VERSION = v1.2.4
|
||||
VERSION = v1.2.5
|
||||
; contact information [optional]
|
||||
CONTACT = https://github.com/exodus4d
|
||||
; public contact email [optional]
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
||||
var mainScriptPath=document.body.getAttribute("data-script"),jsBaseUrl=document.body.getAttribute("data-js-path");requirejs.config({baseUrl:"js",paths:{layout:"layout",config:"app/config",dialog:"app/ui/dialog",templates:"../../templates",img:"../../img",login:"./app/login",mappage:"./app/mappage",setup:"./app/setup",admin:"./app/admin",notification:"./app/notification",jquery:"lib/jquery-3.1.1.min",bootstrap:"lib/bootstrap.min",text:"lib/requirejs/text",mustache:"lib/mustache.min",localForage:"lib/localforage.min",velocity:"lib/velocity.min",velocityUI:"lib/velocity.ui.min",slidebars:"lib/slidebars",jsPlumb:"lib/dom.jsPlumb-1.7.6",farahey:"lib/farahey-0.5",customScrollbar:"lib/jquery.mCustomScrollbar.min",mousewheel:"lib/jquery.mousewheel.min",xEditable:"lib/bootstrap-editable.min",morris:"lib/morris.min",raphael:"lib/raphael-min",bootbox:"lib/bootbox.min",easyPieChart:"lib/jquery.easypiechart.min",peityInlineChart:"lib/jquery.peity.min",dragToSelect:"lib/jquery.dragToSelect",hoverIntent:"lib/jquery.hoverIntent.minified",fullScreen:"lib/jquery.fullscreen.min",select2:"lib/select2.min",validator:"lib/validator.min",lazylinepainter:"lib/jquery.lazylinepainter-1.5.1.min",blueImpGallery:"lib/blueimp-gallery",blueImpGalleryHelper:"lib/blueimp-helper",blueImpGalleryBootstrap:"lib/bootstrap-image-gallery",bootstrapConfirmation:"lib/bootstrap-confirmation",bootstrapToggle:"lib/bootstrap2-toggle.min",lazyload:"lib/jquery.lazyload.min",easePack:"lib/EasePack.min",tweenLite:"lib/TweenLite.min","datatables.net":"lib/datatables/DataTables-1.10.12/js/jquery.dataTables.min","datatables.net-buttons":"lib/datatables/Buttons-1.2.1/js/dataTables.buttons.min","datatables.net-buttons-html":"lib/datatables/Buttons-1.2.1/js/buttons.html5.min","datatables.net-responsive":"lib/datatables/Responsive-2.1.0/js/dataTables.responsive.min","datatables.net-select":"lib/datatables/Select-1.2.0/js/dataTables.select.min",pnotify:"lib/pnotify/pnotify","pnotify.buttons":"lib/pnotify/pnotify.buttons","pnotify.confirm":"lib/pnotify/pnotify.confirm","pnotify.nonblock":"lib/pnotify/pnotify.nonblock","pnotify.desktop":"lib/pnotify/pnotify.desktop","pnotify.history":"lib/pnotify/pnotify.history","pnotify.callbacks":"lib/pnotify/pnotify.callbacks","pnotify.reference":"lib/pnotify/pnotify.reference"},shim:{bootstrap:{deps:["jquery"]},farahey:{deps:["jsPlumb"]},velocity:{deps:["jquery"]},velocityUI:{deps:["velocity"]},slidebars:{deps:["jquery"]},customScrollbar:{deps:["jquery","mousewheel"]},"datatables.net":{deps:["jquery"]},"datatables.net-buttons":{deps:["datatables.net"]},"datatables.net-buttons-html":{deps:["datatables.net-buttons"]},"datatables.net-responsive":{deps:["datatables.net"]},"datatables.net-select":{deps:["datatables.net"]},xEditable:{deps:["bootstrap"]},bootbox:{deps:["jquery","bootstrap"],exports:"bootbox"},morris:{deps:["jquery","raphael"],exports:"Morris"},pnotify:{deps:["jquery"]},easyPieChart:{deps:["jquery"]},peityInlineChart:{deps:["jquery"]},dragToSelect:{deps:["jquery"]},hoverIntent:{deps:["jquery"]},fullScreen:{deps:["jquery"]},select2:{deps:["jquery"],exports:"Select2"},validator:{deps:["jquery","bootstrap"]},lazylinepainter:{deps:["jquery","bootstrap"]},blueImpGallery:{deps:["jquery"]},bootstrapConfirmation:{deps:["bootstrap"]},bootstrapToggle:{deps:["jquery"]},lazyload:{deps:["jquery"]}}}),require.config({baseUrl:jsBaseUrl}),requirejs([mainScriptPath]);
|
||||
//# sourceMappingURL=app.js.map
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["app.js"],"names":["mainScriptPath","document","body","getAttribute","jsBaseUrl","requirejs","config","baseUrl","paths","layout","dialog","templates","img","login","mappage","setup","admin","notification","jquery","bootstrap","text","mustache","localForage","velocity","velocityUI","slidebars","jsPlumb","farahey","customScrollbar","mousewheel","xEditable","morris","raphael","bootbox","easyPieChart","peityInlineChart","dragToSelect","hoverIntent","fullScreen","select2","validator","lazylinepainter","blueImpGallery","blueImpGalleryHelper","blueImpGalleryBootstrap","bootstrapConfirmation","bootstrapToggle","lazyload","easePack","tweenLite","datatables.net","datatables.net-buttons","datatables.net-buttons-html","datatables.net-responsive","datatables.net-select","pnotify","pnotify.buttons","pnotify.confirm","pnotify.nonblock","pnotify.desktop","pnotify.history","pnotify.callbacks","pnotify.reference","shim","deps","exports","require"],"mappings":"AACA,IAAIA,eAAiBC,SAASC,KAAKC,aAAa,eAI5CC,UAAYH,SAASC,KAAKC,aAAa,gBAG3CE,UAAUC,QACNC,QAAS,KAETC,OACIC,OAAQ,SACRH,OAAQ,aACRI,OAAQ,gBACRC,UAAW,kBACXC,IAAK,YAGLC,MAAO,cACPC,QAAS,gBACTC,MAAO,cACPC,MAAO,cACPC,aAAc,qBAEdC,OAAQ,uBACRC,UAAW,oBACXC,KAAM,qBACNC,SAAU,mBACVC,YAAa,sBACbC,SAAU,mBACVC,WAAY,sBACZC,UAAW,gBACXC,QAAS,wBACTC,QAAS,kBACTC,gBAAiB,kCACjBC,WAAY,4BACZC,UAAW,6BACXC,OAAQ,iBACRC,QAAS,kBACTC,QAAS,kBACTC,aAAc,8BACdC,iBAAkB,uBAClBC,aAAc,0BACdC,YAAa,kCACbC,WAAY,4BACZC,QAAS,kBACTC,UAAW,oBACXC,gBAAiB,uCACjBC,eAAgB,sBAChBC,qBAAsB,qBACtBC,wBAAyB,8BACzBC,sBAAuB,6BACvBC,gBAAiB,4BACjBC,SAAU,0BAGVC,SAAU,mBACVC,UAAW,oBAGXC,iBAAkB,6DAClBC,yBAA0B,yDAC1BC,8BAA+B,oDAC/BC,4BAA6B,+DAC7BC,wBAAyB,uDAGzBC,QAAS,sBACTC,kBAAmB,8BACnBC,kBAAmB,8BACnBC,mBAAoB,+BACpBC,kBAAmB,8BACnBC,kBAAmB,8BACnBC,oBAAqB,gCACrBC,oBAAqB,iCAEzBC,MACI5C,WACI6C,MAAO,WAEXrC,SACIqC,MAAO,YAEXzC,UACIyC,MAAO,WAEXxC,YACIwC,MAAO,aAEXvC,WACIuC,MAAO,WAEXpC,iBACIoC,MAAO,SAAU,eAErBd,kBACIc,MAAO,WAEXb,0BACIa,MAAO,mBAEXZ,+BACIY,MAAO,2BAEXX,6BACIW,MAAO,mBAEXV,yBACIU,MAAO,mBAEXlC,WACIkC,MAAO,cAEX/B,SACI+B,MAAO,SAAU,aACjBC,QAAS,WAEblC,QACIiC,MAAO,SAAU,WACjBC,QAAS,UAEbV,SACIS,MAAQ,WAEZ9B,cACI8B,MAAQ,WAEZ7B,kBACI6B,MAAQ,WAEZ5B,cACI4B,MAAQ,WAEZ3B,aACI2B,MAAQ,WAEZ1B,YACI0B,MAAQ,WAEZzB,SACIyB,MAAQ,UACRC,QAAS,WAEbzB,WACIwB,MAAQ,SAAU,cAEtBvB,iBACIuB,MAAQ,SAAU,cAEtBtB,gBACIsB,MAAQ,WAEZnB,uBACImB,MAAQ,cAEZlB,iBACIkB,MAAQ,WAEZjB,UACIiB,MAAQ,cAQpBE,QAAQ5D,QACJC,QAASH,YAIbC,WAAYL","file":"app.js","sourceRoot":"/js"}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
||||
"use strict";let window={};self.importScripts(self.name);let MsgWorker=window.MsgWorker,socket=null,ports=[],characterPorts=[],initSocket=e=>{let t=new MsgWorker("ws:open");null===socket?((socket=new WebSocket(e)).onopen=(e=>{t.meta({readyState:socket.readyState}),sendToCurrentPort(t)}),socket.onmessage=(e=>{let t=JSON.parse(e.data),r=new MsgWorker("ws:send");r.task(t.task),r.meta({readyState:this.readyState,characterIds:t.characterIds}),r.data(t.load),broadcastPorts(r)}),socket.onclose=(e=>{let t=new MsgWorker("ws:closed");t.meta({readyState:socket.readyState,code:e.code,reason:e.reason,wasClean:e.wasClean}),broadcastPorts(t),socket=null}),socket.onerror=(e=>{let t=new MsgWorker("ws:error");t.meta({readyState:socket.readyState}),sendToCurrentPort(t)})):(t.meta({readyState:socket.readyState}),sendToCurrentPort(t))},sendToCurrentPort=e=>{ports[ports.length-1].postMessage(e)},broadcastPorts=e=>{let t=ports,r=e.meta();r&&r.characterIds&&"undefined"!==r.characterIds&&r.characterIds instanceof Array&&(t=getPortsByCharacterIds(r.characterIds));for(let r=0;r<t.length;r++)t[r].postMessage(e)},addPort=(e,t)=>{(t=parseInt(t))>0?characterPorts.push({characterId:t,port:e}):ports.push(e)},getPortsByCharacterIds=e=>{let t=[];for(let r=0;r<characterPorts.length;r++)for(let a=0;a<e.length;a++)characterPorts[r].characterId===e[a]&&t.push(characterPorts[r].port);return t};self.addEventListener("connect",e=>{let t=e.ports[0];addPort(t),t.addEventListener("message",e=>{let r=e.data;switch(Object.setPrototypeOf(r,MsgWorker.prototype),r.command){case"ws:init":let e=r.data();addPort(t,e.characterId),initSocket(e.uri);break;case"ws:send":let a={task:r.task(),load:r.data()};socket.send(JSON.stringify(a))}},!1),t.start()},!1);
|
||||
//# sourceMappingURL=map.js.map
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["app/worker/map.js"],"names":["window","self","importScripts","name","MsgWorker","socket","ports","characterPorts","initSocket","uri","MsgWorkerOpen","WebSocket","onopen","e","meta","readyState","sendToCurrentPort","onmessage","response","JSON","parse","data","MsgWorkerSend","task","this","characterIds","load","broadcastPorts","onclose","closeEvent","MsgWorkerClosed","code","reason","wasClean","onerror","MsgWorkerError","length","postMessage","sentToPorts","Array","getPortsByCharacterIds","i","addPort","port","characterId","parseInt","push","j","addEventListener","event","MsgWorkerMessage","Object","setPrototypeOf","prototype","command","MsgSocket","send","stringify","start"],"mappings":"AAAA,aAGA,IAAIA,UAGJC,KAAKC,cAAeD,KAAKE,MAEzB,IAAIC,UAAYJ,OAAOI,UACnBC,OAAS,KACTC,SACAC,kBAGAC,WAAcC,IACd,IAAIC,EAAgB,IAAIN,UAAU,WAEpB,OAAXC,SACCA,OAAS,IAAIM,UAAUF,IAGhBG,OAAS,CAACC,IACbH,EAAcI,MACVC,WAAYV,OAAOU,aAGvBC,kBAAkBN,KAItBL,OAAOY,UAAY,CAACJ,IAChB,IAAIK,EAAWC,KAAKC,MAAMP,EAAEQ,MAExBC,EAAgB,IAAIlB,UAAU,WAClCkB,EAAcC,KAAML,EAASK,MAC7BD,EAAcR,MACVC,WAAYS,KAAKT,WACjBU,aAAcP,EAASO,eAE3BH,EAAcD,KAAMH,EAASQ,MAE7BC,eAAeL,KAInBjB,OAAOuB,QAAU,CAACC,IACd,IAAIC,EAAkB,IAAI1B,UAAU,aACpC0B,EAAgBhB,MACZC,WAAYV,OAAOU,WACnBgB,KAAMF,EAAWE,KACjBC,OAAQH,EAAWG,OACnBC,SAAUJ,EAAWI,WAGzBN,eAAeG,GACfzB,OAAS,OAIbA,OAAO6B,QAAU,CAACrB,IACd,IAAIsB,EAAiB,IAAI/B,UAAU,YACnC+B,EAAerB,MACXC,WAAYV,OAAOU,aAGvBC,kBAAkBmB,OAItBzB,EAAcI,MACVC,WAAYV,OAAOU,aAEvBC,kBAAkBN,KAKtBM,kBAAqBU,IACrBpB,MAAMA,MAAM8B,OAAS,GAAGC,YAAYX,IAGpCC,eAAkBD,IAElB,IAAIY,EAAchC,MAGdQ,EAAOY,EAAKZ,OAEZA,GACAA,EAAKW,cACiB,cAAtBX,EAAKW,cACLX,EAAKW,wBAAwBc,QAG7BD,EAAcE,uBAAuB1B,EAAKW,eAG9C,IAAK,IAAIgB,EAAI,EAAGA,EAAIH,EAAYF,OAAQK,IACpCH,EAAYG,GAAGJ,YAAYX,IAK/BgB,QAAU,CAACC,EAAMC,MACjBA,EAAcC,SAASD,IAEN,EACbrC,eAAeuC,MACXF,YAAaA,EACbD,KAAMA,IAGVrC,MAAMwC,KAAKH,IAIfH,uBAA0Bf,IAC1B,IAAInB,KAEJ,IAAI,IAAImC,EAAI,EAAGA,EAAIlC,eAAe6B,OAAQK,IACtC,IAAI,IAAIM,EAAI,EAAGA,EAAItB,EAAaW,OAAQW,IACjCxC,eAAekC,GAAGG,cAAgBnB,EAAasB,IAC9CzC,EAAMwC,KAAKvC,eAAekC,GAAGE,MAKzC,OAAOrC,GAIXL,KAAK+C,iBAAiB,UAAYC,IAC9B,IAAIN,EAAOM,EAAM3C,MAAM,GACvBoC,QAAQC,GAERA,EAAKK,iBAAiB,UAAYnC,IAC9B,IAAIqC,EAAmBrC,EAAEQ,KAGzB,OAFA8B,OAAOC,eAAeF,EAAkB9C,UAAUiD,WAE3CH,EAAiBI,SACpB,IAAK,UACD,IAAIjC,EAAO6B,EAAiB7B,OAE5BqB,QAAQC,EAAMtB,EAAKuB,aACnBpC,WAAWa,EAAKZ,KAChB,MACJ,IAAK,UACD,IAAI8C,GACAhC,KAAM2B,EAAiB3B,OACvBG,KAAMwB,EAAiB7B,QAG3BhB,OAAOmD,KAAKrC,KAAKsC,UAAUF,OAMpC,GAEHZ,EAAKe,UACN","file":"map.js","sourceRoot":"/js"}
|
||||
@@ -1,2 +0,0 @@
|
||||
window.MsgWorker=class{constructor(s){this.cmd=s,this.msgTask="",this.msgMeta=null,this.msgBody=null}get command(){return this.cmd}task(s){return s&&(this.msgTask=s),this.msgTask}meta(s){return s&&(this.msgMeta=s),this.msgMeta}data(s){return s&&(this.msgBody=s),this.msgBody}};
|
||||
//# sourceMappingURL=message.js.map
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["app/worker/message.js"],"names":["window","MsgWorker","[object Object]","cmd","this","msgTask","msgMeta","msgBody","command","task","metaData","data"],"mappings":"AAAAA,OAAOC,gBAEHC,YAAYC,GAIRC,KAAKD,IAAMA,EAMXC,KAAKC,QAAU,GAMfD,KAAKE,QAAU,KAMfF,KAAKG,QAAU,KAGnBC,cACI,OAAOJ,KAAKD,IAGhBD,KAAKO,GAKD,OAJGA,IACCL,KAAKC,QAAUI,GAGZL,KAAKC,QAGhBH,KAAKQ,GAKD,OAJGA,IACCN,KAAKE,QAAUI,GAGZN,KAAKE,QAGhBJ,KAAKS,GAKD,OAJGA,IACCP,KAAKG,QAAUI,GAGZP,KAAKG","file":"message.js","sourceRoot":"/js"}
|
||||
@@ -1,2 +0,0 @@
|
||||
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","blueImpGallery"],t):t(window.jQuery,window.blueimp.Gallery)}(function(t,o){"use strict";t.extend(o.prototype.options,{useBootstrapModal:!0});var e=o.prototype.close,n=o.prototype.imageFactory,i=o.prototype.videoFactory,r=o.prototype.textFactory;t.extend(o.prototype,{modalFactory:function(o,e,n,i){if(!this.options.useBootstrapModal||n)return i.call(this,o,e,n);var r=this,a=t(this.container).children(".modal").clone().css("display","block").on("click",function(t){t.target!==a[0]&&t.target!==a.children()[0]||(t.preventDefault(),t.stopPropagation(),r.close())}),c=i.call(this,o,function(t){e({type:t.type,target:a[0]}),a.addClass("in")},n);return a.find(".modal-title").text(c.title||String.fromCharCode(160)),a.find(".modal-body").append(c),a[0]},imageFactory:function(t,o,e){return this.modalFactory(t,o,e,n)},videoFactory:function(t,o,e){return this.modalFactory(t,o,e,i)},textFactory:function(t,o,e){return this.modalFactory(t,o,e,r)},close:function(){this.container.find(".modal").removeClass("in"),e.call(this)}})});
|
||||
//# sourceMappingURL=bootstrap-image-gallery.js.map
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["lib/bootstrap-image-gallery.js"],"names":["factory","define","amd","window","jQuery","blueimp","Gallery","$","extend","prototype","options","useBootstrapModal","close","imageFactory","videoFactory","textFactory","modalFactory","obj","callback","factoryInterface","this","call","that","modal","container","children","clone","css","on","event","target","preventDefault","stopPropagation","element","type","addClass","find","text","title","String","fromCharCode","append","removeClass"],"mappings":"CAaE,SAAUA,GACR,aACsB,mBAAXC,QAAyBA,OAAOC,IACvCD,QACI,SACA,kBACDD,GAEHA,EACIG,OAAOC,OACPD,OAAOE,QAAQC,UAGzB,SAAUC,EAAGD,GACX,aAEAC,EAAEC,OAAOF,EAAQG,UAAUC,SACvBC,mBAAmB,IAGvB,IAAIC,EAAQN,EAAQG,UAAUG,MAC1BC,EAAeP,EAAQG,UAAUI,aACjCC,EAAeR,EAAQG,UAAUK,aACjCC,EAAcT,EAAQG,UAAUM,YAEpCR,EAAEC,OAAOF,EAAQG,WACbO,aAAc,SAAUC,EAAKC,EAAUC,EAAkBnB,GACrD,IAAKoB,KAAKV,QAAQC,mBAAqBQ,EACnC,OAAOnB,EAAQqB,KAAKD,KAAMH,EAAKC,EAAUC,GAE7C,IAAIG,EAAOF,KAEPG,EADgBhB,EAAEa,KAAKI,WAAWC,SAAS,UACrBC,QAAQC,IAAI,UAAW,SAASC,GAAG,QAAS,SAAUC,GAGxEA,EAAMC,SAAWP,EAAM,IACvBM,EAAMC,SAAWP,EAAME,WAAW,KAClCI,EAAME,iBACNF,EAAMG,kBACNV,EAAKV,WAGTqB,EAAUjC,EAAQqB,KAAKD,KAAMH,EAAK,SAAUY,GAC5CX,GACIgB,KAAML,EAAMK,KACZJ,OAAQP,EAAM,KAElBA,EAAMY,SAAS,OAChBhB,GAIH,OAHAI,EAAMa,KAAK,gBAAgBC,KAAKJ,EAAQK,OAASC,OAAOC,aAAa,MACrEjB,EAAMa,KAAK,eAAeK,OAAOR,GAE1BV,EAAM,IAGjBV,aAAc,SAAUI,EAAKC,EAAUC,GACnC,OAAOC,KAAKJ,aAAaC,EAAKC,EAAUC,EAAkBN,IAG9DC,aAAc,SAAUG,EAAKC,EAAUC,GACnC,OAAOC,KAAKJ,aAAaC,EAAKC,EAAUC,EAAkBL,IAG9DC,YAAa,SAAUE,EAAKC,EAAUC,GAClC,OAAOC,KAAKJ,aAAaC,EAAKC,EAAUC,EAAkBJ,IAG9DH,MAAO,WACHQ,KAAKI,UAAUY,KAAK,UAAUM,YAAY,MAC1C9B,EAAMS,KAAKD","file":"bootstrap-image-gallery.js","sourceRoot":"/js"}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
2
public/js/v1.2.4/lib/jquery.peity.min.js
vendored
2
public/js/v1.2.4/lib/jquery.peity.min.js
vendored
@@ -1,2 +0,0 @@
|
||||
!function(t,i,e,n){var r=t.fn.peity=function(i,e){return l&&this.each(function(){var n=t(this),h=n.data("_peity");h?(i&&(h.type=i),t.extend(h.opts,e)):(h=new a(n,i,t.extend({},r.defaults[i],n.data("peity"),e)),n.change(function(){h.draw()}).data("_peity",h)),h.draw()}),this},a=function(t,i,e){this.$el=t,this.type=i,this.opts=e},h=a.prototype,s=h.svgElement=function(e,n){return t(i.createElementNS("http://www.w3.org/2000/svg",e)).attr(n)},l="createElementNS"in i&&s("svg",{})[0].createSVGRect;h.draw=function(){var t=this.opts;r.graphers[this.type].call(this,t),t.after&&t.after.call(this,t)},h.fill=function(){var i=this.opts.fill;return t.isFunction(i)?i:function(t,e){return i[e%i.length]}},h.prepare=function(t,i){return this.$svg||this.$el.hide().after(this.$svg=s("svg",{class:"peity"})),this.$svg.empty().data("peity",this).attr({height:i,width:t})},h.values=function(){return t.map(this.$el.text().split(this.opts.delimiter),function(t){return parseFloat(t)})},r.defaults={},r.graphers={},r.register=function(t,i,e){this.defaults[t]=i,this.graphers[t]=e},r.register("pie",{fill:["#ff9900","#fff4dd","#ffc66e"],radius:8},function(i){if(!i.delimiter){r=this.$el.text().match(/[^0-9\.]/);i.delimiter=r?r[0]:","}if(r=t.map(this.values(),function(t){return 0<t?t:0}),"/"==i.delimiter)var n=r[0],r=[n,e.max(0,r[1]-n)];for(var a=0,n=r.length,h=0;a<n;a++)h+=r[a];h||(n=2,h=1,r=[0,1]);var l=2*i.radius,p=(a=(l=this.prepare(i.width||l,i.height||l)).width())/2,o=(f=l.height())/2,f=e.min(p,o),i=i.innerRadius;"donut"==this.type&&!i&&(i=.5*f);for(var c=e.PI,u=this.fill(),d=this.scale=function(t,i){var n=t/h*c*2-c/2;return[i*e.cos(n)+p,i*e.sin(n)+o]},g=0,a=0;a<n;a++){var m=r[a];if(0!=(v=m/h)){if(1==v)if(i)var v=p-.01,y=o-f,w=o-i,v=s("path",{d:["M",p,y,"A",f,f,0,1,1,v,y,"L",v,w,"A",i,i,0,1,0,p,w].join(" ")});else v=s("circle",{cx:p,cy:o,r:f});else y=g+m,w=["M"].concat(d(g,f),"A",f,f,0,.5<v?1:0,1,d(y,f),"L"),i?w=w.concat(d(y,i),"A",i,i,0,.5<v?1:0,0,d(g,i)):w.push(p,o),g+=m,v=s("path",{d:w.join(" ")});v.attr("fill",u.call(this,m,a,r)),l.append(v)}}}),r.register("donut",t.extend(!0,{},r.defaults.pie),function(t){r.graphers.pie.call(this,t)}),r.register("line",{delimiter:",",fill:"#c6d9fd",height:16,min:0,stroke:"#4d89f9",strokeWidth:1,width:32},function(t){var i=this.values();1==i.length&&i.push(i[0]);for(var r=e.max.apply(e,t.max==n?i:i.concat(t.max)),a=e.min.apply(e,t.min==n?i:i.concat(t.min)),h=this.prepare(t.width,t.height),l=t.strokeWidth,p=h.width(),o=h.height()-l,f=r-a,r=this.x=function(t){return t*(p/(i.length-1))},c=this.y=function(t){var i=o;return f&&(i-=(t-a)/f*o),i+l/2},u=c(e.max(a,0)),d=[0,u],g=0;g<i.length;g++)d.push(r(g),c(i[g]));d.push(p,u),t.fill&&h.append(s("polygon",{fill:t.fill,points:d.join(" ")})),l&&h.append(s("polyline",{fill:"none",points:d.slice(2,d.length-2).join(" "),stroke:t.stroke,"stroke-width":l,"stroke-linecap":"square"}))}),r.register("bar",{delimiter:",",fill:["#4D89F9"],height:16,min:0,padding:.1,width:32},function(t){for(var i=this.values(),r=e.max.apply(e,t.max==n?i:i.concat(t.max)),a=e.min.apply(e,t.min==n?i:i.concat(t.min)),h=this.prepare(t.width,t.height),l=h.width(),p=h.height(),o=r-a,t=t.padding,f=this.fill(),c=this.x=function(t){return t*l/i.length},u=this.y=function(t){return p-(o?(t-a)/o*p:1)},d=0;d<i.length;d++){var g,m=c(d+t),v=c(d+1-t)-m,y=i[d],w=u(y),x=w;o?0>y?x=u(e.min(r,0)):w=u(e.max(a,0)):g=1,0==(g=w-x)&&(g=1,0<r&&o&&x--),h.append(s("rect",{fill:f.call(this,y,d,i),x:m,y:x,width:v,height:g}))}})}(jQuery,document,Math);
|
||||
//# sourceMappingURL=jquery.peity.min.js.map
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
||||
!function(o,i){"function"==typeof define&&define.amd?define("pnotify.buttons",["jquery","pnotify"],i):"object"==typeof exports&&"undefined"!=typeof module?module.exports=i(require("jquery"),require("./pnotify")):i(o.jQuery,o.PNotify)}(this,function(o,i){i.prototype.options.buttons={closer:!0,closer_hover:!0,sticker:!0,sticker_hover:!0,show_on_nonblock:!1,labels:{close:"Close",stick:"Stick",unstick:"Unstick"},classes:{closer:null,pin_up:null,pin_down:null}},i.prototype.modules.buttons={closer:null,sticker:null,init:function(i,s){var n=this;i.elem.on({mouseenter:function(o){!n.options.sticker||i.options.nonblock&&i.options.nonblock.nonblock&&!n.options.show_on_nonblock||n.sticker.trigger("pnotify:buttons:toggleStick").css("visibility","visible"),!n.options.closer||i.options.nonblock&&i.options.nonblock.nonblock&&!n.options.show_on_nonblock||n.closer.css("visibility","visible")},mouseleave:function(o){n.options.sticker_hover&&n.sticker.css("visibility","hidden"),n.options.closer_hover&&n.closer.css("visibility","hidden")}}),this.sticker=o("<div />",{class:"ui-pnotify-sticker","aria-role":"button","aria-pressed":i.options.hide?"false":"true",tabindex:"0",title:i.options.hide?s.labels.stick:s.labels.unstick,css:{cursor:"pointer",visibility:s.sticker_hover?"hidden":"visible"},click:function(){i.options.hide=!i.options.hide,i.options.hide?i.queueRemove():i.cancelRemove(),o(this).trigger("pnotify:buttons:toggleStick")}}).bind("pnotify:buttons:toggleStick",function(){var s=null===n.options.classes.pin_up?i.styles.pin_up:n.options.classes.pin_up,e=null===n.options.classes.pin_down?i.styles.pin_down:n.options.classes.pin_down;o(this).attr("title",i.options.hide?n.options.labels.stick:n.options.labels.unstick).children().attr("class","").addClass(i.options.hide?s:e).attr("aria-pressed",i.options.hide?"false":"true")}).append("<span />").trigger("pnotify:buttons:toggleStick").prependTo(i.container),(!s.sticker||i.options.nonblock&&i.options.nonblock.nonblock&&!s.show_on_nonblock)&&this.sticker.css("display","none"),this.closer=o("<div />",{class:"ui-pnotify-closer","aria-role":"button",tabindex:"0",title:s.labels.close,css:{cursor:"pointer",visibility:s.closer_hover?"hidden":"visible"},click:function(){i.remove(!1),n.sticker.css("visibility","hidden"),n.closer.css("visibility","hidden")}}).append(o("<span />",{class:null===s.classes.closer?i.styles.closer:s.classes.closer})).prependTo(i.container),(!s.closer||i.options.nonblock&&i.options.nonblock.nonblock&&!s.show_on_nonblock)&&this.closer.css("display","none")},update:function(o,i){!i.closer||o.options.nonblock&&o.options.nonblock.nonblock&&!i.show_on_nonblock?this.closer.css("display","none"):i.closer&&this.closer.css("display","block"),!i.sticker||o.options.nonblock&&o.options.nonblock.nonblock&&!i.show_on_nonblock?this.sticker.css("display","none"):i.sticker&&this.sticker.css("display","block"),this.sticker.trigger("pnotify:buttons:toggleStick"),this.closer.find("span").attr("class","").addClass(null===i.classes.closer?o.styles.closer:i.classes.closer),i.sticker_hover?this.sticker.css("visibility","hidden"):o.options.nonblock&&o.options.nonblock.nonblock&&!i.show_on_nonblock||this.sticker.css("visibility","visible"),i.closer_hover?this.closer.css("visibility","hidden"):o.options.nonblock&&o.options.nonblock.nonblock&&!i.show_on_nonblock||this.closer.css("visibility","visible")}},o.extend(i.styling.brighttheme,{closer:"brighttheme-icon-closer",pin_up:"brighttheme-icon-sticker",pin_down:"brighttheme-icon-sticker brighttheme-icon-stuck"}),o.extend(i.styling.jqueryui,{closer:"ui-icon ui-icon-close",pin_up:"ui-icon ui-icon-pin-w",pin_down:"ui-icon ui-icon-pin-s"}),o.extend(i.styling.bootstrap2,{closer:"icon-remove",pin_up:"icon-pause",pin_down:"icon-play"}),o.extend(i.styling.bootstrap3,{closer:"glyphicon glyphicon-remove",pin_up:"glyphicon glyphicon-pause",pin_down:"glyphicon glyphicon-play"}),o.extend(i.styling.fontawesome,{closer:"fa fa-times",pin_up:"fa fa-pause",pin_down:"fa fa-play"})});
|
||||
//# sourceMappingURL=pnotify.buttons.js.map
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["lib/pnotify/pnotify.buttons.js"],"names":["root","factory","define","amd","exports","module","require","jQuery","PNotify","this","$","prototype","options","buttons","closer","closer_hover","sticker","sticker_hover","show_on_nonblock","labels","close","stick","unstick","classes","pin_up","pin_down","modules","init","notice","that","elem","on","mouseenter","e","nonblock","trigger","css","mouseleave","class","aria-role","aria-pressed","hide","tabindex","title","cursor","visibility","click","queueRemove","cancelRemove","bind","styles","attr","children","addClass","append","prependTo","container","remove","update","find","extend","styling","brighttheme","jqueryui","bootstrap2","bootstrap3","fontawesome"],"mappings":"CACC,SAAUA,EAAMC,GACS,mBAAXC,QAAyBA,OAAOC,IAEvCD,OAAO,mBAAoB,SAAU,WAAYD,GACvB,iBAAZG,SAA0C,oBAAXC,OAE7CA,OAAOD,QAAUH,EAAQK,QAAQ,UAAWA,QAAQ,cAGpDL,EAAQD,EAAKO,OAAQP,EAAKQ,UAEhCC,KAAM,SAASC,EAAGF,GAChBA,EAAQG,UAAUC,QAAQC,SAEtBC,QAAQ,EAERC,cAAc,EAEdC,SAAS,EAETC,eAAe,EAEfC,kBAAkB,EAElBC,QACIC,MAAO,QACPC,MAAO,QACPC,QAAS,WAGbC,SACIT,OAAQ,KACRU,OAAQ,KACRC,SAAU,OAGlBjB,EAAQG,UAAUe,QAAQb,SACtBC,OAAQ,KACRE,QAAS,KAETW,KAAM,SAASC,EAAQhB,GACnB,IAAIiB,EAAOpB,KACXmB,EAAOE,KAAKC,IACRC,WAAc,SAASC,IAEfJ,EAAKjB,QAAQI,SAAcY,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAaL,EAAKjB,QAAQM,kBACxGW,EAAKb,QAAQmB,QAAQ,+BAA+BC,IAAI,aAAc,YAEtEP,EAAKjB,QAAQE,QAAac,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAaL,EAAKjB,QAAQM,kBACvGW,EAAKf,OAAOsB,IAAI,aAAc,YAGtCC,WAAc,SAASJ,GAEfJ,EAAKjB,QAAQK,eACbY,EAAKb,QAAQoB,IAAI,aAAc,UAE/BP,EAAKjB,QAAQG,cACbc,EAAKf,OAAOsB,IAAI,aAAc,aAM1C3B,KAAKO,QAAUN,EAAE,WACb4B,MAAS,qBACTC,YAAa,SACbC,eAAgBZ,EAAOhB,QAAQ6B,KAAO,QAAU,OAChDC,SAAY,IACZC,MAASf,EAAOhB,QAAQ6B,KAAO7B,EAAQO,OAAOE,MAAQT,EAAQO,OAAOG,QACrEc,KACIQ,OAAU,UACVC,WAAcjC,EAAQK,cAAgB,SAAW,WAErD6B,MAAS,WACLlB,EAAOhB,QAAQ6B,MAAQb,EAAOhB,QAAQ6B,KAClCb,EAAOhB,QAAQ6B,KACfb,EAAOmB,cAEPnB,EAAOoB,eAEXtC,EAAED,MAAM0B,QAAQ,kCAGvBc,KAAK,8BAA+B,WACjC,IAAIzB,EAAyC,OAAhCK,EAAKjB,QAAQW,QAAQC,OAAkBI,EAAOsB,OAAO1B,OAASK,EAAKjB,QAAQW,QAAQC,OAC5FC,EAA6C,OAAlCI,EAAKjB,QAAQW,QAAQE,SAAoBG,EAAOsB,OAAOzB,SAAWI,EAAKjB,QAAQW,QAAQE,SACtGf,EAAED,MACD0C,KAAK,QAASvB,EAAOhB,QAAQ6B,KAAOZ,EAAKjB,QAAQO,OAAOE,MAAQQ,EAAKjB,QAAQO,OAAOG,SACpF8B,WACAD,KAAK,QAAS,IACdE,SAASzB,EAAOhB,QAAQ6B,KAAOjB,EAASC,GACxC0B,KAAK,eAAgBvB,EAAOhB,QAAQ6B,KAAO,QAAU,UAEzDa,OAAO,YACPnB,QAAQ,+BACRoB,UAAU3B,EAAO4B,aACb5C,EAAQI,SAAYY,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAatB,EAAQM,mBAC7FT,KAAKO,QAAQoB,IAAI,UAAW,QAIhC3B,KAAKK,OAASJ,EAAE,WACZ4B,MAAS,oBACTC,YAAa,SACbG,SAAY,IACZC,MAAS/B,EAAQO,OAAOC,MACxBgB,KAAQQ,OAAU,UAAWC,WAAcjC,EAAQG,aAAe,SAAW,WAC7E+B,MAAS,WACLlB,EAAO6B,QAAO,GACd5B,EAAKb,QAAQoB,IAAI,aAAc,UAC/BP,EAAKf,OAAOsB,IAAI,aAAc,aAGrCkB,OAAO5C,EAAE,YAAa4B,MAAoC,OAA3B1B,EAAQW,QAAQT,OAAkBc,EAAOsB,OAAOpC,OAASF,EAAQW,QAAQT,UACxGyC,UAAU3B,EAAO4B,aACb5C,EAAQE,QAAWc,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAatB,EAAQM,mBAC5FT,KAAKK,OAAOsB,IAAI,UAAW,SAGnCsB,OAAQ,SAAS9B,EAAQhB,IAEhBA,EAAQE,QAAWc,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAatB,EAAQM,iBAC5FT,KAAKK,OAAOsB,IAAI,UAAW,QACpBxB,EAAQE,QACfL,KAAKK,OAAOsB,IAAI,UAAW,UAE1BxB,EAAQI,SAAYY,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAatB,EAAQM,iBAC7FT,KAAKO,QAAQoB,IAAI,UAAW,QACrBxB,EAAQI,SACfP,KAAKO,QAAQoB,IAAI,UAAW,SAGhC3B,KAAKO,QAAQmB,QAAQ,+BAErB1B,KAAKK,OAAO6C,KAAK,QAAQR,KAAK,QAAS,IAAIE,SAAoC,OAA3BzC,EAAQW,QAAQT,OAAkBc,EAAOsB,OAAOpC,OAASF,EAAQW,QAAQT,QAEzHF,EAAQK,cACRR,KAAKO,QAAQoB,IAAI,aAAc,UACtBR,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAatB,EAAQM,kBACjFT,KAAKO,QAAQoB,IAAI,aAAc,WAE/BxB,EAAQG,aACRN,KAAKK,OAAOsB,IAAI,aAAc,UACrBR,EAAOhB,QAAQsB,UAAYN,EAAOhB,QAAQsB,SAASA,WAAatB,EAAQM,kBACjFT,KAAKK,OAAOsB,IAAI,aAAc,aAI1C1B,EAAEkD,OAAOpD,EAAQqD,QAAQC,aACrBhD,OAAQ,0BACRU,OAAQ,2BACRC,SAAU,oDAEdf,EAAEkD,OAAOpD,EAAQqD,QAAQE,UACrBjD,OAAQ,wBACRU,OAAQ,wBACRC,SAAU,0BAEdf,EAAEkD,OAAOpD,EAAQqD,QAAQG,YACrBlD,OAAQ,cACRU,OAAQ,aACRC,SAAU,cAEdf,EAAEkD,OAAOpD,EAAQqD,QAAQI,YACrBnD,OAAQ,6BACRU,OAAQ,4BACRC,SAAU,6BAEdf,EAAEkD,OAAOpD,EAAQqD,QAAQK,aACrBpD,OAAQ,cACRU,OAAQ,cACRC,SAAU","file":"pnotify.buttons.js","sourceRoot":"/js"}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
174
public/js/v1.2.5/app.js
Normal file
174
public/js/v1.2.5/app.js
Normal file
@@ -0,0 +1,174 @@
|
||||
// main script path
|
||||
var mainScriptPath = document.body.getAttribute('data-script');
|
||||
|
||||
// js baseURL. Depends on the environment.
|
||||
// e.g. use raw files (develop) or build files (production)
|
||||
var jsBaseUrl = document.body.getAttribute('data-js-path');
|
||||
|
||||
// requireJs configuration
|
||||
requirejs.config({
|
||||
baseUrl: 'js', // path for baseUrl - dynamically set !below! ("build_js" | "js")
|
||||
|
||||
paths: {
|
||||
layout: 'layout',
|
||||
config: 'app/config', // path for "configuration" files dir
|
||||
dialog: 'app/ui/dialog', // path for "dialog" files dir
|
||||
templates: '../../templates', // template dir
|
||||
img: '../../img', // images dir
|
||||
|
||||
// main views
|
||||
login: './app/login', // initial start "login page" view
|
||||
mappage: './app/mappage', // initial start "map page" view
|
||||
setup: './app/setup', // initial start "setup page" view
|
||||
admin: './app/admin', // initial start "admin page" view
|
||||
notification: './app/notification', // "notification" view
|
||||
|
||||
jquery: 'lib/jquery-3.1.1.min', // v3.1.1 jQuery
|
||||
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript
|
||||
text: 'lib/requirejs/text', // v2.0.12 A RequireJS/AMD loader plugin for loading text resources.
|
||||
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io
|
||||
localForage: 'lib/localforage.min', // v1.4.2 localStorage library - https://mozilla.github.io/localForage
|
||||
velocity: 'lib/velocity.min', // v1.4.1 animation engine - http://julian.com/research/velocity
|
||||
velocityUI: 'lib/velocity.ui.min', // v5.2.0 plugin for velocity - http://julian.com/research/velocity/#uiPack
|
||||
slidebars: 'lib/slidebars', // v0.10 Slidebars - side menu plugin http://plugins.adchsm.me/slidebars
|
||||
jsPlumb: 'lib/dom.jsPlumb-1.7.6', // v1.7.6 jsPlumb (Vanilla)- main map draw plugin https://jsplumbtoolkit.com
|
||||
farahey: 'lib/farahey-0.5', // v0.5 jsPlumb "magnetizing" extension - https://github.com/jsplumb/farahey
|
||||
customScrollbar: 'lib/jquery.mCustomScrollbar.min', // v3.1.3 Custom scroll bars - http://manos.malihu.gr
|
||||
mousewheel: 'lib/jquery.mousewheel.min', // v3.1.13 Mousewheel - https://github.com/jquery/jquery-mousewheel
|
||||
xEditable: 'lib/bootstrap-editable.min', // v1.5.1 X-editable - in placed editing
|
||||
morris: 'lib/morris.min', // v0.5.1 Morris.js - graphs and charts
|
||||
raphael: 'lib/raphael-min', // v2.1.2 Raphaël - required for morris (dependency)
|
||||
bootbox: 'lib/bootbox.min', // v4.4.0 Bootbox.js - custom dialogs - http://bootboxjs.com
|
||||
easyPieChart: 'lib/jquery.easypiechart.min', // v2.1.6 Easy Pie Chart - HTML 5 pie charts - http://rendro.github.io/easy-pie-chart
|
||||
peityInlineChart: 'lib/jquery.peity.min', // v3.2.0 Inline Chart - http://benpickles.github.io/peity/
|
||||
dragToSelect: 'lib/jquery.dragToSelect', // v1.1 Drag to Select - http://andreaslagerkvist.com/jquery/drag-to-select
|
||||
hoverIntent: 'lib/jquery.hoverIntent.minified', // v1.8.0 Hover intention - http://cherne.net/brian/resources/jquery.hoverIntent.html
|
||||
fullScreen: 'lib/jquery.fullscreen.min', // v0.6.0 Full screen mode - https://github.com/private-face/jquery.fullscreen
|
||||
select2: 'lib/select2.min', // v4.0.3 Drop Down customization - https://select2.github.io
|
||||
validator: 'lib/validator.min', // v0.10.1 Validator for Bootstrap 3 - https://github.com/1000hz/bootstrap-validator
|
||||
lazylinepainter: 'lib/jquery.lazylinepainter-1.5.1.min', // v1.5.1 SVG line animation plugin - http://lazylinepainter.info
|
||||
blueImpGallery: 'lib/blueimp-gallery', // v2.21.3 Image Gallery - https://github.com/blueimp/Gallery
|
||||
blueImpGalleryHelper: 'lib/blueimp-helper', // helper function for Blue Imp Gallery
|
||||
blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.4.2 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery
|
||||
bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.5 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation
|
||||
bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com
|
||||
lazyload: 'lib/jquery.lazyload.min', // v1.9.5 LazyLoader images - http://www.appelsiini.net/projects/lazyload
|
||||
|
||||
// header animation
|
||||
easePack: 'lib/EasePack.min',
|
||||
tweenLite: 'lib/TweenLite.min',
|
||||
|
||||
// datatables // v1.10.12 DataTables - https://datatables.net
|
||||
'datatables.net': 'lib/datatables/DataTables-1.10.12/js/jquery.dataTables.min',
|
||||
'datatables.net-buttons': 'lib/datatables/Buttons-1.2.1/js/dataTables.buttons.min',
|
||||
'datatables.net-buttons-html': 'lib/datatables/Buttons-1.2.1/js/buttons.html5.min',
|
||||
'datatables.net-responsive': 'lib/datatables/Responsive-2.1.0/js/dataTables.responsive.min',
|
||||
'datatables.net-select': 'lib/datatables/Select-1.2.0/js/dataTables.select.min',
|
||||
|
||||
// notification plugin
|
||||
pnotify: 'lib/pnotify/pnotify', // v3.0.0 PNotify - notification core file - https://sciactive.com/pnotify/
|
||||
'pnotify.buttons': 'lib/pnotify/pnotify.buttons', // PNotify - buttons notification extension
|
||||
'pnotify.confirm': 'lib/pnotify/pnotify.confirm', // PNotify - confirmation notification extension
|
||||
'pnotify.nonblock': 'lib/pnotify/pnotify.nonblock', // PNotify - notification non-block extension (hover effect)
|
||||
'pnotify.desktop': 'lib/pnotify/pnotify.desktop', // PNotify - desktop push notification extension
|
||||
'pnotify.history': 'lib/pnotify/pnotify.history', // PNotify - history push notification history extension
|
||||
'pnotify.callbacks': 'lib/pnotify/pnotify.callbacks', // PNotify - callbacks push notification extension
|
||||
'pnotify.reference': 'lib/pnotify/pnotify.reference' // PNotify - reference push notification extension
|
||||
},
|
||||
shim: {
|
||||
bootstrap: {
|
||||
deps: ['jquery']
|
||||
},
|
||||
farahey: {
|
||||
deps: ['jsPlumb']
|
||||
},
|
||||
velocity: {
|
||||
deps: ['jquery']
|
||||
},
|
||||
velocityUI: {
|
||||
deps: ['velocity']
|
||||
},
|
||||
slidebars: {
|
||||
deps: ['jquery']
|
||||
},
|
||||
customScrollbar: {
|
||||
deps: ['jquery', 'mousewheel']
|
||||
},
|
||||
'datatables.net': {
|
||||
deps: ['jquery']
|
||||
},
|
||||
'datatables.net-buttons': {
|
||||
deps: ['datatables.net']
|
||||
},
|
||||
'datatables.net-buttons-html': {
|
||||
deps: ['datatables.net-buttons']
|
||||
},
|
||||
'datatables.net-responsive': {
|
||||
deps: ['datatables.net']
|
||||
},
|
||||
'datatables.net-select': {
|
||||
deps: ['datatables.net']
|
||||
},
|
||||
xEditable: {
|
||||
deps: ['bootstrap']
|
||||
},
|
||||
bootbox: {
|
||||
deps: ['jquery', 'bootstrap'],
|
||||
exports: 'bootbox'
|
||||
},
|
||||
morris: {
|
||||
deps: ['jquery', 'raphael'],
|
||||
exports: 'Morris'
|
||||
},
|
||||
pnotify: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
easyPieChart: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
peityInlineChart: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
dragToSelect: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
hoverIntent: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
fullScreen: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
select2: {
|
||||
deps : ['jquery'],
|
||||
exports: 'Select2'
|
||||
},
|
||||
validator: {
|
||||
deps : ['jquery', 'bootstrap']
|
||||
},
|
||||
lazylinepainter: {
|
||||
deps : ['jquery', 'bootstrap']
|
||||
},
|
||||
blueImpGallery: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
bootstrapConfirmation: {
|
||||
deps : ['bootstrap']
|
||||
},
|
||||
bootstrapToggle: {
|
||||
deps : ['jquery']
|
||||
},
|
||||
lazyload: {
|
||||
deps : ['jquery']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// switch baseUrl to js "build_js" in production environment
|
||||
// this has no effect for js build process!
|
||||
// check build.js for build configuration
|
||||
require.config({
|
||||
baseUrl: jsBaseUrl
|
||||
});
|
||||
|
||||
// load the main app module -> initial app start
|
||||
requirejs( [mainScriptPath] );
|
||||
49
public/js/v1.2.5/app/admin.js
Normal file
49
public/js/v1.2.5/app/admin.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Main "admin" page
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'datatables.net',
|
||||
'datatables.net-buttons',
|
||||
'datatables.net-buttons-html',
|
||||
'datatables.net-responsive',
|
||||
'datatables.net-select'
|
||||
], function($, Init, Util) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
splashOverlayClass: 'pf-splash' // class for "splash" overlay
|
||||
};
|
||||
|
||||
/**
|
||||
* main init "admin" page
|
||||
*/
|
||||
$(function(){
|
||||
// set Dialog default config
|
||||
Util.initDefaultBootboxConfig();
|
||||
|
||||
// hide splash loading animation
|
||||
$('.' + config.splashOverlayClass).hideSplashOverlay();
|
||||
|
||||
|
||||
let systemsDataTable = $('.dataTable').dataTable( {
|
||||
pageLength: 100,
|
||||
paging: true,
|
||||
ordering: true,
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
language: {
|
||||
emptyTable: 'No members',
|
||||
zeroRecords: 'No members found',
|
||||
lengthMenu: 'Show _MENU_ members',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ members'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
420
public/js/v1.2.5/app/config/signature_type.js
Normal file
420
public/js/v1.2.5/app/config/signature_type.js
Normal file
@@ -0,0 +1,420 @@
|
||||
/**
|
||||
* Created by exodus4d on 06.07.2015.
|
||||
* static signature types
|
||||
*
|
||||
* (*) marked fields are in-game verified and
|
||||
* proofed, signature names (copy & paste from scanning window)
|
||||
*/
|
||||
|
||||
define(['jquery'], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// signature sources
|
||||
// http://de.sistersprobe.wikia.com/wiki/EVE_Sister_Core_Scanner_Probe_Wiki
|
||||
|
||||
|
||||
// NullSec Relic sites, which can also spawn in C1, C2, C3 wormholes
|
||||
let nullSecRelicSites = {
|
||||
10: 'Ruined Angel Crystal Quarry',
|
||||
11: 'Ruined Angel Monument Site',
|
||||
12: 'Ruined Angel Science Outpost',
|
||||
13: 'Ruined Angel Temple Site',
|
||||
14: 'Ruined Blood Raider Crystal Quarry',
|
||||
15: 'Ruined Blood Raider Monument Site',
|
||||
16: 'Ruined Blood Raider Science Outpost',
|
||||
17: 'Ruined Blood Raider Temple Site',
|
||||
18: 'Ruined Guristas Crystal Quarry',
|
||||
19: 'Ruined Guristas Monument Site',
|
||||
20: 'Ruined Guristas Science Outpost',
|
||||
21: 'Ruined Guristas Temple Site',
|
||||
22: 'Ruined Sansha Crystal Quarry',
|
||||
23: 'Ruined Sansha Monument Site',
|
||||
24: 'Ruined Sansha Science Outpost',
|
||||
25: 'Ruined Sansha Temple Site',
|
||||
26: 'Ruined Serpentis Crystal Quarry',
|
||||
27: 'Ruined Serpentis Monument Site',
|
||||
28: 'Ruined Serpentis Science Outpost',
|
||||
29: 'Ruined Serpentis Temple Site'
|
||||
};
|
||||
|
||||
// NulSec Data sites, which can also spawn in C1, C2, C3 wormholes
|
||||
let nullSecDataSites = {
|
||||
10: 'Abandoned Research Complex DA005',
|
||||
11: 'Abandoned Research Complex DA015',
|
||||
12: 'Abandoned Research Complex DC007',
|
||||
13: 'Abandoned Research Complex DC021',
|
||||
14: 'Abandoned Research Complex DC035',
|
||||
15: 'Abandoned Research Complex DG003',
|
||||
16: 'Central Angel Command Center',
|
||||
17: 'Central Angel Data Mining Site',
|
||||
18: 'Central Angel Sparking Transmitter',
|
||||
19: 'Central Angel Survey Site',
|
||||
20: 'Central Blood Raider Command Center',
|
||||
21: 'Central Blood Raider Data Mining Site',
|
||||
22: 'Central Blood Raider Sparking Transmitter',
|
||||
23: 'Central Blood Raider Survey Site',
|
||||
24: 'Central Guristas Command Center',
|
||||
25: 'Central Guristas Data Mining Center',
|
||||
26: 'Central Guristas Sparking Transmitter',
|
||||
27: 'Central Guristas Survey Site',
|
||||
28: 'Central Sansha Command Center',
|
||||
29: 'Central Sansha Data Mining Site',
|
||||
30: 'Central Sansha Sparking Transmitter',
|
||||
31: 'Central Sansha Survey Site',
|
||||
32: 'Central Serpentis Command Center',
|
||||
33: 'Central Serpentis Data Mining Site',
|
||||
34: 'Central Serpentis Sparking Transmitter',
|
||||
35: 'Central Serpentis Survey Site'
|
||||
};
|
||||
|
||||
|
||||
// signature types
|
||||
let signatureTypes = {
|
||||
1: { // system type (wh)
|
||||
1: { // C1 (area id)
|
||||
1: { // Combat
|
||||
1: 'Perimeter Ambush Point',
|
||||
2: 'Perimeter Camp',
|
||||
3: 'Phase Catalyst Node',
|
||||
4: 'The Line'
|
||||
},
|
||||
2: $.extend({}, nullSecRelicSites, { // Relic
|
||||
1: 'Forgotten Perimeter Coronation Platform', //*
|
||||
2: 'Forgotten Perimeter Power Array' //*
|
||||
}),
|
||||
3: $.extend({}, nullSecDataSites, { // Data
|
||||
1: 'Unsecured Perimeter Amplifier', //*
|
||||
2: 'Unsecured Perimeter Information Center' //*
|
||||
}),
|
||||
4: { // Gas
|
||||
1: 'Barren Perimeter Reservoir', //*
|
||||
2: 'Token Perimeter Reservoir', //*
|
||||
3: 'Minor Perimeter Reservoir', //*
|
||||
4: 'Sizeable Perimeter Reservoir', //*
|
||||
5: 'Ordinary Perimeter Reservoir' //*
|
||||
},
|
||||
5: { // Wormhole
|
||||
1: 'H121 - C1',
|
||||
2: 'C125 - C2',
|
||||
3: 'O883 - C3',
|
||||
4: 'M609 - C4',
|
||||
5: 'L614 - C5',
|
||||
6: 'S804 - C6',
|
||||
7: 'F135 - Thera'
|
||||
},
|
||||
6: { // ORE
|
||||
1: 'Ordinary Perimeter Deposit', //*
|
||||
2: 'Common Perimeter Deposit', //*
|
||||
3: 'Unexceptional Frontier Deposit', //*
|
||||
4: 'Average Frontier Deposit', //*
|
||||
5: 'Isolated Core Deposit', //*
|
||||
6: 'Uncommon Core Deposit' //*
|
||||
},
|
||||
7: { // Ghost
|
||||
|
||||
}
|
||||
},
|
||||
2: { // C2
|
||||
1: { // Combat
|
||||
1: 'Perimeter Checkpoint',
|
||||
2: 'Perimeter Hangar',
|
||||
3: 'The Ruins of Enclave Cohort 27',
|
||||
4: 'Sleeper Data Sanctuary'
|
||||
},
|
||||
2: $.extend({}, nullSecRelicSites, { // Relic
|
||||
1: 'Forgotten Perimeter Gateway', //*
|
||||
2: 'Forgotten Perimeter Habitation Coils' //*
|
||||
}),
|
||||
3: $.extend({}, nullSecDataSites, { // Data
|
||||
1: 'Unsecured Perimeter Comms Relay', //*
|
||||
2: 'Unsecured Perimeter Transponder Farm' //*
|
||||
}),
|
||||
4: { // Gas
|
||||
1: 'Barren Perimeter Reservoir', //*
|
||||
2: 'Token Perimeter Reservoir', //*
|
||||
3: 'Minor Perimeter Reservoir', //*
|
||||
4: 'Sizeable Perimeter Reservoir', //*
|
||||
5: 'Ordinary Perimeter Reservoir' //*
|
||||
},
|
||||
5: { // Wormhole
|
||||
1: 'Z647 - C1',
|
||||
2: 'D382 - C2',
|
||||
3: 'O477 - C3',
|
||||
4: 'Y683 - C4',
|
||||
5: 'N062 - C5',
|
||||
6: 'R474 - C6',
|
||||
7: 'F135 - Thera'
|
||||
},
|
||||
6: { // ORE
|
||||
1: 'Ordinary Perimeter Deposit', //*
|
||||
2: 'Common Perimeter Deposit', //*
|
||||
3: 'Unexceptional Frontier Deposit', //*
|
||||
4: 'Average Frontier Deposit', //*
|
||||
5: 'Isolated Core Deposit', //*
|
||||
6: 'Uncommon Core Deposit' //*
|
||||
},
|
||||
7: { // Ghost
|
||||
|
||||
}
|
||||
},
|
||||
3: { // C3
|
||||
1: { // Combat
|
||||
1: 'Fortification Frontier Stronghold',
|
||||
2: 'Outpost Frontier Stronghold',
|
||||
3: 'Solar Cell',
|
||||
4: 'The Oruze Construct'
|
||||
},
|
||||
2: $.extend({}, nullSecRelicSites, { // Relic
|
||||
1: 'Forgotten Frontier Quarantine Outpost', //*
|
||||
2: 'Forgotten Frontier Recursive Depot' //*
|
||||
}),
|
||||
3: $.extend({}, nullSecDataSites, { // Data
|
||||
1: 'Unsecured Frontier Database', //*
|
||||
2: 'Unsecured Frontier Receiver' //*
|
||||
}),
|
||||
4: { // Gas
|
||||
1: 'Barren Perimeter Reservoir', //*
|
||||
2: 'Token Perimeter Reservoir', //*
|
||||
3: 'Minor Perimeter Reservoir', //*
|
||||
4: 'Sizeable Perimeter Reservoir', //*
|
||||
5: 'Ordinary Perimeter Reservoir', //*
|
||||
6: 'Bountiful Frontier Reservoir', //*
|
||||
7: 'Vast Frontier Reservoir' //*
|
||||
},
|
||||
5: { // Wormhole
|
||||
1: 'V301 - C1',
|
||||
2: 'I182 - C2',
|
||||
3: 'N968 - C3',
|
||||
4: 'T405 - C4',
|
||||
5: 'N770 - C5',
|
||||
6: 'A982 - C6',
|
||||
7: 'F135 - Thera'
|
||||
},
|
||||
6: { // ORE
|
||||
1: 'Ordinary Perimeter Deposit', //*
|
||||
2: 'Common Perimeter Deposit', //*
|
||||
3: 'Unexceptional Frontier Deposit', //*
|
||||
4: 'Average Frontier Deposit', //*
|
||||
5: 'Infrequent Core Deposit', //*
|
||||
6: 'Unusual Core Deposit' //*
|
||||
},
|
||||
7: { // Ghost
|
||||
|
||||
}
|
||||
},
|
||||
4: { // C4
|
||||
1: { // Combat
|
||||
1: 'Frontier Barracks',
|
||||
2: 'Frontier Command Post',
|
||||
3: 'Integrated Terminus',
|
||||
4: 'Sleeper Information Sanctum'
|
||||
},
|
||||
2: { // Relic
|
||||
1: 'Forgotten Frontier Conversion Module',
|
||||
2: 'Forgotten Frontier Evacuation Center'
|
||||
},
|
||||
3: { // Data
|
||||
1: 'Unsecured Frontier Digital Nexus',
|
||||
2: 'Unsecured Frontier Trinary Hub'
|
||||
},
|
||||
4: { // Gas
|
||||
1: 'Barren Perimeter Reservoir', //*
|
||||
2: 'Token Perimeter Reservoir', //*
|
||||
3: 'Minor Perimeter Reservoir', //*
|
||||
4: 'Sizeable Perimeter Reservoir', //*
|
||||
5: 'Ordinary Perimeter Reservoir', //*
|
||||
6: 'Vast Frontier Reservoir', //*
|
||||
7: 'Bountiful Frontier Reservoir' //*
|
||||
},
|
||||
5: { // Wormhole
|
||||
// no *wandering* w-space -> k-space wormholes
|
||||
// all holes are statics or K162
|
||||
},
|
||||
6: { // ORE
|
||||
1: 'Ordinary Perimeter Deposit', //*
|
||||
2: 'Common Perimeter Deposit', //*
|
||||
3: 'Unexceptional Frontier Deposit', //*
|
||||
4: 'Average Frontier Deposit', //*
|
||||
5: 'Unusual Core Deposit', //*
|
||||
6: 'Infrequent Core Deposit' //*
|
||||
},
|
||||
7: { // Ghost
|
||||
|
||||
}
|
||||
},
|
||||
5: { // C5
|
||||
1: { // Combat
|
||||
1: 'Core Garrison', //*
|
||||
2: 'Core Stronghold', //*
|
||||
3: 'Oruze Osobnyk', //*
|
||||
4: 'Quarantine Area'
|
||||
},
|
||||
2: { // Relic
|
||||
1: 'Forgotten Core Data Field',
|
||||
2: 'Forgotten Core Information Pen'
|
||||
},
|
||||
3: { // Data
|
||||
1: 'Unsecured Frontier Enclave Relay',
|
||||
2: 'Unsecured Frontier Server Bank'
|
||||
},
|
||||
4: { // Gas
|
||||
1: 'Barren Perimeter Reservoir', //*
|
||||
2: 'Minor Perimeter Reservoir', //*
|
||||
3: 'Ordinary Perimeter Reservoir', //*
|
||||
4: 'Sizeable Perimeter Reservoir', //*
|
||||
5: 'Token Perimeter Reservoir', //*
|
||||
6: 'Bountiful Frontier Reservoir', //*
|
||||
7: 'Vast Frontier Reservoir', //*
|
||||
8: 'Instrumental Core Reservoir', //*
|
||||
9: 'Vital Core Reservoir' //*
|
||||
},
|
||||
5: { // Wormhole
|
||||
1: 'D792 - HS',
|
||||
2: 'C140 - LS',
|
||||
3: 'Z142 - 0.0',
|
||||
4: 'F135 - Thera'
|
||||
},
|
||||
6: { // ORE
|
||||
1: 'Average Frontier Deposit', //*
|
||||
2: 'Unexceptional Frontier Deposit', //*
|
||||
3: 'Uncommon Core Deposit', //*
|
||||
4: 'Ordinary Perimeter Deposit', //*
|
||||
5: 'Common Perimeter Deposit', //*
|
||||
6: 'Exceptional Core Deposit', //*
|
||||
7: 'Infrequent Core Deposit', //*
|
||||
8: 'Unusual Core Deposit', //*
|
||||
9: 'Rarified Core Deposit', //*
|
||||
10: 'Isolated Core Deposit' //*
|
||||
},
|
||||
7: { // Ghost
|
||||
|
||||
}
|
||||
},
|
||||
6: { // C6
|
||||
1: { // Combat
|
||||
1: 'Core Citadel', //*
|
||||
2: 'Core Bastion', //*
|
||||
3: 'Strange Energy Readings', //*
|
||||
4: 'The Mirror' //*
|
||||
},
|
||||
2: { // Relic
|
||||
1: 'Forgotten Core Assembly Hall', //*
|
||||
2: 'Forgotten Core Circuitry Disassembler' //*
|
||||
},
|
||||
3: { // Data
|
||||
1: 'Unsecured Core Backup Array', //*
|
||||
2: 'Unsecured Core Emergence' //*
|
||||
},
|
||||
4: { // Gas
|
||||
1: 'Barren Perimeter Reservoir', //*
|
||||
2: 'Minor Perimeter Reservoir', //*
|
||||
3: 'Ordinary Perimeter Reservoir', //*
|
||||
4: 'Sizeable Perimeter Reservoir', //*
|
||||
5: 'Token Perimeter Reservoir', //*
|
||||
6: 'Bountiful Frontier Reservoir', //*
|
||||
7: 'Vast Frontier Reservoir', //*
|
||||
8: 'Instrumental Core Reservoir', //*
|
||||
9: 'Vital Core Reservoir' //*
|
||||
},
|
||||
5: { // Wormhole
|
||||
1: 'D792 - HS',
|
||||
2: 'C391 - LS',
|
||||
3: 'C248 - 0.0',
|
||||
4: 'F135 - Thera'
|
||||
},
|
||||
6: { // ORE
|
||||
1: 'Ordinary Perimeter Deposit', //*
|
||||
2: 'Common Perimeter Deposit', //*
|
||||
3: 'Unexceptional Frontier Deposit', //*
|
||||
4: 'Average Frontier Deposit', //*
|
||||
5: 'Rarified Core Deposit' //*
|
||||
},
|
||||
7: { // Ghost
|
||||
1: 'Superior Blood Raider Covert Research Facility' //*
|
||||
}
|
||||
},
|
||||
13: { // Shattered Wormholes
|
||||
5: { // Wormhole (some of them are static)
|
||||
1: 'P060 - C1',
|
||||
2: 'Z647 - C1',
|
||||
3: 'D382 - C2',
|
||||
4: 'L005 - C2',
|
||||
5: 'N766 - C2',
|
||||
6: 'C247 - C3',
|
||||
7: 'M267 - C3',
|
||||
8: 'O477 - C3',
|
||||
9: 'X877 - C4',
|
||||
10: 'Y683 - C4',
|
||||
11: 'H296 - C5',
|
||||
12: 'H900 - C5',
|
||||
13: 'H296 - C5',
|
||||
14: 'N062 - C5', // ??
|
||||
15: 'V911 - C5',
|
||||
16: 'U574 - C6',
|
||||
17: 'V753 - C6',
|
||||
18: 'W237 - C6',
|
||||
19: 'B274 - HS',
|
||||
20: 'D792 - HS',
|
||||
21: 'D845 - HS',
|
||||
22: 'N110 - HS',
|
||||
23: 'A239 - LS',
|
||||
24: 'C391 - LS',
|
||||
25: 'J244 - LS',
|
||||
26: 'U201 - LS', // ??
|
||||
27: 'U210 - LS',
|
||||
28: 'C248 - 0.0',
|
||||
29: 'E545 - 0.0',
|
||||
30: 'K346 - 0.0',
|
||||
31: 'Z060 - 0.0'
|
||||
}
|
||||
}
|
||||
}, // system type (k-space)
|
||||
2: {
|
||||
10: { // High Sec
|
||||
5: { // Wormhole
|
||||
1: 'Z971 - C1',
|
||||
2: 'R943 - C2',
|
||||
3: 'X702 - C3',
|
||||
// no C4
|
||||
4: 'M555 - C5',
|
||||
5: 'B041 - C6',
|
||||
6: 'A641 - HS',
|
||||
7: 'R051 - LS',
|
||||
8: 'V283 - 0.0',
|
||||
9: 'T458 - Thera'
|
||||
}
|
||||
},
|
||||
11: { // Low Sec
|
||||
5: { // Wormhole
|
||||
1: 'Z971 - C1',
|
||||
2: 'R943 - C2',
|
||||
3: 'X702 - C3',
|
||||
// no C4
|
||||
4: 'N432 - C5',
|
||||
5: 'U319 - C6',
|
||||
6: 'B449 - HS',
|
||||
7: 'N944 - LS',
|
||||
8: 'S199 - 0.0',
|
||||
9: 'M164 - Thera'
|
||||
}
|
||||
},
|
||||
12: { // 0.0
|
||||
5: { // Wormhole
|
||||
1: 'Z971 - C1',
|
||||
2: 'R943 - C2',
|
||||
3: 'X702 - C3',
|
||||
// no C4
|
||||
4: 'N432 - C5',
|
||||
5: 'U319 - C6',
|
||||
6: 'B449 - HS',
|
||||
7: 'N944 - LS',
|
||||
8: 'S199 - 0.0',
|
||||
9: 'L031 - Thera'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return signatureTypes;
|
||||
});
|
||||
733
public/js/v1.2.5/app/config/system_effect.js
Normal file
733
public/js/v1.2.5/app/config/system_effect.js
Normal file
@@ -0,0 +1,733 @@
|
||||
/**
|
||||
* Created by exodus4d on 06.07.2015.
|
||||
* static system effects
|
||||
*/
|
||||
|
||||
|
||||
define([], function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
// system effects
|
||||
let systemEffects = {
|
||||
wh: {
|
||||
magnetar: {
|
||||
1: [
|
||||
{
|
||||
effect: 'Damage',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Missile explosion radius',
|
||||
value: '+15%'
|
||||
},{
|
||||
effect: 'Drone Tracking',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Targeting Range',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Tracking Speed',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Target Painter Strength',
|
||||
value: '-15%'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
effect: 'Damage',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Missile explosion radius',
|
||||
value: '+22%'
|
||||
},{
|
||||
effect: 'Drone Tracking',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Targeting Range',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Tracking Speed',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Target Painter Strength',
|
||||
value: '-22%'
|
||||
}
|
||||
],
|
||||
3: [
|
||||
{
|
||||
effect: 'Damage',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Missile explosion radius',
|
||||
value: '+29%'
|
||||
},{
|
||||
effect: 'Drone Tracking',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Targeting Range',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Tracking Speed',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Target Painter Strength',
|
||||
value: '-29%'
|
||||
}
|
||||
],
|
||||
4: [
|
||||
{
|
||||
effect: 'Damage',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Missile explosion radius',
|
||||
value: '+36%'
|
||||
},{
|
||||
effect: 'Drone Tracking',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Targeting Range',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Tracking Speed',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Target Painter Strength',
|
||||
value: '-36%'
|
||||
}
|
||||
],
|
||||
5: [
|
||||
{
|
||||
effect: 'Damage',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Missile explosion radius',
|
||||
value: '+43%'
|
||||
},{
|
||||
effect: 'Drone Tracking',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Targeting Range',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Tracking Speed',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Target Painter Strength',
|
||||
value: '-43%'
|
||||
}
|
||||
],
|
||||
6: [
|
||||
{
|
||||
effect: 'Damage',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Missile explosion radius',
|
||||
value: '+50%'
|
||||
},{
|
||||
effect: 'Drone Tracking',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Targeting Range',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Tracking Speed',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Target Painter Strength',
|
||||
value: '-50%'
|
||||
}
|
||||
]
|
||||
},
|
||||
redGiant: {
|
||||
1: [
|
||||
{
|
||||
effect: 'Heat Damage',
|
||||
value: '+15%'
|
||||
},{
|
||||
effect: 'Overload Bonus',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Smart Bomb Range',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Smart Bomb Damage',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Bomb Damage',
|
||||
value: '+30%'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
effect: 'Heat Damage',
|
||||
value: '+22%'
|
||||
},{
|
||||
effect: 'Overload Bonus',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Smart Bomb Range',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Smart Bomb Damage',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Bomb Damage',
|
||||
value: '+44%'
|
||||
}
|
||||
],
|
||||
3: [
|
||||
{
|
||||
effect: 'Heat Damage',
|
||||
value: '+29%'
|
||||
},{
|
||||
effect: 'Overload Bonus',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Smart Bomb Range',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Smart Bomb Damage',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Bomb Damage',
|
||||
value: '+58%'
|
||||
}
|
||||
],
|
||||
4: [
|
||||
{
|
||||
effect: 'Heat Damage',
|
||||
value: '+36%'
|
||||
},{
|
||||
effect: 'Overload Bonus',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Smart Bomb Range',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Smart Bomb Damage',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Bomb Damage',
|
||||
value: '+72%'
|
||||
}
|
||||
],
|
||||
5: [
|
||||
{
|
||||
effect: 'Heat Damage',
|
||||
value: '+43%'
|
||||
},{
|
||||
effect: 'Overload Bonus',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Smart Bomb Range',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Smart Bomb Damage',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Bomb Damage',
|
||||
value: '+86%'
|
||||
}
|
||||
],
|
||||
6: [
|
||||
{
|
||||
effect: 'Heat Damage',
|
||||
value: '+50%'
|
||||
},{
|
||||
effect: 'Overload Bonus',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Smart Bomb Range',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Smart Bomb Damage',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Bomb Damage',
|
||||
value: '+100%'
|
||||
}
|
||||
]
|
||||
},
|
||||
pulsar: {
|
||||
1: [
|
||||
{
|
||||
effect: 'Shield HP',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Armor Resists',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Capacitor recharge',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Signature',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'NOS / Neut Drain Amount',
|
||||
value: '+30%'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
effect: 'Shield HP',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Armor Resists',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Capacitor recharge',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Signature',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'NOS / Neut Drain Amount',
|
||||
value: '+44%'
|
||||
}
|
||||
],
|
||||
3: [
|
||||
{
|
||||
effect: 'Shield HP',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Armor Resists',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Capacitor recharge',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Signature',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'NOS / Neut Drain Amount',
|
||||
value: '+58%'
|
||||
}
|
||||
],
|
||||
4: [
|
||||
{
|
||||
effect: 'Shield HP',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Armor Resists',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Capacitor recharge',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Signature',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'NOS / Neut Drain Amount',
|
||||
value: '+72%'
|
||||
}
|
||||
],
|
||||
5: [
|
||||
{
|
||||
effect: 'Shield HP',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Armor Resists',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Capacitor recharge',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Signature',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'NOS / Neut Drain Amount',
|
||||
value: '+86%'
|
||||
}
|
||||
],
|
||||
6: [
|
||||
{
|
||||
effect: 'Shield HP',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Armor Resists',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Capacitor recharge',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Signature',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'NOS / Neut Drain Amount',
|
||||
value: '+100%'
|
||||
}
|
||||
]
|
||||
},
|
||||
wolfRayet: {
|
||||
1: [
|
||||
{
|
||||
effect: 'Armor HP',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Shield Resist',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Small Weapon Damage',
|
||||
value: '+60%'
|
||||
},{
|
||||
effect: 'Signature Size',
|
||||
value: '-15%'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
effect: 'Armor HP',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Shield Resist',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Small Weapon Damage',
|
||||
value: '+88%'
|
||||
},{
|
||||
effect: 'Signature Size',
|
||||
value: '-22%'
|
||||
}
|
||||
],
|
||||
3: [
|
||||
{
|
||||
effect: 'Armor HP',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Shield Resist',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Small Weapon Damage',
|
||||
value: '+116%'
|
||||
},{
|
||||
effect: 'Signature Size',
|
||||
value: '-29%'
|
||||
}
|
||||
],
|
||||
4: [
|
||||
{
|
||||
effect: 'Armor HP',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Shield Resist',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Small Weapon Damage',
|
||||
value: '+144%'
|
||||
},{
|
||||
effect: 'Signature Size',
|
||||
value: '-36%'
|
||||
}
|
||||
],
|
||||
5: [
|
||||
{
|
||||
effect: 'Armor HP',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Shield Resist',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Small Weapon Damage',
|
||||
value: '+172%'
|
||||
},{
|
||||
effect: 'Signature Size',
|
||||
value: '-43%'
|
||||
}
|
||||
],
|
||||
6: [
|
||||
{
|
||||
effect: 'Armor HP',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Shield Resist',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Small Weapon Damage',
|
||||
value: '+200%'
|
||||
},{
|
||||
effect: 'Signature Size',
|
||||
value: '-50%'
|
||||
}
|
||||
]
|
||||
},
|
||||
cataclysmic: {
|
||||
1: [
|
||||
{
|
||||
effect: 'Local armor repair amount',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Local shield boost amount',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Shield transfer amount',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Remote repair amount',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Capacitor capacity',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Capacitor recharge time',
|
||||
value: '+15%'
|
||||
},{
|
||||
effect: 'Remote Capacitor Transmitter amount',
|
||||
value: '-15%'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
effect: 'Local armor repair amount',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Local shield boost amount',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Shield transfer amount',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Remote repair amount',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Capacitor capacity',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Capacitor recharge time',
|
||||
value: '+22%'
|
||||
},{
|
||||
effect: 'Remote Capacitor Transmitter amount',
|
||||
value: '-22%'
|
||||
}
|
||||
],
|
||||
3: [
|
||||
{
|
||||
effect: 'Local armor repair amount',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Local shield boost amount',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Shield transfer amount',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Remote repair amount',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Capacitor capacity',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Capacitor recharge time',
|
||||
value: '+29%'
|
||||
},{
|
||||
effect: 'Remote Capacitor Transmitter amount',
|
||||
value: '-29%'
|
||||
}
|
||||
],
|
||||
4: [
|
||||
{
|
||||
effect: 'Local armor repair amount',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Local shield boost amount',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Shield transfer amount',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Remote repair amount',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Capacitor capacity',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Capacitor recharge time',
|
||||
value: '+36%'
|
||||
},{
|
||||
effect: 'Remote Capacitor Transmitter amount',
|
||||
value: '-36%'
|
||||
}
|
||||
],
|
||||
5: [
|
||||
{
|
||||
effect: 'Local armor repair amount',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Local shield boost amount',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Shield transfer amount',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Remote repair amount',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Capacitor capacity',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Capacitor recharge time',
|
||||
value: '+43%'
|
||||
},{
|
||||
effect: 'Remote Capacitor Transmitter amount',
|
||||
value: '-43%'
|
||||
}
|
||||
],
|
||||
6: [
|
||||
{
|
||||
effect: 'Local armor repair amount',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Local shield boost amount',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Shield transfer amount',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Remote repair amount',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Capacitor capacity',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Capacitor recharge time',
|
||||
value: '+50%'
|
||||
},{
|
||||
effect: 'Remote Capacitor Transmitter amount',
|
||||
value: '-50%'
|
||||
}
|
||||
]
|
||||
},
|
||||
blackHole: {
|
||||
1: [
|
||||
{
|
||||
effect: 'Missile velocity',
|
||||
value: '+15%'
|
||||
},{
|
||||
effect: 'Missile Explosion Velocity',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Ship velocity',
|
||||
value: '+30%'
|
||||
},{
|
||||
effect: 'Stasis Webifier Strength',
|
||||
value: '-15%'
|
||||
},{
|
||||
effect: 'Inertia',
|
||||
value: '+15%'
|
||||
},{
|
||||
effect: 'Targeting range',
|
||||
value: '+30%'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
effect: 'Missile velocity',
|
||||
value: '+22%'
|
||||
},{
|
||||
effect: 'Missile Explosion Velocity',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Ship velocity',
|
||||
value: '+44%'
|
||||
},{
|
||||
effect: 'Stasis Webifier Strength',
|
||||
value: '-22%'
|
||||
},{
|
||||
effect: 'Inertia',
|
||||
value: '+22%'
|
||||
},{
|
||||
effect: 'Targeting range',
|
||||
value: '+44%'
|
||||
}
|
||||
],
|
||||
3: [
|
||||
{
|
||||
effect: 'Missile velocity',
|
||||
value: '+29%'
|
||||
},{
|
||||
effect: 'Missile Explosion Velocity',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Ship velocity',
|
||||
value: '+58%'
|
||||
},{
|
||||
effect: 'Stasis Webifier Strength',
|
||||
value: '-29%'
|
||||
},{
|
||||
effect: 'Inertia',
|
||||
value: '+29%'
|
||||
},{
|
||||
effect: 'Targeting range',
|
||||
value: '+58%'
|
||||
}
|
||||
],
|
||||
4: [
|
||||
{
|
||||
effect: 'Missile velocity',
|
||||
value: '+36%'
|
||||
},{
|
||||
effect: 'Missile Explosion Velocity',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Ship velocity',
|
||||
value: '+72%'
|
||||
},{
|
||||
effect: 'Stasis Webifier Strength',
|
||||
value: '-36%'
|
||||
},{
|
||||
effect: 'Inertia',
|
||||
value: '+36%'
|
||||
},{
|
||||
effect: 'Targeting range',
|
||||
value: '+72%'
|
||||
}
|
||||
],
|
||||
5: [
|
||||
{
|
||||
effect: 'Missile velocity',
|
||||
value: '+43%'
|
||||
},{
|
||||
effect: 'Missile Explosion Velocity',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Ship velocity',
|
||||
value: '+86%'
|
||||
},{
|
||||
effect: 'Stasis Webifier Strength',
|
||||
value: '-43%'
|
||||
},{
|
||||
effect: 'Inertia',
|
||||
value: '+43%'
|
||||
},{
|
||||
effect: 'Targeting range',
|
||||
value: '+86%'
|
||||
}
|
||||
],
|
||||
6: [
|
||||
{
|
||||
effect: 'Missile velocity',
|
||||
value: '+50%'
|
||||
},{
|
||||
effect: 'Missile Explosion Velocity',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Ship velocity',
|
||||
value: '+100%'
|
||||
},{
|
||||
effect: 'Stasis Webifier Strength',
|
||||
value: '-50%'
|
||||
},{
|
||||
effect: 'Inertia',
|
||||
value: '+50%'
|
||||
},{
|
||||
effect: 'Targeting range',
|
||||
value: '+100%'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return systemEffects;
|
||||
});
|
||||
90
public/js/v1.2.5/app/counter.js
Normal file
90
public/js/v1.2.5/app/counter.js
Normal file
@@ -0,0 +1,90 @@
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util'
|
||||
], function($, Init, Util) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
counterDigitSmallClass: 'pf-digit-counter-small',
|
||||
counterDigitLargeClass: 'pf-digit-counter-large'
|
||||
};
|
||||
|
||||
/**
|
||||
* update element with time information
|
||||
* @param element
|
||||
* @param tempDate
|
||||
*/
|
||||
let updateDateDiff = function(element, tempDate){
|
||||
let diff = Util.getTimeDiffParts(tempDate, new Date());
|
||||
let days = diff.days;
|
||||
let hrs = diff.hours;
|
||||
let min = diff.min;
|
||||
let leftSec = diff.sec;
|
||||
let value = [];
|
||||
|
||||
if(
|
||||
days > 0 ||
|
||||
value.length > 0
|
||||
){
|
||||
value.push('<span class="' + config.counterDigitLargeClass + '">' + days + 'd' + '</span>');
|
||||
}
|
||||
if(
|
||||
hrs > 0 ||
|
||||
value.length > 0
|
||||
){
|
||||
value.push('<span class="' + config.counterDigitSmallClass + '">' + hrs + 'h' + '</span>');
|
||||
}
|
||||
if(
|
||||
min > 0 ||
|
||||
value.length > 0
|
||||
){
|
||||
value.push('<span class="' + config.counterDigitSmallClass + '">' + min + 'm' + '</span>');
|
||||
}
|
||||
|
||||
if(
|
||||
leftSec >= 0 ||
|
||||
value.length > 0
|
||||
){
|
||||
value.push('<span class="' + config.counterDigitSmallClass + '">' + leftSec + 's' + '</span>');
|
||||
}
|
||||
|
||||
element.html(value.join(' '));
|
||||
};
|
||||
|
||||
/**
|
||||
* init a live counter based on a unix timestamp
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.initTimestampCounter = function(){
|
||||
return this.each(function(){
|
||||
let element = $(this);
|
||||
let timestamp = parseInt( element.text() );
|
||||
|
||||
// do not init twice
|
||||
if(timestamp > 0){
|
||||
// mark as init
|
||||
element.attr('data-counter', 'init');
|
||||
|
||||
let date = new Date( timestamp * 1000);
|
||||
|
||||
updateDateDiff(element, date);
|
||||
|
||||
// show element (if invisible) after first update
|
||||
element.css({'visibility': 'initial'});
|
||||
|
||||
let refreshIntervalId = window.setInterval(function(){
|
||||
|
||||
// update element with current time
|
||||
if( !element.hasClass('stopCounter')){
|
||||
updateDateDiff(element, date);
|
||||
}else{
|
||||
clearInterval( element.data('interval') );
|
||||
}
|
||||
}, 500);
|
||||
|
||||
element.data('interval', refreshIntervalId);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
452
public/js/v1.2.5/app/init.js
Normal file
452
public/js/v1.2.5/app/init.js
Normal file
@@ -0,0 +1,452 @@
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
|
||||
define(['jquery'], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let Config = {
|
||||
path: {
|
||||
img: 'public/img/', // path for images
|
||||
// user API
|
||||
getCaptcha: 'api/user/getCaptcha', // ajax URL - get captcha image
|
||||
getServerStatus: 'api/user/getEveServerStatus', // ajax URL - get EVE-Online server status
|
||||
getCookieCharacterData: 'api/user/getCookieCharacter', // ajax URL - get character data from cookie
|
||||
logIn: 'api/user/logIn', // ajax URL - login
|
||||
logout: 'api/user/logout', // ajax URL - logout
|
||||
deleteLog: 'api/user/deleteLog', // ajax URL - delete character log
|
||||
openIngameWindow: 'api/user/openIngameWindow', // ajax URL - open inGame Window
|
||||
saveUserConfig: 'api/user/saveAccount', // ajax URL - saves/update user account
|
||||
deleteAccount: 'api/user/deleteAccount', // ajax URL - delete Account data
|
||||
// access API
|
||||
searchAccess: 'api/access/search', // ajax URL - search user/corporation/ally by name
|
||||
// main config/map ping API
|
||||
initMap: 'api/map/init', // ajax URL - get static data
|
||||
getAccessData: 'api/map/getAccessData', // ajax URL - get map access tokens (WebSocket)
|
||||
updateMapData: 'api/map/updateData', // ajax URL - main map update trigger
|
||||
updateUserData: 'api/map/updateUserData', // ajax URL - main map user data trigger
|
||||
// map API
|
||||
saveMap: 'api/map/save', // ajax URL - save/update map
|
||||
deleteMap: 'api/map/delete', // ajax URL - delete map
|
||||
importMap: 'api/map/import', // ajax URL - import map
|
||||
getMapConnectionData: 'api/map/getConnectionData', // ajax URL - get connection data
|
||||
// system API
|
||||
searchSystem: 'api/system/search', // ajax URL - search system by name
|
||||
saveSystem: 'api/system/save', // ajax URL - saves system to map
|
||||
deleteSystem: 'api/system/delete', // ajax URL - delete system from map
|
||||
getSystemGraphData: 'api/system/graphData', // ajax URL - get all system graph data
|
||||
getConstellationData: 'api/system/constellationData', // ajax URL - get system constellation data
|
||||
setDestination: 'api/system/setDestination', // ajax URL - set destination
|
||||
// connection API
|
||||
saveConnection: 'api/connection/save', // ajax URL - save new connection to map
|
||||
deleteConnection: 'api/connection/delete', // ajax URL - delete connection from map
|
||||
// signature API
|
||||
getSignatures: 'api/signature/getAll', // ajax URL - get all signature data for system
|
||||
saveSignatureData: 'api/signature/save', // ajax URL - save signature data for system
|
||||
deleteSignatureData: 'api/signature/delete', // ajax URL - delete signature data for system
|
||||
// route API
|
||||
searchRoute: 'api/route/search', // ajax URL - search system routes
|
||||
// stats API
|
||||
getStatisticsData: 'api/statistic/getData', // ajax URL - get statistics data (activity log)
|
||||
// GitHub API
|
||||
gitHubReleases: 'api/github/releases' // ajax URL - get release info from GitHub
|
||||
},
|
||||
url: {
|
||||
ccpImageServer: '//image.eveonline.com/', // CCP image Server
|
||||
zKillboard: '//zkillboard.com/api/' // killboard api
|
||||
},
|
||||
breakpoints: [
|
||||
{ name: 'desktop', width: Infinity },
|
||||
{ name: 'tablet', width: 1200 },
|
||||
{ name: 'fablet', width: 780 },
|
||||
{ name: 'phone', width: 480 }
|
||||
],
|
||||
animationSpeed: {
|
||||
splashOverlay: 300, // "splash" loading overlay
|
||||
headerLink: 100, // links in head bar
|
||||
mapOverlay: 200, // show/hide duration for map overlays
|
||||
mapOverlayLocal: 180, // show/hide duration for map "local" overlay
|
||||
mapMoveSystem: 180, // system position has changed animation
|
||||
mapDeleteSystem: 200, // remove system from map
|
||||
mapModule: 200, // show/hide of an map module
|
||||
dialogEvents: 180 // dialog events /slide/show/...
|
||||
},
|
||||
syncStatus: {
|
||||
type: 'ajax',
|
||||
webSocket: {
|
||||
status: 'closed',
|
||||
class: 'txt-color-danger',
|
||||
timestamp: undefined
|
||||
},
|
||||
sharedWorker: {
|
||||
status: 'offline', // SharedWorker status
|
||||
class: 'txt-color-danger',
|
||||
timestamp: undefined
|
||||
},
|
||||
ajax: {
|
||||
status: 'enabled',
|
||||
class: 'txt-color-success',
|
||||
timestamp: undefined
|
||||
}
|
||||
},
|
||||
performanceLogging: {
|
||||
keyServerMapData: 'UPDATE_SERVER_MAP', // ajax request update map data
|
||||
keyClientMapData: 'UPDATE_CLIENT_MAP', // update client map data
|
||||
keyServerUserData: 'UPDATE_SERVER_USER_DATA', // ajax request update map user data
|
||||
keyClientUserData: 'UPDATE_CLIENT_USER_DATA', // update client map user data
|
||||
},
|
||||
mapIcons: [ // map tab-icons
|
||||
{
|
||||
class: 'fa-desktop',
|
||||
label: 'desktop',
|
||||
unicode: ''
|
||||
},{
|
||||
class: 'fa-bookmark',
|
||||
label: 'bookmark',
|
||||
unicode: ''
|
||||
},{
|
||||
class: 'fa-cube',
|
||||
label: 'cube',
|
||||
unicode: ''
|
||||
},{
|
||||
class: 'fa-plane',
|
||||
label: 'plane',
|
||||
unicode: ''
|
||||
},{
|
||||
class: 'fa-globe',
|
||||
label: 'globe',
|
||||
unicode: ''
|
||||
},{
|
||||
class: 'fa-rocket',
|
||||
label: 'rocket',
|
||||
unicode: ''
|
||||
},{
|
||||
class: 'fa-life-ring',
|
||||
label: 'life ring',
|
||||
unicode: ''
|
||||
},{
|
||||
class: 'fa-heart',
|
||||
label: 'heart',
|
||||
unicode: ''
|
||||
}
|
||||
],
|
||||
|
||||
classes: {
|
||||
// log types
|
||||
logTypes: {
|
||||
info: {
|
||||
class: 'pf-log-info',
|
||||
label: 'info'
|
||||
},
|
||||
warning: {
|
||||
class: 'pf-log-warning',
|
||||
label: 'warning'
|
||||
},
|
||||
error: {
|
||||
class: 'pf-log-error',
|
||||
label: 'error'
|
||||
}
|
||||
},
|
||||
// system effects
|
||||
systemEffects: {
|
||||
|
||||
effect: {
|
||||
class: 'pf-system-effect',
|
||||
name: 'no effect'
|
||||
},
|
||||
magnetar: {
|
||||
class: 'pf-system-effect-magnetar',
|
||||
name: 'magnetar'
|
||||
},
|
||||
redGiant: {
|
||||
class: 'pf-system-effect-redgiant',
|
||||
name: 'red giant'
|
||||
},
|
||||
pulsar: {
|
||||
class: 'pf-system-effect-pulsar',
|
||||
name: 'pulsar'
|
||||
},
|
||||
wolfRayet: {
|
||||
class: 'pf-system-effect-wolfrayet',
|
||||
name: 'wolf rayet'
|
||||
},
|
||||
cataclysmic: {
|
||||
class: 'pf-system-effect-cataclysmic',
|
||||
name: 'cataclysmic'
|
||||
},
|
||||
blackHole: {
|
||||
class: 'pf-system-effect-blackhole',
|
||||
name: 'black hole'
|
||||
}
|
||||
},
|
||||
// system security
|
||||
systemSecurity: {
|
||||
security: {
|
||||
class: 'pf-system-sec'
|
||||
},
|
||||
'SH': {
|
||||
class: 'pf-system-sec-unknown'
|
||||
},
|
||||
'H': {
|
||||
class: 'pf-system-sec-highSec'
|
||||
},
|
||||
'L': {
|
||||
class: 'pf-system-sec-lowSec'
|
||||
},
|
||||
'0.0': {
|
||||
class: 'pf-system-sec-nullSec'
|
||||
},
|
||||
'C6': {
|
||||
class: 'pf-system-sec-high'
|
||||
},
|
||||
'C5': {
|
||||
class: 'pf-system-sec-high'
|
||||
},
|
||||
'C4': {
|
||||
class: 'pf-system-sec-mid'
|
||||
},
|
||||
'C3': {
|
||||
class: 'pf-system-sec-mid'
|
||||
},
|
||||
'C2': {
|
||||
class: 'pf-system-sec-low'
|
||||
},
|
||||
'C1': {
|
||||
class: 'pf-system-sec-low'
|
||||
}
|
||||
},
|
||||
// true sec
|
||||
trueSec: {
|
||||
'0.0': {
|
||||
class: 'pf-system-security-0-0'
|
||||
},
|
||||
'0.1': {
|
||||
class: 'pf-system-security-0-1'
|
||||
},
|
||||
'0.2': {
|
||||
class: 'pf-system-security-0-2'
|
||||
},
|
||||
'0.3': {
|
||||
class: 'pf-system-security-0-3'
|
||||
},
|
||||
'0.4': {
|
||||
class: 'pf-system-security-0-4'
|
||||
},
|
||||
'0.5': {
|
||||
class: 'pf-system-security-0-5'
|
||||
},
|
||||
'0.6': {
|
||||
class: 'pf-system-security-0-6'
|
||||
},
|
||||
'0.7': {
|
||||
class: 'pf-system-security-0-7'
|
||||
},
|
||||
'0.8': {
|
||||
class: 'pf-system-security-0-8'
|
||||
},
|
||||
'0.9': {
|
||||
class: 'pf-system-security-0-9'
|
||||
},
|
||||
'1.0': {
|
||||
class: 'pf-system-security-1-0'
|
||||
}
|
||||
},
|
||||
// system info
|
||||
systemInfo: {
|
||||
rally: {
|
||||
class: 'pf-system-info-rally',
|
||||
label: 'rally point'
|
||||
}
|
||||
},
|
||||
// easy-pie-charts
|
||||
pieChart: {
|
||||
class: 'pf-pie-chart', // class for all pie charts
|
||||
pieChartMapCounterClass: 'pf-pie-chart-map-timer' // class for timer chart
|
||||
}
|
||||
},
|
||||
// map scopes
|
||||
defaultMapScope: 'wh', // default scope for connection
|
||||
// map connection types
|
||||
connectionTypes: {
|
||||
jumpbridge: {
|
||||
cssClass: 'pf-map-connection-jumpbridge',
|
||||
paintStyle: {
|
||||
dashstyle: '4 2 1 2'
|
||||
}
|
||||
},
|
||||
stargate: {
|
||||
cssClass: 'pf-map-connection-stargate',
|
||||
paintStyle: {
|
||||
dashstyle: '0' // solid line
|
||||
}
|
||||
},
|
||||
wh_eol: {
|
||||
cssClass: 'pf-map-connection-wh-eol',
|
||||
paintStyle: {
|
||||
dashstyle: '0' // solid line
|
||||
}
|
||||
},
|
||||
wh_fresh: {
|
||||
cssClass: 'pf-map-connection-wh-fresh',
|
||||
paintStyle: {
|
||||
dashstyle: '0' // solid line
|
||||
}
|
||||
},
|
||||
wh_reduced: {
|
||||
cssClass: 'pf-map-connection-wh-reduced',
|
||||
paintStyle: {
|
||||
dashstyle: '0' // solid line
|
||||
}
|
||||
},
|
||||
wh_critical: {
|
||||
cssClass: 'pf-map-connection-wh-critical',
|
||||
paintStyle: {
|
||||
dashstyle: '0' // solid line
|
||||
}
|
||||
},
|
||||
frigate: {
|
||||
cssClass: 'pf-map-connection-frig',
|
||||
paintStyle: {
|
||||
dashstyle: '0.99'
|
||||
},
|
||||
overlays:[
|
||||
['Label',
|
||||
{
|
||||
label: 'frig',
|
||||
cssClass: ['pf-map-connection-overlay', 'frig'].join(' '),
|
||||
location: 0.6
|
||||
}]
|
||||
]
|
||||
},
|
||||
preserve_mass: {
|
||||
cssClass: 'pf-map-connection-preserve-mass',
|
||||
overlays:[
|
||||
['Label',
|
||||
{
|
||||
label: '<i class="fa fa-fw fa-warning"></i> save mass',
|
||||
cssClass: ['pf-map-connection-overlay', 'mass'].join(' '),
|
||||
location: 0.6
|
||||
}]
|
||||
]
|
||||
}
|
||||
},
|
||||
// signature groups
|
||||
signatureGroups: {
|
||||
1: {
|
||||
name: '(combat site|kampfgebiet|site de combat)', //*
|
||||
label: 'Combat'
|
||||
},
|
||||
2: {
|
||||
name: '(relic site|reliktgebiet|site de reliques)', //*
|
||||
label: 'Relic'
|
||||
},
|
||||
3: {
|
||||
name: '(data site|datengebiet|site de données)',
|
||||
label: 'Data'
|
||||
},
|
||||
4: {
|
||||
name: '(gas site|gasgebiet|site de collecte de gaz)',
|
||||
label: 'Gas'
|
||||
},
|
||||
5: {
|
||||
name: '(wormhole|wurmloch|trou de ver)',
|
||||
label: 'Wormhole'
|
||||
},
|
||||
6: {
|
||||
name: '(ore site|mineraliengebiet|site de minerai)',
|
||||
label: 'Ore'
|
||||
},
|
||||
7: {
|
||||
name: '(ghost)',
|
||||
label: 'Ghost'
|
||||
}
|
||||
},
|
||||
// frigate wormholes
|
||||
frigateWormholes: {
|
||||
1: { // C1
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0',
|
||||
8: 'A009 - (shattered)'
|
||||
},
|
||||
2: { // C2
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0',
|
||||
8: 'A009 - (shattered)'
|
||||
},
|
||||
3: { // C3
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0',
|
||||
8: 'A009 - (shattered)'
|
||||
},
|
||||
4: { // C4
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0',
|
||||
8: 'A009 - (shattered)'
|
||||
},
|
||||
5: { // C5
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0',
|
||||
8: 'A009 - (shattered)'
|
||||
},
|
||||
6: { // C6
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0',
|
||||
8: 'A009 - (shattered)'
|
||||
},
|
||||
13: { // Shattered Wormholes (some of them are static)
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0',
|
||||
8: 'A009 - (shattered)'
|
||||
}
|
||||
},
|
||||
// incoming wormholes
|
||||
incomingWormholes: {
|
||||
1: 'K162 - C1/2/3 (unknown)',
|
||||
2: 'K162 - C4/5 (dangerous)',
|
||||
3: 'K162 - C6 (deadly)',
|
||||
4: 'K162 - HS',
|
||||
5: 'K162 - LS',
|
||||
6: 'K162 - 0.0',
|
||||
7: 'K162 - Thera'
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return Config;
|
||||
});
|
||||
442
public/js/v1.2.5/app/key.js
Normal file
442
public/js/v1.2.5/app/key.js
Normal file
@@ -0,0 +1,442 @@
|
||||
define([
|
||||
'jquery'
|
||||
], function($) {
|
||||
'use strict';
|
||||
|
||||
let allCombo = {
|
||||
// global -------------------------------------------------------------------------------------------
|
||||
tabReload: {
|
||||
group: 'global',
|
||||
label: 'Close open dialog',
|
||||
keyNames: ['ESC']
|
||||
},
|
||||
// signature ----------------------------------------------------------------------------------------
|
||||
signatureSelect: {
|
||||
group: 'signatures',
|
||||
label: 'Select multiple rows',
|
||||
keyNames: ['CONTROL', 'CLICK']
|
||||
}
|
||||
};
|
||||
|
||||
let allEvents = {
|
||||
// global -------------------------------------------------------------------------------------------
|
||||
tabReload: {
|
||||
group: 'global',
|
||||
label: 'Reload tab',
|
||||
keyNames: ['CONTROL', 'R']
|
||||
},
|
||||
signaturePaste: {
|
||||
group: 'global',
|
||||
label: 'Paste signatures from clipboard',
|
||||
keyNames: ['CONTROL', 'V'],
|
||||
alias: 'paste'
|
||||
},
|
||||
|
||||
// map ----------------------------------------------------------------------------------------------
|
||||
mapSystemAdd: {
|
||||
group: 'map',
|
||||
label: 'Add new system',
|
||||
keyNames: ['CONTROL', 'S']
|
||||
},
|
||||
mapSystemsSelect: {
|
||||
group: 'map',
|
||||
label: 'Select all systems',
|
||||
keyNames: ['CONTROL', 'A']
|
||||
},
|
||||
mapSystemsDelete: {
|
||||
group: 'map',
|
||||
label: 'Delete selected systems',
|
||||
keyNames: ['CONTROL', 'D']
|
||||
}
|
||||
};
|
||||
|
||||
let groups = {
|
||||
global: {
|
||||
label: 'Global'
|
||||
},
|
||||
map: {
|
||||
label: 'Map'
|
||||
},
|
||||
signatures: {
|
||||
label: 'Signature'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* enables some console.log() information
|
||||
* @type {boolean}
|
||||
*/
|
||||
let debug = false;
|
||||
|
||||
/**
|
||||
* check interval for "new" active keys
|
||||
* @type {number}
|
||||
*/
|
||||
let keyWatchPeriod = 100;
|
||||
|
||||
/**
|
||||
* DOM data key for an element that lists all active events (comma separated)
|
||||
* @type {string}
|
||||
*/
|
||||
let dataKeyEvents = 'key-events';
|
||||
|
||||
/**
|
||||
* DOM data key prefix whether domElement that holds the trigger needs to be "focused"
|
||||
* @type {string}
|
||||
*/
|
||||
let dataKeyFocusPrefix = 'key-focus-';
|
||||
|
||||
/**
|
||||
* DOM data key that holds the callback function for that element
|
||||
* @type {string}
|
||||
*/
|
||||
let dataKeyCallbackPrefix = 'key-callback-';
|
||||
|
||||
/**
|
||||
* check if module is initiated
|
||||
*/
|
||||
let isInit = false;
|
||||
|
||||
/**
|
||||
* global key map holds all active (hold down) keys
|
||||
* @type {{}}
|
||||
*/
|
||||
let map = {};
|
||||
|
||||
/**
|
||||
* show debug information in console
|
||||
* @param msg
|
||||
* @param element
|
||||
*/
|
||||
let debugWatchKey = (msg, element) => {
|
||||
if(debug){
|
||||
console.info(msg, element);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get all active (hold down) keys at this moment
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getActiveKeys = () => {
|
||||
return Object.keys(map);
|
||||
};
|
||||
|
||||
/**
|
||||
* callback function that compares two arrays
|
||||
* @param element
|
||||
* @param index
|
||||
* @param array
|
||||
*/
|
||||
let compareKeyLists = function(element, index, array) {
|
||||
return this.find(x => x === element);
|
||||
};
|
||||
|
||||
/**
|
||||
* get event names that COULD lead to a "full" event (not all keys pressed yet)
|
||||
* @param keyList
|
||||
* @returns {Array}
|
||||
*/
|
||||
let checkEventNames = (keyList) => {
|
||||
let incompleteEvents = [];
|
||||
for(let event in allEvents){
|
||||
// check if "some" or "all" keys are pressed for en event
|
||||
if( keyList.every(compareKeyLists, allEvents[event].keyNames) ){
|
||||
incompleteEvents.push(event);
|
||||
}
|
||||
}
|
||||
|
||||
return incompleteEvents;
|
||||
};
|
||||
|
||||
/**
|
||||
* get all event names
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getAllEventNames = () => {
|
||||
let eventNames = [];
|
||||
for(let event in allEvents){
|
||||
eventNames.push(event);
|
||||
}
|
||||
return eventNames;
|
||||
};
|
||||
|
||||
/**
|
||||
* get all event names that matches a given keyList
|
||||
* @param keyList
|
||||
* @param checkEvents
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getMatchingEventNames = (keyList, checkEvents) => {
|
||||
checkEvents = checkEvents || getAllEventNames();
|
||||
let events = [];
|
||||
|
||||
for(let event of checkEvents){
|
||||
// check if both key arrays are equal
|
||||
if(
|
||||
allEvents[event].keyNames.every(compareKeyLists, keyList) &&
|
||||
keyList.every(compareKeyLists, allEvents[event].keyNames)
|
||||
){
|
||||
events.push(event);
|
||||
}
|
||||
}
|
||||
|
||||
return events;
|
||||
};
|
||||
|
||||
/**
|
||||
* init global keyWatch interval and check for event trigger (hotKey combinations)
|
||||
*/
|
||||
let init = () => {
|
||||
if( !isInit ){
|
||||
// key watch loop -------------------------------------------------------------------------------
|
||||
let prevActiveKeys = [];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param e
|
||||
* @returns {number} 0: no keys hold, 1: invalid match, 2: partial match, 3: match, 4: alias match, 5: event(s) fired
|
||||
*/
|
||||
let checkForEvents = (e) => {
|
||||
let status = 0;
|
||||
|
||||
// get all pressed keys
|
||||
let activeKeys = getActiveKeys();
|
||||
debugWatchKey('activeKeys', activeKeys);
|
||||
|
||||
// check if "active" keys has changes since last loop
|
||||
if(activeKeys.length){
|
||||
// check for "incomplete" events (not all keys pressed yet)
|
||||
let incompleteEvents = checkEventNames(activeKeys);
|
||||
if(incompleteEvents.length){
|
||||
// "some" event keys pressed OR "all" keys pressed
|
||||
status = 2;
|
||||
|
||||
// check if key combo matches a registered (valid) event
|
||||
let events = getMatchingEventNames(activeKeys, incompleteEvents);
|
||||
if(events.length){
|
||||
status = 3;
|
||||
// check events if there are attached elements to it
|
||||
events.forEach((event) => {
|
||||
// skip events that has an alias and should not be triggered by key combo
|
||||
if( !allEvents[event].alias ){
|
||||
if(allEvents[event].elements){
|
||||
// search for callback functions attached to each element
|
||||
allEvents[event].elements.forEach((domElement) => {
|
||||
let domElementObj = $(domElement);
|
||||
// check if event on this element requires active "focus"
|
||||
let optFocus = domElementObj.data(dataKeyFocusPrefix + event);
|
||||
|
||||
if( !(
|
||||
optFocus &&
|
||||
document.activeElement !== domElement
|
||||
)
|
||||
){
|
||||
// execute callback if valid
|
||||
let callback = domElementObj.data(dataKeyCallbackPrefix + event);
|
||||
if(typeof callback === 'function'){
|
||||
status = 5;
|
||||
callback.call(domElement, domElement, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
status = 4;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}else{
|
||||
// invalid combo
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// store current keys for next loop check
|
||||
prevActiveKeys = activeKeys;
|
||||
|
||||
return status;
|
||||
};
|
||||
|
||||
// set key-events -------------------------------------------------------------------------------
|
||||
let evKeyDown = (e) => {
|
||||
// exclude some HTML Tags from watcher
|
||||
if(
|
||||
e.target.tagName !== 'INPUT' &&
|
||||
e.target.tagName !== 'TEXTAREA'
|
||||
){
|
||||
let key = e.key.toUpperCase();
|
||||
map[key] = true;
|
||||
|
||||
// check for any shortcut combo that triggers an event
|
||||
let status = checkForEvents(e);
|
||||
|
||||
if(
|
||||
status === 2 ||
|
||||
status === 3 ||
|
||||
status === 5
|
||||
){
|
||||
// prevent SOME browser default actions -> we want 'Pathfinder' shortcuts :)
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let evKeyUp = (e) => {
|
||||
let key = e.key.toUpperCase();
|
||||
|
||||
if(map.hasOwnProperty(key)){
|
||||
delete map[key];
|
||||
}
|
||||
};
|
||||
|
||||
let container = $('body');
|
||||
container.on('keydown', evKeyDown);
|
||||
container.on('keyup', evKeyUp);
|
||||
|
||||
// global dom remove listener -------------------------------------------------------------------
|
||||
// -> check whether the removed element had an event listener active and removes them.
|
||||
document.body.addEventListener ('DOMNodeRemoved', function(e){
|
||||
if(typeof e.target.getAttribute === 'function'){
|
||||
let eventNames = e.target.getAttribute(dataKeyEvents);
|
||||
if(eventNames){
|
||||
eventNames.split(',').forEach((event) => {
|
||||
let index = allEvents[event].elements.indexOf(e.target);
|
||||
if(index > -1){
|
||||
// remove element from event list
|
||||
allEvents[event].elements.splice(index, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
isInit = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* add a new "shortCut" combination (event) to a DOM element
|
||||
* @param event
|
||||
* @param callback
|
||||
* @param options
|
||||
*/
|
||||
$.fn.watchKey = function(event, callback, options){
|
||||
|
||||
// default options for keyWatcher on elements
|
||||
let defaultOptions = {
|
||||
focus: false, // element must be focused (active)
|
||||
bubbling: true // elements deeper (children) in the DOM can bubble the event up
|
||||
};
|
||||
|
||||
let customOptions = $.extend(true, {}, defaultOptions, options );
|
||||
|
||||
return this.each((i, domElement) => {
|
||||
let element = $(domElement);
|
||||
|
||||
// init global key events
|
||||
init();
|
||||
|
||||
// check if event is "valid" (exists) and is not already set for this element
|
||||
let validEvent = false;
|
||||
if(allEvents[event].elements){
|
||||
if(allEvents[event].elements.indexOf(domElement) === -1){
|
||||
validEvent = true;
|
||||
}else{
|
||||
console.warn('Event "' + event + '" already set');
|
||||
}
|
||||
}else{
|
||||
validEvent = true;
|
||||
allEvents[event].elements = [];
|
||||
}
|
||||
|
||||
if(validEvent){
|
||||
// store callback options to dom element
|
||||
if(customOptions.focus){
|
||||
let dataAttr = dataKeyFocusPrefix + event;
|
||||
element.data(dataAttr, true);
|
||||
|
||||
// check if DOM element has "tabindex" attr -> required to manually set focus() to it
|
||||
if(!domElement.hasAttribute('tabindex')){
|
||||
domElement.setAttribute('tabindex', 0);
|
||||
}
|
||||
|
||||
// element requires a "focus" listener
|
||||
element.off('click.focusKeyWatcher').on('click.focusKeyWatcher', function(e){
|
||||
if(
|
||||
e.target === this ||
|
||||
customOptions.bubbling
|
||||
){
|
||||
this.focus();
|
||||
debugWatchKey('focus set:', this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// check if is key combo has a native JS event that should be used instead
|
||||
if(allEvents[event].alias){
|
||||
element.on(allEvents[event].alias, callback);
|
||||
}else{
|
||||
// store callback function to dom element
|
||||
let dataAttr = dataKeyCallbackPrefix + event;
|
||||
element.data(dataAttr, callback);
|
||||
}
|
||||
|
||||
// add eventName to dom element as attribute ----------------------------------------------------
|
||||
let currentEventNames = element.attr(dataKeyEvents) ? element.attr(dataKeyEvents).split(',') : [];
|
||||
currentEventNames.push(event);
|
||||
element.attr(dataKeyEvents, currentEventNames.join(','));
|
||||
|
||||
// store domElement to event (global)
|
||||
allEvents[event].elements.push(domElement);
|
||||
|
||||
debugWatchKey('new event "' + event + '" registered', domElement);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get a array with all available shortcut groups and their events
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getGroupedShortcuts = () => {
|
||||
let result = $.extend(true, {}, groups);
|
||||
|
||||
// add combos and events to groups
|
||||
let allEntries = [allCombo, allEvents];
|
||||
for(let i = 0; i < allEntries.length; i++){
|
||||
for(let event in allEntries[i]){
|
||||
let data = allEntries[i][event];
|
||||
|
||||
//format keyNames for UI
|
||||
let keyNames = data.keyNames.map( (key) => {
|
||||
if(key === 'CONTROL'){
|
||||
key = 'ctrl';
|
||||
}
|
||||
return key;
|
||||
});
|
||||
|
||||
let newEventData = {
|
||||
label: data.label,
|
||||
keyNames: keyNames
|
||||
};
|
||||
|
||||
if( result[data.group].events ){
|
||||
result[data.group].events.push(newEventData);
|
||||
}else{
|
||||
result[data.group].events = [newEventData];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// convert obj into array
|
||||
result = Object.values(result);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
return {
|
||||
getGroupedShortcuts: getGroupedShortcuts
|
||||
};
|
||||
});
|
||||
531
public/js/v1.2.5/app/logging.js
Normal file
531
public/js/v1.2.5/app/logging.js
Normal file
@@ -0,0 +1,531 @@
|
||||
/**
|
||||
* logging
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox'
|
||||
], function($, Init, Util, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let logData = []; // cache object for all log entries
|
||||
let logDataTable = null; // "Datatables" Object
|
||||
|
||||
// Morris charts data
|
||||
let maxGraphDataCount = 30; // max date entries for a graph
|
||||
let chartData = {}; // chart Data object for all Morris Log graphs
|
||||
|
||||
let config = {
|
||||
taskDialogId: 'pf-task-dialog', // id for map "task manager" dialog
|
||||
dialogDynamicAreaClass: 'pf-dynamic-area', // class for dynamic areas
|
||||
timestampCounterClass: 'pf-timestamp-counter', // class for "timestamp" counter
|
||||
taskDialogStatusAreaClass: 'pf-task-dialog-status', // class for "status" dynamic area
|
||||
taskDialogLogTableAreaClass: 'pf-task-dialog-table', // class for "log table" dynamic area
|
||||
logGraphClass: 'pf-log-graph', // class for all log Morris graphs
|
||||
tableToolsClass: 'pf-table-tools' // class for table tools
|
||||
};
|
||||
|
||||
/**
|
||||
* get log time string
|
||||
* @returns {string}
|
||||
*/
|
||||
let getLogTime = function(){
|
||||
let serverTime = Util.getServerTime();
|
||||
let logTime = serverTime.toLocaleTimeString('en-US', { hour12: false });
|
||||
|
||||
return logTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* updated "sync status" dynamic dialog area
|
||||
*/
|
||||
let updateSyncStatus = function(){
|
||||
|
||||
// check if task manager dialog is open
|
||||
let logDialog = $('#' + config.taskDialogId);
|
||||
if(logDialog.length){
|
||||
// dialog is open
|
||||
requirejs(['text!templates/modules/sync_status.html', 'mustache'], function(templateSyncStatus, Mustache) {
|
||||
let data = {
|
||||
timestampCounterClass: config.timestampCounterClass,
|
||||
syncStatus: Init.syncStatus,
|
||||
isWebSocket: () => {
|
||||
return (Util.getSyncType() === 'webSocket');
|
||||
},
|
||||
isAjax: () => {
|
||||
return (Util.getSyncType() === 'ajax');
|
||||
}
|
||||
};
|
||||
|
||||
let syncStatusElement = $( Mustache.render(templateSyncStatus, data ) );
|
||||
|
||||
logDialog.find('.' + config.taskDialogStatusAreaClass).html( syncStatusElement );
|
||||
|
||||
logDialog.find('.' + config.timestampCounterClass).initTimestampCounter();
|
||||
|
||||
syncStatusElement.initTooltips({
|
||||
placement: 'right'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the logging dialog
|
||||
*/
|
||||
let showDialog = function(){
|
||||
// dialog content
|
||||
|
||||
requirejs(['text!templates/dialog/task_manager.html', 'mustache'], function(templateTaskManagerDialog, Mustache) {
|
||||
let data = {
|
||||
id: config.taskDialogId,
|
||||
dialogDynamicAreaClass: config.dialogDynamicAreaClass,
|
||||
taskDialogStatusAreaClass: config.taskDialogStatusAreaClass,
|
||||
taskDialogLogTableAreaClass: config.taskDialogLogTableAreaClass,
|
||||
tableActionBarClass: config.tableToolsClass
|
||||
};
|
||||
|
||||
let contentTaskManager = $( Mustache.render(templateTaskManagerDialog, data) );
|
||||
|
||||
let rowElementGraphs = contentTaskManager.find('.row');
|
||||
let taskDialogLogTableAreaElement = contentTaskManager.find('.' + config.taskDialogLogTableAreaClass);
|
||||
|
||||
let logTable = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
|
||||
});
|
||||
|
||||
taskDialogLogTableAreaElement.append(logTable);
|
||||
|
||||
// init log table
|
||||
logDataTable = logTable.DataTable({
|
||||
paging: true,
|
||||
ordering: true,
|
||||
order: [ 1, 'desc' ],
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
pageLength: 10,
|
||||
lengthMenu: [[5, 10, 25, 50, 100, -1], [5, 10, 25, 50, 100, 'All']],
|
||||
data: logData, // load cached logs (if available)
|
||||
language: {
|
||||
emptyTable: 'No entries',
|
||||
zeroRecords: 'No entries found',
|
||||
lengthMenu: 'Show _MENU_ entries',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ entries'
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
title: '<i class="fa fa-lg fa-tag"></i>',
|
||||
width: '18px',
|
||||
searchable: false,
|
||||
class: ['text-center'].join(' '),
|
||||
data: 'status'
|
||||
},{
|
||||
targets: 1,
|
||||
title: '<i class="fa fa-lg fa-fw fa-clock-o"></i> ',
|
||||
width: '50px',
|
||||
searchable: true,
|
||||
class: 'text-right',
|
||||
data: 'time'
|
||||
},{
|
||||
targets: 2,
|
||||
title: '<i class="fa fa-lg fa-fw fa-history"></i> ',
|
||||
width: '35px',
|
||||
searchable: false,
|
||||
class: 'text-right',
|
||||
sType: 'html',
|
||||
data: 'duration'
|
||||
},{
|
||||
targets: 3,
|
||||
title: 'description',
|
||||
searchable: true,
|
||||
data: 'description'
|
||||
},{
|
||||
targets: 4,
|
||||
title: 'type',
|
||||
width: '40px',
|
||||
searchable: true,
|
||||
class: ['text-center'].join(' '),
|
||||
data: 'type'
|
||||
},{
|
||||
targets: 5,
|
||||
title: 'Prozess-ID ',
|
||||
width: '80px',
|
||||
searchable: false,
|
||||
class: 'text-right',
|
||||
data: 'key'
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
// open dialog
|
||||
let logDialog = bootbox.dialog({
|
||||
title: 'Task-Manager',
|
||||
message: contentTaskManager,
|
||||
size: 'large',
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'close',
|
||||
className: 'btn-default'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal dialog is shown
|
||||
logDialog.on('shown.bs.modal', function(e) {
|
||||
updateSyncStatus();
|
||||
|
||||
// show Morris graphs ----------------------------------------------------------
|
||||
|
||||
// function for chart label formation
|
||||
let labelYFormat = function(y){
|
||||
return Math.round(y) + 'ms';
|
||||
};
|
||||
|
||||
for(let key in chartData) {
|
||||
if(chartData.hasOwnProperty(key)) {
|
||||
// create a chart for each key
|
||||
|
||||
let colElementGraph = $('<div>', {
|
||||
class: ['col-md-6'].join(' ')
|
||||
});
|
||||
|
||||
|
||||
// graph element
|
||||
let graphElement = $('<div>', {
|
||||
class: config.logGraphClass
|
||||
});
|
||||
|
||||
let graphArea = $('<div>', {
|
||||
class: config.dialogDynamicAreaClass
|
||||
}).append( graphElement );
|
||||
|
||||
// headline
|
||||
let headline = $('<h4>', {
|
||||
text: key
|
||||
}).prepend(
|
||||
$('<span>', {
|
||||
class: ['txt-color', 'txt-color-grayLight'].join(' '),
|
||||
text: 'Prozess-ID: '
|
||||
})
|
||||
);
|
||||
|
||||
// show update ping between function calls
|
||||
let updateElement = $('<small>', {
|
||||
class: ['txt-color', 'txt-color-blue', 'pull-right'].join(' ')
|
||||
});
|
||||
headline.append(updateElement).append('<br>');
|
||||
|
||||
// show average execution time
|
||||
let averageElement = $('<small>', {
|
||||
class: 'pull-right'
|
||||
});
|
||||
headline.append(averageElement);
|
||||
|
||||
colElementGraph.append( headline );
|
||||
colElementGraph.append( graphArea );
|
||||
|
||||
graphArea.showLoadingAnimation();
|
||||
|
||||
rowElementGraphs.append( colElementGraph );
|
||||
|
||||
// cache DOM Elements that will be updated frequently
|
||||
chartData[key].averageElement = averageElement;
|
||||
chartData[key].updateElement = updateElement;
|
||||
|
||||
chartData[key].graph = Morris.Area({
|
||||
element: graphElement,
|
||||
data: [],
|
||||
xkey: 'x',
|
||||
ykeys: ['y'],
|
||||
labels: [key],
|
||||
units: 'ms',
|
||||
parseTime: false,
|
||||
ymin: 0,
|
||||
yLabelFormat: labelYFormat,
|
||||
padding: 10,
|
||||
hideHover: true,
|
||||
pointSize: 3,
|
||||
lineColors: ['#375959'],
|
||||
pointFillColors: ['#477372'],
|
||||
pointStrokeColors: ['#313335'],
|
||||
lineWidth: 2,
|
||||
grid: false,
|
||||
gridStrokeWidth: 0.3,
|
||||
gridTextSize: 9,
|
||||
gridTextFamily: 'Oxygen Bold',
|
||||
gridTextColor: '#63676a',
|
||||
behaveLikeLine: true,
|
||||
goals: [],
|
||||
goalLineColors: ['#66c84f'],
|
||||
smooth: false,
|
||||
fillOpacity: 0.3,
|
||||
resize: true
|
||||
});
|
||||
|
||||
updateLogGraph(key);
|
||||
|
||||
graphArea.hideLoadingAnimation();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// add dataTable buttons (extension)
|
||||
|
||||
let buttons = new $.fn.dataTable.Buttons( logDataTable, {
|
||||
buttons: [
|
||||
{
|
||||
extend: 'copy',
|
||||
className: 'btn btn-sm btn-default',
|
||||
text: '<i class="fa fa-fw fa-clipboard"></i> copy'
|
||||
},{
|
||||
extend: 'csv',
|
||||
className: 'btn btn-sm btn-default',
|
||||
text: '<i class="fa fa-fw fa-download"></i> csv'
|
||||
}
|
||||
]
|
||||
} );
|
||||
|
||||
logDataTable.buttons().container().appendTo( $(this).find('.' + config.tableToolsClass));
|
||||
});
|
||||
|
||||
|
||||
// modal dialog is closed
|
||||
logDialog.on('hidden.bs.modal', function(e) {
|
||||
// clear memory -> destroy all charts
|
||||
for (let key in chartData) {
|
||||
if (chartData.hasOwnProperty(key)) {
|
||||
chartData[key].graph = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal dialog before hide
|
||||
logDialog.on('hide.bs.modal', function(e) {
|
||||
|
||||
// destroy logTable
|
||||
logDataTable.destroy(true);
|
||||
logDataTable= null;
|
||||
|
||||
// remove event -> prevent calling this multiple times
|
||||
$(this).off('hide.bs.modal');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* updates the log graph for a log key
|
||||
* @param key
|
||||
* @param duration (if undefined -> just update graph with current data)
|
||||
*/
|
||||
let updateLogGraph = function(key, duration){
|
||||
|
||||
// check if graph data already exist
|
||||
if( !(chartData.hasOwnProperty(key))){
|
||||
chartData[key] = {};
|
||||
chartData[key].data = [];
|
||||
chartData[key].graph = null;
|
||||
chartData[key].averageElement = null;
|
||||
chartData[key].updateElement = null;
|
||||
}
|
||||
|
||||
// add new value
|
||||
if(duration !== undefined){
|
||||
chartData[key].data.unshift(duration);
|
||||
}
|
||||
|
||||
if(chartData[key].data.length > maxGraphDataCount){
|
||||
chartData[key].data = chartData[key].data.slice(0, maxGraphDataCount);
|
||||
}
|
||||
|
||||
function getGraphData(data) {
|
||||
let tempChartData = {
|
||||
data: [],
|
||||
dataSum: 0,
|
||||
average: 0
|
||||
};
|
||||
|
||||
for(let x = 0; x < maxGraphDataCount; x++){
|
||||
let value = 0;
|
||||
if(data[x]){
|
||||
value = data[x];
|
||||
tempChartData.dataSum = Number( (tempChartData.dataSum + value).toFixed(2) );
|
||||
}
|
||||
|
||||
tempChartData.data.push({
|
||||
x: x,
|
||||
y: value
|
||||
});
|
||||
}
|
||||
|
||||
// calculate average
|
||||
tempChartData.average = Number( ( tempChartData.dataSum / data.length ).toFixed(2) );
|
||||
|
||||
return tempChartData;
|
||||
}
|
||||
|
||||
let tempChartData = getGraphData(chartData[key].data);
|
||||
|
||||
// add new data to graph (Morris chart) - if is already initialized
|
||||
if(chartData[key].graph !== null){
|
||||
let avgElement = chartData[key].averageElement;
|
||||
let updateElement = chartData[key].updateElement;
|
||||
|
||||
let delay = Util.getCurrentTriggerDelay( key, 0 );
|
||||
|
||||
if(delay){
|
||||
updateElement[0].textContent = ' delay: ' + delay + 'ms ';
|
||||
}
|
||||
|
||||
// set/change average line
|
||||
chartData[key].graph.options.goals = [tempChartData.average];
|
||||
|
||||
// change avg. display
|
||||
avgElement[0].textContent = 'Avg. ' + tempChartData.average + 'ms';
|
||||
|
||||
let avgStatus = getLogStatusByDuration(key, tempChartData.average);
|
||||
let avgStatusClass = Util.getLogInfo( avgStatus, 'class' );
|
||||
|
||||
//change avg. display class
|
||||
if( !avgElement.hasClass(avgStatusClass) ){
|
||||
// avg status changed!
|
||||
avgElement.removeClass().addClass('pull-right txt-color ' + avgStatusClass);
|
||||
|
||||
// change goals line color
|
||||
if(avgStatus === 'warning'){
|
||||
chartData[key].graph.options.goalLineColors = ['#e28a0d'];
|
||||
$(document).setProgramStatus('slow connection');
|
||||
}else{
|
||||
chartData[key].graph.options.goalLineColors = ['#5cb85c'];
|
||||
}
|
||||
}
|
||||
|
||||
// set new data and redraw
|
||||
chartData[key].graph.setData( tempChartData.data );
|
||||
}
|
||||
|
||||
return tempChartData.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the log "status" by log duration (ms).
|
||||
* If duration > warning limit -> show as warning
|
||||
* @param logKey
|
||||
* @param logDuration
|
||||
* @returns {string}
|
||||
*/
|
||||
let getLogStatusByDuration = function(logKey, logDuration){
|
||||
let logStatus = 'info';
|
||||
if( logDuration > Init.timer[logKey].EXECUTION_LIMIT ){
|
||||
logStatus = 'warning';
|
||||
}
|
||||
return logStatus;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the css class for a specific log type
|
||||
* @param logType
|
||||
* @returns {string}
|
||||
*/
|
||||
let getLogTypeIconClass = function(logType){
|
||||
|
||||
let logIconClass = '';
|
||||
|
||||
switch(logType){
|
||||
case 'client':
|
||||
logIconClass = 'fa-user';
|
||||
break;
|
||||
case 'server':
|
||||
logIconClass = 'fa-download';
|
||||
break;
|
||||
}
|
||||
|
||||
return logIconClass;
|
||||
};
|
||||
|
||||
/**
|
||||
* init logging -> set global log events
|
||||
*/
|
||||
let init = function(){
|
||||
|
||||
let maxEntries = 150;
|
||||
|
||||
$(window).on('pf:syncStatus', function(){
|
||||
updateSyncStatus();
|
||||
});
|
||||
|
||||
// set global logging listener
|
||||
$(window).on('pf:log', function(e, logKey, options){
|
||||
|
||||
// check required logging information
|
||||
if(
|
||||
options &&
|
||||
options.duration &&
|
||||
options.description
|
||||
){
|
||||
let logDescription = options.description;
|
||||
let logDuration = options.duration;
|
||||
let logType = options.type;
|
||||
|
||||
// check log status by duration
|
||||
let logStatus = getLogStatusByDuration(logKey, logDuration);
|
||||
let statusClass = Util.getLogInfo( logStatus, 'class' );
|
||||
let typeIconClass = getLogTypeIconClass(logType);
|
||||
|
||||
// update graph data
|
||||
updateLogGraph(logKey, logDuration);
|
||||
|
||||
let logRowData = {
|
||||
status: '<i class="fa fa-fw fa-circle txt-color ' + statusClass + '"></i>',
|
||||
time: getLogTime(),
|
||||
duration: '<span class="txt-color ' + statusClass + '">' + logDuration + '<small>ms</small></span>',
|
||||
description: logDescription,
|
||||
type: '<i class="fa ' + typeIconClass + '"></i>',
|
||||
key: logKey
|
||||
};
|
||||
|
||||
|
||||
if(logDataTable){
|
||||
// add row if dataTable is initialized before new log
|
||||
logDataTable.row.add( logRowData ).draw(false);
|
||||
}else{
|
||||
// add row data to cache
|
||||
logData.push(logRowData);
|
||||
}
|
||||
}
|
||||
|
||||
// delete old log entries from table ---------------------------------
|
||||
let rowCount = logData.length;
|
||||
|
||||
if( rowCount >= maxEntries ){
|
||||
|
||||
if(logDataTable){
|
||||
logDataTable.rows(0, {order:'index'}).remove().draw(false);
|
||||
}else{
|
||||
logData.shift();
|
||||
}
|
||||
}
|
||||
|
||||
// cache logs in order to keep previous logs in table after reopening the dialog
|
||||
if(logDataTable){
|
||||
logData = logDataTable.rows({order:'index'}).data();
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
init: init,
|
||||
getLogTime: getLogTime,
|
||||
showDialog: showDialog
|
||||
};
|
||||
});
|
||||
853
public/js/v1.2.5/app/login.js
Normal file
853
public/js/v1.2.5/app/login.js
Normal file
@@ -0,0 +1,853 @@
|
||||
/**
|
||||
* Main loginPage application
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'blueImpGallery',
|
||||
'bootbox',
|
||||
'lazyload',
|
||||
'app/ui/header',
|
||||
'app/ui/logo',
|
||||
'app/ui/demo_map',
|
||||
'dialog/account_settings',
|
||||
'dialog/notification',
|
||||
'dialog/manual',
|
||||
'dialog/releases',
|
||||
'dialog/credit'
|
||||
], function($, Init, Util, Render, Gallery, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
splashOverlayClass: 'pf-splash', // class for "splash" overlay
|
||||
|
||||
// header
|
||||
headerId: 'pf-landing-top', // id for header
|
||||
headerContainerId: 'pf-header-container', // id for header container
|
||||
logoContainerId: 'pf-logo-container', // id for main header logo container
|
||||
headHeaderMapId: 'pf-header-map', // id for header image (svg animation)
|
||||
|
||||
// map bg
|
||||
headMapBgId: 'pf-header-map-bg', // id for header background container
|
||||
mapNeocomId: 'pf-map-neocom', // id for map "neocom" image
|
||||
mapBrowserId: 'pf-map-browser', // id for "browser" image
|
||||
mapBgImageId: 'pf-map-bg-image', // id for "background" map image
|
||||
|
||||
// navigation
|
||||
navigationElementId: 'pf-navbar', // id for navbar element
|
||||
navigationLinkManualClass: 'pf-navbar-manual', // class for "manual" trigger link
|
||||
navigationLinkLicenseClass: 'pf-navbar-license', // class for "license" trigger link
|
||||
navigationVersionLinkClass: 'pf-navbar-version-info', // class for "version information"
|
||||
|
||||
// cookie hint
|
||||
cookieHintId: 'pf-cookie-hint', // id for "cookie hint" element
|
||||
|
||||
// login
|
||||
ssoButtonClass: 'pf-sso-login-button', // class for SSO login button
|
||||
|
||||
// character select
|
||||
characterSelectionClass: 'pf-character-selection', // class for character panel wrapper
|
||||
characterRowAnimateClass: 'pf-character-row-animate', // class for character panel row during animation
|
||||
characterImageWrapperClass: 'pf-character-image-wrapper', // class for image wrapper (animated)
|
||||
characterImageInfoClass: 'pf-character-info', // class for character info layer (visible on hover)
|
||||
dynamicMessageContainerClass: 'pf-dynamic-message-container', // class for "dynamic" (JS) message container
|
||||
|
||||
// gallery
|
||||
galleryId: 'pf-gallery', // id for gallery container
|
||||
galleryThumbImageClass: 'pf-landing-image-preview', // class for gallery thumb images
|
||||
galleryThumbContainerId: 'pf-landing-gallery-thumb-container', // id for gallery thumb images
|
||||
galleryCarouselId: 'pf-landing-gallery-carousel', // id for "carousel" element
|
||||
|
||||
// notification panel
|
||||
notificationPanelId: 'pf-notification-panel', // id for "notification panel" (e.g. last update information)
|
||||
|
||||
// sticky panel
|
||||
stickyPanelClass: 'pf-landing-sticky-panel', // class for sticky panels
|
||||
stickyPanelServerId: 'pf-landing-server-panel', // id for EVE Online server status panel
|
||||
stickyPanelAdminId: 'pf-landing-admin-panel', // id for admin login panel
|
||||
|
||||
// animation
|
||||
animateElementClass: 'pf-animate-on-visible', // class for elements that will be animated to show
|
||||
|
||||
defaultAcceptCookieExpire: 365 // default expire for "accept coolies" cookie
|
||||
};
|
||||
|
||||
/**
|
||||
* set a cookie
|
||||
* @param cname
|
||||
* @param cvalue
|
||||
* @param exdays
|
||||
*/
|
||||
let setCookie = function(cname, cvalue, exdays) {
|
||||
let d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
let expires = 'expires=' + d.toUTCString();
|
||||
let path = 'path=' + Util.getDocumentPath();
|
||||
document.cookie = cname + '=' + cvalue + '; ' + expires + '; ' + path;
|
||||
};
|
||||
|
||||
/**
|
||||
* get cookie value by name
|
||||
* @param cname
|
||||
* @returns {*}
|
||||
*/
|
||||
let getCookie = function(cname) {
|
||||
let name = cname + '=';
|
||||
let ca = document.cookie.split(';');
|
||||
|
||||
for(let i = 0; i <ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) === ' ') {
|
||||
c = c.substring(1);
|
||||
}
|
||||
|
||||
if (c.indexOf(name) === 0) {
|
||||
return c.substring(name.length,c.length);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
/**
|
||||
* set link observer for "version info" dialog
|
||||
*/
|
||||
let setVersionLinkObserver = function(){
|
||||
$('.' + config.navigationVersionLinkClass).off('click').on('click', function(e){
|
||||
$.fn.releasesDialog();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* move panel out of "cookie" accept hint
|
||||
* @param direction
|
||||
*/
|
||||
let moveAdminPanel = (direction) => {
|
||||
let adminPanel = $('#' + config.stickyPanelAdminId);
|
||||
adminPanel.css({bottom: ((direction === 'up') ? '+' : '-') + '=35px'});
|
||||
};
|
||||
|
||||
/**
|
||||
* set page observer
|
||||
*/
|
||||
let setPageObserver = function(){
|
||||
let cookieHintElement = $('#' + config.cookieHintId);
|
||||
|
||||
// cookie hint --------------------------------------------------------
|
||||
cookieHintElement.on('show.bs.collapse', function () {
|
||||
// move admin panel upwards (prevents overlapping with cookie notice)
|
||||
moveAdminPanel('up');
|
||||
});
|
||||
|
||||
cookieHintElement.on('hidden.bs.collapse', function () {
|
||||
moveAdminPanel('down');
|
||||
});
|
||||
|
||||
if(getCookie('cookie') !== '1'){
|
||||
// hint not excepted
|
||||
cookieHintElement.collapse('show');
|
||||
|
||||
// show Cookie accept hint on SSO login button
|
||||
let confirmationSettings = {
|
||||
container: 'body',
|
||||
placement: 'bottom',
|
||||
btnOkClass: 'btn btn-sm btn-default',
|
||||
btnOkLabel: 'dismiss',
|
||||
btnOkIcon: 'fa fa-fw fa-sign-in',
|
||||
title: 'Accept cookies',
|
||||
btnCancelClass: 'btn btn-sm btn-success',
|
||||
btnCancelLabel: 'accept',
|
||||
btnCancelIcon: 'fa fa-fw fa-check',
|
||||
onCancel: function(e, target){
|
||||
// "Accept cookies"
|
||||
setCookie('cookie', 1, config.defaultAcceptCookieExpire);
|
||||
|
||||
// set "default" href
|
||||
let href = $(target).data('bs.confirmation').getHref();
|
||||
$(e.target).attr('href', href);
|
||||
},
|
||||
onConfirm : function(e, target){
|
||||
// "NO cookies" => trigger "default" href link action
|
||||
},
|
||||
href: function(target){
|
||||
return $(target).attr('href');
|
||||
}
|
||||
};
|
||||
|
||||
$('.' + config.ssoButtonClass).confirmation(confirmationSettings);
|
||||
}
|
||||
|
||||
cookieHintElement.find('.btn-success').on('click', function(){
|
||||
setCookie('cookie', 1, config.defaultAcceptCookieExpire);
|
||||
});
|
||||
|
||||
// manual -------------------------------------------------------------
|
||||
$('.' + config.navigationLinkManualClass).on('click', function(e){
|
||||
e.preventDefault();
|
||||
$.fn.showMapManual();
|
||||
});
|
||||
|
||||
// license ------------------------------------------------------------
|
||||
$('.' + config.navigationLinkLicenseClass).on('click', function(e){
|
||||
e.preventDefault();
|
||||
$.fn.showCreditsDialog(false, true);
|
||||
});
|
||||
|
||||
// releases -----------------------------------------------------------
|
||||
setVersionLinkObserver();
|
||||
|
||||
// tooltips -----------------------------------------------------------
|
||||
let mapTooltipOptions = {
|
||||
toggle: 'tooltip',
|
||||
delay: 150
|
||||
};
|
||||
|
||||
let tooltipElements = $('[title]').not('.slide img');
|
||||
tooltipElements.tooltip(mapTooltipOptions);
|
||||
|
||||
// initial show some tooltips
|
||||
tooltipElements.filter('[data-show="1"]').tooltip('show');
|
||||
};
|
||||
|
||||
/**
|
||||
* init image carousel
|
||||
*/
|
||||
let initCarousel = function(){
|
||||
|
||||
// check if carousel exists
|
||||
if($('#' + config.galleryCarouselId).length === 0){
|
||||
return;
|
||||
}
|
||||
|
||||
// extent "blueimp" gallery for a textFactory method to show HTML templates
|
||||
Gallery.prototype.textFactory = function (obj, callback) {
|
||||
let newSlideContent = $('<div>')
|
||||
.addClass('text-content')
|
||||
.attr('imgTitle', obj.title);
|
||||
|
||||
let moduleConfig = {
|
||||
name: obj.href, // template name
|
||||
position: newSlideContent,
|
||||
functions: {
|
||||
after: function(){
|
||||
// element inserted -> load complete
|
||||
callback({
|
||||
type: 'complete',
|
||||
target: newSlideContent[0]
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// render HTML file (template)
|
||||
let moduleData = {
|
||||
id: config.headHeaderMapId,
|
||||
bgId: config.headMapBgId,
|
||||
neocomId: config.mapNeocomId,
|
||||
browserId: config.mapBrowserId,
|
||||
mapBgImageId: config.mapBgImageId
|
||||
};
|
||||
|
||||
Render.showModule(moduleConfig, moduleData);
|
||||
|
||||
return newSlideContent[0];
|
||||
};
|
||||
|
||||
// initialize carousel ------------------------------------------------
|
||||
let carousel = new Gallery([
|
||||
{
|
||||
imgTitle: 'Browser',
|
||||
href: 'ui/map',
|
||||
type: 'text/html'
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/responsive.jpg',
|
||||
imgTitle: 'Responsive layout',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/pathfinder_1.jpg',
|
||||
imgTitle: 'Map view',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/pathfinder_3.jpg',
|
||||
imgTitle: 'Map information',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/pathfinder_2.jpg',
|
||||
imgTitle: 'System information',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
}
|
||||
], {
|
||||
container: '#' + config.galleryCarouselId,
|
||||
carousel: true,
|
||||
startSlideshow: false,
|
||||
titleProperty: 'imgTitle',
|
||||
transitionSpeed: 600,
|
||||
slideshowInterval: 5000,
|
||||
onopened: function () {
|
||||
// Callback function executed when the Gallery has been initialized
|
||||
// and the initialization transition has been completed.
|
||||
// -> show "demo" map
|
||||
|
||||
// set title for first slide
|
||||
$( this.options.container ).find( this.options.titleElement).text('Browser view');
|
||||
|
||||
$('#' + config.headHeaderMapId).drawDemoMap(function(){
|
||||
|
||||
// zoom map SVGs
|
||||
$('#' + config.headHeaderMapId + ' svg').velocity({
|
||||
scaleX: 0.66,
|
||||
scaleY: 0.66
|
||||
}, {
|
||||
duration: 360
|
||||
});
|
||||
|
||||
// position map container
|
||||
$('#' + config.headHeaderMapId).velocity({
|
||||
marginTop: '130px',
|
||||
marginLeft: '-50px'
|
||||
}, {
|
||||
duration: 360,
|
||||
complete: function(){
|
||||
// show browser
|
||||
$('#' + config.mapBrowserId).velocity('transition.slideUpBigIn', {
|
||||
duration: 360,
|
||||
complete: function(){
|
||||
// show neocom
|
||||
$('#' + config.mapNeocomId).velocity('transition.slideLeftIn', {
|
||||
duration: 180
|
||||
});
|
||||
|
||||
// show background
|
||||
$('#' + config.mapBgImageId).velocity('transition.shrinkIn', {
|
||||
duration: 360
|
||||
});
|
||||
|
||||
// when map is shown -> start carousel looping
|
||||
carousel.play();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get all thumbnail elements
|
||||
* @returns {*|jQuery|HTMLElement}
|
||||
*/
|
||||
let getThumbnailElements = function(){
|
||||
return $('a[data-gallery="#' + config.galleryId + '"]').not('.disabled');
|
||||
};
|
||||
|
||||
/**
|
||||
* init gallery for thumbnail elements
|
||||
* @param newElements
|
||||
*/
|
||||
let initGallery = function(newElements){
|
||||
if( newElements.length > 0){
|
||||
// We have to add ALL thumbnail elements to the gallery!
|
||||
// -> even those wthat are invisible (not lazyLoaded) now!
|
||||
// -> This is required for "swipe" through all images
|
||||
let allThumbLinks = getThumbnailElements();
|
||||
|
||||
requirejs(['blueImpGalleryBootstrap'], function() {
|
||||
$(newElements).each(function() {
|
||||
let borderless = false;
|
||||
|
||||
let galleryElement = $('#' + config.galleryId);
|
||||
galleryElement.data('useBootstrapModal', !borderless);
|
||||
galleryElement.toggleClass('blueimp-gallery-controls', borderless);
|
||||
|
||||
$(this).on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
e = e || window.event;
|
||||
let target = e.target || e.srcElement;
|
||||
let link = target.src ? target.parentNode : target;
|
||||
|
||||
let options = {
|
||||
index: link,
|
||||
event: e,
|
||||
container: '#' + config.galleryId,
|
||||
titleProperty: 'description'
|
||||
};
|
||||
|
||||
new Gallery(allThumbLinks, options);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* init "YouTube" video preview
|
||||
*/
|
||||
let initYoutube = function(){
|
||||
|
||||
$('.youtube').each(function() {
|
||||
// Based on the YouTube ID, we can easily find the thumbnail image
|
||||
$(this).css('background-image', 'url(//i.ytimg.com/vi/' + this.id + '/sddefault.jpg)');
|
||||
|
||||
// Overlay the Play icon to make it look like a video player
|
||||
$(this).append($('<div/>', {'class': 'play'}));
|
||||
|
||||
$(document).delegate('#' + this.id, 'click', function() {
|
||||
// Create an iFrame with autoplay set to true
|
||||
let iFrameUrl = '//www.youtube.com/embed/' + this.id + '?autoplay=1&autohide=1';
|
||||
if ( $(this).data('params') ){
|
||||
iFrameUrl += '&'+$(this).data('params');
|
||||
}
|
||||
|
||||
// The height and width of the iFrame should be the same as parent
|
||||
let iFrame = $('<iframe/>', {
|
||||
frameborder: '0',
|
||||
src: iFrameUrl,
|
||||
width: $(this).width(),
|
||||
height: $(this).height(),
|
||||
class: 'pricing-big'
|
||||
});
|
||||
|
||||
// Replace the YouTube thumbnail with YouTube HTML5 Player
|
||||
$(this).replaceWith(iFrame);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init scrollSpy for navigation bar
|
||||
*/
|
||||
let initScrollSpy = function(){
|
||||
// init scrollspy
|
||||
|
||||
// show elements that are currently in the viewport
|
||||
let showVisibleElements = function(){
|
||||
// find all elements that should be animated
|
||||
let visibleElements = $('.' + config.animateElementClass).isInViewport();
|
||||
|
||||
$(visibleElements).removeClass( config.animateElementClass );
|
||||
|
||||
$(visibleElements).velocity('transition.flipXIn', {
|
||||
duration: 600,
|
||||
stagger: 60,
|
||||
delay: 500,
|
||||
complete: function(element){
|
||||
// show "fade" modules (e.g. ribbons)
|
||||
$(element).find('.fade').addClass('in');
|
||||
|
||||
// init gallery for "now" visible elements
|
||||
let newGalleryElements = $(element).filter('[data-gallery="#' + config.galleryId + '"]');
|
||||
initGallery(newGalleryElements);
|
||||
},
|
||||
visibility: 'visible'
|
||||
});
|
||||
};
|
||||
|
||||
$( window ).scroll(function() {
|
||||
// check for new visible elements
|
||||
showVisibleElements();
|
||||
});
|
||||
|
||||
// initial check for visible elements
|
||||
showVisibleElements();
|
||||
|
||||
// event listener for navigation links
|
||||
$('.page-scroll').on('click', function(){
|
||||
// get element to scroll
|
||||
let anchorTag = $(this).attr('data-anchor');
|
||||
|
||||
// scroll to container
|
||||
$(anchorTag).velocity('scroll', {
|
||||
duration: 300,
|
||||
easing: 'swing'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get current EVE-Online server status
|
||||
* -> show "server panel"
|
||||
*/
|
||||
let initServerStatus = function(){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.getServerStatus,
|
||||
dataType: 'json'
|
||||
}).done(function(responseData, textStatus, request){
|
||||
|
||||
if(responseData.hasOwnProperty('status')){
|
||||
let data = responseData.status;
|
||||
data.stickyPanelServerId = config.stickyPanelServerId;
|
||||
data.stickyPanelClass = config.stickyPanelClass;
|
||||
|
||||
let statusClass = '';
|
||||
switch(data.serviceStatus.toLowerCase()){
|
||||
case 'online': statusClass = 'txt-color-green'; break;
|
||||
case 'vip': statusClass = 'txt-color-orange'; break;
|
||||
case 'offline': statusClass = 'txt-color-redDarker'; break;
|
||||
}
|
||||
data.serviceStatus = {
|
||||
eve: data.serviceStatus,
|
||||
style: statusClass
|
||||
};
|
||||
|
||||
requirejs(['text!templates/ui/server_panel.html', 'mustache'], function(template, Mustache) {
|
||||
let content = Mustache.render(template, data);
|
||||
$('#' + config.headerId).prepend(content);
|
||||
$('#' + config.stickyPanelServerId).velocity('transition.slideLeftBigIn', {
|
||||
duration: 240
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}).fail(handleAjaxErrorResponse);
|
||||
};
|
||||
|
||||
/**
|
||||
* show "notification panel" to user
|
||||
* -> checks if panel not already shown
|
||||
*/
|
||||
let initNotificationPanel = function(){
|
||||
let storageKey = 'notification_panel';
|
||||
let currentVersion = Util.getVersion();
|
||||
|
||||
let showNotificationPanel = function(){
|
||||
let data = {
|
||||
version: Util.getVersion()
|
||||
};
|
||||
|
||||
requirejs(['text!templates/ui/notice.html', 'mustache'], function(template, Mustache) {
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
let notificationPanel = $('#' + config.notificationPanelId);
|
||||
notificationPanel.html(content);
|
||||
notificationPanel.velocity('transition.slideUpIn', {
|
||||
duration: 300,
|
||||
complete: function(){
|
||||
setVersionLinkObserver();
|
||||
|
||||
// mark panel as "shown"
|
||||
Util.getLocalStorage().setItem(storageKey, currentVersion);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Util.getLocalStorage().getItem(storageKey).then(function(data){
|
||||
// check if panel was shown before
|
||||
if(data){
|
||||
if(data !== this.version){
|
||||
// show current panel
|
||||
showNotificationPanel();
|
||||
}
|
||||
}else{
|
||||
// show current panel
|
||||
showNotificationPanel();
|
||||
}
|
||||
}.bind({
|
||||
version: currentVersion
|
||||
}));
|
||||
};
|
||||
|
||||
/**
|
||||
* load character data from cookie information
|
||||
* -> all validation is done server side!
|
||||
*/
|
||||
let initCharacterSelect = function(){
|
||||
|
||||
/**
|
||||
* init panel animation for an element
|
||||
* @param imageWrapperElement
|
||||
*/
|
||||
let initCharacterAnimation = function(imageWrapperElement){
|
||||
|
||||
imageWrapperElement.velocity('stop').velocity('transition.flipBounceXIn', {
|
||||
display: 'inline-block',
|
||||
drag: true,
|
||||
duration: 500
|
||||
});
|
||||
|
||||
// Hover effect for character info layer
|
||||
imageWrapperElement.hoverIntent(function(e){
|
||||
let characterInfoElement = $(this).find('.' + config.characterImageInfoClass);
|
||||
|
||||
characterInfoElement.velocity('finish').velocity({
|
||||
width: ['100%', [ 400, 15 ] ]
|
||||
},{
|
||||
easing: 'easeOutSine'
|
||||
});
|
||||
}, function(e){
|
||||
let characterInfoElement = $(this).find('.' + config.characterImageInfoClass);
|
||||
|
||||
characterInfoElement.velocity('finish').velocity({
|
||||
width: 0
|
||||
},{
|
||||
duration: 150,
|
||||
easing: 'easeOutSine'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* update all character panels -> set CSS class (e.g. after some panels were added/removed,..)
|
||||
*/
|
||||
let updateCharacterPanels = function(){
|
||||
let characterRows = $('.' + config.characterSelectionClass + ' .pf-dynamic-area').parent();
|
||||
let rowClassIdentifier = ((12 / characterRows.length ) <= 3) ? 3 : (12 / characterRows.length);
|
||||
$(characterRows).removeClass().addClass('col-sm-' + rowClassIdentifier);
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
let removeCharacterPanel = function(panelElement){
|
||||
$(panelElement).velocity('transition.expandOut', {
|
||||
duration: 250,
|
||||
complete: function () {
|
||||
// lock row for CSS animations while removing...
|
||||
$(this).parent().addClass(config.characterRowAnimateClass);
|
||||
|
||||
$(this).parent().velocity({
|
||||
width: 0
|
||||
},{
|
||||
easing: 'ease',
|
||||
duration: 300,
|
||||
complete: function(){
|
||||
$(this).remove();
|
||||
// reset column CSS classes for all existing panels
|
||||
updateCharacterPanels();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
let getCharacterAuthLabel = (authStatus) => {
|
||||
let label = '';
|
||||
switch(authStatus){
|
||||
case 'UNKNOWN':
|
||||
label = 'ERROR';
|
||||
break;
|
||||
case 'CORPORATION':
|
||||
case 'ALLIANCE':
|
||||
label = 'INVALID';
|
||||
break;
|
||||
default:
|
||||
label = authStatus;
|
||||
break;
|
||||
}
|
||||
return label;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// request character data for each character panel
|
||||
requirejs(['text!templates/ui/character_panel.html', 'mustache'], function(template, Mustache){
|
||||
|
||||
$('.' + config.characterSelectionClass + ' .pf-dynamic-area').each(function(){
|
||||
let characterElement = $(this);
|
||||
|
||||
characterElement.showLoadingAnimation();
|
||||
|
||||
let requestData = {
|
||||
cookie: characterElement.data('cookie')
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.getCookieCharacterData,
|
||||
data: requestData,
|
||||
dataType: 'json',
|
||||
context: {
|
||||
cookieName: requestData.cookie,
|
||||
characterElement: characterElement
|
||||
}
|
||||
}).done(function(responseData, textStatus, request){
|
||||
this.characterElement.hideLoadingAnimation();
|
||||
|
||||
if(
|
||||
responseData.error &&
|
||||
responseData.error.length > 0
|
||||
){
|
||||
$('.' + config.dynamicMessageContainerClass).showMessage({
|
||||
dismissible: false,
|
||||
type: responseData.error[0].type,
|
||||
title: 'Character verification failed',
|
||||
text: responseData.error[0].message
|
||||
});
|
||||
}
|
||||
|
||||
if(responseData.hasOwnProperty('character')){
|
||||
|
||||
let data = {
|
||||
link: this.characterElement.data('href'),
|
||||
cookieName: this.cookieName,
|
||||
character: responseData.character,
|
||||
authLabel: getCharacterAuthLabel(responseData.character.authStatus),
|
||||
authOK: responseData.character.authStatus === 'OK'
|
||||
};
|
||||
|
||||
let content = Mustache.render(template, data);
|
||||
this.characterElement.html(content);
|
||||
|
||||
// lock character selection on click (prevent click spamming)
|
||||
this.characterElement.find('a').on('click', function(){
|
||||
$('.' + config.splashOverlayClass).showSplashOverlay();
|
||||
});
|
||||
|
||||
// show character panel (animation settings)
|
||||
initCharacterAnimation(this.characterElement.find('.' + config.characterImageWrapperClass));
|
||||
}else{
|
||||
// character data not available -> remove panel
|
||||
removeCharacterPanel(this.characterElement);
|
||||
}
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
let characterElement = this.characterElement;
|
||||
characterElement.hideLoadingAnimation();
|
||||
|
||||
// character data not available -> remove panel
|
||||
removeCharacterPanel(this.characterElement);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* default ajax error handler
|
||||
* -> show user notifications
|
||||
* @param jqXHR
|
||||
* @param status
|
||||
* @param error
|
||||
*/
|
||||
let handleAjaxErrorResponse = function(jqXHR, status, error){
|
||||
|
||||
let type = status;
|
||||
let title = 'Status ' + jqXHR.status + ': ' + error;
|
||||
let message = '';
|
||||
|
||||
if(jqXHR.responseText){
|
||||
let errorObj = $.parseJSON(jqXHR.responseText);
|
||||
|
||||
if(
|
||||
errorObj.error &&
|
||||
errorObj.error.length > 0
|
||||
){
|
||||
for(let i = 0; i < errorObj.error.length; i++){
|
||||
let errorData = errorObj.error[i];
|
||||
type = errorData.type;
|
||||
title = 'Status ' + errorData.code + ': ' + errorData.status;
|
||||
message = errorData.message;
|
||||
|
||||
Util.showNotify({title: title, text: message, type: type});
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Util.showNotify({title: title, text: message, type: type});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* main init "landing" page
|
||||
*/
|
||||
$(function(){
|
||||
// set Dialog default config
|
||||
Util.initDefaultBootboxConfig();
|
||||
|
||||
// show app information in browser console
|
||||
Util.showVersionInfo();
|
||||
|
||||
// show log off message
|
||||
let isLogOut = location.search.split('logout')[1];
|
||||
if(isLogOut !== undefined){
|
||||
|
||||
// show logout dialog
|
||||
let options = {
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'close',
|
||||
className: ['btn-default'].join(' ')
|
||||
}
|
||||
},
|
||||
content: {
|
||||
icon: 'fa-sign-out',
|
||||
class: 'txt-color-warning',
|
||||
title: 'Logout',
|
||||
headline: 'Logout',
|
||||
text: [
|
||||
'For security reasons, you were logged out automatically',
|
||||
'Please log in again'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.showNotificationDialog(options);
|
||||
|
||||
// change url (remove logout parameter)
|
||||
if (history.pushState) {
|
||||
history.pushState({}, '', location.protocol + '//' + location.host + location.pathname);
|
||||
}
|
||||
}
|
||||
|
||||
// "Lock" default link action (=> open in new tab)!
|
||||
// -> until "gallery" is initialized (=> wait animation complete!)
|
||||
getThumbnailElements().on('click', function(e){
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// init "lazy loading" for images
|
||||
$('.' + config.galleryThumbImageClass).lazyload({
|
||||
threshold : 300
|
||||
});
|
||||
|
||||
// hide splash loading animation
|
||||
$('.' + config.splashOverlayClass).hideSplashOverlay();
|
||||
|
||||
// init server status information
|
||||
initServerStatus();
|
||||
|
||||
// init notification panel
|
||||
initNotificationPanel();
|
||||
|
||||
// init character select
|
||||
initCharacterSelect();
|
||||
|
||||
// init page observer
|
||||
setPageObserver();
|
||||
|
||||
// init carousel
|
||||
initCarousel();
|
||||
|
||||
// init scrollspy
|
||||
// -> after "Carousel"! required for correct "viewport" calculation (Gallery)!
|
||||
initScrollSpy();
|
||||
|
||||
// init youtube videos
|
||||
initYoutube();
|
||||
|
||||
// draw header logo
|
||||
$('#' + config.logoContainerId).drawLogo(function(){
|
||||
// init header animation
|
||||
$('#' + config.headerContainerId).initHeader(function(){
|
||||
|
||||
});
|
||||
}, false);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
132
public/js/v1.2.5/app/map/contextmenu.js
Normal file
132
public/js/v1.2.5/app/map/contextmenu.js
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* context menu
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery'
|
||||
], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$.fn.contextMenu = function (settings) {
|
||||
|
||||
// animation
|
||||
let animationInType = 'transition.flipXIn';
|
||||
let animationInDuration = 150;
|
||||
let animationOutType = 'transition.flipXOut';
|
||||
let animationOutDuration = 150;
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
// Open context menu
|
||||
$(this).off('pf:openContextMenu').on('pf:openContextMenu', function (e, originalEvent, component, hiddenOptions, activeOptions) {
|
||||
|
||||
// hide all other open context menus
|
||||
$('#pf-dialog-wrapper > .dropdown-menu').hide();
|
||||
|
||||
let contextMenu = $(settings.menuSelector);
|
||||
|
||||
let menuLiElements = contextMenu.find('li');
|
||||
|
||||
// show all menu entries
|
||||
menuLiElements.show();
|
||||
|
||||
// disable specific menu entries
|
||||
for(let i = 0; i < hiddenOptions.length; i++){
|
||||
contextMenu.find('li[data-action="' + hiddenOptions[i] + '"]').hide();
|
||||
}
|
||||
|
||||
// deactivate all menu entries
|
||||
menuLiElements.removeClass('active');
|
||||
|
||||
//set active specific menu entries
|
||||
for(let j = 0; j < activeOptions.length; j++){
|
||||
contextMenu.find('li[data-action="' + activeOptions[j] + '"]').addClass('active');
|
||||
}
|
||||
|
||||
//open menu
|
||||
contextMenu.css({
|
||||
position: 'absolute',
|
||||
left: getLeftLocation(originalEvent),
|
||||
top: getTopLocation(originalEvent)
|
||||
}).velocity(animationInType, {
|
||||
duration: animationInDuration,
|
||||
complete: function(){
|
||||
|
||||
let posX = 0;
|
||||
let posY = 0;
|
||||
|
||||
if(
|
||||
originalEvent.offsetX &&
|
||||
originalEvent.offsetY
|
||||
){
|
||||
// Chrome
|
||||
posX = originalEvent.offsetX;
|
||||
posY = originalEvent.offsetY ;
|
||||
}else if(originalEvent.originalEvent){
|
||||
// Firefox -> #415
|
||||
posX = originalEvent.originalEvent.layerX;
|
||||
posY = originalEvent.originalEvent.layerY ;
|
||||
}
|
||||
|
||||
let position = {
|
||||
x: posX,
|
||||
y: posY
|
||||
};
|
||||
|
||||
$(this).off('click').one('click', {component: component, position: position}, function (e) {
|
||||
// hide contextmenu
|
||||
$(this).hide();
|
||||
|
||||
let params = {
|
||||
selectedMenu: $(e.target),
|
||||
component: e.data.component,
|
||||
position: e.data.position
|
||||
};
|
||||
|
||||
settings.menuSelected.call(this, params);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//make sure menu closes on any click
|
||||
$(document).one('click.closeContextmenu', function () {
|
||||
$('.dropdown-menu[role="menu"]').velocity(animationOutType, {
|
||||
duration: animationOutDuration
|
||||
});
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function getLeftLocation(e) {
|
||||
let mouseWidth = e.pageX;
|
||||
let pageWidth = $(window).width();
|
||||
let menuWidth = $(settings.menuSelector).width();
|
||||
|
||||
// opening menu would pass the side of the page
|
||||
if (mouseWidth + menuWidth > pageWidth &&
|
||||
menuWidth < mouseWidth) {
|
||||
return mouseWidth - menuWidth;
|
||||
}
|
||||
return mouseWidth;
|
||||
}
|
||||
|
||||
function getTopLocation(e) {
|
||||
let mouseHeight = e.pageY;
|
||||
let pageHeight = $(window).height();
|
||||
let menuHeight = $(settings.menuSelector).height();
|
||||
|
||||
// opening menu would pass the bottom of the page
|
||||
if (mouseHeight + menuHeight > pageHeight &&
|
||||
menuHeight < mouseHeight) {
|
||||
return mouseHeight - menuHeight;
|
||||
}
|
||||
return mouseHeight;
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
584
public/js/v1.2.5/app/map/local.js
Normal file
584
public/js/v1.2.5/app/map/local.js
Normal file
@@ -0,0 +1,584 @@
|
||||
/**
|
||||
* map overlay functions for "Nearby" table
|
||||
* Created by Exodus on 13.04.2017.
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, MapUtil) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
overlayClass: 'pf-map-overlay', // class for all map overlays
|
||||
overlayLocalClass: 'pf-map-overlay-local', // class for "local" overlay
|
||||
|
||||
// left section
|
||||
overlayLocalContentClass: 'pf-map-overlay-local-content', // class for left area - content
|
||||
overlayLocalHeadlineClass: 'pf-map-overlay-headline', // class for headline
|
||||
overlayLocalTableClass: 'pf-local-table', // class for local tables
|
||||
|
||||
// right section
|
||||
overlayLocalTriggerClass: 'pf-map-overlay-local-trigger', // class for open/close trigger icon
|
||||
overlayLocalOpenClass: 'pf-map-overlay-local-open', // class for open status
|
||||
overlayLocalMainClass: 'pf-map-overlay-local-main', // class for right area (always visible)
|
||||
overlayLocalUsersClass: 'pf-map-overlay-local-users', // class for active user count
|
||||
overlayLocalJumpsClass: 'pf-map-overlay-local-jumps', // class for jump distance for table results
|
||||
|
||||
// dataTable
|
||||
tableImageCellClass: 'pf-table-image-cell', // class for table "image" cells
|
||||
tableActionCellClass: 'pf-table-action-cell', // class for table "action" cells
|
||||
tableActionCellIconClass: 'pf-table-action-icon-cell', // class for table "action" icon (icon is part of cell content)
|
||||
|
||||
// toolbar
|
||||
toolbarClass: 'pf-map-overlay-toolbar', // class for toolbar - content
|
||||
toolbarIconClass: 'pf-map-overlay-toolbar-icon', // class for toolbar icon
|
||||
toolbarCheckboxClass: 'pf-map-overlay-toolbar-checkbox' // class for toolbar checkbox
|
||||
};
|
||||
|
||||
/**
|
||||
* checks whether overlay is currently open or not
|
||||
* @param overlay
|
||||
* @returns {*}
|
||||
*/
|
||||
let isOpen = (overlay) => {
|
||||
return overlay.hasClass(config.overlayLocalOpenClass);
|
||||
};
|
||||
|
||||
/**
|
||||
* open overlay -> animation
|
||||
* @param overlay
|
||||
*/
|
||||
let openOverlay = (overlay) => {
|
||||
if( !isOpen(overlay) ){
|
||||
let overlayMain = overlay.find('.' + config.overlayLocalMainClass);
|
||||
overlayMain.find('.' + config.overlayLocalTriggerClass).addClass('right');
|
||||
overlay.addClass(config.overlayLocalOpenClass);
|
||||
|
||||
overlay.velocity({
|
||||
width: '350px'
|
||||
},{
|
||||
duration: Init.animationSpeed.mapOverlayLocal,
|
||||
easing: 'easeOut'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* close overlay -> animation
|
||||
* @param overlay
|
||||
*/
|
||||
let closeOverlay = (overlay) => {
|
||||
if( isOpen(overlay) ){
|
||||
let overlayMain = overlay.find('.' + config.overlayLocalMainClass);
|
||||
overlayMain.find('.' + config.overlayLocalTriggerClass).removeClass('right');
|
||||
overlay.removeClass(config.overlayLocalOpenClass);
|
||||
|
||||
overlay.velocity({
|
||||
width: '32px'
|
||||
},{
|
||||
duration: Init.animationSpeed.mapOverlayLocal,
|
||||
easing: 'easeOut'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* sets overlay observer
|
||||
* @param overlay
|
||||
* @param mapId
|
||||
*/
|
||||
let setOverlayObserver = (overlay, mapId) => {
|
||||
let overlayMain = overlay.find('.' + config.overlayLocalMainClass);
|
||||
|
||||
overlayMain.on('click', function(){
|
||||
let overlayMain = $(this).parent('.' + config.overlayLocalClass);
|
||||
let isOpenStatus = isOpen(overlayMain);
|
||||
|
||||
// store current state in indexDB (client)
|
||||
MapUtil.storeLocalData('map', mapId, 'showLocal', !isOpenStatus );
|
||||
|
||||
// trigger open/close
|
||||
if( isOpenStatus ){
|
||||
closeOverlay(overlay);
|
||||
}else{
|
||||
openOverlay(overlay);
|
||||
}
|
||||
});
|
||||
|
||||
overlayMain.initTooltips({
|
||||
container: 'body',
|
||||
placement: 'bottom'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* filter DataTable rows by column data and return rowIds
|
||||
* @param table
|
||||
* @param data
|
||||
* @param values
|
||||
* @param checkExistence
|
||||
*/
|
||||
let filterRows = (table, data = 'id', values = [], checkExistence = true) => {
|
||||
return table.rows().eq(0).filter( function (rowIdx) {
|
||||
let rowExists = values.indexOf( table.row(rowIdx ).data()[data] ) !== -1;
|
||||
|
||||
if( !checkExistence ){
|
||||
rowExists = !rowExists;
|
||||
}
|
||||
|
||||
return rowExists;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the "headline" within the Overlay
|
||||
* @param overlay
|
||||
* @param systemData
|
||||
* @param characterAll
|
||||
* @param characterLocal
|
||||
*/
|
||||
let updateLocaleHeadline = (overlay, systemData, characterAll = 0, characterLocal = 0) => {
|
||||
let headlineElement = overlay.find('.' + config.overlayLocalHeadlineClass);
|
||||
let userCountElement = overlay.find('.' + config.overlayLocalUsersClass);
|
||||
|
||||
|
||||
let secClassBase = Util.getSecurityClassForSystem('security');
|
||||
let secClass = Util.getSecurityClassForSystem(systemData.security);
|
||||
|
||||
let childElements = headlineElement.children('span');
|
||||
childElements.eq(1).removeClass().addClass(
|
||||
[secClassBase, secClass].join(' ')
|
||||
).text(systemData.security);
|
||||
|
||||
childElements.eq(2).text(systemData.alias ? systemData.alias : systemData.name);
|
||||
|
||||
// update userCount for "near by" count -------------------------------------------------------------------
|
||||
if( characterAll > 0){
|
||||
userCountElement.toggleClass( 'txt-color-green', true).toggleClass( 'txt-color-red', false);
|
||||
}else{
|
||||
userCountElement.toggleClass( 'txt-color-green', false).toggleClass( 'txt-color-red', true);
|
||||
}
|
||||
userCountElement.text(characterAll);
|
||||
|
||||
// update userCount in current system ---------------------------------------------------------------------
|
||||
if( characterLocal > 0){
|
||||
childElements.eq(3).toggleClass( 'txt-color-green', true).toggleClass( 'txt-color-red', false);
|
||||
}else{
|
||||
childElements.eq(3).toggleClass( 'txt-color-green', false).toggleClass( 'txt-color-red', true);
|
||||
}
|
||||
childElements.eq(3).text(characterLocal);
|
||||
};
|
||||
|
||||
/**
|
||||
* updates all changed table rows
|
||||
* @param systemData
|
||||
* @param userData
|
||||
*/
|
||||
$.fn.updateLocalTable = function(systemData, userData){
|
||||
return this.each(function(){
|
||||
let overlay = $(this);
|
||||
let tableElement = overlay.find('.' + config.overlayLocalTableClass);
|
||||
let localTable = tableElement.DataTable();
|
||||
let mapId = systemData.mapId;
|
||||
|
||||
let characterAllIds = [];
|
||||
let characterLocalIds = [];
|
||||
|
||||
// system is on map (just for security check)
|
||||
for(let jumps in userData) {
|
||||
if( userData.hasOwnProperty(jumps) ){
|
||||
jumps = parseInt(jumps);
|
||||
|
||||
for(let j = 0; j < userData[jumps].length; j++){
|
||||
// add jump distance
|
||||
userData[jumps][j].jumps = jumps;
|
||||
|
||||
let rowData = userData[jumps][j];
|
||||
|
||||
// check for existing rows
|
||||
let indexes = filterRows(localTable, 'id', [rowData.id]);
|
||||
|
||||
if(indexes.length > 0){
|
||||
// row exists -> update
|
||||
let changedRow = localTable.row( parseInt(indexes[0]) );
|
||||
let changedRowElement = changedRow.nodes().to$();
|
||||
|
||||
// remove tooltips
|
||||
changedRowElement.find('[title]').tooltip('hide').tooltip('destroy');
|
||||
|
||||
// update data
|
||||
changedRow.data(rowData);
|
||||
}else{
|
||||
// new row
|
||||
localTable.row.add(rowData);
|
||||
}
|
||||
|
||||
if(jumps === 0){
|
||||
characterLocalIds.push(rowData.id);
|
||||
}
|
||||
|
||||
characterAllIds.push(rowData.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove rows that no longer exists ----------------------------------------------------------------------
|
||||
let indexesRemove = filterRows(localTable, 'id', characterAllIds, false);
|
||||
localTable.rows(indexesRemove).remove();
|
||||
|
||||
localTable.draw();
|
||||
|
||||
// update system relevant data in overlay -----------------------------------------------------------------
|
||||
updateLocaleHeadline(overlay, systemData, characterAllIds.length, characterLocalIds.length);
|
||||
|
||||
// open Overlay -------------------------------------------------------------------------------------------
|
||||
if( !isOpen(overlay) ){
|
||||
let promiseStore = MapUtil.getLocaleData('map', mapId);
|
||||
promiseStore.then(function(dataStore) {
|
||||
if(
|
||||
dataStore &&
|
||||
dataStore.showLocal
|
||||
){
|
||||
openOverlay(overlay);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Access a nested JSON object by "dot.notation" syntax
|
||||
* @param obj
|
||||
* @param selector
|
||||
* @returns {*}
|
||||
*/
|
||||
let getDescendantProp = (obj, selector) => {
|
||||
return selector.split('.').reduce(function(a, b) {
|
||||
return a[b];
|
||||
}, obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* init tooltip for a "DataTables" Cell
|
||||
* @param api
|
||||
* @param cell
|
||||
* @param titleSelector
|
||||
*/
|
||||
let initCellTooltip = (api, cell, titleSelector = '') => {
|
||||
$(cell).hover( function(e){
|
||||
let rowIdx = api.cell(cell).index().row;
|
||||
let rowData = api.row(rowIdx).data();
|
||||
|
||||
$(this).tooltip({
|
||||
container: 'body',
|
||||
title: String( getDescendantProp(rowData, titleSelector) ),
|
||||
placement: 'left',
|
||||
delay: 100
|
||||
}).tooltip('show');
|
||||
}, function(e){
|
||||
$(this).tooltip('hide');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* init all map local overlay on a "parent" element
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.initLocalOverlay = function(mapId){
|
||||
return this.each(function(){
|
||||
let parentElement = $(this);
|
||||
|
||||
let overlay = $('<div>', {
|
||||
class: [config.overlayClass, config.overlayLocalClass].join(' ')
|
||||
});
|
||||
|
||||
let content = $('<div>', {
|
||||
class: [ 'text-right', config.overlayLocalContentClass].join(' ')
|
||||
});
|
||||
|
||||
// crate new route table
|
||||
let table = $('<table>', {
|
||||
class: ['compact', 'order-column', config.overlayLocalTableClass].join(' ')
|
||||
});
|
||||
|
||||
let overlayMain = $('<div>', {
|
||||
text: '',
|
||||
class: config.overlayLocalMainClass
|
||||
}).append(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-chevron-down', 'fa-fw', 'pf-animate-rotate', config.overlayLocalTriggerClass].join(' ')
|
||||
}),
|
||||
$('<span>', {
|
||||
class: ['badge', 'txt-color', 'txt-color-red', config.overlayLocalUsersClass].join(' '),
|
||||
text: 0
|
||||
}),
|
||||
$('<div>', {
|
||||
class: config.overlayLocalJumpsClass
|
||||
}).append(
|
||||
$('<span>', {
|
||||
class: ['badge', 'txt-color', 'txt-color-grayLight'].join(' '),
|
||||
text: MapUtil.config.defaultLocalJumpRadius
|
||||
}).attr('title', 'jumps')
|
||||
)
|
||||
);
|
||||
|
||||
let headline = $('<div>', {
|
||||
class: config.overlayLocalHeadlineClass
|
||||
}).append(
|
||||
$('<span>', {
|
||||
html: 'Nearby ',
|
||||
class: 'pull-left'
|
||||
}),
|
||||
$('<span>'),
|
||||
$('<span>'),
|
||||
$('<span>', {
|
||||
class: ['badge', ' txt-color', 'txt-color-red'].join(' '),
|
||||
text: 0
|
||||
})
|
||||
);
|
||||
|
||||
content.append(headline);
|
||||
content.append(table);
|
||||
// toolbar not used for now
|
||||
// content.append(initToolbar());
|
||||
|
||||
overlay.append(overlayMain);
|
||||
overlay.append(content);
|
||||
|
||||
// set observer
|
||||
setOverlayObserver(overlay, mapId);
|
||||
|
||||
parentElement.append(overlay);
|
||||
|
||||
// init local table ---------------------------------------------------------------------------------------
|
||||
|
||||
table.on('draw.dt', function(e, settings){
|
||||
// init table tooltips
|
||||
$(this).find('td').initTooltips({
|
||||
container: 'body',
|
||||
placement: 'left'
|
||||
});
|
||||
|
||||
// hide pagination in case of only one page
|
||||
let paginationElement = overlay.find('.dataTables_paginate');
|
||||
let pageElements = paginationElement.find('span .paginate_button');
|
||||
if(pageElements.length <= 1){
|
||||
paginationElement.hide();
|
||||
}else{
|
||||
paginationElement.show();
|
||||
}
|
||||
});
|
||||
|
||||
// table init complete
|
||||
table.on( 'init.dt', function (){
|
||||
// init table head tooltips
|
||||
$(this).initTooltips({
|
||||
container: 'body',
|
||||
placement: 'top'
|
||||
});
|
||||
});
|
||||
|
||||
let localTable = table.DataTable( {
|
||||
pageLength: 13, // hint: if pagination visible => we need space to show it
|
||||
paging: true,
|
||||
lengthChange: false,
|
||||
ordering: true,
|
||||
order: [ 0, 'asc' ],
|
||||
info: false,
|
||||
searching: false,
|
||||
hover: false,
|
||||
autoWidth: false,
|
||||
rowId: function(rowData) {
|
||||
return 'pf-local-row_' + rowData.id; // characterId
|
||||
},
|
||||
language: {
|
||||
emptyTable: '<span>You are alone</span>'
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
orderable: true,
|
||||
title: '<span title="jumps" data-toggle="tooltip"> </span>',
|
||||
width: '1px',
|
||||
className: ['pf-help-default', 'text-center'].join(' '),
|
||||
data: 'jumps',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data;
|
||||
if(type === 'display'){
|
||||
if(value === 0){
|
||||
value = '<i class="fa fa-map-marker"></i>';
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
let api = this.DataTable();
|
||||
initCellTooltip(api, cell, 'log.system.name');
|
||||
}
|
||||
},{
|
||||
targets: 1,
|
||||
orderable: false,
|
||||
title: '',
|
||||
width: '26px',
|
||||
className: ['pf-help-default', 'text-center', config.tableImageCellClass].join(' '),
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data.typeName;
|
||||
if(type === 'display'){
|
||||
value = '<img src="' + Init.url.ccpImageServer + 'Render/' + data.typeId + '_32.png"/>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
let api = this.DataTable();
|
||||
initCellTooltip(api, cell, 'log.ship.typeName');
|
||||
}
|
||||
}, {
|
||||
targets: 2,
|
||||
orderable: true,
|
||||
title: 'ship name',
|
||||
width: '80px',
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data.name;
|
||||
if(type === 'display'){
|
||||
value = '<div class="' + MapUtil.config.tableCellEllipsisClass + ' ' + MapUtil.config.tableCellEllipsis80Class + '">' + data.name + '</div>';
|
||||
}
|
||||
return value;
|
||||
},
|
||||
sort: 'name'
|
||||
}
|
||||
},{
|
||||
targets: 3,
|
||||
orderable: true,
|
||||
title: 'pilot',
|
||||
data: 'name',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data;
|
||||
if(type === 'display'){
|
||||
value = '<div class="' + MapUtil.config.tableCellEllipsisClass + ' ' + MapUtil.config.tableCellEllipsis90Class + '">' + data + '</div>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 4,
|
||||
orderable: false,
|
||||
title: '<i title="docked station" data-toggle="tooltip" class="fa fa-home text-right"></i>',
|
||||
width: '10px',
|
||||
className: ['pf-help-default'].join(' '),
|
||||
data: 'log.station',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = '';
|
||||
if(
|
||||
type === 'display' &&
|
||||
data.id
|
||||
){
|
||||
value = '<i class="fa fa-home"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
let api = this.DataTable();
|
||||
initCellTooltip(api, cell, 'log.station.name');
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
orderable: false,
|
||||
title: '<i title="open ingame" data-toggle="tooltip" class="fa fa-id-card text-right"></i>',
|
||||
width: '10px',
|
||||
className: [config.tableActionCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data;
|
||||
if(type === 'display'){
|
||||
value = '<i class="fa fa-id-card ' + config.tableActionCellIconClass + '"></i>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// open character information window (ingame)
|
||||
$(cell).on('click', { tableApi: this.DataTable(), cellData: cellData }, function(e){
|
||||
let cellData = e.data.tableApi.cell(this).data();
|
||||
Util.openIngameWindow(e.data.cellData);
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
let initToolbar = () => {
|
||||
|
||||
let getCheckbox = (options) => {
|
||||
return $('<div>', {
|
||||
class: [config.toolbarCheckboxClass, 'checkbox'].join(' ')
|
||||
}).append(
|
||||
$('<input>', {
|
||||
type: 'checkbox',
|
||||
id: options.id,
|
||||
name: options.name,
|
||||
value: options.value,
|
||||
checked: 'checked'
|
||||
}),
|
||||
$('<label>',{
|
||||
'for': options.id,
|
||||
html: options.label
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
let toolbar = $('<div>', {
|
||||
class: [config.toolbarClass].join(' ')
|
||||
}).append(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-lg', 'fa-filter', config.toolbarIconClass, 'pull-left'].join(' ')
|
||||
}),
|
||||
getCheckbox({
|
||||
id: 'test',
|
||||
name: 'filter_character_active',
|
||||
value: 1,
|
||||
checked: true,
|
||||
label: 'active'
|
||||
})
|
||||
);
|
||||
|
||||
return toolbar;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear Overlay and "Reset"
|
||||
* @param mapId
|
||||
*/
|
||||
$.fn.clearLocalTable = function(mapId){
|
||||
return this.each(function(){
|
||||
let overlay = $(this);
|
||||
|
||||
// update locale overlay headline -------------------------------------------------------------------------
|
||||
updateLocaleHeadline(overlay, {
|
||||
name: 'unknown',
|
||||
security: ''
|
||||
});
|
||||
|
||||
// clear all table rows -----------------------------------------------------------------------------------
|
||||
let tableElement = overlay.find('.' + config.overlayLocalTableClass);
|
||||
let localTable = tableElement.DataTable();
|
||||
localTable.rows().remove().draw();
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
180
public/js/v1.2.5/app/map/magnetizing.js
Normal file
180
public/js/v1.2.5/app/map/magnetizing.js
Normal file
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* Map "magnetizing" feature
|
||||
* jsPlumb extension used: http://morrisonpitt.com/farahey/
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/map/util',
|
||||
'farahey'
|
||||
], function($, MapUtil) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Cached current "Magnetizer" object
|
||||
* @type {Magnetizer}
|
||||
*/
|
||||
let m8 = null;
|
||||
|
||||
/**
|
||||
* init a jsPlumb (map) Element for "magnetised" function.
|
||||
* this is optional and prevents systems from being overlapped
|
||||
*/
|
||||
$.fn.initMagnetizer = function(){
|
||||
let mapContainer = this;
|
||||
let systems = mapContainer.getSystems();
|
||||
|
||||
/**
|
||||
* helper function
|
||||
* get current system offset
|
||||
* @param system
|
||||
* @returns {{left, top}}
|
||||
* @private
|
||||
*/
|
||||
let _offset = function(system) {
|
||||
|
||||
let _ = function(p) {
|
||||
let v = system.style[p];
|
||||
return parseInt(v.substring(0, v.length - 2));
|
||||
};
|
||||
|
||||
return {
|
||||
left:_('left'),
|
||||
top:_('top')
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* helper function
|
||||
* set new system offset
|
||||
* @param system
|
||||
* @param o
|
||||
* @private
|
||||
*/
|
||||
let _setOffset = function(system, o) {
|
||||
let markAsUpdated = false;
|
||||
|
||||
// new position must be within parent container
|
||||
// no negative offset!
|
||||
if(
|
||||
o.left >= 0 &&
|
||||
o.left <= 2300
|
||||
){
|
||||
markAsUpdated = true;
|
||||
system.style.left = o.left + 'px';
|
||||
}
|
||||
|
||||
if(
|
||||
o.top >= 0 &&
|
||||
o.top <= 498
|
||||
){
|
||||
markAsUpdated = true;
|
||||
system.style.top = o.top + 'px';
|
||||
}
|
||||
|
||||
if(markAsUpdated === true){
|
||||
$(system).markAsChanged();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* helper function
|
||||
* exclude current dragged element(s) from position update
|
||||
* @param id
|
||||
* @returns {boolean}
|
||||
* @private
|
||||
*/
|
||||
let _dragFilter = function(id) {
|
||||
return !$('#' + id).is('.jsPlumb_dragged, .pf-system-locked');
|
||||
};
|
||||
|
||||
let gridConstrain = function(gridX, gridY) {
|
||||
return function(id, current, delta) {
|
||||
if( mapContainer.hasClass(MapUtil.config.mapGridClass) ){
|
||||
// active grid
|
||||
return {
|
||||
left:(gridX * Math.floor( (current[0] + delta.left) / gridX )) - current[0],
|
||||
top:(gridY * Math.floor( (current[1] + delta.top) / gridY )) - current[1]
|
||||
};
|
||||
}else{
|
||||
// no grid
|
||||
return delta;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// main init for "magnetize" feature ------------------------------------------------------
|
||||
m8 = new Magnetizer({
|
||||
container: mapContainer,
|
||||
getContainerPosition: function(c) {
|
||||
return c.offset();
|
||||
},
|
||||
getPosition:_offset,
|
||||
getSize: function(system) {
|
||||
return [ $(system).outerWidth(), $(system).outerHeight() ];
|
||||
},
|
||||
getId : function(system) {
|
||||
return $(system).attr('id');
|
||||
},
|
||||
setPosition:_setOffset,
|
||||
elements: systems,
|
||||
filter: _dragFilter,
|
||||
padding: [6, 6],
|
||||
constrain: gridConstrain(MapUtil.config.mapSnapToGridDimension, MapUtil.config.mapSnapToGridDimension)
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.destroyMagnetizer = function(){
|
||||
let mapContainer = this;
|
||||
|
||||
// remove cached "magnetizer" instance
|
||||
m8 = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* update system positions for "all" systems that are effected by drag&drop
|
||||
* @param map
|
||||
* @param e
|
||||
*/
|
||||
let executeAtEvent = function(map, e){
|
||||
if(m8 !== null && e ){
|
||||
m8.executeAtEvent(e);
|
||||
map.repaintEverything();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* rearrange all systems of a map
|
||||
* needs "magnetization" to be active
|
||||
* @param map
|
||||
*/
|
||||
let executeAtCenter = function(map){
|
||||
if(m8 !== null){
|
||||
m8.executeAtCenter();
|
||||
map.repaintEverything();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* set/update elements for "magnetization"
|
||||
* -> (e.g. new systems was added)
|
||||
* @param map
|
||||
*/
|
||||
let setElements = function(map){
|
||||
if(m8 !== null){
|
||||
let mapContainer = $(map.getContainer());
|
||||
let systems = mapContainer.getSystems();
|
||||
m8.setElements(systems);
|
||||
|
||||
// re-arrange systems
|
||||
executeAtCenter(map);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
executeAtCenter: executeAtCenter,
|
||||
executeAtEvent: executeAtEvent,
|
||||
setElements: setElements
|
||||
};
|
||||
});
|
||||
3387
public/js/v1.2.5/app/map/map.js
Normal file
3387
public/js/v1.2.5/app/map/map.js
Normal file
File diff suppressed because it is too large
Load Diff
770
public/js/v1.2.5/app/map/overlay.js
Normal file
770
public/js/v1.2.5/app/map/overlay.js
Normal file
@@ -0,0 +1,770 @@
|
||||
/**
|
||||
* map overlay functions
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util'
|
||||
], function($, Init, Util) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
logTimerCount: 3, // map log timer in seconds
|
||||
|
||||
// map
|
||||
mapWrapperClass: 'pf-map-wrapper', // wrapper div (scrollable)
|
||||
|
||||
// map overlay positions
|
||||
mapOverlayClass: 'pf-map-overlay', // class for all map overlays
|
||||
mapOverlayTimerClass: 'pf-map-overlay-timer', // class for map overlay timer e.g. map timer
|
||||
mapOverlayInfoClass: 'pf-map-overlay-info', // class for map overlay info e.g. map info
|
||||
overlayLocalClass: 'pf-map-overlay-local', // class for map overlay "local" table
|
||||
|
||||
// system
|
||||
systemHeadClass: 'pf-system-head', // class for system head
|
||||
|
||||
// overlay IDs
|
||||
connectionOverlayId: 'pf-map-connection-overlay', // connection "normal size" ID (jsPlumb)
|
||||
connectionOverlayEolId: 'pf-map-connection-eol-overlay', // connection EOL overlay ID (jsPlumb)
|
||||
connectionOverlayArrowId: 'pf-map-connection-arrow-overlay', // connection Arrows overlay ID (jsPlumb)
|
||||
connectionOverlaySmallId: 'pf-map-connection-small-overlay', // connection "smaller" overlay ID (jsPlumb)
|
||||
|
||||
// overlay classes
|
||||
connectionOverlayClass: 'pf-map-connection-overlay', // class for "normal size" overlay
|
||||
connectionArrowOverlayClass: 'pf-map-connection-arrow-overlay', // class for "connection arrow" overlay
|
||||
connectionDiamondOverlayClass: 'pf-map-connection-diamond-overlay', // class for "connection diamond" overlay
|
||||
connectionOverlaySmallClass: 'pf-map-connection-small-overlay' // class for "smaller" overlays
|
||||
};
|
||||
|
||||
/**
|
||||
* get MapObject (jsPlumb) from mapElement
|
||||
* @param mapElement
|
||||
* @returns {*}
|
||||
*/
|
||||
let getMapObjectFromMapElement = (mapElement) => {
|
||||
let Map = require('app/map/map');
|
||||
return Map.getMapInstance( mapElement.data('id') );
|
||||
};
|
||||
|
||||
/**
|
||||
* get map object (jsPlumb) from iconElement
|
||||
* @param overlayIcon
|
||||
* @returns {*}
|
||||
*/
|
||||
let getMapObjectFromOverlayIcon = (overlayIcon) => {
|
||||
let mapElement = Util.getMapElementFromOverlay(overlayIcon);
|
||||
|
||||
return getMapObjectFromMapElement( mapElement );
|
||||
};
|
||||
|
||||
/**
|
||||
* add overlays to connections (signature based data)
|
||||
* @param connections
|
||||
* @param connectionsData
|
||||
*/
|
||||
let addConnectionsOverlay = (connections, connectionsData) => {
|
||||
let SystemSignatures = require('app/ui/system_signature');
|
||||
|
||||
/**
|
||||
* add label to endpoint
|
||||
* @param endpoint
|
||||
* @param label
|
||||
*/
|
||||
let addEndpointOverlay = (endpoint, label) => {
|
||||
let newLabel = '';
|
||||
let colorClass = 'txt-color-grayLighter';
|
||||
|
||||
if(label.length > 0){
|
||||
newLabel = label;
|
||||
|
||||
// check if multiple labels found => conflict
|
||||
if( label.includes(', ') ){
|
||||
colorClass = 'txt-color-orangeLight';
|
||||
}else if( !label.includes('K162') ){
|
||||
colorClass = 'txt-color-yellow';
|
||||
}
|
||||
}else{
|
||||
// endpoint not connected with a signature
|
||||
newLabel = '<i class="fa fa-question-circle"></i>';
|
||||
colorClass = 'txt-color-red';
|
||||
}
|
||||
|
||||
endpoint.addOverlay([
|
||||
'Label',
|
||||
{
|
||||
label: '<span class="txt-color ' + colorClass + '">' + newLabel + '</span>',
|
||||
id: config.connectionOverlaySmallId,
|
||||
cssClass: config.connectionOverlaySmallClass,
|
||||
location: [ 0.5, 0.5 ]
|
||||
}
|
||||
]);
|
||||
|
||||
};
|
||||
|
||||
// loop through all map connections (get from DOM)
|
||||
for(let connection of connections) {
|
||||
let connectionId = connection.getParameter('connectionId');
|
||||
let sourceEndpoint = connection.endpoints[0];
|
||||
let targetEndpoint = connection.endpoints[1];
|
||||
let sourceSystem = $(sourceEndpoint.element);
|
||||
let targetSystem = $(targetEndpoint.element);
|
||||
let sourceId = sourceSystem.data('id');
|
||||
let targetId = targetSystem.data('id');
|
||||
|
||||
let signatureTypeNames = {
|
||||
sourceLabels: [],
|
||||
targetLabels: []
|
||||
};
|
||||
|
||||
// ... find matching connectionData (from Ajax)
|
||||
for(let connectionData of connectionsData){
|
||||
if(
|
||||
connectionData.id === connectionId &&
|
||||
connectionData.signatures // signature data is required...
|
||||
){
|
||||
|
||||
// ... collect overlay/label data from signatures
|
||||
for(let signatureData of connectionData.signatures){
|
||||
// ... typeId is required to get a valid name
|
||||
if(signatureData.typeId > 0){
|
||||
|
||||
// whether "source" or "target" system is relevant for current connection and current signature...
|
||||
let tmpSystem = null;
|
||||
let tmpSystemType = null;
|
||||
|
||||
if(signatureData.system.id === sourceId){
|
||||
// relates to "source" endpoint
|
||||
tmpSystemType = 'sourceLabels';
|
||||
tmpSystem = sourceSystem;
|
||||
}else if(signatureData.system.id === targetId){
|
||||
// relates to "target" endpoint
|
||||
tmpSystemType = 'targetLabels';
|
||||
tmpSystem = targetSystem;
|
||||
}
|
||||
|
||||
// ... get endpoint label for source || target system
|
||||
if(tmpSystem && tmpSystem){
|
||||
// ... get all available signature type (wormholes) names
|
||||
let availableSigTypeNames = SystemSignatures.getAllSignatureNamesBySystem(tmpSystem, 5);
|
||||
let flattenSigTypeNames = Util.flattenXEditableSelectArray(availableSigTypeNames);
|
||||
|
||||
if( flattenSigTypeNames.hasOwnProperty(signatureData.typeId) ){
|
||||
let label = flattenSigTypeNames[signatureData.typeId];
|
||||
// shorten label, just take the in game name
|
||||
label = label.substr(0, label.indexOf(' '));
|
||||
signatureTypeNames[tmpSystemType].push(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ... connection matched -> continue with next one
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let sourceLabel = signatureTypeNames.sourceLabels.join(', ');
|
||||
let targetLabel = signatureTypeNames.targetLabels.join(', ');
|
||||
|
||||
// add endpoint overlays ------------------------------------------------------
|
||||
addEndpointOverlay(sourceEndpoint, sourceLabel);
|
||||
addEndpointOverlay(targetEndpoint, targetLabel);
|
||||
|
||||
// add arrow (connection) overlay that points from "XXX" => "K162" ------------
|
||||
let overlayType = 'Diamond'; // not specified
|
||||
let arrowDirection = 1;
|
||||
|
||||
if(
|
||||
(sourceLabel.includes('K162') && targetLabel.includes('K162')) ||
|
||||
(sourceLabel.length === 0 && targetLabel.length === 0) ||
|
||||
(
|
||||
sourceLabel.length > 0 && targetLabel.length > 0 &&
|
||||
!sourceLabel.includes('K162') && !targetLabel.includes('K162')
|
||||
)
|
||||
){
|
||||
// unknown direction
|
||||
overlayType = 'Diamond'; // not specified
|
||||
arrowDirection = 1;
|
||||
}else if(
|
||||
(sourceLabel.includes('K162')) ||
|
||||
(sourceLabel.length === 0 && !targetLabel.includes('K162'))
|
||||
){
|
||||
// convert default arrow direction
|
||||
overlayType = 'Arrow';
|
||||
arrowDirection = -1;
|
||||
}else{
|
||||
// default arrow direction is fine
|
||||
overlayType = 'Arrow';
|
||||
arrowDirection = 1;
|
||||
}
|
||||
|
||||
connection.addOverlay([
|
||||
overlayType,
|
||||
{
|
||||
width: 12,
|
||||
length: 15,
|
||||
location: 0.5,
|
||||
foldback: 0.85,
|
||||
direction: arrowDirection,
|
||||
id: config.connectionOverlayArrowId,
|
||||
cssClass: (overlayType === 'Arrow') ? config.connectionArrowOverlayClass : config.connectionDiamondOverlayClass
|
||||
}
|
||||
]);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* remove overviews from a Tooltip
|
||||
* @param endpoint
|
||||
* @param i
|
||||
*/
|
||||
let removeEndpointOverlay = (endpoint, i) => {
|
||||
endpoint.removeOverlays(config.connectionOverlaySmallId);
|
||||
};
|
||||
|
||||
/**
|
||||
* format json object with "time parts" into string
|
||||
* @param parts
|
||||
* @returns {string}
|
||||
*/
|
||||
let formatTimeParts = (parts) => {
|
||||
let label = '';
|
||||
if(parts.days){
|
||||
label += parts.days + 'd ';
|
||||
}
|
||||
label += ('00' + parts.hours).slice(-2);
|
||||
label += ':' + ('00' + parts.min).slice(-2);
|
||||
return label;
|
||||
};
|
||||
|
||||
/**
|
||||
* hide default icon and replace it with "loading" icon
|
||||
* @param iconElement
|
||||
*/
|
||||
let showLoading = (iconElement) => {
|
||||
iconElement = $(iconElement);
|
||||
let dataName = 'default-icon';
|
||||
let defaultIconClass = iconElement.data(dataName);
|
||||
|
||||
// get default icon class
|
||||
if( !defaultIconClass ){
|
||||
// index 0 == 'fa-fw', index 1 == IconName
|
||||
defaultIconClass = $(iconElement).attr('class').match(/\bfa-\S*/g)[1];
|
||||
iconElement.data(dataName, defaultIconClass);
|
||||
}
|
||||
|
||||
iconElement.toggleClass( defaultIconClass + ' fa-refresh fa-spin' );
|
||||
};
|
||||
|
||||
/**
|
||||
* hide "loading" icon and replace with default icon
|
||||
* @param iconElement
|
||||
*/
|
||||
let hideLoading = (iconElement) => {
|
||||
iconElement = $(iconElement);
|
||||
let dataName = 'default-icon';
|
||||
let defaultIconClass = iconElement.data(dataName);
|
||||
|
||||
iconElement.toggleClass( defaultIconClass + ' fa-refresh fa-spin' );
|
||||
};
|
||||
|
||||
/**
|
||||
* git signature data that is linked to a connection for a mapId
|
||||
* @param mapElement
|
||||
* @param connections
|
||||
* @param callback
|
||||
*/
|
||||
let getConnectionSignatureData = (mapElement, connections, callback) => {
|
||||
let mapOverlay = $(mapElement).getMapOverlay('info');
|
||||
let overlayConnectionIcon = mapOverlay.find('.pf-map-overlay-endpoint');
|
||||
|
||||
showLoading(overlayConnectionIcon);
|
||||
|
||||
let requestData = {
|
||||
mapId: mapElement.data('id')
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.getMapConnectionData,
|
||||
data: requestData,
|
||||
dataType: 'json',
|
||||
context: {
|
||||
mapElement: mapElement,
|
||||
connections: connections,
|
||||
overlayConnectionIcon: overlayConnectionIcon
|
||||
}
|
||||
}).done(function(connectionsData){
|
||||
// hide all connection before add them (refresh)
|
||||
this.mapElement.hideEndpointOverlays();
|
||||
// ... add overlays
|
||||
callback(this.connections, connectionsData);
|
||||
}).always(function() {
|
||||
hideLoading(this.overlayConnectionIcon);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* showEndpointOverlays
|
||||
* -> used by "refresh" overlays (hover) AND/OR initial menu trigger
|
||||
*/
|
||||
$.fn.showEndpointOverlays = function(){
|
||||
let mapElement = $(this);
|
||||
let map = getMapObjectFromMapElement(mapElement);
|
||||
let MapUtil = require('app/map/util');
|
||||
let connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh');
|
||||
|
||||
// get connection signature information ---------------------------------------
|
||||
getConnectionSignatureData(mapElement, connections, addConnectionsOverlay);
|
||||
};
|
||||
|
||||
/**
|
||||
* hideEndpointOverlays
|
||||
* -> see showEndpointOverlays()
|
||||
*/
|
||||
$.fn.hideEndpointOverlays = function(){
|
||||
let map = getMapObjectFromMapElement($(this));
|
||||
let MapUtil = require('app/map/util');
|
||||
let connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh');
|
||||
|
||||
for (let connection of connections){
|
||||
connection.removeOverlays(config.connectionOverlayArrowId);
|
||||
connection.endpoints.forEach(removeEndpointOverlay);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Overlay options (all available map options shown in overlay)
|
||||
* "active": (active || hover) indicated whether an icon/option
|
||||
* is marked as "active".
|
||||
* "active": Makes icon active when visible
|
||||
* "hover": Make icon active on hover
|
||||
*/
|
||||
let options = {
|
||||
filter: {
|
||||
title: 'active filter',
|
||||
trigger: 'active',
|
||||
class: 'pf-map-overlay-filter',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-filter']
|
||||
},
|
||||
mapSnapToGrid: {
|
||||
title: 'active grid',
|
||||
trigger: 'active',
|
||||
class: 'pf-map-overlay-grid',
|
||||
iconClass: ['glyphicon', 'glyphicon-th']
|
||||
},
|
||||
mapMagnetizer: {
|
||||
title: 'active magnetizer',
|
||||
trigger: 'active',
|
||||
class: 'pf-map-overlay-magnetizer',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-magnet']
|
||||
},
|
||||
systemRegion: {
|
||||
title: 'show regions',
|
||||
trigger: 'hover',
|
||||
class: 'pf-map-overlay-region',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-tags'],
|
||||
hoverIntent: {
|
||||
over: function(e){
|
||||
let mapElement = Util.getMapElementFromOverlay(this);
|
||||
mapElement.find('.' + config.systemHeadClass).each(function(){
|
||||
let system = $(this);
|
||||
// init tooltip if not already exists
|
||||
if ( !system.data('bs.tooltip') ){
|
||||
system.tooltip({
|
||||
container: mapElement,
|
||||
placement: 'right',
|
||||
title: function(){
|
||||
return $(this).parent().data('region');
|
||||
},
|
||||
trigger: 'manual'
|
||||
});
|
||||
}
|
||||
system.tooltip('show');
|
||||
});
|
||||
},
|
||||
out: function(e){
|
||||
let mapElement = Util.getMapElementFromOverlay(this);
|
||||
mapElement.find('.' + config.systemHeadClass).tooltip('hide');
|
||||
}
|
||||
}
|
||||
},
|
||||
mapEndpoint: {
|
||||
title: 'refresh signature overlays',
|
||||
trigger: 'refresh',
|
||||
class: 'pf-map-overlay-endpoint',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-link'],
|
||||
hoverIntent: {
|
||||
over: function(e){
|
||||
let mapElement = Util.getMapElementFromOverlay(this);
|
||||
mapElement.showEndpointOverlays();
|
||||
},
|
||||
out: function(e){
|
||||
// just "refresh" on hover
|
||||
}
|
||||
}
|
||||
},
|
||||
connection: {
|
||||
title: 'WH data',
|
||||
trigger: 'hover',
|
||||
class: 'pf-map-overlay-connection',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-fighter-jet'],
|
||||
hoverIntent: {
|
||||
over: function(e){
|
||||
let map = getMapObjectFromOverlayIcon(this);
|
||||
let MapUtil = require('app/map/util');
|
||||
let connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh');
|
||||
let serverDate = Util.getServerTime();
|
||||
|
||||
// show connection overlays ---------------------------------------------------
|
||||
for (let connection of connections) {
|
||||
let createdTimestamp = connection.getParameter('created');
|
||||
let updatedTimestamp = connection.getParameter('updated');
|
||||
|
||||
let createdDate = Util.convertTimestampToServerTime(createdTimestamp);
|
||||
let updatedDate = Util.convertTimestampToServerTime(updatedTimestamp);
|
||||
|
||||
let createdDiff = Util.getTimeDiffParts(createdDate, serverDate);
|
||||
let updatedDiff = Util.getTimeDiffParts(updatedDate, serverDate);
|
||||
|
||||
// format overlay label
|
||||
let labels = [
|
||||
'<i class="fa fa-fw fa-plus-square"></i> ' + formatTimeParts(createdDiff),
|
||||
'<i class="fa fa-fw fa-pencil-square"></i> ' + formatTimeParts(updatedDiff)
|
||||
];
|
||||
|
||||
// add label overlay ------------------------------------------------------
|
||||
connection.addOverlay([
|
||||
'Label',
|
||||
{
|
||||
label: labels.join('<br>'),
|
||||
id: config.connectionOverlayId,
|
||||
cssClass: config.connectionOverlaySmallClass,
|
||||
location: 0.35
|
||||
}
|
||||
]);
|
||||
}
|
||||
},
|
||||
out: function(e){
|
||||
let map = getMapObjectFromOverlayIcon(this);
|
||||
let MapUtil = require('app/map/util');
|
||||
let connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh');
|
||||
|
||||
for (let connection of connections){
|
||||
connection.removeOverlays(config.connectionOverlayId);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
connectionEol: {
|
||||
title: 'EOL timer',
|
||||
trigger: 'hover',
|
||||
class: 'pf-map-overlay-connection-eol',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-clock-o'],
|
||||
hoverIntent: {
|
||||
over: function(e){
|
||||
let map = getMapObjectFromOverlayIcon(this);
|
||||
let MapUtil = require('app/map/util');
|
||||
let connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh', ['wh_eol']);
|
||||
let serverDate = Util.getServerTime();
|
||||
|
||||
for (let connection of connections) {
|
||||
let eolTimestamp = connection.getParameter('eolUpdated');
|
||||
let eolDate = Util.convertTimestampToServerTime(eolTimestamp);
|
||||
let diff = Util.getTimeDiffParts(eolDate, serverDate);
|
||||
|
||||
connection.addOverlay([
|
||||
'Label',
|
||||
{
|
||||
label: '<i class="fa fa-fw fa-clock-o"></i> ' + formatTimeParts(diff),
|
||||
id: config.connectionOverlayEolId,
|
||||
cssClass: [config.connectionOverlayClass, 'eol'].join(' '),
|
||||
location: 0.25
|
||||
}
|
||||
]);
|
||||
}
|
||||
},
|
||||
out: function(e){
|
||||
let map = getMapObjectFromOverlayIcon(this);
|
||||
let MapUtil = require('app/map/util');
|
||||
let connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh', ['wh_eol']);
|
||||
|
||||
for (let connection of connections) {
|
||||
connection.removeOverlay(config.connectionOverlayEolId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get map overlay element by type e.g. timer/counter, info - overlay
|
||||
* @param overlayType
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.getMapOverlay = function(overlayType){
|
||||
let mapWrapperElement = $(this).parents('.' + config.mapWrapperClass);
|
||||
|
||||
let mapOverlay = null;
|
||||
switch(overlayType){
|
||||
case 'timer':
|
||||
mapOverlay = mapWrapperElement.find('.' + config.mapOverlayTimerClass);
|
||||
break;
|
||||
case 'info':
|
||||
mapOverlay = mapWrapperElement.find('.' + config.mapOverlayInfoClass);
|
||||
break;
|
||||
case 'local':
|
||||
mapOverlay = mapWrapperElement.find('.' + config.overlayLocalClass);
|
||||
break;
|
||||
}
|
||||
|
||||
return mapOverlay;
|
||||
};
|
||||
|
||||
/**
|
||||
* draws the map update counter to the map overlay timer
|
||||
* @param percent
|
||||
* @param value
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.setMapUpdateCounter = function(percent, value){
|
||||
|
||||
let mapOverlayTimer = $(this);
|
||||
|
||||
// check if counter already exists
|
||||
let counterChart = mapOverlayTimer.getMapCounter();
|
||||
|
||||
if(counterChart.length === 0){
|
||||
// create new counter
|
||||
|
||||
counterChart = $('<div>', {
|
||||
class: [Init.classes.pieChart.class, Init.classes.pieChart.pieChartMapCounterClass].join(' ')
|
||||
}).attr('data-percent', percent).append(
|
||||
$('<span>', {
|
||||
text: value
|
||||
})
|
||||
);
|
||||
|
||||
mapOverlayTimer.append(counterChart);
|
||||
|
||||
// init counter
|
||||
counterChart.initMapUpdateCounter();
|
||||
|
||||
// set tooltip
|
||||
mapOverlayTimer.attr('data-placement', 'left');
|
||||
mapOverlayTimer.attr('title', 'update counter');
|
||||
mapOverlayTimer.tooltip();
|
||||
}
|
||||
|
||||
return counterChart;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the map counter chart from overlay
|
||||
* @returns {JQuery|*|T|{}|jQuery}
|
||||
*/
|
||||
$.fn.getMapCounter = function(){
|
||||
return $(this).find('.' + Init.classes.pieChart.pieChartMapCounterClass);
|
||||
};
|
||||
|
||||
$.fn.getMapOverlayInterval = function(){
|
||||
return $(this).getMapOverlay('timer').getMapCounter().data('interval');
|
||||
};
|
||||
|
||||
/**
|
||||
* start the map update counter or reset
|
||||
*/
|
||||
$.fn.startMapUpdateCounter = function(){
|
||||
|
||||
let mapOverlayTimer = $(this);
|
||||
let counterChart = mapOverlayTimer.getMapCounter();
|
||||
|
||||
let maxSeconds = config.logTimerCount;
|
||||
|
||||
let counterChartLabel = counterChart.find('span');
|
||||
|
||||
let percentPerCount = 100 / maxSeconds;
|
||||
|
||||
// update counter
|
||||
let updateChart = function(tempSeconds){
|
||||
let pieChart = counterChart.data('easyPieChart');
|
||||
|
||||
if(pieChart !== undefined){
|
||||
counterChart.data('easyPieChart').update( percentPerCount * tempSeconds);
|
||||
}
|
||||
counterChartLabel.text(tempSeconds);
|
||||
};
|
||||
|
||||
// main timer function is called on any counter update
|
||||
let timer = function(mapUpdateCounter){
|
||||
// decrease timer
|
||||
let currentSeconds = counterChart.data('currentSeconds');
|
||||
currentSeconds--;
|
||||
counterChart.data('currentSeconds', currentSeconds);
|
||||
|
||||
if(currentSeconds >= 0){
|
||||
// update counter
|
||||
updateChart(currentSeconds);
|
||||
}else{
|
||||
// hide counter and reset
|
||||
clearInterval(mapUpdateCounter);
|
||||
|
||||
mapOverlayTimer.velocity('transition.whirlOut', {
|
||||
duration: Init.animationSpeed.mapOverlay,
|
||||
complete: function(){
|
||||
counterChart.data('interval', false);
|
||||
Util.getMapElementFromOverlay(mapOverlayTimer).trigger('pf:unlocked');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// get current seconds (in case the timer is already running)
|
||||
let currentSeconds = counterChart.data('currentSeconds');
|
||||
|
||||
// start values for timer and chart
|
||||
counterChart.data('currentSeconds', maxSeconds);
|
||||
updateChart(maxSeconds);
|
||||
|
||||
if(
|
||||
currentSeconds === undefined ||
|
||||
currentSeconds < 0
|
||||
){
|
||||
// start timer
|
||||
let mapUpdateCounter = setInterval(() => {
|
||||
timer(mapUpdateCounter);
|
||||
}, 1000);
|
||||
|
||||
// store counter interval
|
||||
counterChart.data('interval', mapUpdateCounter);
|
||||
|
||||
// show overlay
|
||||
if(mapOverlayTimer.is(':hidden')){
|
||||
mapOverlayTimer.velocity('stop').velocity('transition.whirlIn', { duration: Init.animationSpeed.mapOverlay });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* update (show/hide) a overlay icon in the "info"-overlay
|
||||
* show/hide the overlay itself is no icons are visible
|
||||
* @param option
|
||||
* @param viewType
|
||||
*/
|
||||
$.fn.updateOverlayIcon = function(option, viewType){
|
||||
let mapOverlayInfo = $(this);
|
||||
|
||||
let showOverlay = false;
|
||||
|
||||
let mapOverlayIconClass = options[option].class;
|
||||
|
||||
// look for the overlay icon that should be updated
|
||||
let iconElement = mapOverlayInfo.find('.' + mapOverlayIconClass);
|
||||
|
||||
if(iconElement){
|
||||
if(viewType === 'show'){
|
||||
showOverlay = true;
|
||||
|
||||
// check "trigger" and mark as "active"
|
||||
if(
|
||||
options[option].trigger === 'active' ||
|
||||
options[option].trigger === 'refresh'
|
||||
){
|
||||
iconElement.addClass('active');
|
||||
}
|
||||
|
||||
// check if icon is not already visible
|
||||
// -> prevents unnecessary "show" animation
|
||||
if( !iconElement.data('visible') ){
|
||||
// display animation for icon
|
||||
iconElement.velocity({
|
||||
opacity: [0.8, 0],
|
||||
scale: [1, 0],
|
||||
width: ['30px', 0],
|
||||
marginLeft: ['3px', 0]
|
||||
},{
|
||||
duration: 240,
|
||||
easing: 'easeInOutQuad'
|
||||
});
|
||||
|
||||
iconElement.data('visible', true);
|
||||
}
|
||||
}else if(viewType === 'hide'){
|
||||
iconElement.removeClass('active').velocity('reverse');
|
||||
iconElement.data('visible', false);
|
||||
|
||||
// check if there is any visible icon remaining
|
||||
let visibleIcons = mapOverlayInfo.find('i:visible');
|
||||
if(visibleIcons.length > 0){
|
||||
showOverlay = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// show the entire overlay if there is at least one active icon
|
||||
if(
|
||||
showOverlay === true &&
|
||||
mapOverlayInfo.is(':hidden')
|
||||
){
|
||||
// show overlay
|
||||
mapOverlayInfo.velocity('stop').velocity('transition.whirlIn', { duration: Init.animationSpeed.mapOverlay });
|
||||
}else if(
|
||||
showOverlay === false &&
|
||||
mapOverlayInfo.is(':visible')
|
||||
){
|
||||
// hide overlay
|
||||
mapOverlayInfo.velocity('stop').velocity('transition.whirlOut', { duration: Init.animationSpeed.mapOverlay });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* init all map overlays on a "parent" element
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.initMapOverlays = function(){
|
||||
return this.each(function(){
|
||||
let parentElement = $(this);
|
||||
|
||||
let mapOverlayTimer = $('<div>', {
|
||||
class: [config.mapOverlayClass, config.mapOverlayTimerClass].join(' ')
|
||||
});
|
||||
parentElement.append(mapOverlayTimer);
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
// add map overlay info. after scrollbar is initialized
|
||||
let mapOverlayInfo = $('<div>', {
|
||||
class: [config.mapOverlayClass, config.mapOverlayInfoClass].join(' ')
|
||||
});
|
||||
|
||||
// add all overlay elements
|
||||
for (let prop in options) {
|
||||
if(options.hasOwnProperty(prop)){
|
||||
let icon = $('<i>', {
|
||||
class: options[prop].iconClass.concat( ['pull-right', options[prop].class] ).join(' ')
|
||||
}).attr('title', options[prop].title).tooltip({
|
||||
placement: 'bottom',
|
||||
container: 'body',
|
||||
delay: 150
|
||||
});
|
||||
|
||||
// add "hover" action for some icons
|
||||
if(
|
||||
options[prop].trigger === 'hover' ||
|
||||
options[prop].trigger === 'refresh'
|
||||
){
|
||||
icon.hoverIntent(options[prop].hoverIntent);
|
||||
}
|
||||
|
||||
mapOverlayInfo.append(icon);
|
||||
}
|
||||
}
|
||||
parentElement.append(mapOverlayInfo);
|
||||
|
||||
// reset map update timer
|
||||
mapOverlayTimer.setMapUpdateCounter(100, config.logTimerCount);
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
75
public/js/v1.2.5/app/map/scrollbar.js
Normal file
75
public/js/v1.2.5/app/map/scrollbar.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Created by Exodus on 26.06.2016.
|
||||
*/
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util'
|
||||
], function($, Init, Util) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* init map scrollbar
|
||||
* @param config
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.initCustomScrollbar = function(config){
|
||||
|
||||
// default config -------------------------------------------------------------------------
|
||||
let defaultConfig = {
|
||||
axis: 'x',
|
||||
theme: 'light-thick',
|
||||
scrollInertia: 300,
|
||||
autoExpandScrollbar: false,
|
||||
scrollButtons:{
|
||||
scrollAmount: 30,
|
||||
enable: true
|
||||
},
|
||||
callbacks:{
|
||||
onTotalScrollOffset: 0,
|
||||
onTotalScrollBackOffset: 0,
|
||||
alwaysTriggerOffsets: true
|
||||
},
|
||||
|
||||
advanced: {
|
||||
updateOnBrowserResize: true,
|
||||
updateOnContentResize: true,
|
||||
autoExpandHorizontalScroll: true,
|
||||
autoScrollOnFocus: 'div'
|
||||
},
|
||||
mouseWheel:{
|
||||
enable: false, // scroll weel currently disabled
|
||||
scrollAmount: 'auto',
|
||||
axis: 'x',
|
||||
preventDefault: true
|
||||
},
|
||||
scrollbarPosition: 'inside',
|
||||
autoDraggerLength: true
|
||||
//autoHideScrollbar: false
|
||||
};
|
||||
|
||||
// init -----------------------------------------------------------------------------------
|
||||
config = $.extend(true, {}, defaultConfig, config);
|
||||
|
||||
return this.each(function(){
|
||||
let scrollableElement = $(this);
|
||||
|
||||
// prevent multiple initialization
|
||||
scrollableElement.mCustomScrollbar('destroy');
|
||||
|
||||
// init custom scrollbars
|
||||
scrollableElement.mCustomScrollbar(config);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* scroll to a specific position in the map
|
||||
* demo: http://manos.malihu.gr/repository/custom-scrollbar/demo/examples/scrollTo_demo.html
|
||||
* @returns {*} // string or id
|
||||
*/
|
||||
$.fn.scrollToX = function(position){
|
||||
return this.each(function(){
|
||||
$(this).mCustomScrollbar('scrollTo', position);
|
||||
});
|
||||
};
|
||||
});
|
||||
245
public/js/v1.2.5/app/map/system.js
Normal file
245
public/js/v1.2.5/app/map/system.js
Normal file
@@ -0,0 +1,245 @@
|
||||
/**
|
||||
* map system functions
|
||||
*/
|
||||
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox',
|
||||
'app/map/util'
|
||||
], ($, Init, Util, bootbox, MapUtil) => {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
newSystemOffset: {
|
||||
x: 130,
|
||||
y: 0
|
||||
},
|
||||
|
||||
systemActiveClass: 'pf-system-active' // class for an active system in a map
|
||||
};
|
||||
|
||||
/**
|
||||
* show "set rally point" dialog for system
|
||||
* @param system
|
||||
*/
|
||||
$.fn.showRallyPointDialog = (system) => {
|
||||
requirejs(['text!templates/dialog/system_rally.html', 'mustache'], function(template, Mustache) {
|
||||
let data = {
|
||||
notificationStatus: Init.notificationStatus.rallySet
|
||||
};
|
||||
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
let rallyDialog = bootbox.dialog({
|
||||
message: content,
|
||||
title: 'Set rally point for "' + system.getSystemInfo( ['alias'] ) + '"',
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'cancel',
|
||||
className: 'btn-default'
|
||||
},
|
||||
setRallyPoke: {
|
||||
label: '<i class="fa fa-fw fa-volume-up"></i> set rally and poke',
|
||||
className: 'btn-primary',
|
||||
callback: function() {
|
||||
system.setSystemRally(1, {
|
||||
poke: true
|
||||
});
|
||||
system.markAsChanged();
|
||||
}
|
||||
},
|
||||
success: {
|
||||
label: '<i class="fa fa-fw fa-users"></i> set rally',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
system.setSystemRally(1);
|
||||
system.markAsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* shows delete dialog for systems that should be deleted
|
||||
* @param map
|
||||
* @param systems
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.showDeleteSystemDialog = (map, systems = []) => {
|
||||
let mapContainer = $( map.getContainer() );
|
||||
let validDeleteSystems = [];
|
||||
let activeCharacters = 0;
|
||||
// check if systems belong to map -> security check
|
||||
for (let system of systems) {
|
||||
let systemElement = $(system);
|
||||
if(
|
||||
systemElement.data('mapid') === mapContainer.data('id') &&
|
||||
!systemElement.data('locked')
|
||||
){
|
||||
// system belongs to map -> valid system
|
||||
validDeleteSystems.push(system);
|
||||
|
||||
activeCharacters += (systemElement.data('userCount') ? parseInt( systemElement.data('userCount') ) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(validDeleteSystems.length){
|
||||
let msg = '';
|
||||
if(validDeleteSystems.length === 1){
|
||||
let deleteSystem = $(validDeleteSystems[0]);
|
||||
let systemName = deleteSystem.data('name');
|
||||
let systemAlias = deleteSystem.getSystemInfo( ['alias'] );
|
||||
|
||||
let systemNameStr = (systemName === systemAlias) ? '"' + systemName + '"' : '"' + systemAlias + '" (' + systemName + ')';
|
||||
systemNameStr = '<span class="txt-color txt-color-warning">' + systemNameStr + '</span>';
|
||||
msg = 'Delete system ' + systemNameStr + ' and all its connections?';
|
||||
}else{
|
||||
msg = 'Delete ' + validDeleteSystems.length + ' selected systems and their connections?';
|
||||
}
|
||||
|
||||
// add warning for active characters
|
||||
if(activeCharacters > 0){
|
||||
msg += ' <span class="txt-color txt-color-warning">Warning: ' + activeCharacters + ' active characters</span>';
|
||||
}
|
||||
|
||||
let systemDeleteDialog = bootbox.confirm(msg, result => {
|
||||
if(result){
|
||||
deleteSystems(map, validDeleteSystems, (deletedSystems) => {
|
||||
// callback function after deleted -> close dialog
|
||||
systemDeleteDialog.modal('hide');
|
||||
|
||||
// check whether all systems were deleted properly
|
||||
if(deletedSystems.length !== validDeleteSystems.length){
|
||||
let notDeletedCount = validDeleteSystems.length - deletedSystems.length;
|
||||
|
||||
Util.showNotify({
|
||||
title: 'Failed to delete systems',
|
||||
text: '(' + notDeletedCount + '/' + validDeleteSystems.length + ') systems could not be deleted',
|
||||
type: 'warning'}
|
||||
);
|
||||
}else if(deletedSystems.length === 1){
|
||||
Util.showNotify({title: 'System deleted', text: $(deletedSystems[0]).data('name'), type: 'success'});
|
||||
}else{
|
||||
Util.showNotify({title: systems.length + ' systems deleted', type: 'success'});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
Util.showNotify({title: 'No systems selected', type: 'warning'});
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* delete system(s) with all their connections
|
||||
* (ajax call) remove system from DB
|
||||
* @param map
|
||||
* @param systems
|
||||
* @param callback function
|
||||
*/
|
||||
let deleteSystems = (map, systems = [], callback = (systems) => {}) => {
|
||||
let mapContainer = $( map.getContainer() );
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.deleteSystem,
|
||||
data: {
|
||||
mapId: mapContainer.data('id'),
|
||||
systemIds: systems.map( system => $(system).data('id') )
|
||||
},
|
||||
dataType: 'json',
|
||||
context: {
|
||||
map: map,
|
||||
systems: systems
|
||||
}
|
||||
}).done(function(data){
|
||||
// check if all systems were deleted that should get deleted
|
||||
let deletedSystems = this.systems.filter(
|
||||
function(system){
|
||||
return this.indexOf( $(system).data('id') ) !== -1;
|
||||
}, data.deletedSystemIds
|
||||
);
|
||||
|
||||
// remove systems from map
|
||||
removeSystems(this.map, deletedSystems);
|
||||
|
||||
callback(deletedSystems);
|
||||
}).fail(function(jqXHR, status, error) {
|
||||
let reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': deleteSystem', text: reason, type: 'warning'});
|
||||
$(document).setProgramStatus('problem');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* remove system(s) from map (no backend requests)
|
||||
* @param map
|
||||
* @param systems
|
||||
*/
|
||||
let removeSystems = (map, systems) => {
|
||||
|
||||
let removeSystemCallbak = function(deleteSystem){
|
||||
map.remove(deleteSystem);
|
||||
};
|
||||
|
||||
for (let system of systems){
|
||||
system = $(system);
|
||||
|
||||
// check if system is "active"
|
||||
if( system.hasClass(config.systemActiveClass) ){
|
||||
// get parent Tab Content and fire clear modules event
|
||||
let tabContentElement = MapUtil.getTabContentElementByMapElement( system );
|
||||
$(tabContentElement).trigger('pf:removeSystemModules');
|
||||
}
|
||||
|
||||
// remove endpoints and their connections
|
||||
// do not fire a "connectionDetached" event
|
||||
map.detachAllConnections(system, {fireEvent: false});
|
||||
|
||||
// hide tooltip
|
||||
system.toggleSystemTooltip('destroy', {});
|
||||
|
||||
// remove system
|
||||
system.velocity('transition.whirlOut', {
|
||||
duration: Init.animationSpeed.mapDeleteSystem,
|
||||
complete: removeSystemCallbak
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* calculate the x/y coordinates for a new system - relativ to a source system
|
||||
* @param sourceSystem
|
||||
* @returns {{x: *, y: *}}
|
||||
*/
|
||||
let calculateNewSystemPosition = function(sourceSystem){
|
||||
|
||||
// related system is available
|
||||
let currentX = sourceSystem.css('left');
|
||||
let currentY = sourceSystem.css('top');
|
||||
|
||||
// remove "px"
|
||||
currentX = parseInt( currentX.substring(0, currentX.length - 2) );
|
||||
currentY = parseInt( currentY.substring(0, currentY.length - 2) );
|
||||
|
||||
let newPosition = {
|
||||
x: currentX + config.newSystemOffset.x,
|
||||
y: currentY + config.newSystemOffset.y
|
||||
};
|
||||
|
||||
return newPosition;
|
||||
};
|
||||
|
||||
return {
|
||||
deleteSystems: deleteSystems,
|
||||
removeSystems: removeSystems,
|
||||
calculateNewSystemPosition: calculateNewSystemPosition
|
||||
};
|
||||
});
|
||||
667
public/js/v1.2.5/app/map/util.js
Normal file
667
public/js/v1.2.5/app/map/util.js
Normal file
@@ -0,0 +1,667 @@
|
||||
/**
|
||||
* Map util functions
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox'
|
||||
], function($, Init, Util, bootbox) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
mapSnapToGridDimension: 20, // px for grid snapping (grid YxY)
|
||||
defaultLocalJumpRadius: 3, // default search radius (in jumps) for "nearby" pilots
|
||||
|
||||
// local storage
|
||||
characterLocalStoragePrefix: 'character_', // prefix for character data local storage key
|
||||
mapLocalStoragePrefix: 'map_', // prefix for map data local storage key
|
||||
mapTabContentClass: 'pf-map-tab-content', // Tab-Content element (parent element)
|
||||
|
||||
mapClass: 'pf-map', // class for all maps
|
||||
mapGridClass: 'pf-grid-small', // class for map grid snapping
|
||||
|
||||
systemIdPrefix: 'pf-system-', // id prefix for a system
|
||||
systemClass: 'pf-system', // class for all systems
|
||||
systemSelectedClass: 'pf-system-selected', // class for selected systems in a map
|
||||
|
||||
// dataTable
|
||||
tableCellEllipsisClass: 'pf-table-cell-ellipsis',
|
||||
tableCellEllipsis80Class: 'pf-table-cell-80',
|
||||
tableCellEllipsis90Class: 'pf-table-cell-90',
|
||||
tableCellEllipsis100Class: 'pf-table-cell-100'
|
||||
};
|
||||
|
||||
// map menu options
|
||||
let mapOptions = {
|
||||
mapMagnetizer: {
|
||||
buttonId: Util.config.menuButtonMagnetizerId,
|
||||
description: 'Magnetizer',
|
||||
onEnable: 'initMagnetizer', // jQuery extension function
|
||||
onDisable: 'destroyMagnetizer' // jQuery extension function
|
||||
},
|
||||
mapSnapToGrid : {
|
||||
buttonId: Util.config.menuButtonGridId,
|
||||
description: 'Grid snapping',
|
||||
class: 'mapGridClass'
|
||||
},
|
||||
mapEndpoint : {
|
||||
buttonId: Util.config.menuButtonEndpointId,
|
||||
description: 'Endpoint overlay',
|
||||
onEnable: 'showEndpointOverlays', // jQuery extension function
|
||||
onDisable: 'hideEndpointOverlays' // jQuery extension function
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get all available map Types
|
||||
* optional they can be filtered by current access level of a user
|
||||
* @param {bool} filterByUser
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getMapTypes = function(filterByUser){
|
||||
let mapTypes = [];
|
||||
|
||||
$.each(Init.mapTypes, function(prop, data){
|
||||
// skip "default" type -> just for 'add' icon
|
||||
if(data.label.length > 0){
|
||||
let tempData = data;
|
||||
tempData.name = prop;
|
||||
mapTypes.push(tempData);
|
||||
}
|
||||
});
|
||||
|
||||
if(filterByUser === true){
|
||||
let corporationId = Util.getCurrentUserInfo('corporationId');
|
||||
let allianceId = Util.getCurrentUserInfo('allianceId');
|
||||
|
||||
let authorizedMapTypes = [];
|
||||
// check if character data exists
|
||||
if(corporationId > 0) {
|
||||
authorizedMapTypes.push('corporation');
|
||||
}
|
||||
if(allianceId > 0){
|
||||
authorizedMapTypes.push('alliance');
|
||||
}
|
||||
|
||||
// private maps are always allowed
|
||||
authorizedMapTypes.push('private');
|
||||
|
||||
// compare "all" map types with "authorized" types
|
||||
let tempMapTypes = [];
|
||||
for(let i = 0; i < mapTypes.length; i++){
|
||||
for(let j = 0; j < authorizedMapTypes.length; j++){
|
||||
if(mapTypes[i].name === authorizedMapTypes[j]){
|
||||
tempMapTypes.push(mapTypes[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
mapTypes = tempMapTypes;
|
||||
}
|
||||
|
||||
return mapTypes;
|
||||
};
|
||||
|
||||
/**
|
||||
* get all available scopes for a map
|
||||
* @returns {Array}
|
||||
*/
|
||||
let getMapScopes = function(){
|
||||
let scopes = [];
|
||||
$.each(Init.mapScopes, function(prop, data){
|
||||
let tempData = data;
|
||||
tempData.name = prop;
|
||||
scopes.push(tempData);
|
||||
});
|
||||
|
||||
return scopes;
|
||||
};
|
||||
|
||||
/**
|
||||
* get some scope info for a given info string
|
||||
* @param {string} info
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
let getScopeInfoForMap = function(info, option){
|
||||
let scopeInfo = '';
|
||||
if(Init.mapScopes.hasOwnProperty(info)){
|
||||
scopeInfo = Init.mapScopes[info][option];
|
||||
}
|
||||
return scopeInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get all available map icons
|
||||
* @returns {Object[]}
|
||||
*/
|
||||
let getMapIcons = function(){
|
||||
return Init.mapIcons;
|
||||
};
|
||||
|
||||
/**
|
||||
* get map info
|
||||
* @param {string} mapType
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
let getInfoForMap = function(mapType, option){
|
||||
let mapInfo = '';
|
||||
if(Init.mapTypes.hasOwnProperty(mapType)){
|
||||
mapInfo = Init.mapTypes[mapType][option];
|
||||
}
|
||||
return mapInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get some system info for a given info string (e.g. rally class)
|
||||
* @param {string} info
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
let getInfoForSystem = function(info, option){
|
||||
let systemInfo = '';
|
||||
if(Init.classes.systemInfo.hasOwnProperty(info)){
|
||||
systemInfo = Init.classes.systemInfo[info][option];
|
||||
}
|
||||
return systemInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get system type information
|
||||
* @param {number} systemTypeId
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
let getSystemTypeInfo = function(systemTypeId, option){
|
||||
let systemTypeInfo = '';
|
||||
$.each(Init.systemType, function(prop, data){
|
||||
if(systemTypeId === data.id){
|
||||
systemTypeInfo = data[option];
|
||||
return;
|
||||
}
|
||||
});
|
||||
return systemTypeInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get some info for a given effect string
|
||||
* @param effect
|
||||
* @param option
|
||||
* @returns {string}
|
||||
*/
|
||||
let getEffectInfoForSystem = function(effect, option){
|
||||
let effectInfo = '';
|
||||
if( Init.classes.systemEffects.hasOwnProperty(effect) ){
|
||||
effectInfo = Init.classes.systemEffects[effect][option];
|
||||
}
|
||||
return effectInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get system elements on a map
|
||||
* @returns {*|jQuery}
|
||||
*/
|
||||
$.fn.getSystems = function(){
|
||||
return this.find('.' + config.systemClass);
|
||||
};
|
||||
|
||||
/**
|
||||
* get all selected (NOT active) systems in a map
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.getSelectedSystems = function(){
|
||||
let mapElement = $(this);
|
||||
return mapElement.find('.' + config.systemSelectedClass);
|
||||
};
|
||||
|
||||
/**
|
||||
* search connections by systems
|
||||
* @param {Object} map - jsPlumb
|
||||
* @param {JQuery[]} systems - system DOM elements
|
||||
* @returns {Array} connections - found connection, DOM elements
|
||||
*/
|
||||
let searchConnectionsBySystems = function(map, systems){
|
||||
let connections = [];
|
||||
let withBackConnection = true;
|
||||
|
||||
$.each(systems, function(i, system){
|
||||
// get connections where system is source
|
||||
connections = connections.concat( map.getConnections({source: system}) );
|
||||
if(withBackConnection === true){
|
||||
// get connections where system is target
|
||||
connections = connections.concat( map.getConnections({target: system}) );
|
||||
}
|
||||
});
|
||||
return connections;
|
||||
};
|
||||
|
||||
/**
|
||||
* search connections by scope and/or type
|
||||
* -> scope and target can be an array
|
||||
* @param {Object} map - jsPlumb
|
||||
* @param {string|string[]} scope
|
||||
* @param {string|string[]} type
|
||||
* @returns {Array}
|
||||
*/
|
||||
let searchConnectionsByScopeAndType = function(map, scope, type){
|
||||
let connections = [];
|
||||
let scopeArray = (scope === undefined) ? ['*'] : ((Array.isArray(scope)) ? scope : [scope]);
|
||||
let typeArray = (type === undefined) ? [] : ((Array.isArray(type)) ? type : [type]);
|
||||
|
||||
map.select({scope: scopeArray}).each(function(connection){
|
||||
if(typeArray.length > 0){
|
||||
// filter by connection type as well...
|
||||
for(let i = 0; i < typeArray.length; i++){
|
||||
if( connection.hasType(typeArray[i]) ){
|
||||
connections.push(connection);
|
||||
break; // don´t add same connection multiple times
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// connection type is ignored
|
||||
connections.push(connection);
|
||||
}
|
||||
});
|
||||
|
||||
return connections;
|
||||
};
|
||||
|
||||
/**
|
||||
* get Connection Info by option
|
||||
* @param {string} connectionTyp
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
let getConnectionInfo = function(connectionTyp, option){
|
||||
let connectionInfo = '';
|
||||
if(Init.connectionTypes.hasOwnProperty(connectionTyp)){
|
||||
connectionInfo = Init.connectionTypes[connectionTyp][option];
|
||||
}
|
||||
return connectionInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get all direct connections between two given systems
|
||||
* @param map
|
||||
* @param {JQuery} systemA
|
||||
* @param {JQuery} systemB
|
||||
* @returns {Array}
|
||||
*/
|
||||
let checkForConnection = function(map, systemA, systemB){
|
||||
let connections = [];
|
||||
connections = connections.concat( map.getConnections({scope: '*', source: systemA, target: systemB}) );
|
||||
// get connections where system is target
|
||||
connections = connections.concat( map.getConnections({scope: '*', source: systemB, target: systemA}) );
|
||||
return connections;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the default connection type for a scope
|
||||
* e.g. for new type after scope change
|
||||
* @param {string} scope
|
||||
* @returns {string}
|
||||
*/
|
||||
let getDefaultConnectionTypeByScope = function(scope){
|
||||
let type = '';
|
||||
switch(scope){
|
||||
case 'wh':
|
||||
type = 'wh_fresh';
|
||||
break;
|
||||
case 'jumpbridge':
|
||||
type = 'jumpbridge';
|
||||
break;
|
||||
case'stargate':
|
||||
type = 'stargate';
|
||||
break;
|
||||
default:
|
||||
console.error('Connection scope "' + scope + '" unknown!');
|
||||
}
|
||||
|
||||
return type;
|
||||
};
|
||||
|
||||
/**
|
||||
* set/change connection status of a wormhole
|
||||
* @param {Object} connection - jsPlumb object
|
||||
* @param {string} status
|
||||
*/
|
||||
let setConnectionWHStatus = function(connection, status){
|
||||
if(
|
||||
status === 'wh_fresh' &&
|
||||
connection.hasType('wh_fresh') !== true
|
||||
){
|
||||
connection.removeType('wh_reduced');
|
||||
connection.removeType('wh_critical');
|
||||
connection.addType('wh_fresh');
|
||||
}else if(
|
||||
status === 'wh_reduced' &&
|
||||
connection.hasType('wh_reduced') !== true
|
||||
){
|
||||
connection.removeType('wh_fresh');
|
||||
connection.removeType('wh_critical');
|
||||
connection.addType('wh_reduced');
|
||||
}else if(
|
||||
status === 'wh_critical' &&
|
||||
connection.hasType('wh_critical') !== true
|
||||
){
|
||||
connection.removeType('wh_fresh');
|
||||
connection.removeType('wh_reduced');
|
||||
connection.addType('wh_critical');
|
||||
}else if(
|
||||
status === 'wh_eol' &&
|
||||
connection.hasType('wh_eol') !== true
|
||||
){
|
||||
connection.addType('wh_eol');
|
||||
}else if(
|
||||
status === 'wh_eol' &&
|
||||
connection.hasType('wh_eol') !== true
|
||||
){
|
||||
connection.addType('wh_eol');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get some scope info for a given info string
|
||||
* @param {string} info
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
let getScopeInfoForConnection = function(info, option){
|
||||
let scopeInfo = '';
|
||||
if(Init.connectionScopes.hasOwnProperty(info)){
|
||||
switch(option){
|
||||
case 'connectorDefinition':
|
||||
// json data in DB
|
||||
let temp = '{ "data": ' + Init.connectionScopes[info][option] + '}';
|
||||
scopeInfo = $.parseJSON( temp).data;
|
||||
break;
|
||||
default:
|
||||
scopeInfo = Init.connectionScopes[info][option];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return scopeInfo;
|
||||
};
|
||||
|
||||
/**
|
||||
* get TabContentElement by any element on a map e.g. system
|
||||
* @param element
|
||||
* @returns {*}
|
||||
*/
|
||||
let getTabContentElementByMapElement = function(element){
|
||||
let tabContentElement = $(element).parents('.' + config.mapTabContentClass);
|
||||
return tabContentElement;
|
||||
};
|
||||
|
||||
/**
|
||||
* store mapId for current user (IndexedDB)
|
||||
* @param mapId
|
||||
*/
|
||||
let storeDefaultMapId = function(mapId){
|
||||
if(mapId > 0){
|
||||
let userData = Util.getCurrentUserData();
|
||||
if(
|
||||
userData &&
|
||||
userData.character
|
||||
){
|
||||
storeLocalData('character', userData.character.id, 'defaultMapId', mapId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get key prefix for local storage data
|
||||
* @param type
|
||||
* @returns {boolean}
|
||||
*/
|
||||
let getLocalStoragePrefixByType = function(type){
|
||||
let prefix = false;
|
||||
switch(type){
|
||||
case 'character': prefix = config.characterLocalStoragePrefix; break;
|
||||
case 'map': prefix = config.mapLocalStoragePrefix; break;
|
||||
default: prefix = config.mapLocalStoragePrefix;
|
||||
}
|
||||
return prefix;
|
||||
};
|
||||
|
||||
/**
|
||||
* get stored local data from client cache (IndexedDB)
|
||||
* @param type
|
||||
* @param objectId
|
||||
* @returns {*}
|
||||
*/
|
||||
let getLocaleData = function(type, objectId){
|
||||
if(objectId > 0){
|
||||
let storageKey = getLocalStoragePrefixByType(type) + objectId;
|
||||
return Util.getLocalStorage().getItem(storageKey);
|
||||
}else{
|
||||
console.warn('Local storage requires object id > 0');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* store local config data to client cache (IndexedDB)
|
||||
* @param type
|
||||
* @param objectId
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
let storeLocalData = function(type, objectId, key, value){
|
||||
if(objectId > 0){
|
||||
// get current map config
|
||||
let storageKey = getLocalStoragePrefixByType(type) + objectId;
|
||||
Util.getLocalStorage().getItem(storageKey).then(function(data) {
|
||||
// This code runs once the value has been loaded
|
||||
// from the offline store.
|
||||
data = (data === null) ? {} : data;
|
||||
// set/update value
|
||||
data[this.key] = this.value;
|
||||
Util.getLocalStorage().setItem(this.storageKey, data);
|
||||
}.bind({
|
||||
key: key,
|
||||
value: value,
|
||||
storageKey: storageKey
|
||||
})).catch(function(err) {
|
||||
// This code runs if there were any errors
|
||||
console.error('Map local storage can not be accessed!');
|
||||
});
|
||||
}else{
|
||||
console.warn('storeLocalData(): Local storage requires object id > 0');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* delete local map configuration by key (IndexedDB)
|
||||
* @param type
|
||||
* @param objectId
|
||||
* @param key
|
||||
*/
|
||||
let deleteLocalData = function(type, objectId, key){
|
||||
if(objectId > 0){
|
||||
// get current map config
|
||||
let storageKey = getLocalStoragePrefixByType(type) + objectId;
|
||||
Util.getLocalStorage().getItem(storageKey).then(function(data) {
|
||||
if(
|
||||
data &&
|
||||
data.hasOwnProperty(key)
|
||||
){
|
||||
delete data[key];
|
||||
Util.getLocalStorage().setItem(this.storageKey, data);
|
||||
}
|
||||
}.bind({
|
||||
storageKey: storageKey
|
||||
}));
|
||||
}else{
|
||||
console.warn('deleteLocalData(): Local storage requires object id > 0');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* set or change rallyPoint for systems
|
||||
* @param rallyUpdated
|
||||
* @param options
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.setSystemRally = function(rallyUpdated, options){
|
||||
rallyUpdated = rallyUpdated || 0;
|
||||
let rallyPoke = false;
|
||||
|
||||
let defaultOptions = {
|
||||
poke: false,
|
||||
hideNotification: false,
|
||||
hideCounter: false,
|
||||
};
|
||||
options = $.extend({}, defaultOptions, options);
|
||||
|
||||
return this.each(function(){
|
||||
let system = $(this);
|
||||
let rally = system.data('rallyUpdated') || 0;
|
||||
|
||||
if(rallyUpdated !== rally){
|
||||
// rally status changed
|
||||
if( !options.hideCounter ){
|
||||
system.getMapOverlay('timer').startMapUpdateCounter();
|
||||
}
|
||||
|
||||
let rallyClass = getInfoForSystem('rally', 'class');
|
||||
|
||||
if(rallyUpdated > 0){
|
||||
// new rally point set OR update system with rally information
|
||||
|
||||
system.addClass( rallyClass );
|
||||
// rallyUpdated > 0 is required for poke!
|
||||
rallyPoke = options.poke;
|
||||
|
||||
let notificationOptions = {
|
||||
title: 'Rally Point',
|
||||
text: 'System: ' + system.data('name')
|
||||
};
|
||||
|
||||
if(rallyUpdated === 1){
|
||||
// rally point not saved on DB
|
||||
notificationOptions.type = 'success';
|
||||
Util.showNotify(notificationOptions);
|
||||
}else if(options.poke){
|
||||
// rally saved AND poke option active
|
||||
|
||||
// check if desktop notification was already send
|
||||
let mapId = system.data('mapid');
|
||||
let systemId = system.data('id');
|
||||
let promiseStore = getLocaleData('map', mapId);
|
||||
promiseStore.then(function(data) {
|
||||
// This code runs once the value has been loaded
|
||||
// from the offline store.
|
||||
let rallyPokeData = {};
|
||||
|
||||
if(
|
||||
data &&
|
||||
data.rallyPoke
|
||||
){
|
||||
// poke data exists
|
||||
rallyPokeData = data.rallyPoke;
|
||||
}
|
||||
|
||||
if(
|
||||
!rallyPokeData.hasOwnProperty(this.systemId) || // rally poke was not already send to client
|
||||
rallyPokeData[this.systemId] !== rallyUpdated // already send to that system but in the past
|
||||
){
|
||||
rallyPokeData[this.systemId] = rallyUpdated;
|
||||
storeLocalData('map', this.mapId, 'rallyPoke', rallyPokeData);
|
||||
|
||||
notificationOptions.type = 'info';
|
||||
Util.showNotify(notificationOptions, {desktop: true, stack: 'barBottom'});
|
||||
}
|
||||
}.bind({
|
||||
mapId: mapId,
|
||||
systemId: systemId,
|
||||
rallyUpdated: rallyUpdated
|
||||
}));
|
||||
}
|
||||
}else{
|
||||
// rally point removed
|
||||
system.removeClass( rallyClass );
|
||||
|
||||
if( !options.hideNotification ){
|
||||
Util.showNotify({title: 'Rally point removed', type: 'success'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
system.data('rallyUpdated', rallyUpdated);
|
||||
system.data('rallyPoke', rallyPoke);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* set map "shortcut" events
|
||||
*/
|
||||
$.fn.setMapShortcuts = function(){
|
||||
return this.each((i, mapWrapper) => {
|
||||
mapWrapper = $(mapWrapper);
|
||||
let mapElement = mapWrapper.findMapElement();
|
||||
|
||||
// dynamic require Map module -> otherwise there is a require(), loop
|
||||
let Map = require('app/map/map');
|
||||
let map = Map.getMapInstance( mapElement.data('id'));
|
||||
|
||||
mapWrapper.watchKey('mapSystemAdd', (mapWrapper) => {
|
||||
Map.showNewSystemDialog(map, {position: {x: 0, y: 0}});
|
||||
},{focus: true});
|
||||
|
||||
mapWrapper.watchKey('mapSystemsSelect', (mapWrapper) => {
|
||||
mapElement.selectAllSystems();
|
||||
},{focus: true});
|
||||
|
||||
mapWrapper.watchKey('mapSystemsDelete', (mapWrapper) => {
|
||||
let selectedSystems = mapElement.getSelectedSystems();
|
||||
$.fn.showDeleteSystemDialog(map, selectedSystems);
|
||||
},{focus: true});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.findMapElement = function(){
|
||||
return $(this).find('.' + config.mapClass);
|
||||
};
|
||||
|
||||
/**
|
||||
* get systemId string (selector
|
||||
* @param mapId
|
||||
* @param systemId
|
||||
* @returns {string}
|
||||
*/
|
||||
let getSystemId = (mapId, systemId) => {
|
||||
return config.systemIdPrefix + mapId + '-' + systemId;
|
||||
};
|
||||
|
||||
return {
|
||||
config: config,
|
||||
mapOptions: mapOptions,
|
||||
getMapTypes: getMapTypes,
|
||||
getMapScopes: getMapScopes,
|
||||
getScopeInfoForMap: getScopeInfoForMap,
|
||||
getMapIcons: getMapIcons,
|
||||
getInfoForMap: getInfoForMap,
|
||||
getInfoForSystem: getInfoForSystem,
|
||||
getSystemTypeInfo: getSystemTypeInfo,
|
||||
getEffectInfoForSystem: getEffectInfoForSystem,
|
||||
searchConnectionsBySystems: searchConnectionsBySystems,
|
||||
searchConnectionsByScopeAndType: searchConnectionsByScopeAndType,
|
||||
getConnectionInfo: getConnectionInfo,
|
||||
checkForConnection: checkForConnection,
|
||||
getDefaultConnectionTypeByScope: getDefaultConnectionTypeByScope,
|
||||
setConnectionWHStatus: setConnectionWHStatus,
|
||||
getScopeInfoForConnection: getScopeInfoForConnection,
|
||||
getTabContentElementByMapElement: getTabContentElementByMapElement,
|
||||
storeDefaultMapId: storeDefaultMapId,
|
||||
getLocaleData: getLocaleData,
|
||||
storeLocalData: storeLocalData,
|
||||
deleteLocalData: deleteLocalData,
|
||||
getSystemId: getSystemId
|
||||
};
|
||||
});
|
||||
127
public/js/v1.2.5/app/map/worker.js
Normal file
127
public/js/v1.2.5/app/map/worker.js
Normal file
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* SharedWorker config for map
|
||||
*/
|
||||
|
||||
define([
|
||||
'app/util'
|
||||
], function(Util) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
|
||||
};
|
||||
|
||||
let sharedWorker = null;
|
||||
let MsgWorker = null;
|
||||
let characterId = null;
|
||||
|
||||
/**
|
||||
* get WebSocket URL for SharedWorker script
|
||||
* @returns {string}
|
||||
*/
|
||||
let getWebSocketURL = () => {
|
||||
let domain = location.host;
|
||||
let workerProtocol = (window.location.protocol === 'https:') ? 'wss:' : 'ws:';
|
||||
return workerProtocol + '//' + domain + '/ws/map/update';
|
||||
};
|
||||
|
||||
/**
|
||||
* get SharedWorker Script path
|
||||
* @returns {string}
|
||||
*/
|
||||
let getWorkerScript = () => {
|
||||
return '/public/js/' + Util.getVersion() + '/app/worker/map.js';
|
||||
};
|
||||
|
||||
/**
|
||||
* get path to message object
|
||||
* @returns {string}
|
||||
*/
|
||||
let getMessageWorkerObjectPath = () => {
|
||||
return '/public/js/' + Util.getVersion() + '/app/worker/message.js';
|
||||
};
|
||||
|
||||
/**
|
||||
* init (connect) WebSocket within SharedWorker
|
||||
*/
|
||||
let initSocket = () => {
|
||||
let MsgWorkerInit = new MsgWorker('ws:init');
|
||||
MsgWorkerInit.data({
|
||||
uri: getWebSocketURL(),
|
||||
characterId: characterId,
|
||||
});
|
||||
|
||||
sharedWorker.port.postMessage(MsgWorkerInit);
|
||||
};
|
||||
|
||||
/**
|
||||
* init (start/connect) to "SharedWorker"
|
||||
* -> set worker events
|
||||
*/
|
||||
let init = (config) => {
|
||||
// set characterId that is connected with this SharedWorker PORT
|
||||
characterId = parseInt(config.characterId);
|
||||
|
||||
// get message Class for App <=> SharedWorker MessageEvent communication
|
||||
requirejs([getMessageWorkerObjectPath()], () => {
|
||||
MsgWorker = window.MsgWorker;
|
||||
|
||||
// start/connect to "SharedWorker"
|
||||
sharedWorker = new SharedWorker( getWorkerScript(), getMessageWorkerObjectPath() );
|
||||
|
||||
sharedWorker.port.addEventListener('message', (e) => {
|
||||
let MsgWorkerMessage = e.data;
|
||||
Object.setPrototypeOf(MsgWorkerMessage, MsgWorker.prototype);
|
||||
|
||||
switch(MsgWorkerMessage.command){
|
||||
case 'ws:open':
|
||||
config.callbacks.onOpen(MsgWorkerMessage);
|
||||
break;
|
||||
case 'ws:send':
|
||||
config.callbacks.onGet(MsgWorkerMessage);
|
||||
break;
|
||||
case 'ws:closed':
|
||||
config.callbacks.onClosed(MsgWorkerMessage);
|
||||
break;
|
||||
case 'ws:error':
|
||||
config.callbacks.onError(MsgWorkerMessage);
|
||||
break;
|
||||
|
||||
}
|
||||
}, false);
|
||||
|
||||
sharedWorker.onerror = (e) => {
|
||||
// could not connect to SharedWorker script -> send error back
|
||||
let MsgWorkerError = new MsgWorker('sw:error');
|
||||
MsgWorkerError.meta({
|
||||
reason: 'Could not connect to SharedWorker: ' + getWorkerScript()
|
||||
});
|
||||
|
||||
config.callbacks.onError(MsgWorkerError);
|
||||
};
|
||||
|
||||
sharedWorker.port.start();
|
||||
|
||||
// SharedWorker initialized
|
||||
let MsgWorkerInit = new MsgWorker('sw:init');
|
||||
config.callbacks.onInit(MsgWorkerInit);
|
||||
|
||||
// startWebSocket
|
||||
initSocket();
|
||||
});
|
||||
};
|
||||
|
||||
let send = (task, data) => {
|
||||
let MsgWorkerSend = new MsgWorker('ws:send');
|
||||
MsgWorkerSend.task(task);
|
||||
MsgWorkerSend.data(data);
|
||||
|
||||
sharedWorker.port.postMessage(MsgWorkerSend);
|
||||
};
|
||||
|
||||
return {
|
||||
getWebSocketURL: getWebSocketURL,
|
||||
init: init,
|
||||
send: send
|
||||
};
|
||||
});
|
||||
392
public/js/v1.2.5/app/mappage.js
Normal file
392
public/js/v1.2.5/app/mappage.js
Normal file
@@ -0,0 +1,392 @@
|
||||
/**
|
||||
* Main map application
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'app/logging',
|
||||
'app/page',
|
||||
'app/map/worker',
|
||||
'app/key',
|
||||
'app/ui/form_element',
|
||||
'app/module_map'
|
||||
], ($, Init, Util, Render, Logging, Page, MapWorker) => {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* main init "map" page
|
||||
*/
|
||||
$(() => {
|
||||
Util.initPrototypes();
|
||||
|
||||
// set default AJAX config
|
||||
Util.ajaxSetup();
|
||||
|
||||
// set default dialog config
|
||||
Util.initDefaultBootboxConfig();
|
||||
|
||||
// load page
|
||||
// load info (maintenance) info panel (if scheduled)
|
||||
$('body').loadPageStructure().setGlobalShortcuts();
|
||||
|
||||
// show app information in browser console
|
||||
Util.showVersionInfo();
|
||||
|
||||
// init logging
|
||||
Logging.init();
|
||||
|
||||
let mapModule = $('#' + Util.config.mapModuleId);
|
||||
|
||||
// map init load static data =======================================================
|
||||
$.getJSON( Init.path.initMap, (initData) => {
|
||||
|
||||
|
||||
if( initData.error.length > 0 ){
|
||||
for(let i = 0; i < initData.error.length; i++){
|
||||
Util.showNotify({
|
||||
title: initData.error[i].title,
|
||||
text: initData.error[i].message,
|
||||
type: initData.error[i].type
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Init.timer = initData.timer;
|
||||
Init.mapTypes = initData.mapTypes;
|
||||
Init.mapScopes = initData.mapScopes;
|
||||
Init.connectionScopes = initData.connectionScopes;
|
||||
Init.systemStatus = initData.systemStatus;
|
||||
Init.systemType = initData.systemType;
|
||||
Init.characterStatus = initData.characterStatus;
|
||||
Init.routes = initData.routes;
|
||||
Init.notificationStatus = initData.notificationStatus;
|
||||
Init.routeSearch = initData.routeSearch;
|
||||
Init.programMode = initData.programMode;
|
||||
|
||||
// init tab change observer, Once the timers are available
|
||||
Page.initTabChangeObserver();
|
||||
|
||||
// init map module
|
||||
mapModule.initMapModule();
|
||||
|
||||
// load info (maintenance) info panel (if scheduled)
|
||||
if(Init.programMode.maintenance){
|
||||
$('body').showGlobalInfoPanel();
|
||||
}
|
||||
|
||||
}).fail(( jqXHR, status, error) => {
|
||||
let reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
|
||||
$(document).trigger('pf:shutdown', {status: jqXHR.status, reason: reason});
|
||||
});
|
||||
|
||||
/**
|
||||
* request all map access data (tokens) -> required wor WebSocket subscription
|
||||
*/
|
||||
let getMapAccessData = () => {
|
||||
$.getJSON( Init.path.getAccessData, ( response ) => {
|
||||
if(response.status === 'OK'){
|
||||
// init SharedWorker for maps
|
||||
MapWorker.init({
|
||||
characterId: response.data.id,
|
||||
callbacks: {
|
||||
onInit: (MsgWorkerMessage) => {
|
||||
Util.setSyncStatus(MsgWorkerMessage.command);
|
||||
},
|
||||
onOpen: (MsgWorkerMessage) => {
|
||||
Util.setSyncStatus(MsgWorkerMessage.command, MsgWorkerMessage.meta());
|
||||
|
||||
MapWorker.send( 'subscribe', response.data);
|
||||
},
|
||||
onGet: (MsgWorkerMessage) => {
|
||||
switch(MsgWorkerMessage.task()){
|
||||
case 'mapUpdate':
|
||||
Util.updateCurrentMapData( MsgWorkerMessage.data() );
|
||||
mapModule.updateMapModule();
|
||||
break;
|
||||
case 'mapAccess':
|
||||
case 'mapDeleted':
|
||||
Util.deleteCurrentMapData( MsgWorkerMessage.data() );
|
||||
mapModule.updateMapModule();
|
||||
break;
|
||||
}
|
||||
|
||||
Util.setSyncStatus('ws:get');
|
||||
},
|
||||
onClosed: (MsgWorkerMessage) => {
|
||||
Util.setSyncStatus(MsgWorkerMessage.command, MsgWorkerMessage.meta());
|
||||
},
|
||||
onError: (MsgWorkerMessage) => {
|
||||
Util.setSyncStatus(MsgWorkerMessage.command, MsgWorkerMessage.meta());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
getMapAccessData();
|
||||
|
||||
/**
|
||||
* main function for init all map relevant trigger calls
|
||||
*/
|
||||
$.fn.initMapModule = function(){
|
||||
|
||||
let mapModule = $(this);
|
||||
|
||||
// log keys ------------------------------------------------------------------------
|
||||
let logKeyServerMapData = Init.performanceLogging.keyServerMapData;
|
||||
let logKeyServerUserData = Init.performanceLogging.keyServerUserData;
|
||||
|
||||
// main update intervals/trigger (heartbeat)
|
||||
let updateTimeouts = {
|
||||
mapUpdate: 0,
|
||||
userUpdate: 0
|
||||
};
|
||||
|
||||
let locationToggle = $('#' + Util.config.headMapTrackingId);
|
||||
|
||||
/**
|
||||
* Ajax error response handler function for main-ping functions
|
||||
* @param jqXHR
|
||||
* @param status
|
||||
* @param error
|
||||
*/
|
||||
let handleAjaxErrorResponse = (jqXHR, status, error) => {
|
||||
// clear both main update request trigger timer
|
||||
clearUpdateTimeouts();
|
||||
|
||||
let reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
let errorData = [];
|
||||
|
||||
if(jqXHR.responseJSON){
|
||||
// handle JSON
|
||||
let errorObj = $.parseJSON(jqXHR.responseText);
|
||||
|
||||
if(
|
||||
errorObj.error &&
|
||||
errorObj.error.length > 0
|
||||
){
|
||||
errorData = errorObj.error;
|
||||
}
|
||||
}else{
|
||||
// handle HTML
|
||||
errorData.push({
|
||||
type: 'error',
|
||||
message: 'Please restart and reload this page'
|
||||
});
|
||||
}
|
||||
|
||||
$(document).trigger('pf:shutdown', {status: jqXHR.status, reason: reason, error: errorData});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* init (schedule) next MapUpdate Ping
|
||||
*/
|
||||
let initMapUpdatePing = (forceUpdateMapData) => {
|
||||
// get the current update delay (this can change if a user is inactive)
|
||||
let delay = Util.getCurrentTriggerDelay( logKeyServerMapData, 0 );
|
||||
|
||||
updateTimeouts.mapUpdate = setTimeout((forceUpdateMapData) => {
|
||||
triggerMapUpdatePing(forceUpdateMapData);
|
||||
}, delay, forceUpdateMapData);
|
||||
};
|
||||
|
||||
// ping for main map update ========================================================
|
||||
/**
|
||||
* @param forceUpdateMapData // force request to be send
|
||||
*/
|
||||
let triggerMapUpdatePing = (forceUpdateMapData) => {
|
||||
|
||||
// check each interval if map module is still available
|
||||
let check = $('#' + mapModule.attr('id')).length;
|
||||
|
||||
if(check === 0){
|
||||
// program crash stop any update
|
||||
return;
|
||||
}
|
||||
|
||||
// get updated map data
|
||||
let updatedMapData = {
|
||||
mapData: mapModule.getMapModuleDataForUpdate(),
|
||||
getUserData: ( Util.getCurrentUserData() ) ? 0 : 1
|
||||
};
|
||||
|
||||
// check if mapUpdate trigger should be send
|
||||
// -> if "syncType" === "ajax" -> send always
|
||||
// -> if "syncType" === "webSocket" -> send initial AND on map changes
|
||||
if(
|
||||
forceUpdateMapData ||
|
||||
Util.getSyncType() === 'ajax' ||
|
||||
(
|
||||
Util.getSyncType() === 'webSocket' &&
|
||||
updatedMapData.mapData.length
|
||||
)
|
||||
){
|
||||
// start log
|
||||
Util.timeStart(logKeyServerMapData);
|
||||
|
||||
// store updatedMapData
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.updateMapData,
|
||||
data: updatedMapData,
|
||||
dataType: 'json'
|
||||
}).done((data) => {
|
||||
// log request time
|
||||
let duration = Util.timeStop(logKeyServerMapData);
|
||||
Util.log(logKeyServerMapData, {duration: duration, type: 'server', description: 'request map data'});
|
||||
|
||||
Util.setSyncStatus('ajax:get');
|
||||
|
||||
if(
|
||||
data.error &&
|
||||
data.error.length > 0
|
||||
){
|
||||
// any error in the main trigger functions result in a user log-off
|
||||
$(document).trigger('pf:menuLogout');
|
||||
}else{
|
||||
$(document).setProgramStatus('online');
|
||||
|
||||
if(data.userData !== undefined) {
|
||||
// store current user data global (cache)
|
||||
Util.setCurrentUserData(data.userData);
|
||||
}
|
||||
|
||||
// map data found
|
||||
Util.setCurrentMapData(data.mapData);
|
||||
|
||||
// load/update main map module
|
||||
mapModule.updateMapModule();
|
||||
|
||||
// get the current update delay (this can change if a user is inactive)
|
||||
let mapUpdateDelay = Util.getCurrentTriggerDelay( logKeyServerMapData, 0 );
|
||||
|
||||
// init new trigger
|
||||
initMapUpdatePing(false);
|
||||
|
||||
// initial start for the userUpdate trigger
|
||||
// this should only be called at the first time!
|
||||
if(updateTimeouts.userUpdate === 0){
|
||||
// start user update trigger after map loaded
|
||||
updateTimeouts.userUpdate = setTimeout(() => {
|
||||
triggerUserUpdatePing();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
}).fail(handleAjaxErrorResponse);
|
||||
}else{
|
||||
// skip this mapUpdate trigger and init next one
|
||||
initMapUpdatePing(false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// ping for user data update =======================================================
|
||||
let triggerUserUpdatePing = () => {
|
||||
|
||||
// IMPORTANT: Get user data for ONE map that is currently visible
|
||||
// On later releases this can be easy changed to "full update" all maps for a user
|
||||
//
|
||||
let mapIds = [];
|
||||
let activeMap = Util.getMapModule().getActiveMap();
|
||||
if(activeMap){
|
||||
mapIds = [ activeMap.data('id') ];
|
||||
}
|
||||
|
||||
let updatedUserData = {
|
||||
mapIds: mapIds,
|
||||
systemData: Util.getCurrentSystemData(),
|
||||
characterMapData: {
|
||||
mapTracking: (locationToggle.is(':checked') ? 1 : 0) // location tracking
|
||||
}
|
||||
};
|
||||
|
||||
Util.timeStart(logKeyServerUserData);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.updateUserData,
|
||||
data: updatedUserData,
|
||||
dataType: 'json'
|
||||
}).done((data) => {
|
||||
|
||||
// log request time
|
||||
let duration = Util.timeStop(logKeyServerUserData);
|
||||
Util.log(logKeyServerUserData, {duration: duration, type: 'server', description:'request user data'});
|
||||
|
||||
if(data.error.length > 0){
|
||||
// any error in the main trigger functions result in a user log-off
|
||||
$(document).trigger('pf:menuLogout');
|
||||
}else{
|
||||
|
||||
$(document).setProgramStatus('online');
|
||||
|
||||
if(data.userData !== undefined){
|
||||
// store current user data global (cache)
|
||||
let userData = Util.setCurrentUserData(data.userData);
|
||||
|
||||
// store current map user data (cache)
|
||||
if(data.mapUserData !== undefined){
|
||||
Util.setCurrentMapUserData(data.mapUserData);
|
||||
}
|
||||
|
||||
// active character data found
|
||||
mapModule.updateMapModuleData();
|
||||
|
||||
// update system info panels
|
||||
if(data.system){
|
||||
mapModule.updateSystemModuleData(data.system);
|
||||
}
|
||||
|
||||
// get the current update delay (this can change if a user is inactive)
|
||||
let mapUserUpdateDelay = Util.getCurrentTriggerDelay( logKeyServerUserData, 0 );
|
||||
|
||||
// init new trigger
|
||||
updateTimeouts.userUpdate = setTimeout(() => {
|
||||
triggerUserUpdatePing();
|
||||
}, mapUserUpdateDelay);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}).fail(handleAjaxErrorResponse);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* clear both main update timeouts
|
||||
* -> stop program from working -> shutdown
|
||||
*/
|
||||
let clearUpdateTimeouts = () => {
|
||||
for(let intervalKey in updateTimeouts) {
|
||||
|
||||
if(updateTimeouts.hasOwnProperty(intervalKey)){
|
||||
clearTimeout( updateTimeouts[intervalKey] );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// initial start of the map update function
|
||||
triggerMapUpdatePing(true);
|
||||
|
||||
// Send map update request on tab close/reload, in order to save map changes that
|
||||
// haven´t been saved through default update trigger
|
||||
window.addEventListener('beforeunload', function(e) {
|
||||
triggerMapUpdatePing();
|
||||
// IMPORTANT, return false in order to not "abort" ajax request in background!
|
||||
return false;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
782
public/js/v1.2.5/app/module_map.js
Normal file
782
public/js/v1.2.5/app/module_map.js
Normal file
@@ -0,0 +1,782 @@
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/map/map',
|
||||
'app/map/util',
|
||||
'app/counter',
|
||||
'app/ui/system_info',
|
||||
'app/ui/system_graph',
|
||||
'app/ui/system_signature',
|
||||
'app/ui/system_route',
|
||||
'app/ui/system_killboard',
|
||||
'datatables.net',
|
||||
'datatables.net-buttons',
|
||||
'datatables.net-buttons-html',
|
||||
'datatables.net-responsive',
|
||||
'datatables.net-select'
|
||||
], function($, Init, Util, Map, MapUtil) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
dynamicElementWrapperId: 'pf-dialog-wrapper', // parent Element for dynamic content (dialogs,..)
|
||||
mapTabElementId: 'pf-map-tab-element', // id for map tab element (tabs + content)
|
||||
mapTabBarId: 'pf-map-tabs', // id for map tab bar
|
||||
mapTabIdPrefix: 'pf-map-tab-', // id prefix for a map tab
|
||||
mapTabClass: 'pf-map-tab', // class for a map tab
|
||||
mapTabLinkTextClass: 'nav-tabs-link', // class for span elements in a tab
|
||||
mapTabIconClass: 'pf-map-tab-icon', // class for map icon
|
||||
mapTabSharedIconClass: 'pf-map-tab-shared-icon', // class for map shared icon
|
||||
mapTabContentClass: 'pf-map-tab-content', // class for tab content container
|
||||
mapTabContentSystemInfoClass: 'pf-map-tab-content-system',
|
||||
mapWrapperClass: 'pf-map-wrapper', // scrollable
|
||||
mapClass: 'pf-map', // class for each map
|
||||
|
||||
// TabContentStructure
|
||||
mapTabContentRow: 'pf-map-content-row', // main row for Tab content (grid)
|
||||
mapTabContentCell: 'pf-map-content-col', // column
|
||||
mapTabContentCellFirst: 'pf-map-content-col-first', // first column
|
||||
mapTabContentCellSecond: 'pf-map-content-col-second', // second column
|
||||
|
||||
// module
|
||||
moduleClass: 'pf-module', // class for a module
|
||||
moduleClosedClass: 'pf-module-closed' // class for a closed module
|
||||
|
||||
};
|
||||
|
||||
let mapTabChangeBlocked = false; // flag for preventing map tab switch
|
||||
|
||||
/**
|
||||
* get all maps for a maps module
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.getMaps = function(){
|
||||
return $(this).find('.' + config.mapClass);
|
||||
};
|
||||
|
||||
/**
|
||||
* get the current active mapElement
|
||||
* @returns {JQuery|*|T|{}|jQuery}
|
||||
*/
|
||||
$.fn.getActiveMap = function(){
|
||||
let map = $(this).find('.active.' + config.mapTabContentClass + ' .' + config.mapClass);
|
||||
if(!map.length){
|
||||
map = false;
|
||||
}
|
||||
return map;
|
||||
};
|
||||
|
||||
/**
|
||||
* set Tab Observer, events are triggered within map.js
|
||||
*/
|
||||
$.fn.setTabContentObserver = function(){
|
||||
return this.each(function(){
|
||||
// update Tab Content with system data information
|
||||
$(this).on('pf:drawSystemModules', function(e){
|
||||
drawSystemModules($( e.target ));
|
||||
});
|
||||
|
||||
$(this).on('pf:removeSystemModules', function(e){
|
||||
removeSystemModules($( e.target ));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* clear all system info modules and remove them
|
||||
* @param tabContentElement
|
||||
* @param callback
|
||||
*/
|
||||
let removeSystemModules = function(tabContentElement, callback){
|
||||
tabContentElement.find('.' + config.moduleClass).velocity('transition.slideDownOut', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
complete: function(tempElement){
|
||||
$(tempElement).remove();
|
||||
|
||||
if(callback){
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* clears and updates the system info element (signature table, system info,...)
|
||||
* @param tabContentElement
|
||||
*/
|
||||
let drawSystemModules = function(tabContentElement){
|
||||
let currentSystemData = Util.getCurrentSystemData();
|
||||
|
||||
// get Table cell for system Info
|
||||
let firstCell = $(tabContentElement).find('.' + config.mapTabContentCellFirst);
|
||||
let secondCell = $(tabContentElement).find('.' + config.mapTabContentCellSecond);
|
||||
|
||||
// draw system info module
|
||||
firstCell.drawSystemInfoModule(currentSystemData.mapId, currentSystemData.systemData);
|
||||
|
||||
// draw system graph module
|
||||
firstCell.drawSystemGraphModule(currentSystemData.systemData);
|
||||
|
||||
// draw signature table module
|
||||
firstCell.drawSignatureTableModule(currentSystemData.mapId, currentSystemData.systemData);
|
||||
|
||||
// draw system routes module
|
||||
secondCell.drawSystemRouteModule(currentSystemData.mapId, currentSystemData.systemData);
|
||||
|
||||
// draw system killboard module
|
||||
secondCell.drawSystemKillboardModule(currentSystemData.systemData);
|
||||
|
||||
// set Module Observer
|
||||
setModuleObserver();
|
||||
};
|
||||
|
||||
/**
|
||||
* set observer for each module
|
||||
*/
|
||||
let setModuleObserver = function(){
|
||||
|
||||
// toggle height for a module
|
||||
$(document).off('click.toggleModuleHeight').on('click.toggleModuleHeight', '.' + config.moduleClass, function(e){
|
||||
let moduleElement = $(this);
|
||||
// get click position
|
||||
let posX = moduleElement.offset().left;
|
||||
let posY = moduleElement.offset().top;
|
||||
let clickX = e.pageX - posX;
|
||||
let clickY = e.pageY - posY;
|
||||
|
||||
// check for top-left click
|
||||
if(clickX <= 8 && clickY <= 8){
|
||||
|
||||
// remember height
|
||||
if(! moduleElement.data('origHeight')){
|
||||
|
||||
moduleElement.data('origHeight', moduleElement.outerHeight());
|
||||
}
|
||||
|
||||
if(moduleElement.hasClass( config.moduleClosedClass )){
|
||||
let moduleHeight = moduleElement.data('origHeight');
|
||||
moduleElement.velocity('finish').velocity({
|
||||
height: [ moduleHeight + 'px', [ 400, 15 ] ]
|
||||
},{
|
||||
duration: 400,
|
||||
easing: 'easeOutSine',
|
||||
complete: function(){
|
||||
moduleElement.removeClass( config.moduleClosedClass );
|
||||
moduleElement.removeData();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
moduleElement.velocity('finish').velocity({
|
||||
height: [ '35px', [ 400, 15 ] ]
|
||||
},{
|
||||
duration: 400,
|
||||
easing: 'easeOutSine',
|
||||
complete: function(){
|
||||
moduleElement.addClass( config.moduleClosedClass );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* updates only visible/active map module
|
||||
* @returns {boolean}
|
||||
*/
|
||||
$.fn.updateMapModuleData = function(){
|
||||
let mapModule = $(this);
|
||||
|
||||
// performance logging (time measurement)
|
||||
let logKeyClientUserData = Init.performanceLogging.keyClientUserData;
|
||||
Util.timeStart(logKeyClientUserData);
|
||||
|
||||
// get all active map elements for module
|
||||
let mapElement = mapModule.getActiveMap();
|
||||
|
||||
if(mapElement !== false){
|
||||
let mapId = mapElement.data('id');
|
||||
|
||||
let currentMapUserData = Util.getCurrentMapUserData(mapId);
|
||||
|
||||
|
||||
if(currentMapUserData){
|
||||
// trigger "update local" for this map => async
|
||||
mapElement.trigger('pf:updateLocal', currentMapUserData);
|
||||
|
||||
// update map with current user data
|
||||
mapElement.updateUserData(currentMapUserData);
|
||||
}
|
||||
}
|
||||
|
||||
// log client user data update time
|
||||
let duration = Util.timeStop(logKeyClientUserData);
|
||||
Util.log(logKeyClientUserData, {duration: duration, type: 'client', description:'update users'});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* update system info panels (below map)
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.updateSystemModuleData = function(systemData){
|
||||
let mapModule = $(this);
|
||||
|
||||
if(systemData){
|
||||
// check if current open system is still the requested info system
|
||||
let currentSystemData = Util.getCurrentSystemData();
|
||||
|
||||
if(currentSystemData){
|
||||
if(systemData.id === currentSystemData.systemData.id){
|
||||
// trigger system update events
|
||||
$(document).triggerHandler('pf:updateSystemInfoModule', [systemData]);
|
||||
$(document).triggerHandler('pf:updateSystemSignatureModule', [systemData]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* load all structure elements into a TabsContent div (tab body)
|
||||
*/
|
||||
$.fn.initContentStructure = function(){
|
||||
return this.each(function(){
|
||||
// init bootstrap Grid
|
||||
let contentStructure = $('<div>', {
|
||||
class: ['row', config.mapTabContentRow].join(' ')
|
||||
}).append(
|
||||
$('<div>', {
|
||||
class: ['col-xs-12', 'col-md-8', config.mapTabContentCellFirst, config.mapTabContentCell].join(' ')
|
||||
})
|
||||
).append(
|
||||
$('<div>', {
|
||||
class: ['col-xs-12', 'col-md-4', config.mapTabContentCellSecond, config.mapTabContentCell].join(' ')
|
||||
})
|
||||
);
|
||||
|
||||
// append grid structure
|
||||
$(this).append(contentStructure);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get a fresh tab element
|
||||
* @param options
|
||||
* @returns {*|jQuery|HTMLElement}
|
||||
*/
|
||||
let getTabElement = function(options){
|
||||
let tabElement = $('<div>', {
|
||||
id: config.mapTabElementId
|
||||
});
|
||||
|
||||
let tabBar = $('<ul>', {
|
||||
class: ['nav', 'nav-tabs'].join(' '),
|
||||
id: options.barId
|
||||
}).attr('role', 'tablist');
|
||||
|
||||
let tabContent = $('<div>', {
|
||||
class: 'tab-content'
|
||||
}).attr('data-map-tabs', options.barId);
|
||||
|
||||
tabElement.append(tabBar);
|
||||
tabElement.append(tabContent);
|
||||
|
||||
return tabElement;
|
||||
};
|
||||
|
||||
/**
|
||||
* set data for a map tab, or update an existing map tab with new data
|
||||
* @param options
|
||||
*/
|
||||
$.fn.updateTabData = function(options){
|
||||
let tabElement = $(this);
|
||||
|
||||
// set "main" data
|
||||
tabElement.data('map-id', options.id).data('updated', options.updated);
|
||||
|
||||
// change "tab" link
|
||||
tabElement.attr('href', '#' + config.mapTabIdPrefix + options.id);
|
||||
|
||||
// change "map" icon
|
||||
let mapIconElement = tabElement.find('.' + config.mapTabIconClass);
|
||||
mapIconElement.removeClass().addClass([config.mapTabIconClass, 'fa', 'fa-fw', options.icon].join(' '));
|
||||
|
||||
// change "shared" icon
|
||||
let mapSharedIconElement = tabElement.find('.' + config.mapTabSharedIconClass);
|
||||
mapSharedIconElement.hide();
|
||||
|
||||
// check if the map is a "shared" map
|
||||
if(options.access){
|
||||
if(
|
||||
options.access.character.length > 1 ||
|
||||
options.access.corporation.length > 1 ||
|
||||
options.access.alliance.length > 1
|
||||
){
|
||||
mapSharedIconElement.show();
|
||||
}
|
||||
}
|
||||
|
||||
// change map name label
|
||||
let tabLinkTextElement = tabElement.find('.' + config.mapTabLinkTextClass);
|
||||
tabLinkTextElement.text(options.name);
|
||||
|
||||
// change tabClass
|
||||
let listElement = tabElement.parent();
|
||||
|
||||
// new tab classes
|
||||
let tabClasses = [config.mapTabClass, options.type.classTab ];
|
||||
|
||||
// check if tab was "active" before
|
||||
if( listElement.hasClass('active') ){
|
||||
tabClasses.push('active');
|
||||
}
|
||||
listElement.removeClass().addClass( tabClasses.join(' ') );
|
||||
|
||||
// set title for tooltip
|
||||
if(options.type.name !== undefined){
|
||||
tabLinkTextElement.attr('title', options.type.name + ' map');
|
||||
}
|
||||
|
||||
let mapTooltipOptions = {
|
||||
placement: 'bottom',
|
||||
container: 'body',
|
||||
trigger: 'hover',
|
||||
delay: 150
|
||||
};
|
||||
|
||||
listElement.find('[title]').tooltip(mapTooltipOptions).tooltip('fixTitle');
|
||||
|
||||
if(options.right === true){
|
||||
listElement.addClass('pull-right');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* add a new tab to tab-map-module end returns the new objects
|
||||
* @param options
|
||||
* @returns {{listElement: (*|void), contentElement: (*|HTMLElement)}}
|
||||
*/
|
||||
$.fn.addTab = function(options){
|
||||
let tabElement = $(this);
|
||||
let tabBar = tabElement.find('ul.nav-tabs');
|
||||
let tabContent = tabElement.find('div.tab-content');
|
||||
|
||||
let listElement = $('<li>').attr('role', 'presentation');
|
||||
|
||||
if(options.right === true){
|
||||
listElement.addClass('pull-right');
|
||||
}
|
||||
|
||||
// link element
|
||||
let linkElement = $('<a>').attr('role', 'tab');
|
||||
|
||||
// map icon element
|
||||
let mapIconElement = $('<i>', {
|
||||
class: config.mapTabIconClass
|
||||
});
|
||||
|
||||
// map shared icon element
|
||||
let mapSharedIconElement = $('<i>', {
|
||||
class: [config.mapTabSharedIconClass, 'fa', 'fa-fw', 'fa-share-alt'].join(' '),
|
||||
title: 'shared map'
|
||||
});
|
||||
|
||||
// text element
|
||||
let textElement = $('<span>', {
|
||||
class: config.mapTabLinkTextClass
|
||||
});
|
||||
|
||||
let newListElement = listElement.append(
|
||||
linkElement.append(mapIconElement).append(textElement).append(mapSharedIconElement)
|
||||
);
|
||||
|
||||
tabBar.append( newListElement );
|
||||
|
||||
// update Tab element -> set data
|
||||
linkElement.updateTabData(options);
|
||||
|
||||
// tabs content =======================================================
|
||||
let contentElement = $('<div>', {
|
||||
id: config.mapTabIdPrefix + parseInt( options.id ),
|
||||
class: [config.mapTabContentClass].join(' ')
|
||||
});
|
||||
|
||||
contentElement.addClass('tab-pane');
|
||||
|
||||
tabContent.append(contentElement);
|
||||
|
||||
// init tab ===========================================================
|
||||
linkElement.on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
// callback function after tab switch
|
||||
function switchTabCallback(mapElement, tabLinkElement){
|
||||
tabLinkElement.tab('show');
|
||||
// unfreeze map
|
||||
mapElement.data('frozen', false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mapTabChangeBlocked === false){
|
||||
let tabLinkElement = $(this);
|
||||
let mapId = tabLinkElement.data('map-id');
|
||||
|
||||
// ignore "add" tab. no need for map change
|
||||
if(mapId > 0){
|
||||
let mapElement = $('#' + config.mapTabElementId).getActiveMap();
|
||||
|
||||
if(mapId !== mapElement.data('id')){
|
||||
// block tabs until switch is done
|
||||
mapTabChangeBlocked = true;
|
||||
|
||||
// freeze active map -> no user data update while map switch
|
||||
mapElement.data('frozen', true);
|
||||
|
||||
// hide current map with animation
|
||||
mapElement.visualizeMap('hide', function(){
|
||||
// un-block map tabs
|
||||
mapTabChangeBlocked = switchTabCallback(mapElement, tabLinkElement);
|
||||
});
|
||||
}
|
||||
}else{
|
||||
tabLinkElement.tab('show');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
listElement: newListElement,
|
||||
contentElement: contentElement
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* deletes a map tab for a given map id
|
||||
* @param mapId
|
||||
*/
|
||||
$.fn.deleteTab = function(mapId){
|
||||
let tabElement = $(this);
|
||||
let linkElement = tabElement.find('a[href="#' + config.mapTabIdPrefix + mapId + '"]');
|
||||
let deletedTabName = '';
|
||||
|
||||
if(linkElement.length > 0){
|
||||
deletedTabName = linkElement.find('.' + config.mapTabLinkTextClass).text();
|
||||
|
||||
let liElement = linkElement.parent();
|
||||
let contentElement = tabElement.find('div[id="' + config.mapTabIdPrefix + mapId + '"]');
|
||||
|
||||
let findNewActiveTab = false;
|
||||
// check if liElement was active
|
||||
if(liElement.hasClass('active')){
|
||||
// search any remaining li element and set active
|
||||
findNewActiveTab = true;
|
||||
}
|
||||
|
||||
liElement.remove();
|
||||
contentElement.remove();
|
||||
|
||||
// remove map instance from local cache
|
||||
Map.clearMapInstance(mapId);
|
||||
|
||||
if(findNewActiveTab === true){
|
||||
tabElement.find('.' + config.mapTabClass + ':not(.pull-right):first a').tab('show');
|
||||
}
|
||||
}
|
||||
|
||||
return deletedTabName;
|
||||
};
|
||||
|
||||
/**
|
||||
* clear all active maps
|
||||
*/
|
||||
$.fn.clearMapModule = function(){
|
||||
let mapModuleElement = $(this);
|
||||
let tabMapElement = $('#' + config.mapTabElementId);
|
||||
|
||||
if(tabMapElement.length > 0){
|
||||
let tabElements = mapModuleElement.getMapTabElements();
|
||||
|
||||
for(let i = 0; i < tabElements.length; i++){
|
||||
let tabElement = $(tabElements[i]);
|
||||
let mapId = tabElement.data('map-id');
|
||||
|
||||
if(mapId > 0){
|
||||
tabMapElement.deleteTab(mapId);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* load/update map module into element (all maps)
|
||||
* @returns {boolean}
|
||||
*/
|
||||
$.fn.updateMapModule = function(){
|
||||
let mapModuleElement = $(this);
|
||||
|
||||
// store current map data global (cache)
|
||||
// temp store current map data to prevent data-change while function execution!
|
||||
let tempMapData = Util.getCurrentMapData();
|
||||
|
||||
if(tempMapData.length === 0){
|
||||
// clear all existing maps
|
||||
mapModuleElement.clearMapModule();
|
||||
|
||||
// no map data available -> show "new map" dialog
|
||||
$(document).trigger('pf:menuShowMapSettings', {tab: 'new'});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// performance logging (time measurement)
|
||||
let logKeyClientMapData = Init.performanceLogging.keyClientMapData;
|
||||
Util.timeStart(logKeyClientMapData);
|
||||
|
||||
// check if tabs module is already loaded
|
||||
let tabMapElement = $('#' + config.mapTabElementId);
|
||||
|
||||
// check if tabs have changed
|
||||
let tabsChanged = false;
|
||||
|
||||
if(tabMapElement.length > 0){
|
||||
// tab element already exists
|
||||
let tabElements = mapModuleElement.getMapTabElements();
|
||||
|
||||
// map ID that is currently active
|
||||
let activeMapId = 0;
|
||||
|
||||
// mapIds that are currently active
|
||||
let activeMapIds = [];
|
||||
|
||||
// check whether a tab/map is still active
|
||||
for(let i = 0; i < tabElements.length; i++){
|
||||
let tabElement = $(tabElements[i]);
|
||||
let mapId = tabElement.data('map-id');
|
||||
|
||||
if(mapId > 0){
|
||||
let tabMapData = Util.getCurrentMapData(mapId);
|
||||
|
||||
if(tabMapData !== false){
|
||||
// map data available ->
|
||||
activeMapIds.push(mapId);
|
||||
|
||||
// check for map data change and update tab
|
||||
if(tabMapData.config.updated > tabElement.data('updated')){
|
||||
tabElement.updateTabData(tabMapData.config);
|
||||
}
|
||||
}else{
|
||||
// map data not available -> remove tab
|
||||
let deletedTabName = tabMapElement.deleteTab(mapId);
|
||||
|
||||
tabsChanged = true;
|
||||
|
||||
if(deletedTabName.length > 0){
|
||||
Util.showNotify({title: 'Map removed', text: deletedTabName + ' deleted', type: 'warning'});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add new tabs for new maps
|
||||
$.each(tempMapData, function(i, data){
|
||||
if( activeMapIds.indexOf( data.config.id ) === -1 ){
|
||||
// add new map tab
|
||||
|
||||
let newTabElements = tabMapElement.addTab(data.config);
|
||||
|
||||
// check if there is any active map yet (this is not the case
|
||||
// when ALL maps are removed AND new maps are added in one call
|
||||
// e.g. character switch)
|
||||
if(tabMapElement.find('.' + config.mapTabClass + '.active:not(.pull-right)').length === 0){
|
||||
tabMapElement.find('.' + config.mapTabClass + ':not(.pull-right):first a').tab('show');
|
||||
|
||||
activeMapId = data.config.id;
|
||||
}
|
||||
|
||||
// set observer for manually triggered map events
|
||||
newTabElements.contentElement.setTabContentObserver();
|
||||
|
||||
// load all the structure elements for the new tab
|
||||
newTabElements.contentElement.initContentStructure();
|
||||
|
||||
tabsChanged = true;
|
||||
|
||||
Util.showNotify({title: 'Map added', text: data.config.name + ' added', type: 'success'});
|
||||
}
|
||||
});
|
||||
|
||||
// get current active map
|
||||
if(activeMapId === 0){
|
||||
activeMapId = Util.getMapModule().getActiveMap().data('id');
|
||||
}
|
||||
let activeMapData = Util.getCurrentMapData(activeMapId);
|
||||
|
||||
if(activeMapData !== false){
|
||||
// update active map with new mapData
|
||||
let currentTabContentElement = $('#' + config.mapTabIdPrefix + activeMapId);
|
||||
|
||||
$( currentTabContentElement).loadMap( activeMapData, {} );
|
||||
}
|
||||
}else{
|
||||
// create Tab Element
|
||||
tabsChanged = true;
|
||||
|
||||
let options = {
|
||||
barId: config.mapTabBarId
|
||||
};
|
||||
|
||||
tabMapElement = getTabElement(options);
|
||||
|
||||
// add new tab for each map
|
||||
for(let j = 0; j < tempMapData.length; j++){
|
||||
let data = tempMapData[j];
|
||||
tabMapElement.addTab(data.config);
|
||||
}
|
||||
|
||||
// add "add" button
|
||||
let tabAddOptions = {
|
||||
id: 0,
|
||||
type: {
|
||||
classTab: MapUtil.getInfoForMap( 'standard', 'classTab')
|
||||
},
|
||||
icon: 'fa-plus',
|
||||
name: 'add',
|
||||
right: true
|
||||
};
|
||||
|
||||
tabMapElement.addTab(tabAddOptions);
|
||||
|
||||
mapModuleElement.prepend(tabMapElement);
|
||||
|
||||
let currentUserData = Util.getCurrentUserData();
|
||||
let promiseStore = MapUtil.getLocaleData('character', currentUserData.character.id);
|
||||
|
||||
promiseStore.then(function(data) {
|
||||
// array key where map data is available (0 == first map found)
|
||||
let mapDataIndex = 0;
|
||||
// tab dom selector
|
||||
let mapKeyTabSelector = 'first';
|
||||
|
||||
if(
|
||||
data &&
|
||||
data.defaultMapId
|
||||
){
|
||||
mapDataIndex = Util.getCurrentMapDataIndex(data.defaultMapId);
|
||||
mapKeyTabSelector = 'nth-child(' + ( mapDataIndex + 1 ) + ')';
|
||||
}
|
||||
|
||||
// ==============================================================
|
||||
|
||||
// this new created module
|
||||
let tabContentElements = tabMapElement.find('.' + config.mapTabContentClass);
|
||||
|
||||
// set observer for manually triggered map events
|
||||
tabContentElements.setTabContentObserver();
|
||||
|
||||
// load all the structure elements for ALL Tab Content Body
|
||||
tabContentElements.initContentStructure();
|
||||
|
||||
// set first Tab active
|
||||
tabMapElement.find('.' + config.mapTabClass + ':' + mapKeyTabSelector + ' a').tab('show');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if(tabsChanged === true){
|
||||
|
||||
// remove previous event handlers
|
||||
let allTabElements = mapModuleElement.getMapTabElements();
|
||||
allTabElements.off('show.bs.tab');
|
||||
allTabElements.off('shown.bs.tab');
|
||||
allTabElements.off('hide.bs.tab');
|
||||
|
||||
|
||||
// check for "new map" action before tap-change
|
||||
allTabElements.on('show.bs.tab', function (e) {
|
||||
let mapId = $(e.target).data('map-id');
|
||||
|
||||
if(mapId > 0){
|
||||
// save mapId as new "default" (local storage)
|
||||
let userData = MapUtil.storeDefaultMapId(mapId);
|
||||
}else{
|
||||
// add new Tab selected
|
||||
$(document).trigger('pf:menuShowMapSettings', {tab: 'new'});
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// load new map right after tab-change
|
||||
allTabElements.on('shown.bs.tab', function (e) {
|
||||
let mapId = $(e.target).data('map-id');
|
||||
let tabMapData = Util.getCurrentMapData(mapId);
|
||||
|
||||
if(tabMapData !== false){
|
||||
// load map
|
||||
let currentTabContentElement = $('#' + config.mapTabIdPrefix + mapId);
|
||||
|
||||
$( currentTabContentElement).loadMap( tabMapData, {showAnimation: true} );
|
||||
|
||||
// "wake up" scrollbar for map and get previous state back
|
||||
let scrollableElement = currentTabContentElement.find('.' + config.mapWrapperClass);
|
||||
$(scrollableElement).mCustomScrollbar( 'update');
|
||||
}else{
|
||||
// no map data found -> remove tab
|
||||
tabMapElement.deleteTab(mapId);
|
||||
}
|
||||
});
|
||||
|
||||
allTabElements.on('hide.bs.tab', function (e) {
|
||||
let newMapId = $(e.relatedTarget).data('map-id');
|
||||
let oldMapId = $(e.target).data('map-id');
|
||||
|
||||
// skip "add button"
|
||||
if(newMapId > 0){
|
||||
let currentTabContentElement = $('#' + config.mapTabIdPrefix + oldMapId);
|
||||
|
||||
// disable scrollbar for map that will be hidden. "freeze" current state
|
||||
let scrollableElement = currentTabContentElement.find('.' + config.mapWrapperClass);
|
||||
$(scrollableElement).mCustomScrollbar( 'disable' );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// log client map update time
|
||||
let duration = Util.timeStop(logKeyClientMapData);
|
||||
Util.log(logKeyClientMapData, {duration: duration, type: 'client', description: 'update map'});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* collect all data (systems/connections) for export/save from each active map in the map module
|
||||
* if no change detected -> do not attach map data to return array
|
||||
* @returns {Array}
|
||||
*/
|
||||
$.fn.getMapModuleDataForUpdate = function(){
|
||||
// get all active map elements for module
|
||||
let mapElements = $(this).getMaps();
|
||||
|
||||
let data = [];
|
||||
for(let i = 0; i < mapElements.length; i++){
|
||||
// get all changed (system / connection) data from this map
|
||||
let mapData = $(mapElements[i]).getMapDataFromClient({forceData: false, checkForChange: true});
|
||||
|
||||
if(mapData !== false){
|
||||
|
||||
if(
|
||||
mapData.data.systems.length > 0 ||
|
||||
mapData.data.connections.length > 0
|
||||
){
|
||||
data.push(mapData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
});
|
||||
190
public/js/v1.2.5/app/notification.js
Normal file
190
public/js/v1.2.5/app/notification.js
Normal file
@@ -0,0 +1,190 @@
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'pnotify',
|
||||
//'pnotify.buttons',
|
||||
//'pnotify.confirm',
|
||||
'pnotify.nonblock',
|
||||
'pnotify.desktop',
|
||||
//'pnotify.history',
|
||||
'pnotify.callbacks'
|
||||
], function($, Init, PNotify) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
title: '',
|
||||
text: '',
|
||||
type: '', // 'info', 'success', error, 'warning'
|
||||
icon: false,
|
||||
styling: 'fontawesome', // 'fontawesome', 'bootstrap3', 'jqueryui'
|
||||
animate_speed: 'fast', // animation speed for notifications moving up/down
|
||||
hide: true, // close after few seconds
|
||||
delay: 5000, // visible time for notification in browser
|
||||
mouse_reset: true, // Reset the hide timer if the mouse moves over the notice.
|
||||
shadow: true,
|
||||
addclass: 'stack-bottomright', // class for display, must changed on stack different stacks
|
||||
width: '250px',
|
||||
// nonblock extension parameter (click through notifications)
|
||||
nonblock: {
|
||||
nonblock: true, // change for enable
|
||||
nonblock_opacity: 0.9
|
||||
},
|
||||
// desktop extension "Web Notifications"
|
||||
desktop: {
|
||||
desktop: false, // change for enable
|
||||
icon: Init.path.img + 'notifications/logo.png' // default image for desktop notifications
|
||||
}
|
||||
};
|
||||
|
||||
// initial page title (cached)
|
||||
let initialPageTitle = document.title;
|
||||
|
||||
// global blink timeout cache
|
||||
let blinkTimer;
|
||||
|
||||
// stack container for all notifications
|
||||
let stack = {
|
||||
bottomRight: {
|
||||
stack: {
|
||||
dir1: 'up',
|
||||
dir2: 'left',
|
||||
firstpos1: 30,
|
||||
firstpos2: 10,
|
||||
spacing1: 5,
|
||||
spacing2: 5,
|
||||
push: 'bottom'
|
||||
},
|
||||
addclass: 'stack-bottomright',
|
||||
width: '250px',
|
||||
},
|
||||
barBottom: {
|
||||
stack: {
|
||||
dir1: 'up',
|
||||
dir2: 'right',
|
||||
// context: $('body'),
|
||||
spacing1: 0,
|
||||
spacing2: 0
|
||||
},
|
||||
addclass: 'stack-bar-bottom',
|
||||
width: '70%',
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* show a notification in browser and/or "Web Notifications" in OS
|
||||
* @param customConfig
|
||||
* @param settings
|
||||
*/
|
||||
let showNotify = function(customConfig, settings){
|
||||
|
||||
customConfig = $.extend(true, {}, config, customConfig );
|
||||
|
||||
// desktop notification
|
||||
if(
|
||||
settings &&
|
||||
settings.desktop === true
|
||||
){
|
||||
// ask for Web Notifications permission
|
||||
PNotify.desktop.permission();
|
||||
|
||||
customConfig.delay = 10000;
|
||||
customConfig.desktop.desktop = true;
|
||||
|
||||
// make browser tab blink
|
||||
startTabBlink(customConfig.title);
|
||||
}
|
||||
|
||||
// set notification stack
|
||||
if(
|
||||
settings &&
|
||||
settings.stack
|
||||
){
|
||||
customConfig.stack = stack[settings.stack].stack;
|
||||
customConfig.addclass = stack[settings.stack].addclass;
|
||||
customConfig.width = stack[settings.stack].width;
|
||||
}else{
|
||||
customConfig.stack = stack.bottomRight.stack;
|
||||
customConfig.addclass = stack.bottomRight.addclass;
|
||||
}
|
||||
|
||||
switch(customConfig.type){
|
||||
case 'info':
|
||||
customConfig.icon = 'fa fa-info fa-fw fa-lg';
|
||||
break;
|
||||
case 'success':
|
||||
customConfig.icon = 'fa fa-check fa-fw fa-lg';
|
||||
break;
|
||||
case 'warning':
|
||||
customConfig.icon = 'fa fa-exclamation-triangle fa-fw fa-lg';
|
||||
break;
|
||||
case 'error':
|
||||
customConfig.icon = 'fa fa-close fa-fw fa-lg';
|
||||
break;
|
||||
case 'lock':
|
||||
customConfig.icon = 'fa fa-lock fa-fw fa-lg';
|
||||
customConfig.type = 'success';
|
||||
break;
|
||||
case 'unlock':
|
||||
customConfig.icon = 'fa fa-unlock fa-fw fa-lg';
|
||||
customConfig.type = 'info';
|
||||
break;
|
||||
default:
|
||||
customConfig.icon = false;
|
||||
}
|
||||
|
||||
new PNotify(customConfig);
|
||||
};
|
||||
|
||||
/**
|
||||
* change document.title and make the browsers tab blink
|
||||
* @param blinkTitle
|
||||
*/
|
||||
let startTabBlink = function(blinkTitle){
|
||||
let initBlink = (function(blinkTitle){
|
||||
|
||||
// count blinks if tab is currently active
|
||||
let activeTabBlinkCount = 0;
|
||||
|
||||
let blink = function(){
|
||||
// number of "blinks" should be limited if tab is currently active
|
||||
if(window.isVisible){
|
||||
activeTabBlinkCount++;
|
||||
}
|
||||
|
||||
// toggle page title
|
||||
document.title = (document.title === blinkTitle) ? initialPageTitle : blinkTitle;
|
||||
|
||||
if(activeTabBlinkCount > 10){
|
||||
stopTabBlink();
|
||||
}
|
||||
};
|
||||
|
||||
return function () {
|
||||
if (!blinkTimer) {
|
||||
blinkTimer = setInterval(blink, 1000);
|
||||
}
|
||||
};
|
||||
}( blinkTitle ));
|
||||
|
||||
initBlink();
|
||||
};
|
||||
|
||||
/**
|
||||
* stop blinking document.title
|
||||
*/
|
||||
let stopTabBlink = function(){
|
||||
if(blinkTimer){
|
||||
clearInterval(blinkTimer);
|
||||
document.title = initialPageTitle;
|
||||
blinkTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
showNotify: showNotify,
|
||||
startTabBlink: startTabBlink,
|
||||
stopTabBlink: stopTabBlink
|
||||
};
|
||||
});
|
||||
|
||||
1213
public/js/v1.2.5/app/page.js
Normal file
1213
public/js/v1.2.5/app/page.js
Normal file
File diff suppressed because it is too large
Load Diff
69
public/js/v1.2.5/app/render.js
Normal file
69
public/js/v1.2.5/app/render.js
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Render controller
|
||||
*/
|
||||
|
||||
define(['jquery', 'mustache'], function($, Mustache) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* init function will be called before and after a new module is loaded
|
||||
* @param functionName
|
||||
* @param config
|
||||
*/
|
||||
var initModule = function(functionName, config){
|
||||
|
||||
if(
|
||||
typeof config.functions === 'object' &&
|
||||
typeof config.functions[functionName] === 'function'
|
||||
){
|
||||
config.functions[functionName]();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* load a template and render is with Mustache
|
||||
* @param config
|
||||
* @param data
|
||||
*/
|
||||
var showModule = function(config, data){
|
||||
|
||||
// require module template
|
||||
requirejs(['text!templates/' + config.name + '.html'], function(template) {
|
||||
|
||||
// check for an id, if module already exists, do not insert again
|
||||
if(
|
||||
data.id === 'undefined' ||
|
||||
$('#' + data.id).length === 0
|
||||
){
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
// display module
|
||||
switch(config.link){
|
||||
case 'prepend':
|
||||
config.position.prepend(content);
|
||||
break;
|
||||
case 'before':
|
||||
config.position.before(content);
|
||||
break;
|
||||
case 'after':
|
||||
config.position.after(content);
|
||||
break;
|
||||
default:
|
||||
config.position.append(content);
|
||||
}
|
||||
}
|
||||
|
||||
// init module function after render
|
||||
initModule('after', config);
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
showModule: showModule
|
||||
};
|
||||
});
|
||||
178
public/js/v1.2.5/app/setup.js
Normal file
178
public/js/v1.2.5/app/setup.js
Normal file
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* Main setupPage application
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/map/worker'
|
||||
], function($, Init, Util, MapWorker) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
splashOverlayClass: 'pf-splash' // class for "splash" overlay
|
||||
};
|
||||
|
||||
/**
|
||||
* set page observer
|
||||
*/
|
||||
let setPageObserver = () => {
|
||||
let body = $('body');
|
||||
|
||||
// collapse ---------------------------------------
|
||||
body.find('[data-toggle="collapse"]').css({cursor: 'pointer'}).on('click', function(){
|
||||
$(this).find('.pf-animate-rotate').toggleClass('right');
|
||||
});
|
||||
|
||||
// buttons ----------------------------------------
|
||||
// exclude "download" && "navigation" buttons
|
||||
body.find('.btn').not('.navbar-fixed-bottom .btn').not('[href^="?export"]').on('click', function(e){
|
||||
$('.' + config.splashOverlayClass).showSplashOverlay();
|
||||
});
|
||||
|
||||
// tooltips ---------------------------------------
|
||||
body.initTooltips();
|
||||
|
||||
// change url (remove logout parameter)
|
||||
if (history.pushState) {
|
||||
history.pushState({}, '', location.protocol + '//' + location.host + location.pathname);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* perform a basic check if Clients (browser) can connect to the webSocket server
|
||||
*/
|
||||
let testWebSocket = () => {
|
||||
let tcpSocketPanel = $('#pf-setup-tcpSocket');
|
||||
let webSocketPanel = $('#pf-setup-webSocket');
|
||||
let webSocketURI = MapWorker.getWebSocketURL();
|
||||
let sslIcon = webSocketURI.startsWith('wss:') ?
|
||||
'<i class="fa fa-fw fa-lock txt-color txt-color-success"></i>' :
|
||||
'<i class="fa fa-fw fa-unlock txt-color txt-color-warning"></i>';
|
||||
|
||||
webSocketPanel.showLoadingAnimation();
|
||||
|
||||
let removeColorClasses = (el) => {
|
||||
el.removeClass (function (index, css) {
|
||||
return (css.match (/\btxt-color-\S+/g) || []).join(' ');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* updates the WebSocket panel with new data
|
||||
* @param data
|
||||
*/
|
||||
let updateWebSocketPanel = (data) => {
|
||||
if(data.uri){
|
||||
let uriRow = webSocketPanel.find('.panel-body table tr');
|
||||
uriRow.find('td:nth-child(2) kbd').html(data.uri.value);
|
||||
if(data.uri.status){
|
||||
let statusIcon = uriRow.find('td:nth-child(3) i');
|
||||
removeColorClasses(statusIcon);
|
||||
|
||||
statusIcon.toggleClass('fa-warning', false).toggleClass('fa-check', true).addClass('txt-color-success');
|
||||
}
|
||||
}
|
||||
|
||||
if(data.status){
|
||||
let footer = webSocketPanel.find('.panel-footer h3');
|
||||
removeColorClasses(footer);
|
||||
footer.text(data.status.label).addClass(data.status.class);
|
||||
}
|
||||
};
|
||||
|
||||
// update initial
|
||||
updateWebSocketPanel({
|
||||
uri: {
|
||||
value: sslIcon + ' ' + webSocketURI,
|
||||
status: true
|
||||
},
|
||||
status: {
|
||||
label: 'CONNECTING...',
|
||||
class: 'txt-color-warning'
|
||||
}
|
||||
});
|
||||
|
||||
// try to connect to WebSocket server
|
||||
let socket = new WebSocket(webSocketURI);
|
||||
|
||||
socket.onopen = (e) => {
|
||||
updateWebSocketPanel({
|
||||
status: {
|
||||
label: 'OPEN wait for response...',
|
||||
class: 'txt-color-warning'
|
||||
}
|
||||
});
|
||||
|
||||
// sent token and check response
|
||||
socket.send(JSON.stringify({
|
||||
task: 'healthCheck',
|
||||
load: tcpSocketPanel.data('token')
|
||||
}));
|
||||
|
||||
webSocketPanel.hideLoadingAnimation();
|
||||
};
|
||||
|
||||
socket.onmessage = (e) => {
|
||||
let response = JSON.parse(e.data);
|
||||
|
||||
if(response === 1){
|
||||
// SUCCESS
|
||||
updateWebSocketPanel({
|
||||
status: {
|
||||
label: 'CONNECTED',
|
||||
class: 'txt-color-success'
|
||||
}
|
||||
});
|
||||
}else{
|
||||
// Got response but INVALID
|
||||
updateWebSocketPanel({
|
||||
status: {
|
||||
label: 'INVALID RESPONSE',
|
||||
class: 'txt-color-warning'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
socket.onerror = (e) => {
|
||||
updateWebSocketPanel({
|
||||
status: {
|
||||
label: 'CONNECTION ERROR',
|
||||
class: 'txt-color-danger'
|
||||
}
|
||||
});
|
||||
|
||||
webSocketPanel.hideLoadingAnimation();
|
||||
};
|
||||
|
||||
socket.onclose = (closeEvent) => {
|
||||
updateWebSocketPanel({
|
||||
status: {
|
||||
label: 'CONNECTION FAILED',
|
||||
class: 'txt-color-danger'
|
||||
}
|
||||
});
|
||||
|
||||
webSocketPanel.hideLoadingAnimation();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* main init "setup" page
|
||||
*/
|
||||
$(function(){
|
||||
|
||||
// show app information in browser console --------
|
||||
Util.showVersionInfo();
|
||||
|
||||
// hide splash loading animation ------------------
|
||||
$('.' + config.splashOverlayClass).hideSplashOverlay();
|
||||
|
||||
setPageObserver();
|
||||
|
||||
testWebSocket();
|
||||
});
|
||||
});
|
||||
314
public/js/v1.2.5/app/ui/demo_map.js
Normal file
314
public/js/v1.2.5/app/ui/demo_map.js
Normal file
@@ -0,0 +1,314 @@
|
||||
/**
|
||||
* Demo SVG map
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'lazylinepainter'
|
||||
], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
headerSystemsContainerId: 'pf-header-systems', // id for systems layer
|
||||
headerSystemConnectorsId: 'pf-header-connectors', // id for connectors layer
|
||||
headerConnectionsContainerId: 'pf-header-connections', // id for connections layer
|
||||
headerBackgroundContainerId: 'pf-header-background', // id for background layer
|
||||
|
||||
headerSystemClass: 'pf-header-system', // class for all header background systems
|
||||
|
||||
// map dimensions
|
||||
mapWidth: 600, // map width (px)
|
||||
mapHeight: 380 // map height (px)
|
||||
};
|
||||
|
||||
/**
|
||||
* draw systems layer
|
||||
* @param callback
|
||||
*/
|
||||
var drawSystems = function(callback){
|
||||
|
||||
var pathObj = {
|
||||
systems: {
|
||||
strokepath: [
|
||||
// systems =======================================================================
|
||||
// 1
|
||||
{
|
||||
path: 'm 155 30 90 0 c 2.8 0 5 2.2 5 5 l 0 10 c 0 2.8 -2.2 5 -5 5 l -90 0 c -2.8 0 -5 -2.2 -5 -5 l 0 -10 c 0 -2.8 2.2 -5 5 -5 z',
|
||||
duration: 500,
|
||||
strokeColor: '#568A89' //teal
|
||||
},
|
||||
// 2
|
||||
{
|
||||
path: 'm 374 91 110 0 c 2.8 0 5 2.2 5 5 l 0 10 c 0 2.8 -2.2 5 -5 5 l -110 0 c -2.8 0 -5 -2.2 -5 -5 l 0 -10 c 0 -2.8 2.2 -5 5 -5 z',
|
||||
duration: 500,
|
||||
strokeColor: '#63676A' //gray
|
||||
},
|
||||
// 3
|
||||
{
|
||||
path: 'm 15 149 90 0 c 2.8 0 5 2.2 5 5 l 0 30 c 0 2.8 -2.2 5 -5 5 l -90 0 c -2.8 0 -5 -2.2 -5 -5 l 0 -30 c 0 -2.8 2.2 -5 5 -5 z',
|
||||
duration: 500,
|
||||
strokeColor: '#D9534F ' //red
|
||||
},
|
||||
// 4
|
||||
{
|
||||
path: 'm 235 230 90 0 c 2.8 0 5 2.2 5 5 l 0 10 c 0 2.8 -2.2 5 -5 5 l -90 0 c -2.8 0 -5 -2.2 -5 -5 l 0 -10 c 0 -2.8 2.2 -5 5 -5 z',
|
||||
duration: 500,
|
||||
strokeColor: '#63676A' //gray
|
||||
},
|
||||
// 5
|
||||
{
|
||||
path: 'm 175 330 90 0 c 2.8 0 5 2.2 5 5 l 0 30 c 0 2.8 -2.2 5 -5 5 l -90 0 c -2.8 0 -5 -2.2 -5 -5 l 0 -30 c 0 -2.8 2.2 -5 5 -5 z',
|
||||
duration: 500,
|
||||
strokeColor: '#E28A0D ' //orange
|
||||
},
|
||||
// 6
|
||||
{
|
||||
path: 'm 436 312 90 0 c 2.8 0 5 2.2 5 5 l 0 10 c 0 2.8 -2.2 5 -5 5 l -90 0 c -2.8 0 -5 -2.2 -5 -5 l 0 -10 c 0 -2.8 2.2 -5 5 -5 z',
|
||||
duration: 500,
|
||||
strokeColor: '#5CB85C ' //green
|
||||
}
|
||||
],
|
||||
dimensions: {
|
||||
width: config.mapWidth,
|
||||
height: config.mapHeight
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// draw systems into header
|
||||
$('#' + config.headerSystemsContainerId).lazylinepainter(
|
||||
{
|
||||
svgData: pathObj,
|
||||
strokeWidth: 2,
|
||||
strokeOpacity: 1,
|
||||
overrideKey: 'systems',
|
||||
strokeJoin: 'miter',
|
||||
strokeCap: 'butt',
|
||||
delay: 1000,
|
||||
onComplete: function(){
|
||||
drawConnectors(callback);
|
||||
}
|
||||
|
||||
}).lazylinepainter('paint');
|
||||
};
|
||||
|
||||
/**
|
||||
* draw connectors layer
|
||||
* @param callback
|
||||
*/
|
||||
var drawConnectors = function(callback){
|
||||
|
||||
var connectorDuration = 150;
|
||||
|
||||
var pathObj = {
|
||||
connectors: {
|
||||
strokepath: [
|
||||
// connectors ====================================================================
|
||||
// 1
|
||||
{
|
||||
path: 'm 250.4 34.8 c 1.7 0 3.1 1.3 3.9 2.9 0.8 1.7 0.8 3.7 0 5.3 -0.8 1.7 -2.4 2.7 -4 2.7',
|
||||
duration: connectorDuration
|
||||
},
|
||||
{
|
||||
path: 'm 150 34.7 c -1.7 0 -3.1 1.3 -3.9 2.9 -0.8 1.7 -0.8 3.7 0 5.3 0.8 1.7 2.4 2.7 4 2.7',
|
||||
duration: connectorDuration
|
||||
},
|
||||
// 2
|
||||
{
|
||||
path: 'm 369 96 c -1.7 0 -3.1 1.3 -3.9 2.9 -0.8 1.7 -0.8 3.7 0 5.3 0.8 1.7 2.4 2.7 4 2.7',
|
||||
duration: connectorDuration
|
||||
},
|
||||
// 3
|
||||
{
|
||||
path: 'm 110.4 165 c 1.7 0 3.1 1.3 3.9 2.9 0.8 1.7 0.8 3.7 0 5.3 -0.8 1.7 -2.4 2.7 -4 2.7',
|
||||
duration: connectorDuration
|
||||
},
|
||||
{
|
||||
path: 'm 56 148 c 0 -1.7 1.3 -3.1 2.9 -3.9 1.7 -0.8 3.7 -0.8 5.3 0 1.7 0.8 2.7 2.4 2.7 4',
|
||||
duration: connectorDuration
|
||||
},
|
||||
// 4
|
||||
{
|
||||
path: 'm 229 236 c -1.7 0 -3.1 1.3 -3.9 2.9 -0.8 1.7 -0.8 3.7 0 5.3 0.8 1.7 2.4 2.7 4 2.7',
|
||||
duration: connectorDuration
|
||||
},
|
||||
{
|
||||
path: 'm 331 234.7 c 1.7 0 3.1 1.3 3.9 2.9 0.8 1.7 0.8 3.7 0 5.3 -0.8 1.7 -2.4 2.7 -4 2.7',
|
||||
duration: connectorDuration
|
||||
},
|
||||
{
|
||||
path: 'm 285 251 c 0 1.7 -1.3 3.1 -2.9 3.9 -1.7 0.8 -3.7 0.8 -5.3 0 -1.7 -0.8 -2.7 -2.4 -2.7 -4',
|
||||
duration: connectorDuration
|
||||
},
|
||||
// 5
|
||||
{
|
||||
path: 'm 213 329.5 c 0 -1.7 1.3 -3.1 2.9 -3.9 1.7 -0.8 3.7 -0.8 5.3 0 1.7 0.8 2.7 2.4 2.7 4',
|
||||
duration: connectorDuration
|
||||
},
|
||||
// 6
|
||||
{
|
||||
path: 'm 430 316 c -1.7 0 -3.1 1.3 -3.9 2.9 -0.8 1.7 -0.8 3.7 0 5.3 0.8 1.7 2.4 2.7 4 2.7',
|
||||
duration: connectorDuration
|
||||
}
|
||||
],
|
||||
dimensions: {
|
||||
width: config.mapWidth,
|
||||
height: config.mapHeight
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// draw systems into header
|
||||
$('#' + config.headerConnectionsContainerId).lazylinepainter(
|
||||
{
|
||||
svgData: pathObj,
|
||||
strokeWidth: 2,
|
||||
duration: 600,
|
||||
drawSequential: false,
|
||||
strokeOpacity: 1,
|
||||
overrideKey: 'connectors',
|
||||
strokeJoin: 'miter',
|
||||
strokeCap: 'butt',
|
||||
strokeColor: '#63676A', //gray
|
||||
onComplete: function(){
|
||||
drawConnections(callback);
|
||||
}
|
||||
|
||||
}).lazylinepainter('paint');
|
||||
};
|
||||
|
||||
/**
|
||||
* draw connections layer
|
||||
* @param callback
|
||||
*/
|
||||
var drawConnections = function(callback){
|
||||
|
||||
var connectionDuration = 250;
|
||||
var connectionWidth = 8;
|
||||
var connectionInnerWidth = 4;
|
||||
var connectionBorderColor = '#63676A'; //gray
|
||||
|
||||
var pathObj = {
|
||||
connections: {
|
||||
strokepath: [
|
||||
// connections ====================================================================
|
||||
// 1 - 2
|
||||
{
|
||||
path: 'm 255,40 c 44.5,0 64.2,61.1 109.0,61.15',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionWidth
|
||||
},
|
||||
{
|
||||
path: 'm 255,40 c 44.5,0 64.2,61.1 109.0,61.15',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionInnerWidth,
|
||||
strokeColor: '#3C3F41' // gray
|
||||
},
|
||||
// 2 - 3
|
||||
{
|
||||
path: 'm 146,40.0 c -51.7,0 -83.8,58.8 -83.8,104.5',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionWidth
|
||||
},
|
||||
{
|
||||
path: 'm 146,40.0 c -51.7,0 -83.8,58.8 -83.8,104.5',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionInnerWidth,
|
||||
strokeColor: '#E28A0D' // orange
|
||||
},
|
||||
// 3 - 4
|
||||
{
|
||||
path: 'm 115,171 c 45.7,0 64.1,71.2 109.6,70.8',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionWidth
|
||||
},
|
||||
{
|
||||
path: 'm 115,171 c 45.7,0 64.1,71.2 109.6,70.8',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionInnerWidth,
|
||||
strokeColor: '#A52521' // red
|
||||
},
|
||||
// 4 - 5
|
||||
{
|
||||
path: 'm 279,256 c 0.5,35.9 -60.1,35.1 -60.1,70.0',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionWidth
|
||||
},
|
||||
{
|
||||
path: 'm 279,256 c 0.5,35.9 -60.1,35.1 -60.1,70.0',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionInnerWidth,
|
||||
strokeColor: '#3C3F41' // gray
|
||||
},
|
||||
// 4 - 6
|
||||
{
|
||||
path: 'm 335,240 c 44.2,0 43.7,81.6 89.9,81.6',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionWidth
|
||||
},
|
||||
{
|
||||
path: 'm 335,240 c 44.2,0 43.7,81.6 89.9,81.6',
|
||||
duration: connectionDuration,
|
||||
strokeWidth: connectionInnerWidth,
|
||||
strokeColor: '#3C3F41' // gray
|
||||
}
|
||||
],
|
||||
dimensions: {
|
||||
width: config.mapWidth,
|
||||
height: config.mapHeight
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// draw systems into header
|
||||
$('#' + config.headerSystemConnectorsId).lazylinepainter(
|
||||
{
|
||||
svgData: pathObj,
|
||||
strokeWidth: 2,
|
||||
duration: 600,
|
||||
// drawSequential: false,
|
||||
strokeOpacity: 1,
|
||||
overrideKey: 'connections',
|
||||
strokeJoin: 'miter',
|
||||
strokeCap: 'butt',
|
||||
strokeColor: connectionBorderColor,
|
||||
onComplete: function(){
|
||||
drawBackground(callback);
|
||||
}
|
||||
|
||||
}).lazylinepainter('paint');
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* draw background layer
|
||||
* @param callback
|
||||
*/
|
||||
var drawBackground = function(callback){
|
||||
$('#' + config.headerBackgroundContainerId + ' .' + config.headerSystemClass).velocity('transition.bounceUpIn', {
|
||||
stagger: 150,
|
||||
complete: function(){
|
||||
if(typeof callback === 'function'){
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* draws the demo map
|
||||
* @param callback
|
||||
*/
|
||||
$.fn.drawDemoMap = function(callback){
|
||||
var canvasElement = $(this);
|
||||
|
||||
|
||||
// draw systems
|
||||
drawSystems(callback);
|
||||
};
|
||||
|
||||
});
|
||||
211
public/js/v1.2.5/app/ui/dialog/account_settings.js
Normal file
211
public/js/v1.2.5/app/ui/dialog/account_settings.js
Normal file
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
* user settings/share dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox'
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// select character dialog
|
||||
settingsDialogId: 'pf-settings-dialog', // id for "settings" dialog
|
||||
settingsAccountContainerId: 'pf-settings-dialog-account', // id for the "account" container
|
||||
settingsShareContainerId: 'pf-settings-dialog-share', // id for the "share" container
|
||||
settingsCharacterContainerId: 'pf-settings-dialog-character', // id for the "character" container
|
||||
|
||||
// captcha
|
||||
captchaKeyUpdateAccount: 'SESSION.CAPTCHA.ACCOUNT.UPDATE', // key for captcha reason
|
||||
captchaImageWrapperId: 'pf-dialog-captcha-wrapper', // id for "captcha image" wrapper
|
||||
captchaImageId: 'pf-dialog-captcha-image', // id for "captcha image"
|
||||
|
||||
loadingOptions: { // config for loading overlay
|
||||
icon: {
|
||||
size: 'fa-2x'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* show "register/settings" dialog
|
||||
* @returns {boolean}
|
||||
*/
|
||||
$.fn.showSettingsDialog = function(){
|
||||
|
||||
// check if there are other dialogs open
|
||||
var openDialogs = Util.getOpenDialogs();
|
||||
if(openDialogs.length > 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
requirejs(['text!templates/dialog/settings.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
id: config.settingsDialogId,
|
||||
settingsAccountContainerId: config.settingsAccountContainerId,
|
||||
settingsShareContainerId: config.settingsShareContainerId,
|
||||
settingsCharacterContainerId: config.settingsCharacterContainerId,
|
||||
userData: Init.currentUserData,
|
||||
captchaImageWrapperId: config.captchaImageWrapperId,
|
||||
captchaImageId: config.captchaImageId,
|
||||
formErrorContainerClass: Util.config.formErrorContainerClass,
|
||||
ccpImageServer: Init.url.ccpImageServer
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
var accountSettingsDialog = bootbox.dialog({
|
||||
title: 'Account settings',
|
||||
message: content,
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'cancel',
|
||||
className: 'btn-default'
|
||||
},
|
||||
success: {
|
||||
label: '<i class="fa fa-check fa-fw"></i> save',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
|
||||
// get the current active form
|
||||
var form = $('#' + config.settingsDialogId).find('form').filter(':visible');
|
||||
|
||||
// validate form
|
||||
form.validator('validate');
|
||||
|
||||
// check whether the form is valid
|
||||
var formValid = form.isValidForm();
|
||||
|
||||
if(formValid === true){
|
||||
var tabFormValues = form.getFormValues();
|
||||
|
||||
// send Tab data and store values
|
||||
var requestData = {
|
||||
formData: tabFormValues
|
||||
};
|
||||
|
||||
accountSettingsDialog.find('.modal-content').showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.saveUserConfig,
|
||||
data: requestData,
|
||||
dataType: 'json'
|
||||
}).done(function(responseData){
|
||||
accountSettingsDialog.find('.modal-content').hideLoadingAnimation();
|
||||
|
||||
// set new captcha for any request
|
||||
// captcha is required for sensitive data (not for all data)
|
||||
if(
|
||||
responseData.error &&
|
||||
responseData.error.length > 0
|
||||
){
|
||||
form.showFormMessage(responseData.error);
|
||||
|
||||
$('#' + config.captchaImageWrapperId).showCaptchaImage(config.captchaKeyUpdateAccount, function(){
|
||||
$('#captcha').resetFormFields();
|
||||
});
|
||||
}else{
|
||||
// store new/updated user data -> update head
|
||||
if(responseData.userData){
|
||||
Util.setCurrentUserData(responseData.userData);
|
||||
}
|
||||
|
||||
form.find('.alert').velocity('transition.slideDownOut',{
|
||||
duration: 500,
|
||||
complete: function(){
|
||||
$('#' + config.captchaImageWrapperId).showCaptchaImage(config.captchaKeyUpdateAccount, function(){
|
||||
$('#captcha').resetFormFields();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Util.showNotify({title: 'Account saved', type: 'success'});
|
||||
|
||||
// close dialog/menu
|
||||
$(document).trigger('pf:closeMenu', [{}]);
|
||||
accountSettingsDialog.modal('hide');
|
||||
}
|
||||
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
accountSettingsDialog.find('.modal-content').hideLoadingAnimation();
|
||||
|
||||
var reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': saveAccountSettings', text: reason, type: 'error'});
|
||||
|
||||
// set new captcha for any request
|
||||
// captcha is required for sensitive data (not for all)
|
||||
$('#' + config.captchaImageWrapperId).showCaptchaImage(config.captchaKeyUpdateAccount, function(){
|
||||
$('#captcha').resetFormFields();
|
||||
});
|
||||
|
||||
// check for DB errors
|
||||
if(jqXHR.status === 500){
|
||||
|
||||
if(jqXHR.responseText){
|
||||
var errorObj = $.parseJSON(jqXHR.responseText);
|
||||
|
||||
if(
|
||||
errorObj.error &&
|
||||
errorObj.error.length > 0
|
||||
){
|
||||
form.showFormMessage(errorObj.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).setProgramStatus('problem');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// after modal is shown =======================================================================
|
||||
accountSettingsDialog.on('shown.bs.modal', function(e) {
|
||||
|
||||
var dialogElement = $(this);
|
||||
var form = dialogElement.find('form');
|
||||
|
||||
// request captcha image and show
|
||||
var captchaImageWrapperContainer = $('#' + config.captchaImageWrapperId);
|
||||
captchaImageWrapperContainer.showCaptchaImage(config.captchaKeyUpdateAccount);
|
||||
|
||||
// init captcha refresh button
|
||||
captchaImageWrapperContainer.find('i').on('click', function(){
|
||||
captchaImageWrapperContainer.showCaptchaImage(config.captchaKeyUpdateAccount);
|
||||
});
|
||||
|
||||
|
||||
// init dialog tooltips
|
||||
dialogElement.initTooltips();
|
||||
|
||||
form.initFormValidation();
|
||||
});
|
||||
|
||||
// events for tab change
|
||||
accountSettingsDialog.find('.navbar a').on('shown.bs.tab', function(e){
|
||||
|
||||
// init "toggle" switches on current active tab
|
||||
accountSettingsDialog.find( $(this).attr('href') ).find('input[data-toggle="toggle"][type="checkbox"]').bootstrapToggle({
|
||||
on: '<i class="fa fa-fw fa-check"></i> Enable',
|
||||
off: 'Disable <i class="fa fa-fw fa-ban"></i>',
|
||||
onstyle: 'success',
|
||||
offstyle: 'warning',
|
||||
width: 90,
|
||||
height: 30
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
});
|
||||
51
public/js/v1.2.5/app/ui/dialog/credit.js
Normal file
51
public/js/v1.2.5/app/ui/dialog/credit.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* credits dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/ui/logo'
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// jump info dialog
|
||||
creditsDialogClass: 'pf-credits-dialog', // class for credits dialog
|
||||
creditsDialogLogoContainerId: 'pf-logo-container' // id for logo element
|
||||
};
|
||||
|
||||
/**
|
||||
* show jump info dialog
|
||||
*/
|
||||
$.fn.showCreditsDialog = function(callback, enableHover){
|
||||
|
||||
requirejs(['text!templates/dialog/credit.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
logoContainerId: config.creditsDialogLogoContainerId,
|
||||
version: Util.getVersion()
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
var creditDialog = bootbox.dialog({
|
||||
className: config.creditsDialogClass,
|
||||
title: 'Licence',
|
||||
message: content
|
||||
});
|
||||
|
||||
// after modal is shown =======================================================================
|
||||
creditDialog.on('shown.bs.modal', function(e) {
|
||||
|
||||
// load Logo svg
|
||||
creditDialog.find('#' + config.creditsDialogLogoContainerId).drawLogo(callback, enableHover);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
116
public/js/v1.2.5/app/ui/dialog/delete_account.js
Normal file
116
public/js/v1.2.5/app/ui/dialog/delete_account.js
Normal file
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* delete account dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox'
|
||||
], function($, Init, Util, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// global dialog
|
||||
deleteAccountId: 'pf-dialog-delete-account', // dialog id
|
||||
|
||||
// captcha
|
||||
captchaKeyDeleteAccount: 'SESSION.CAPTCHA.ACCOUNT.DELETE', // key for captcha reason
|
||||
captchaImageWrapperId: 'pf-dialog-captcha-wrapper' // id for "captcha image" wrapper
|
||||
};
|
||||
|
||||
/**
|
||||
* shows delete account dialog
|
||||
*/
|
||||
$.fn.showDeleteAccountDialog = function(){
|
||||
|
||||
|
||||
requirejs(['text!templates/dialog/delete_account.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
deleteAccountId: config.deleteAccountId,
|
||||
userData: Util.getCurrentUserData(),
|
||||
captchaImageWrapperId: config.captchaImageWrapperId,
|
||||
formErrorContainerClass: Util.config.formErrorContainerClass
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
var deleteAccountDialog = bootbox.dialog({
|
||||
title: 'Delete account',
|
||||
message: content,
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'cancel',
|
||||
className: 'btn-default'
|
||||
},
|
||||
success: {
|
||||
label: '<i class="fa fa-user-times fa-fw"></i> delete account',
|
||||
className: 'btn-danger',
|
||||
callback: function() {
|
||||
var dialogElement = $(this);
|
||||
var form = dialogElement.find('form');
|
||||
|
||||
// validate form
|
||||
form.validator('validate');
|
||||
var formValid = form.isValidForm();
|
||||
|
||||
if(formValid){
|
||||
|
||||
var formValues = form.getFormValues();
|
||||
|
||||
if(! $.isEmptyObject(formValues) ){
|
||||
// send Tab data and store values
|
||||
var requestData = {
|
||||
formData: formValues
|
||||
};
|
||||
|
||||
dialogElement.find('.modal-content').showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.deleteAccount,
|
||||
data: requestData,
|
||||
dataType: 'json'
|
||||
}).done(function(responseData){
|
||||
dialogElement.find('.modal-content').hideLoadingAnimation();
|
||||
|
||||
if(responseData.reroute !== undefined){
|
||||
Util.redirect(responseData.reroute, []);
|
||||
}else if(
|
||||
responseData.error &&
|
||||
responseData.error.length > 0
|
||||
){
|
||||
form.showFormMessage(responseData.error);
|
||||
|
||||
$('#' + config.captchaImageWrapperId).showCaptchaImage(config.captchaKeyDeleteAccount, function(){
|
||||
form.find('[name="captcha"]').resetFormFields();
|
||||
});
|
||||
}
|
||||
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
dialogElement.find('.modal-content').hideLoadingAnimation();
|
||||
|
||||
var reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': deleteAccount', text: reason, type: 'error'});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// after modal is shown =======================================================================
|
||||
deleteAccountDialog.on('shown.bs.modal', function(e) {
|
||||
// request captcha image and show
|
||||
$('#' + config.captchaImageWrapperId).showCaptchaImage(config.captchaKeyDeleteAccount);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
38
public/js/v1.2.5/app/ui/dialog/jump_info.js
Normal file
38
public/js/v1.2.5/app/ui/dialog/jump_info.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* jump info dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// jump info dialog
|
||||
jumpInfoDialogClass: 'pf-jump-info-dialog' // class for jump info dialog
|
||||
};
|
||||
|
||||
/**
|
||||
* show jump info dialog
|
||||
*/
|
||||
$.fn.showJumpInfoDialog = function(){
|
||||
|
||||
requirejs(['text!templates/dialog/jump_info.html', 'mustache'], function(template, Mustache) {
|
||||
let data = {};
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
let signatureReaderDialog = bootbox.dialog({
|
||||
className: config.jumpInfoDialogClass,
|
||||
title: 'Wormhole jump information',
|
||||
message: content
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
172
public/js/v1.2.5/app/ui/dialog/manual.js
Normal file
172
public/js/v1.2.5/app/ui/dialog/manual.js
Normal file
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* map manual dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// global dialog
|
||||
dialogNavigationClass: 'pf-dialog-navigation-list', // class for dialog navigation bar
|
||||
dialogNavigationListItemClass: 'pf-dialog-navigation-list-item', // class for map manual li main navigation elements
|
||||
|
||||
// map manual dialog
|
||||
mapManualScrollspyId: 'pf-manual-scrollspy' // id for map manual scrollspy
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the map manual modal dialog
|
||||
*/
|
||||
$.fn.showMapManual = function(){
|
||||
|
||||
requirejs(['text!templates/dialog/map_manual.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
let data = {
|
||||
dialogNavigationClass: config.dialogNavigationClass,
|
||||
dialogNavLiClass: config.dialogNavigationListItemClass,
|
||||
scrollspyId: config.mapManualScrollspyId,
|
||||
pieChartClass : Init.classes.pieChart.pieChartMapCounterClass,
|
||||
mapCounterClass : Init.classes.pieChart.pieChartMapCounterClass
|
||||
};
|
||||
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
// show dialog
|
||||
let mapManualDialog = bootbox.dialog({
|
||||
title: 'Manual',
|
||||
message: content,
|
||||
size: 'large',
|
||||
buttons: {
|
||||
success: {
|
||||
label: 'close',
|
||||
className: 'btn-default',
|
||||
callback: function() {
|
||||
$(mapManualDialog).modal('hide');
|
||||
}
|
||||
}
|
||||
},
|
||||
show: true
|
||||
});
|
||||
|
||||
// modal offset top
|
||||
let modalOffsetTop = 200;
|
||||
|
||||
// disable on scroll event
|
||||
let disableOnScrollEvent = false;
|
||||
|
||||
// scroll breakpoints
|
||||
let scrolLBreakpointElements = null;
|
||||
// scroll navigation links
|
||||
let scrollNavLiElements = null;
|
||||
|
||||
mapManualDialog.on('shown.bs.modal', function(e) {
|
||||
// modal on open
|
||||
scrolLBreakpointElements = $('.pf-manual-scroll-break');
|
||||
scrollNavLiElements = $('.' + config.dialogNavigationListItemClass);
|
||||
});
|
||||
|
||||
let scrollspyElement = $('#' + config.mapManualScrollspyId);
|
||||
|
||||
let whileScrolling = function(){
|
||||
|
||||
if(disableOnScrollEvent === false){
|
||||
for(let i = 0; i < scrolLBreakpointElements.length; i++){
|
||||
let offset = $(scrolLBreakpointElements[i]).offset().top;
|
||||
|
||||
if( (offset - modalOffsetTop) > 0){
|
||||
|
||||
if(! $( scrollNavLiElements[i]).hasClass('active')){
|
||||
// remove all active classes
|
||||
scrollNavLiElements.removeClass('active');
|
||||
// remove focus on links
|
||||
scrollNavLiElements.find('a').blur();
|
||||
|
||||
$( scrollNavLiElements[i]).addClass('active');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// init scrollbar
|
||||
scrollspyElement.mCustomScrollbar({
|
||||
axis: 'y',
|
||||
theme: 'light-thick',
|
||||
scrollInertia: 200,
|
||||
autoExpandScrollbar: false,
|
||||
scrollButtons:{
|
||||
scrollAmount: 30,
|
||||
enable: true
|
||||
},
|
||||
advanced: {
|
||||
updateOnBrowserResize: true,
|
||||
updateOnContentResize: true
|
||||
},
|
||||
callbacks:{
|
||||
onInit: function(){
|
||||
// init fake-map update counter
|
||||
scrollspyElement.find('.' + data.mapCounterClass).initMapUpdateCounter();
|
||||
|
||||
// set navigation button observer
|
||||
let mainNavigationLinks = $('.' + config.dialogNavigationClass).find('a');
|
||||
// text anchor links
|
||||
let subNavigationLinks = scrollspyElement.find('a[data-target]');
|
||||
|
||||
let navigationLinks = mainNavigationLinks.add(subNavigationLinks);
|
||||
|
||||
navigationLinks.on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
disableOnScrollEvent = true;
|
||||
|
||||
// scroll to anchor
|
||||
scrollspyElement.mCustomScrollbar('scrollTo', $(this).attr('data-target'));
|
||||
|
||||
let mainNavigationLiElement = $(this).parent('.' + config.dialogNavigationListItemClass);
|
||||
|
||||
|
||||
whileScrolling();
|
||||
|
||||
// if link is a main navigation link (not an anchor link)
|
||||
|
||||
if(mainNavigationLiElement.length > 0){
|
||||
// remove all active classes
|
||||
scrollNavLiElements.removeClass('active');
|
||||
|
||||
// set new active class
|
||||
$(this).parent().addClass('active');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
onScroll: function(){
|
||||
disableOnScrollEvent = false;
|
||||
|
||||
whileScrolling();
|
||||
},
|
||||
whileScrolling: whileScrolling
|
||||
},
|
||||
mouseWheel:{
|
||||
enable: true,
|
||||
scrollAmount: 200,
|
||||
axis: 'y',
|
||||
preventDefault: true // do not scroll parent at the end
|
||||
},
|
||||
scrollbarPosition: 'outsite',
|
||||
autoDraggerLength: true
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
907
public/js/v1.2.5/app/ui/dialog/map_info.js
Normal file
907
public/js/v1.2.5/app/ui/dialog/map_info.js
Normal file
@@ -0,0 +1,907 @@
|
||||
/**
|
||||
* map info dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, bootbox, MapUtil) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// global dialog
|
||||
dialogNavigationClass: 'pf-dialog-navigation-list', // class for dialog navigation bar
|
||||
|
||||
// map info dialog/tabs
|
||||
dialogMapInfoSummaryId: 'pf-map-info-dialog-summary', // id for map "summary" container
|
||||
dialogMapInfoUsersId: 'pf-map-info-dialog-users', // id for map "user" container
|
||||
dialogMapInfoRefreshId: 'pf-map-info-dialog-refresh', // id for map "refresh" container
|
||||
|
||||
// "summary" container
|
||||
mapInfoId: 'pf-map-info', // id for map info
|
||||
mapInfoSystemsId: 'pf-map-info-systems', // id for map info systems box
|
||||
mapInfoConnectionsId: 'pf-map-info-connections', // id for map info connections box
|
||||
mapInfoUsersId: 'pf-map-info-users', // id for map info users box
|
||||
|
||||
mapInfoTableClass: 'pf-map-info-table', // class for data
|
||||
mapInfoLifetimeCounterClass: 'pf-map-info-lifetime-counter', // class for map lifetime counter
|
||||
|
||||
// dataTable
|
||||
tableImageCellClass: 'pf-table-image-cell', // class for table "image" cells
|
||||
tableImageSmallCellClass: 'pf-table-image-small-cell', // class for table "small image" cells
|
||||
tableActionCellClass: 'pf-table-action-cell', // class for table "action" cells
|
||||
tableCounterCellClass: 'pf-table-counter-cell', // class for table "counter" cells
|
||||
tableActionCellIconClass: 'pf-table-action-icon-cell', // class for table "action" icon (icon is part of cell content)
|
||||
|
||||
loadingOptions: { // config for loading overlay
|
||||
icon: {
|
||||
size: 'fa-2x'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// confirmation dialog settings (e.g. delete row)
|
||||
let confirmationSettings = {
|
||||
container: 'body',
|
||||
placement: 'left',
|
||||
btnCancelClass: 'btn btn-sm btn-default',
|
||||
btnCancelLabel: 'cancel',
|
||||
btnCancelIcon: 'fa fa-fw fa-ban',
|
||||
btnOkClass: 'btn btn-sm btn-danger',
|
||||
btnOkLabel: 'delete',
|
||||
btnOkIcon: 'fa fa-fw fa-close'
|
||||
};
|
||||
|
||||
/**
|
||||
* loads the map info data into an element
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.loadMapInfoData = function(mapData){
|
||||
let mapElement = $(this);
|
||||
|
||||
mapElement.empty();
|
||||
mapElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
let countSystems = mapData.data.systems.length;
|
||||
let countConnections = mapData.data.connections.length;
|
||||
|
||||
// map type
|
||||
let mapTypes = MapUtil.getMapTypes();
|
||||
let mapType = null;
|
||||
|
||||
for(let i = 0; i < mapTypes.length; i++){
|
||||
if(mapTypes[i].id === mapData.config.type.id){
|
||||
mapType = mapTypes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check max map limits (e.g. max systems per map) ============================================================
|
||||
let percentageSystems = (100 / mapType.defaultConfig.max_systems) * countSystems;
|
||||
let maxSystemsClass = (percentageSystems < 90) ? 'txt-color-success' : (percentageSystems < 100) ? 'txt-color-warning' : 'txt-color-danger';
|
||||
|
||||
// build content ==============================================================================================
|
||||
|
||||
let dlElementLeft = $('<dl>', {
|
||||
class: 'dl-horizontal',
|
||||
css: {'float': 'left'}
|
||||
}).append(
|
||||
$('<dt>').text( 'Icon' )
|
||||
).append(
|
||||
$('<dd>').append(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-fw', mapData.config.icon].join(' ')
|
||||
})
|
||||
)
|
||||
).append(
|
||||
$('<dt>').text( 'Name' )
|
||||
).append(
|
||||
$('<dd>').text( mapData.config.name )
|
||||
).append(
|
||||
$('<dt>').text( 'Type' )
|
||||
).append(
|
||||
$('<dd>', {
|
||||
class: mapType.class
|
||||
}).text( mapType.name )
|
||||
);
|
||||
|
||||
mapElement.append(dlElementLeft);
|
||||
|
||||
let dlElementRight = $('<dl>', {
|
||||
class: 'dl-horizontal',
|
||||
css: {'float': 'right'}
|
||||
}).append(
|
||||
$('<dt>').text( 'Lifetime' )
|
||||
).append(
|
||||
$('<dd>', {
|
||||
class: config.mapInfoLifetimeCounterClass,
|
||||
text: mapData.config.created
|
||||
})
|
||||
).append(
|
||||
$('<dt>').text( 'Systems' )
|
||||
).append(
|
||||
$('<dd>', {
|
||||
class: ['txt-color', maxSystemsClass].join(' ')
|
||||
}).text( countSystems + ' / ' + mapType.defaultConfig.max_systems )
|
||||
).append(
|
||||
$('<dt>').text( 'Connections' )
|
||||
).append(
|
||||
$('<dd>').text( countConnections )
|
||||
);
|
||||
|
||||
mapElement.append(dlElementRight);
|
||||
|
||||
// init map lifetime counter
|
||||
$('.' + config.mapInfoLifetimeCounterClass).initTimestampCounter();
|
||||
|
||||
mapElement.hideLoadingAnimation();
|
||||
};
|
||||
|
||||
/**
|
||||
* loads system info table into an element
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.loadSystemInfoTable = function(mapData){
|
||||
|
||||
let systemsElement = $(this);
|
||||
|
||||
systemsElement.empty();
|
||||
|
||||
let systemTable = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border', config.mapInfoTableClass].join(' ')
|
||||
});
|
||||
systemsElement.append(systemTable);
|
||||
|
||||
systemsElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
// table init complete
|
||||
systemTable.on( 'init.dt', function () {
|
||||
systemsElement.hideLoadingAnimation();
|
||||
|
||||
// init table tooltips
|
||||
let tooltipElements = systemsElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
});
|
||||
|
||||
// prepare data for dataTables
|
||||
let systemsData = [];
|
||||
for(let i = 0; i < mapData.data.systems.length; i++){
|
||||
let tempSystemData = mapData.data.systems[i];
|
||||
|
||||
let tempData = {};
|
||||
|
||||
// system id
|
||||
tempData.id = tempSystemData.id;
|
||||
|
||||
// current position
|
||||
if(tempSystemData.currentUser === true){
|
||||
tempData.position = {
|
||||
position: '<i class="fa fa fa-map-marker fa-lg fa-fw"></i>',
|
||||
position_sort: 1
|
||||
};
|
||||
}else{
|
||||
tempData.position = {
|
||||
position: '',
|
||||
position_sort: 0
|
||||
};
|
||||
}
|
||||
|
||||
// active pilots
|
||||
if(tempSystemData.userCount > 0){
|
||||
tempData.userCount = tempSystemData.userCount;
|
||||
}else{
|
||||
tempData.userCount = '';
|
||||
}
|
||||
|
||||
// type
|
||||
tempData.type = {
|
||||
type: MapUtil.getSystemTypeInfo(tempSystemData.type.id, 'name'),
|
||||
type_sort: tempSystemData.type.id
|
||||
};
|
||||
|
||||
// security
|
||||
let securityClass = Util.getSecurityClassForSystem(tempSystemData.security);
|
||||
tempData.security = {
|
||||
security: '<span class="' + securityClass + '">' + tempSystemData.security + '</span>',
|
||||
security_sort: tempSystemData.security
|
||||
};
|
||||
|
||||
// name
|
||||
tempData.name = tempSystemData.name;
|
||||
|
||||
// alias
|
||||
tempData.alias = (tempSystemData.alias === tempSystemData.name) ? '' : tempSystemData.alias;
|
||||
|
||||
// region
|
||||
tempData.region = tempSystemData.region.name;
|
||||
|
||||
// static
|
||||
let statics = [];
|
||||
for(let j = 0; j < tempSystemData.statics.length; j++){
|
||||
let security = tempSystemData.statics[j].security;
|
||||
let secClass = Util.getSecurityClassForSystem(security);
|
||||
statics.push('<span class="' + secClass + '">' + security + '</span>');
|
||||
}
|
||||
tempData.static = statics.join(' ');
|
||||
|
||||
// status
|
||||
let systemStatusClass = Util.getStatusInfoForSystem(tempSystemData.status.id, 'class');
|
||||
if(systemStatusClass !== ''){
|
||||
tempData.status = {
|
||||
status: '<i class="fa fa fa-square-o fa-lg fa-fw ' + systemStatusClass + '"></i>',
|
||||
status_sort: tempSystemData.status.id
|
||||
};
|
||||
}else{
|
||||
tempData.status = {
|
||||
status: '',
|
||||
status_sort: tempSystemData.status.id
|
||||
};
|
||||
}
|
||||
|
||||
// effect
|
||||
let systemEffectClass = MapUtil.getEffectInfoForSystem(tempSystemData.effect, 'class');
|
||||
if(systemEffectClass !== ''){
|
||||
tempData.effect = {
|
||||
effect: '<i class="fa fa fa-square fa-lg fa-fw ' + systemEffectClass + '"></i>',
|
||||
effect_sort: tempSystemData.effect
|
||||
};
|
||||
}else{
|
||||
tempData.effect = {
|
||||
effect: '',
|
||||
effect_sort: ''
|
||||
};
|
||||
}
|
||||
|
||||
// trueSec
|
||||
let systemTrueSecClass = Util.getTrueSecClassForSystem(tempSystemData.trueSec);
|
||||
if(systemTrueSecClass !== ''){
|
||||
tempData.trueSec = {
|
||||
trueSec: '<span class="' + systemTrueSecClass + '">' + tempSystemData.trueSec.toFixed(1) + '</span>',
|
||||
trueSec_sort: tempSystemData.trueSec
|
||||
};
|
||||
}else{
|
||||
tempData.trueSec = {
|
||||
trueSec: '',
|
||||
trueSec_sort: tempSystemData.trueSec
|
||||
};
|
||||
}
|
||||
|
||||
// locked
|
||||
if(tempSystemData.locked === 1){
|
||||
tempData.locked = {
|
||||
locked: '<i class="fa fa-lock fa-lg fa-fw"></i>',
|
||||
locked_sort: tempSystemData.locked
|
||||
};
|
||||
}else{
|
||||
tempData.locked = {
|
||||
locked: '',
|
||||
locked_sort: 0
|
||||
};
|
||||
}
|
||||
|
||||
// updated
|
||||
tempData.updated = tempSystemData.updated.updated;
|
||||
|
||||
// delete row
|
||||
tempData.clear = '<i class="fa fa-close txt-color txt-color-redDarker"></i>';
|
||||
|
||||
systemsData.push(tempData);
|
||||
}
|
||||
|
||||
let systemsDataTable = systemTable.dataTable( {
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [[ 9, 'desc' ], [ 3, 'asc' ]],
|
||||
autoWidth: false,
|
||||
responsive: {
|
||||
breakpoints: Init.breakpoints,
|
||||
details: false
|
||||
},
|
||||
hover: false,
|
||||
data: systemsData,
|
||||
columnDefs: [],
|
||||
language: {
|
||||
emptyTable: 'Map is empty',
|
||||
zeroRecords: 'No systems found',
|
||||
lengthMenu: 'Show _MENU_ systems',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ systems'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title: 'type',
|
||||
width: '25px',
|
||||
className: ['min-desktop'].join(' '),
|
||||
data: 'type',
|
||||
render: {
|
||||
_: 'type',
|
||||
sort: 'type_sort'
|
||||
}
|
||||
},{
|
||||
title: '',
|
||||
width: '1px',
|
||||
searchable: false,
|
||||
data: 'security',
|
||||
render: {
|
||||
_: 'security',
|
||||
sort: 'security_sort'
|
||||
}
|
||||
},{
|
||||
title: 'sec',
|
||||
width: '18px',
|
||||
className: ['text-center', 'min-desktop'].join(' '),
|
||||
searchable: false,
|
||||
data: 'trueSec',
|
||||
render: {
|
||||
_: 'trueSec',
|
||||
sort: 'trueSec_sort'
|
||||
}
|
||||
},{
|
||||
title: 'system',
|
||||
data: 'name'
|
||||
},{
|
||||
title: 'alias',
|
||||
data: 'alias'
|
||||
},{
|
||||
title: 'region',
|
||||
data: 'region'
|
||||
},{
|
||||
title: '<i class="fa fa-square-o fa-lg" title="system status" data-toggle="tooltip"></i>',
|
||||
width: '12px',
|
||||
searchable: false,
|
||||
data: 'status',
|
||||
render: {
|
||||
_: 'status',
|
||||
sort: 'status_sort'
|
||||
}
|
||||
},{
|
||||
title: '<i class="fa fa-square fa-lg" title="system effect" data-toggle="tooltip"></i>',
|
||||
width: '12px',
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'effect',
|
||||
render: {
|
||||
_: 'effect',
|
||||
sort: 'effect_sort'
|
||||
}
|
||||
},{
|
||||
title: 'static',
|
||||
width: '30px',
|
||||
data: 'static'
|
||||
},{
|
||||
title: '<i class="fa fa-map-marker fa-lg" title="your position" data-toggle="tooltip"></i>',
|
||||
width: '8px',
|
||||
searchable: false,
|
||||
data: 'position',
|
||||
render: {
|
||||
_: 'position',
|
||||
sort: 'position_sort'
|
||||
}
|
||||
},{
|
||||
title: '<i class="fa fa-plane fa-lg" title="active pilots" data-toggle="tooltip"></i>',
|
||||
width: '12px',
|
||||
className: 'text-center',
|
||||
searchable: false,
|
||||
data: 'userCount'
|
||||
},{
|
||||
title: '<i class="fa fa-lock fa-lg" title="system locked" data-toggle="tooltip"></i>',
|
||||
width: '10px',
|
||||
searchable: false,
|
||||
data: 'locked',
|
||||
render: {
|
||||
_: 'locked',
|
||||
sort: 'locked_sort'
|
||||
}
|
||||
},{
|
||||
title: 'updated',
|
||||
width: '80px',
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCounterCellClass, 'min-desktop'].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
$(cell).initTimestampCounter();
|
||||
|
||||
// highlight cell
|
||||
let diff = new Date().getTime() - cellData * 1000;
|
||||
let dateDiff = new Date(diff);
|
||||
if(dateDiff.getUTCDate() > 1){
|
||||
$(cell).addClass('txt-color txt-color-warning');
|
||||
}
|
||||
}
|
||||
},{
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '10px',
|
||||
className: ['text-center', config.tableActionCellClass].join(' '),
|
||||
data: 'clear',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
||||
let tempTableElement = this;
|
||||
|
||||
let tempConfirmationSettings = confirmationSettings;
|
||||
tempConfirmationSettings.title = 'Delete system';
|
||||
tempConfirmationSettings.onConfirm = function(e, target){
|
||||
let deleteRowElement = $(target).parents('tr');
|
||||
|
||||
let activeMap = Util.getMapModule().getActiveMap();
|
||||
let systemElement = $('#' + MapUtil.getSystemId(mapData.config.id, rowData.id) );
|
||||
|
||||
if(systemElement.length){
|
||||
// trigger system delete event
|
||||
activeMap.trigger('pf:deleteSystems', [{
|
||||
systems: [systemElement[0]],
|
||||
callback: function(deletedSystems){
|
||||
// callback function after ajax "delete" success
|
||||
// check if system was deleted
|
||||
if(deletedSystems.length === 1){
|
||||
// remove table row
|
||||
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
||||
|
||||
Util.showNotify({title: 'System deleted', text: rowData.name, type: 'success'});
|
||||
|
||||
// refresh connection table (connections might have changed) ==================
|
||||
let connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
let mapDataNew = activeMap.getMapDataFromClient({forceData: true});
|
||||
|
||||
connectionsElement.loadConnectionInfoTable(mapDataNew);
|
||||
}else{
|
||||
// error
|
||||
Util.showNotify({title: 'Failed to delete system', text: rowData.name, type: 'error'});
|
||||
}
|
||||
}
|
||||
}]);
|
||||
}
|
||||
};
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(tempConfirmationSettings);
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* loads connection info table into an element
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.loadConnectionInfoTable = function(mapData){
|
||||
let connectionsElement = $(this);
|
||||
|
||||
connectionsElement.empty();
|
||||
|
||||
let connectionTable = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border', config.mapInfoTableClass].join(' ')
|
||||
});
|
||||
connectionsElement.append(connectionTable);
|
||||
|
||||
connectionsElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
// table init complete
|
||||
connectionTable.on( 'init.dt', function () {
|
||||
connectionsElement.hideLoadingAnimation();
|
||||
});
|
||||
|
||||
// connections table ==========================================================================================
|
||||
|
||||
// prepare data for dataTables
|
||||
let connectionData = [];
|
||||
for(let j = 0; j < mapData.data.connections.length; j++){
|
||||
let tempConnectionData = mapData.data.connections[j];
|
||||
|
||||
let tempConData = {};
|
||||
|
||||
tempConData.id = tempConnectionData.id;
|
||||
|
||||
tempConData.scope = {
|
||||
scope: MapUtil.getScopeInfoForConnection(tempConnectionData.scope, 'label'),
|
||||
scope_sort: tempConnectionData.scope
|
||||
};
|
||||
|
||||
// source system name
|
||||
tempConData.source = tempConnectionData.sourceName;
|
||||
|
||||
// connection
|
||||
let connectionClasses = [];
|
||||
for(let k = 0; k < tempConnectionData.type.length; k++){
|
||||
connectionClasses.push( MapUtil.getConnectionInfo( tempConnectionData.type[k], 'cssClass') );
|
||||
|
||||
}
|
||||
|
||||
connectionClasses = connectionClasses.join(' ');
|
||||
|
||||
tempConData.connection = '<div class="pf-fake-connection ' + connectionClasses + '"></div>';
|
||||
|
||||
|
||||
tempConData.target = tempConnectionData.targetName;
|
||||
|
||||
tempConData.updated = tempConnectionData.updated;
|
||||
|
||||
tempConData.clear = '<i class="fa fa-close txt-color txt-color-redDarker"></i>';
|
||||
|
||||
connectionData.push(tempConData);
|
||||
}
|
||||
|
||||
let connectionDataTable = connectionTable.dataTable( {
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [ 0, 'desc' ],
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
data: connectionData,
|
||||
columnDefs: [],
|
||||
language: {
|
||||
emptyTable: 'No connections',
|
||||
zeroRecords: 'No connections found',
|
||||
lengthMenu: 'Show _MENU_ connections',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ connections'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title: 'scope',
|
||||
width: '50px',
|
||||
orderable: true,
|
||||
data: 'scope',
|
||||
render: {
|
||||
_: 'scope',
|
||||
sort: 'scope_sort'
|
||||
}
|
||||
},{
|
||||
title: 'source system',
|
||||
data: 'source'
|
||||
},{
|
||||
title: 'connection',
|
||||
width: '80px',
|
||||
className: 'text-center',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
data: 'connection'
|
||||
}, {
|
||||
title: 'target system',
|
||||
data: 'target'
|
||||
},{
|
||||
title: 'updated',
|
||||
width: '80px',
|
||||
searchable: false,
|
||||
className: ['text-right', config.tableCounterCellClass].join(' '),
|
||||
data: 'updated',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
$(cell).initTimestampCounter();
|
||||
|
||||
// highlight cell
|
||||
let diff = new Date().getTime() - cellData * 1000;
|
||||
let dateDiff = new Date(diff);
|
||||
if(dateDiff.getUTCDate() > 1){
|
||||
$(cell).addClass('txt-color txt-color-warning');
|
||||
}
|
||||
}
|
||||
},{
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '10px',
|
||||
className: ['text-center', config.tableActionCellClass].join(' '),
|
||||
data: 'clear',
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
||||
let tempTableElement = this;
|
||||
|
||||
let tempConfirmationSettings = confirmationSettings;
|
||||
tempConfirmationSettings.title = 'Delete connection';
|
||||
tempConfirmationSettings.onConfirm = function(e, target){
|
||||
let deleteRowElement = $(target).parents('tr');
|
||||
|
||||
// deleteSignatures(row);
|
||||
let connection = $().getConnectionById(mapData.config.id, rowData.id);
|
||||
|
||||
$().deleteConnections([connection], function(){
|
||||
// callback function after ajax "delete" success
|
||||
// remove table row
|
||||
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
||||
});
|
||||
};
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(tempConfirmationSettings);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* loads user info table into an element
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.loadUsersInfoTable = function(mapData){
|
||||
let usersElement = $(this);
|
||||
|
||||
usersElement.empty();
|
||||
|
||||
let userTable = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border', config.mapInfoTableClass].join(' ')
|
||||
});
|
||||
usersElement.append(userTable);
|
||||
|
||||
usersElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
// table init complete
|
||||
userTable.on( 'init.dt', function () {
|
||||
usersElement.hideLoadingAnimation();
|
||||
|
||||
// init table tooltips
|
||||
let tooltipElements = usersElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip({
|
||||
container: usersElement.parent()
|
||||
});
|
||||
});
|
||||
|
||||
let getIconForInformationWindow = () => {
|
||||
return '<i class="fa fa-fw fa-id-card ' + config.tableActionCellIconClass + '" title="open ingame" data-toggle="tooltip"></i>';
|
||||
};
|
||||
|
||||
// users table ================================================================================================
|
||||
// prepare users data for dataTables
|
||||
let currentMapUserData = Util.getCurrentMapUserData( mapData.config.id );
|
||||
let usersData = [];
|
||||
|
||||
if(
|
||||
currentMapUserData &&
|
||||
currentMapUserData.data &&
|
||||
currentMapUserData.data.systems
|
||||
){
|
||||
for(let i = 0; i < currentMapUserData.data.systems.length; i++){
|
||||
let tempSystemUserData = currentMapUserData.data.systems[i];
|
||||
for(let j = 0; j < tempSystemUserData.user.length; j++){
|
||||
usersData.push( tempSystemUserData.user[j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let userDataTable = userTable.dataTable( {
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [[ 3, 'asc' ]],
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
data: usersData,
|
||||
language: {
|
||||
emptyTable: 'No active pilots',
|
||||
zeroRecords: 'No active pilots found',
|
||||
lengthMenu: 'Show _MENU_ pilots',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ pilots'
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: ['pf-help-default', 'text-center', config.tableImageCellClass].join(' '),
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data;
|
||||
if(type === 'display'){
|
||||
value = '<img src="' + Init.url.ccpImageServer + 'Render/' + value.typeId + '_32.png" title="' + value.typeName + '" data-toggle="tooltip" />';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 1,
|
||||
title: 'ship name',
|
||||
width: '100px',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: function(data, type, row){
|
||||
let value = data.name;
|
||||
if(type === 'display'){
|
||||
value = '<div class="' + MapUtil.config.tableCellEllipsisClass + ' ' + MapUtil.config.tableCellEllipsis100Class + '">' + data.name + '</div>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 2,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: [config.tableImageCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data;
|
||||
if(type === 'display'){
|
||||
value = '<img src="' + Init.url.ccpImageServer + 'Character/' + value + '_32.jpg" />';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 3,
|
||||
title: 'pilot',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
className: [config.tableActionCellClass].join(' '),
|
||||
data: 'name',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data;
|
||||
if(type === 'display'){
|
||||
value += ' ' + getIconForInformationWindow();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// open character information window (ingame)
|
||||
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
|
||||
let rowData = e.data.tableApi.row(this).data();
|
||||
Util.openIngameWindow(rowData.id);
|
||||
});
|
||||
}
|
||||
},{
|
||||
targets: 4,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: [config.tableImageCellClass, config.tableImageSmallCellClass].join(' '),
|
||||
data: 'corporation',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
let value = data;
|
||||
if(type === 'display'){
|
||||
value = '<img src="' + Init.url.ccpImageServer + 'Corporation/' + value.id + '_32.png" />';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
title: 'corporation',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
className: [config.tableActionCellClass].join(' '),
|
||||
data: 'corporation',
|
||||
render: {
|
||||
_: function (data, type, row, meta) {
|
||||
let value = data.name;
|
||||
if(type === 'display'){
|
||||
value += ' ' + getIconForInformationWindow();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
// open character information window (ingame)
|
||||
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
|
||||
let cellData = e.data.tableApi.cell(this).data();
|
||||
Util.openIngameWindow(cellData.id);
|
||||
});
|
||||
}
|
||||
},{
|
||||
targets: 6,
|
||||
title: 'system',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'log.system',
|
||||
render: {
|
||||
_: 'name',
|
||||
sort: 'name'
|
||||
}
|
||||
},{
|
||||
targets: 7,
|
||||
title: 'station',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'log.station',
|
||||
render: {
|
||||
_: 'name',
|
||||
sort: 'name'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the map information modal dialog
|
||||
* @param options
|
||||
*/
|
||||
$.fn.showMapInfoDialog = function(options){
|
||||
let activeMap = Util.getMapModule().getActiveMap();
|
||||
let mapData = activeMap.getMapDataFromClient({forceData: true});
|
||||
|
||||
if(mapData !== false){
|
||||
requirejs(['text!templates/dialog/map_info.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
let data = {
|
||||
dialogSummaryContainerId: config.dialogMapInfoSummaryId,
|
||||
dialogUsersContainerId: config.dialogMapInfoUsersId,
|
||||
dialogRefreshContainerId: config.dialogMapInfoRefreshId,
|
||||
dialogNavigationClass: config.dialogNavigationClass,
|
||||
mapInfoId: config.mapInfoId,
|
||||
mapInfoSystemsId: config.mapInfoSystemsId,
|
||||
mapInfoConnectionsId: config.mapInfoConnectionsId,
|
||||
mapInfoUsersId: config.mapInfoUsersId,
|
||||
|
||||
// default open tab ----------
|
||||
openTabInformation: options.tab === 'information',
|
||||
openTabActivity: options.tab === 'activity'
|
||||
};
|
||||
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
let mapInfoDialog = bootbox.dialog({
|
||||
title: 'Map information',
|
||||
message: content,
|
||||
size: 'large',
|
||||
buttons: {
|
||||
success: {
|
||||
label: 'close',
|
||||
className: 'btn-primary',
|
||||
callback: function() {
|
||||
$(mapInfoDialog).modal('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mapInfoDialog.on('shown.bs.modal', function(e) {
|
||||
// modal on open
|
||||
|
||||
let mapElement = $('#' + config.mapInfoId);
|
||||
let systemsElement = $('#' + config.mapInfoSystemsId);
|
||||
let connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
let usersElement = $('#' + config.mapInfoUsersId);
|
||||
|
||||
|
||||
// set refresh button observer
|
||||
$('#' + config.dialogMapInfoRefreshId).on('click', function(){
|
||||
let menuAction = $(this).attr('data-action');
|
||||
if(menuAction === 'refresh'){
|
||||
// get new map data
|
||||
let mapData = activeMap.getMapDataFromClient({forceData: true});
|
||||
|
||||
mapElement.loadMapInfoData(mapData);
|
||||
systemsElement.loadSystemInfoTable(mapData);
|
||||
connectionsElement.loadConnectionInfoTable(mapData);
|
||||
usersElement.loadUsersInfoTable(mapData);
|
||||
}
|
||||
});
|
||||
|
||||
// load map data
|
||||
mapElement.loadMapInfoData(mapData);
|
||||
|
||||
// load system table
|
||||
systemsElement.loadSystemInfoTable(mapData);
|
||||
|
||||
// load connection table
|
||||
connectionsElement.loadConnectionInfoTable(mapData);
|
||||
|
||||
// load users table
|
||||
usersElement.loadUsersInfoTable(mapData);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
643
public/js/v1.2.5/app/ui/dialog/map_settings.js
Normal file
643
public/js/v1.2.5/app/ui/dialog/map_settings.js
Normal file
@@ -0,0 +1,643 @@
|
||||
/**
|
||||
* map settings dialogs
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, Render, bootbox, MapUtil) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// map dialog
|
||||
newMapDialogId: 'pf-map-dialog', // id for map settings dialog
|
||||
dialogMapCreateContainerId: 'pf-map-dialog-create', // id for the "new map" container
|
||||
dialogMapEditContainerId: 'pf-map-dialog-edit', // id for the "edit" container
|
||||
dialogMapSettingsContainerId: 'pf-map-dialog-settings', // id for the "settings" container
|
||||
dialogMapDownloadContainerId: 'pf-map-dialog-download', // id for the "download" container
|
||||
|
||||
deleteExpiredConnectionsId: 'pf-map-dialog-delete-connections-expired', // id for "deleteExpiredConnections" checkbox
|
||||
deleteEolConnectionsId: 'pf-map-dialog-delete-connections-eol', // id for "deleteEOLConnections" checkbox
|
||||
persistentAliasesId: 'pf-map-dialog-persistent-aliases', // id for "persistentAliases" checkbox
|
||||
|
||||
characterSelectId: 'pf-map-dialog-character-select', // id for "character" select
|
||||
corporationSelectId: 'pf-map-dialog-corporation-select', // id for "corporation" select
|
||||
allianceSelectId: 'pf-map-dialog-alliance-select', // id for "alliance" select
|
||||
|
||||
dialogMapExportFormId: 'pf-map-dialog-form-export', // id for "export" form
|
||||
dialogMapImportFormId: 'pf-map-dialog-form-import', // id for "import" form
|
||||
|
||||
buttonExportId: 'pf-map-dialog-button-export', // id for "export" button
|
||||
buttonImportId: 'pf-map-dialog-button-import', // id for "import" button
|
||||
|
||||
fieldExportId: 'pf-map-filename-export', // id for "export" filename field
|
||||
fieldImportId: 'pf-map-filename-import', // id for "import" filename field
|
||||
dialogMapImportInfoId: 'pf-map-import-container', // id for "info" container
|
||||
dragDropElementClass: 'pf-form-dropzone' // class for "drag&drop" zone
|
||||
};
|
||||
|
||||
/**
|
||||
* format a given string into a valid filename
|
||||
* @param filename
|
||||
* @returns {string}
|
||||
*/
|
||||
let formatFilename = function(filename){
|
||||
filename = filename.replace(/[^a-zA-Z0-9]/g,'_');
|
||||
|
||||
let nowDate = new Date();
|
||||
let filenameDate = nowDate.toISOString().slice(0,10).replace(/-/g, '_');
|
||||
|
||||
return (filename + '_' + filenameDate).replace(/__/g,'_');
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the add/edit map dialog
|
||||
* @param mapData
|
||||
* @param options
|
||||
*/
|
||||
$.fn.showMapSettingsDialog = function(mapData, options){
|
||||
|
||||
// check if dialog is already open
|
||||
let mapInfoDialogElement = $('#' + config.newMapDialogId);
|
||||
if(!mapInfoDialogElement.is(':visible')){
|
||||
|
||||
requirejs([
|
||||
'text!templates/dialog/map.html',
|
||||
'text!templates/form/map_settings.html',
|
||||
'mustache'
|
||||
], function(templateMapDialog, templateMapSettings, Mustache) {
|
||||
|
||||
let dialogTitle = 'Map settings';
|
||||
|
||||
// if there are no maps -> hide settings tab
|
||||
let hideSettingsTab = false;
|
||||
let hideEditTab = false;
|
||||
let hideDownloadTab = false;
|
||||
|
||||
if(mapData === false){
|
||||
hideSettingsTab = true;
|
||||
hideEditTab = true;
|
||||
hideDownloadTab = true;
|
||||
}
|
||||
|
||||
// available map "types" for a new or existing map
|
||||
let mapTypes = MapUtil.getMapTypes(true);
|
||||
|
||||
let data = {
|
||||
scope: MapUtil.getMapScopes(),
|
||||
type: mapTypes,
|
||||
icon: MapUtil.getMapIcons(),
|
||||
formErrorContainerClass: Util.config.formErrorContainerClass,
|
||||
formWarningContainerClass: Util.config.formWarningContainerClass,
|
||||
formInfoContainerClass: Util.config.formInfoContainerClass
|
||||
};
|
||||
|
||||
// render "new map" tab content -------------------------------------------
|
||||
let contentNewMap = Mustache.render(templateMapSettings, data);
|
||||
|
||||
// render "edit map" tab content ------------------------------------------
|
||||
let contentEditMap = Mustache.render(templateMapSettings, data);
|
||||
contentEditMap = $(contentEditMap);
|
||||
|
||||
// current map access info
|
||||
let accessCharacter = [];
|
||||
let accessCorporation = [];
|
||||
let accessAlliance = [];
|
||||
let deleteExpiredConnections = true;
|
||||
let deleteEolConnections = true;
|
||||
let persistentAliases = true;
|
||||
|
||||
if(mapData !== false){
|
||||
// set current map information
|
||||
contentEditMap.find('input[name="id"]').val( mapData.config.id );
|
||||
contentEditMap.find('select[name="icon"]').val( mapData.config.icon );
|
||||
contentEditMap.find('input[name="name"]').val( mapData.config.name );
|
||||
contentEditMap.find('select[name="scopeId"]').val( mapData.config.scope.id );
|
||||
contentEditMap.find('select[name="typeId"]').val( mapData.config.type.id );
|
||||
|
||||
accessCharacter = mapData.config.access.character;
|
||||
accessCorporation = mapData.config.access.corporation;
|
||||
accessAlliance = mapData.config.access.alliance;
|
||||
|
||||
deleteExpiredConnections = mapData.config.deleteExpiredConnections;
|
||||
deleteEolConnections = mapData.config.deleteEolConnections;
|
||||
persistentAliases = mapData.config.persistentAliases;
|
||||
}
|
||||
|
||||
// render main dialog -----------------------------------------------------
|
||||
data = {
|
||||
id: config.newMapDialogId,
|
||||
mapData: mapData,
|
||||
type: mapTypes,
|
||||
|
||||
// message container
|
||||
formErrorContainerClass: Util.config.formErrorContainerClass,
|
||||
formWarningContainerClass: Util.config.formWarningContainerClass,
|
||||
formInfoContainerClass: Util.config.formInfoContainerClass,
|
||||
|
||||
// default open tab ----------
|
||||
openTabNew: options.tab === 'new',
|
||||
openTabEdit: options.tab === 'edit',
|
||||
openTabSettings: options.tab === 'settings',
|
||||
openTabDownload: options.tab === 'download',
|
||||
|
||||
dialogMapCreateContainerId: config.dialogMapCreateContainerId,
|
||||
dialogMapEditContainerId: config.dialogMapEditContainerId,
|
||||
dialogMapSettingsContainerId: config.dialogMapSettingsContainerId,
|
||||
dialogMapDownloadContainerId: config.dialogMapDownloadContainerId,
|
||||
|
||||
hideEditTab: hideEditTab,
|
||||
hideSettingsTab: hideSettingsTab,
|
||||
hideDownloadTab: hideDownloadTab,
|
||||
|
||||
// settings tab --------------
|
||||
deleteExpiredConnectionsId : config.deleteExpiredConnectionsId,
|
||||
deleteEolConnectionsId : config.deleteEolConnectionsId,
|
||||
persistentAliasesId : config.persistentAliasesId,
|
||||
deleteExpiredConnections: deleteExpiredConnections,
|
||||
deleteEolConnections: deleteEolConnections,
|
||||
persistentAliases: persistentAliases,
|
||||
|
||||
characterSelectId: config.characterSelectId,
|
||||
corporationSelectId: config.corporationSelectId,
|
||||
allianceSelectId: config.allianceSelectId,
|
||||
|
||||
// map access objects --------
|
||||
accessCharacter: accessCharacter,
|
||||
accessCorporation: accessCorporation,
|
||||
accessAlliance: accessAlliance,
|
||||
|
||||
// access limitations --------
|
||||
maxCharacter: Init.mapTypes.private.defaultConfig.max_shared,
|
||||
maxCorporation: Init.mapTypes.corporation.defaultConfig.max_shared,
|
||||
maxAlliance: Init.mapTypes.alliance.defaultConfig.max_shared,
|
||||
|
||||
// download tab --------------
|
||||
dialogMapExportFormId: config.dialogMapExportFormId,
|
||||
dialogMapImportFormId: config.dialogMapImportFormId,
|
||||
buttonExportId: config.buttonExportId,
|
||||
buttonImportId: config.buttonImportId,
|
||||
fieldExportId: config.fieldExportId,
|
||||
fieldImportId: config.fieldImportId,
|
||||
dialogMapImportInfoId: config.dialogMapImportInfoId,
|
||||
|
||||
formatFilename: function(){
|
||||
// format filename from "map name" (initial)
|
||||
return function (mapName, render) {
|
||||
let filename = render(mapName);
|
||||
return formatFilename(filename);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
let contentDialog = Mustache.render(templateMapDialog, data);
|
||||
contentDialog = $(contentDialog);
|
||||
|
||||
// set tab content
|
||||
$('#' + config.dialogMapCreateContainerId, contentDialog).html(contentNewMap);
|
||||
$('#' + config.dialogMapEditContainerId, contentDialog).html(contentEditMap);
|
||||
|
||||
let mapInfoDialog = bootbox.dialog({
|
||||
title: dialogTitle,
|
||||
message: contentDialog,
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'cancel',
|
||||
className: 'btn-default'
|
||||
},
|
||||
success: {
|
||||
label: '<i class="fa fa-check fa-fw"></i> save',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
|
||||
// get the current active form
|
||||
let form = $('#' + config.newMapDialogId).find('form').filter(':visible');
|
||||
|
||||
// validate form
|
||||
form.validator('validate');
|
||||
|
||||
// validate select2 fields (settings tab)
|
||||
form.find('select').each(function(){
|
||||
let selectField = $(this);
|
||||
let selectValues = selectField.val();
|
||||
|
||||
if(selectValues.length > 0){
|
||||
selectField.parents('.form-group').removeClass('has-error');
|
||||
}else{
|
||||
selectField.parents('.form-group').addClass('has-error');
|
||||
}
|
||||
});
|
||||
|
||||
// check whether the form is valid
|
||||
let formValid = form.isValidForm();
|
||||
|
||||
if(formValid === true){
|
||||
|
||||
// lock dialog
|
||||
let dialogContent = mapInfoDialog.find('.modal-content');
|
||||
dialogContent.showLoadingAnimation();
|
||||
|
||||
// get form data
|
||||
let formData = form.getFormValues();
|
||||
|
||||
// checkbox fix -> settings tab
|
||||
if( form.find('#' + config.deleteExpiredConnectionsId).length ){
|
||||
formData.deleteExpiredConnections = formData.hasOwnProperty('deleteExpiredConnections') ? parseInt( formData.deleteExpiredConnections ) : 0;
|
||||
}
|
||||
if( form.find('#' + config.deleteEolConnectionsId).length ){
|
||||
formData.deleteEolConnections = formData.hasOwnProperty('deleteEolConnections') ? parseInt( formData.deleteEolConnections ) : 0;
|
||||
}
|
||||
if( form.find('#' + config.persistentAliasesId).length ){
|
||||
formData.persistentAliases = formData.hasOwnProperty('persistentAliases') ? parseInt( formData.persistentAliases ) : 0;
|
||||
}
|
||||
|
||||
let requestData = {formData: formData};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.saveMap,
|
||||
data: requestData,
|
||||
dataType: 'json'
|
||||
}).done(function(responseData){
|
||||
|
||||
dialogContent.hideLoadingAnimation();
|
||||
|
||||
if(responseData.error.length){
|
||||
form.showFormMessage(responseData.error);
|
||||
}else{
|
||||
// success
|
||||
Util.showNotify({title: dialogTitle, text: 'Map: ' + responseData.mapData.mapData.name, type: 'success'});
|
||||
|
||||
// update map-tab Element
|
||||
let tabLinkElement = Util.getMapModule().getMapTabElements(responseData.mapData.mapData.id);
|
||||
|
||||
if(tabLinkElement.length === 1){
|
||||
tabLinkElement.updateTabData(responseData.mapData.mapData);
|
||||
}
|
||||
|
||||
$(mapInfoDialog).modal('hide');
|
||||
$(document).trigger('pf:closeMenu', [{}]);
|
||||
}
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
let reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': saveMap', text: reason, type: 'warning'});
|
||||
$(document).setProgramStatus('problem');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// after modal is shown =======================================================================
|
||||
mapInfoDialog.on('shown.bs.modal', function(e){
|
||||
mapInfoDialog.initTooltips();
|
||||
|
||||
// prevent "disabled" tabs from being clicked... "bootstrap" bugFix...
|
||||
mapInfoDialog.find('.navbar a[data-toggle=tab]').on('click', function(e){
|
||||
if ($(this).hasClass('disabled')){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// set form validator
|
||||
mapInfoDialog.find('form').initFormValidation();
|
||||
|
||||
// show form messages -------------------------------------
|
||||
// get current active form(tab)
|
||||
let form = $('#' + config.newMapDialogId).find('form').filter(':visible');
|
||||
|
||||
form.showFormMessage([{type: 'info', message: 'Creating new maps or change settings may take a few seconds'}]);
|
||||
|
||||
if(mapData === false){
|
||||
// no map data found (probably new user
|
||||
form.showFormMessage([{type: 'warning', message: 'No maps found. Create a new map before you can start'}]);
|
||||
}
|
||||
|
||||
// init select fields in case "settings" tab is open by default
|
||||
if(options.tab === 'settings'){
|
||||
initSettingsSelectFields(mapInfoDialog);
|
||||
}
|
||||
|
||||
// init "download tab" ========================================================================
|
||||
let downloadTabElement = mapInfoDialog.find('#' + config.dialogMapDownloadContainerId);
|
||||
if(downloadTabElement.length){
|
||||
// tab exists
|
||||
|
||||
// export map data ------------------------------------------------------------------------
|
||||
downloadTabElement.find('#' + config.buttonExportId).on('click', { mapData: mapData }, function(e){
|
||||
|
||||
let exportForm = $('#' + config.dialogMapExportFormId);
|
||||
let validExportForm = exportForm.isValidForm();
|
||||
|
||||
if(validExportForm){
|
||||
let mapElement = Util.getMapModule().getActiveMap();
|
||||
|
||||
if(mapElement){
|
||||
// IMPORTANT: Get map data from client (NOT from global mapData which is available in here)
|
||||
// -> This excludes some data (e.g. wh statics)
|
||||
// -> Bring export inline with main map toggle requests
|
||||
let exportMapData = mapElement.getMapDataFromClient({
|
||||
forceData: true,
|
||||
getAll: true
|
||||
});
|
||||
|
||||
// set map data right before download
|
||||
$(this).setExportMapData(exportMapData);
|
||||
|
||||
// disable button
|
||||
$(this).attr('disabled', true);
|
||||
}else{
|
||||
console.error('Map not found');
|
||||
}
|
||||
}else{
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// import map data ------------------------------------------------------------------------
|
||||
// check if "FileReader" API is supported
|
||||
let importFormElement = downloadTabElement.find('#' + config.dialogMapImportFormId);
|
||||
if(window.File && window.FileReader && window.FileList && window.Blob){
|
||||
|
||||
// show file info in UI
|
||||
downloadTabElement.find('#' + config.fieldImportId).on('change', function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
let infoContainerElement = importFormElement.find('#' + config.dialogMapImportInfoId);
|
||||
infoContainerElement.hide().empty();
|
||||
importFormElement.hideFormMessage('all');
|
||||
|
||||
let output = [];
|
||||
let files = e.target.files;
|
||||
|
||||
for (let i = 0, f; !!(f = files[i]); i++) {
|
||||
output.push(( i + 1 ) + '. file: ' + f.name + ' - ' +
|
||||
f.size + ' bytes; last modified: ' +
|
||||
f.lastModifiedDate.toLocaleDateString() );
|
||||
}
|
||||
|
||||
if(output.length > 0){
|
||||
infoContainerElement.html( output ).show();
|
||||
}
|
||||
|
||||
importFormElement.validator('validate');
|
||||
});
|
||||
|
||||
// drag&drop
|
||||
let importData = {};
|
||||
importData.mapData = [];
|
||||
let files = [];
|
||||
let filesCount = 0;
|
||||
let filesCountFail = 0;
|
||||
|
||||
// onLoad for FileReader API
|
||||
let readerOnLoad = function(readEvent) {
|
||||
|
||||
// get file content
|
||||
try{
|
||||
importData.mapData.push( JSON.parse( readEvent.target.result ) );
|
||||
}catch(error){
|
||||
filesCountFail++;
|
||||
importFormElement.showFormMessage([{type: 'error', message: 'File can not be parsed'}]);
|
||||
}
|
||||
|
||||
// start import when all files are parsed
|
||||
if(
|
||||
filesCount === files.length &&
|
||||
filesCountFail === 0
|
||||
){
|
||||
importMaps(importData);
|
||||
}
|
||||
};
|
||||
|
||||
let handleDragOver = function(dragEvent) {
|
||||
dragEvent.stopPropagation();
|
||||
dragEvent.preventDefault();
|
||||
dragEvent.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
|
||||
};
|
||||
|
||||
let handleFileSelect = function(evt){
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
|
||||
importData = importFormElement.getFormValues();
|
||||
importData.mapData = [];
|
||||
filesCount = 0;
|
||||
filesCountFail = 0;
|
||||
|
||||
files = evt.dataTransfer.files; // FileList object.
|
||||
|
||||
for (let file; !!(file = files[filesCount]); filesCount++){
|
||||
let reader = new FileReader();
|
||||
reader.onload = readerOnLoad;
|
||||
reader.readAsText(file);
|
||||
}
|
||||
};
|
||||
|
||||
let dropZone = downloadTabElement.find('.' + config.dragDropElementClass);
|
||||
dropZone[0].addEventListener('dragover', handleDragOver, false);
|
||||
dropZone[0].addEventListener('drop', handleFileSelect, false);
|
||||
|
||||
// import "button"
|
||||
downloadTabElement.find('#' + config.buttonImportId).on('click', function(e) {
|
||||
|
||||
importFormElement.validator('validate');
|
||||
let validImportForm = importFormElement.isValidForm();
|
||||
|
||||
if(validImportForm){
|
||||
importData = importFormElement.getFormValues();
|
||||
importData.mapData = [];
|
||||
|
||||
let fileElement = downloadTabElement.find('#' + config.fieldImportId);
|
||||
files = fileElement[0].files;
|
||||
filesCount = 0;
|
||||
filesCountFail = 0;
|
||||
|
||||
for (let file; !!(file = files[filesCount]); filesCount++){
|
||||
let reader = new FileReader();
|
||||
reader.onload = readerOnLoad;
|
||||
reader.readAsText(file);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
importFormElement.showFormMessage([{type: 'error', message: 'The File APIs are not fully supported in this browser.'}]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// events for tab change
|
||||
mapInfoDialog.find('.navbar a').on('shown.bs.tab', function(e){
|
||||
let selectElementCharacter = mapInfoDialog.find('#' + config.characterSelectId);
|
||||
let selectElementCorporation = mapInfoDialog.find('#' + config.corporationSelectId);
|
||||
let selectElementAlliance = mapInfoDialog.find('#' + config.allianceSelectId);
|
||||
|
||||
if($(e.target).attr('href') === '#' + config.dialogMapSettingsContainerId){
|
||||
// "settings" tab
|
||||
initSettingsSelectFields(mapInfoDialog);
|
||||
}else{
|
||||
if( $(selectElementCharacter).data('select2') !== undefined ){
|
||||
$(selectElementCharacter).select2('destroy');
|
||||
}
|
||||
|
||||
if( $(selectElementCorporation).data('select2') !== undefined ){
|
||||
$(selectElementCorporation).select2('destroy');
|
||||
}
|
||||
|
||||
if( $(selectElementAlliance).data('select2') !== undefined ){
|
||||
$(selectElementAlliance).select2('destroy');
|
||||
}
|
||||
}
|
||||
|
||||
// no "save" dialog button on "in/export" tab
|
||||
if($(e.target).attr('href') === '#' + config.dialogMapDownloadContainerId){
|
||||
mapInfoDialog.find('button.btn-success').hide();
|
||||
}else{
|
||||
mapInfoDialog.find('button.btn-success').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* import new map(s) data
|
||||
* @param importData
|
||||
*/
|
||||
let importMaps = function(importData){
|
||||
|
||||
let importForm = $('#' + config.dialogMapImportFormId);
|
||||
importForm.hideFormMessage('all');
|
||||
|
||||
// lock dialog
|
||||
let dialogContent = importForm.parents('.modal-content');
|
||||
dialogContent.showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.importMap,
|
||||
data: importData,
|
||||
dataType: 'json'
|
||||
}).done(function(responseData){
|
||||
if(responseData.error.length){
|
||||
// form.showFormMessage(responseData.error);
|
||||
importForm.showFormMessage(responseData.error);
|
||||
}else{
|
||||
// success
|
||||
if(responseData.warning.length){
|
||||
importForm.showFormMessage(responseData.warning);
|
||||
}
|
||||
|
||||
Util.showNotify({title: 'Import finished', text: 'Map(s) imported', type: 'success'});
|
||||
}
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
let reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': importMap', text: reason, type: 'error'});
|
||||
}).always(function() {
|
||||
importForm.find('input, select').resetFormFields().trigger('change');
|
||||
dialogContent.hideLoadingAnimation();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* set json map data for export to an element (e.g. <a>-Tag or button) for download
|
||||
* @param mapData
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.setExportMapData = function(mapData){
|
||||
|
||||
let fieldExport = $('#' + config.fieldExportId);
|
||||
let filename = '';
|
||||
let mapDataEncoded = '';
|
||||
|
||||
if(fieldExport.length){
|
||||
filename = fieldExport.val();
|
||||
|
||||
if(filename.length > 0){
|
||||
mapDataEncoded = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify( mapData ));
|
||||
}
|
||||
}
|
||||
|
||||
return this.each(function(){
|
||||
let exportButton = $(this);
|
||||
exportButton.attr('href', 'data:' + mapDataEncoded);
|
||||
exportButton.attr('download', filename + '.json');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init select2 fields within the settings dialog
|
||||
* @param mapInfoDialog
|
||||
*/
|
||||
let initSettingsSelectFields = function(mapInfoDialog){
|
||||
|
||||
let selectElementCharacter = mapInfoDialog.find('#' + config.characterSelectId);
|
||||
let selectElementCorporation = mapInfoDialog.find('#' + config.corporationSelectId);
|
||||
let selectElementAlliance = mapInfoDialog.find('#' + config.allianceSelectId);
|
||||
|
||||
// init character select live search
|
||||
selectElementCharacter.initAccessSelect({
|
||||
type: 'character',
|
||||
maxSelectionLength: Init.mapTypes.private.defaultConfig.max_shared
|
||||
});
|
||||
|
||||
// init corporation select live search
|
||||
selectElementCorporation.initAccessSelect({
|
||||
type: 'corporation',
|
||||
maxSelectionLength: Init.mapTypes.corporation.defaultConfig.max_shared
|
||||
});
|
||||
|
||||
// init alliance select live search
|
||||
selectElementAlliance.initAccessSelect({
|
||||
type: 'alliance',
|
||||
maxSelectionLength: Init.mapTypes.alliance.defaultConfig.max_shared
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the delete map Dialog
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.showDeleteMapDialog = function(mapData){
|
||||
|
||||
let mapName = mapData.config.name;
|
||||
|
||||
let mapDeleteDialog = bootbox.confirm('Delete map "' + mapName + '"?', function(result){
|
||||
if(result){
|
||||
let data = {mapData: mapData.config};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.deleteMap,
|
||||
data: data,
|
||||
dataType: 'json'
|
||||
}).done(function(data){
|
||||
Util.showNotify({title: 'Map deleted', text: 'Map: ' + mapName, type: 'success'});
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
let reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': deleteMap', text: reason, type: 'warning'});
|
||||
$(document).setProgramStatus('problem');
|
||||
}).always(function() {
|
||||
$(mapDeleteDialog).modal('hide');
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
88
public/js/v1.2.5/app/ui/dialog/notification.js
Normal file
88
public/js/v1.2.5/app/ui/dialog/notification.js
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* notification dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox'
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
|
||||
// shutdown dialog
|
||||
notificationDialogId: 'pf-notification-dialog', // id for "notification" dialog
|
||||
notificationDialogClass: 'pf-notification-dialog' // class for "notification" dialog
|
||||
};
|
||||
|
||||
/**
|
||||
* show/animate dialog page content
|
||||
* @param dialog
|
||||
*/
|
||||
let showPageContent = function(dialog){
|
||||
let headlineElement = dialog.find('h1');
|
||||
|
||||
headlineElement.delay(300).velocity('transition.shrinkIn', {
|
||||
duration: 500
|
||||
}).delay(800);
|
||||
|
||||
headlineElement.velocity({
|
||||
scale: 1.05
|
||||
}, {
|
||||
duration: 600,
|
||||
loop: 5
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* show "notification" dialog
|
||||
* @param dialogData
|
||||
*/
|
||||
$.fn.showNotificationDialog = function(dialogData){
|
||||
|
||||
// check if there is already a notification dialog open
|
||||
let notificationDialogClassDialoges = $('.' + config.notificationDialogClass);
|
||||
|
||||
if(notificationDialogClassDialoges.length === 0){
|
||||
|
||||
// close all modals
|
||||
$('.modal').modal('hide');
|
||||
|
||||
requirejs(['text!templates/dialog/notification.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
let data = {
|
||||
id: config.notificationDialogId,
|
||||
content: dialogData.content
|
||||
};
|
||||
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
// show dialog
|
||||
let shutdownDialog = bootbox.dialog({
|
||||
title: dialogData.content.title,
|
||||
message: content,
|
||||
className: config.notificationDialogClass,
|
||||
buttons: dialogData.buttons
|
||||
});
|
||||
|
||||
|
||||
shutdownDialog.on('shown.bs.modal', function(e) {
|
||||
// remove close button
|
||||
let dialog = $(this);
|
||||
|
||||
dialog.find('.bootbox-close-button').remove();
|
||||
dialog.find('button').blur();
|
||||
|
||||
// show error message
|
||||
showPageContent(dialog);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
84
public/js/v1.2.5/app/ui/dialog/releases.js
Normal file
84
public/js/v1.2.5/app/ui/dialog/releases.js
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* releases dialog (GitHub API repository information)
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox'
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
releasesDialogClass: 'pf-releases-dialog' // class for "Releases" dialog
|
||||
};
|
||||
|
||||
/**
|
||||
* load release information in dialog
|
||||
* @param releasesDialog
|
||||
*/
|
||||
var loadDialogData = function(releasesDialog){
|
||||
|
||||
// lock dialog
|
||||
var dialogContent = releasesDialog.find('.modal-content');
|
||||
dialogContent.showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.gitHubReleases,
|
||||
// data: updatedMapData,
|
||||
dataType: 'json'
|
||||
}).done(function(releasesData){
|
||||
requirejs(['text!templates/ui/timeline_element.html', 'mustache'], function(template, Mustache) {
|
||||
for(var i = 0; i < releasesData.length; i++){
|
||||
var releaseData = releasesData[i];
|
||||
|
||||
// template vars
|
||||
var data = {
|
||||
isFirst: (i === 0),
|
||||
isOdd: (i % 2 !== 0),
|
||||
releaseDate: releaseData.published_at.substr(0, 10),
|
||||
releaseData: releaseData
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
releasesDialog.find('ul.timeline').append(content);
|
||||
}
|
||||
|
||||
$('.timeline > li').velocity('transition.expandIn', {
|
||||
stagger: 300,
|
||||
duration: 240,
|
||||
//display: 'auto',
|
||||
complete: function(){}
|
||||
});
|
||||
});
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': login', text: reason, type: 'error'});
|
||||
}).always(function() {
|
||||
dialogContent.hideLoadingAnimation();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* show releases dialog
|
||||
*/
|
||||
$.fn.releasesDialog = function(){
|
||||
var content = '<ul class="timeline"></ul>';
|
||||
|
||||
var releasesDialog = bootbox.dialog({
|
||||
className: config.releasesDialogClass,
|
||||
title: 'Releases',
|
||||
size: 'large',
|
||||
message: content
|
||||
});
|
||||
|
||||
// after modal is shown =======================================================================
|
||||
releasesDialog.on('shown.bs.modal', function(e) {
|
||||
loadDialogData(releasesDialog);
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
50
public/js/v1.2.5/app/ui/dialog/shortcuts.js
Normal file
50
public/js/v1.2.5/app/ui/dialog/shortcuts.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* shortcuts dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/key',
|
||||
], function($, Init, Util, Render, bootbox, Key) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// map dialog
|
||||
shortcutsDialogId: 'pf-shortcuts-dialog', // id for shortcuts dialog
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the map manual modal dialog
|
||||
*/
|
||||
$.fn.showShortcutsDialog = function(){
|
||||
requirejs(['text!templates/dialog/shortcuts.html', 'mustache'], function(template, Mustache){
|
||||
|
||||
let data = {
|
||||
id: config.shortcutsDialogId,
|
||||
shortcuts: Key.getGroupedShortcuts()
|
||||
};
|
||||
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
// show dialog
|
||||
let shortcutsDialog = bootbox.dialog({
|
||||
title: 'Keyboard Shortcuts',
|
||||
message: content,
|
||||
size: 'large',
|
||||
buttons: {
|
||||
success: {
|
||||
label: 'close',
|
||||
className: 'btn-default'
|
||||
}
|
||||
},
|
||||
show: true
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
});
|
||||
711
public/js/v1.2.5/app/ui/dialog/stats.js
Normal file
711
public/js/v1.2.5/app/ui/dialog/stats.js
Normal file
@@ -0,0 +1,711 @@
|
||||
/**
|
||||
* activity stats dialog
|
||||
*/
|
||||
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox'
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// dialog
|
||||
statsDialogId: 'pf-stats-dialog', // id for "stats" dialog
|
||||
dialogNavigationClass: 'pf-dialog-navigation-list', // class for dialog navigation bar
|
||||
dialogNavigationListItemClass: 'pf-dialog-navigation-list-item', // class for map manual li main navigation elements
|
||||
|
||||
dialogNavigationOffsetClass : 'pf-dialog-navigation-offset', // class for "current" offset filter
|
||||
dialogNavigationPrevClass : 'pf-dialog-navigation-prev', // class for "prev" period load
|
||||
dialogNavigationNextClass : 'pf-dialog-navigation-next', // class for "next" period load
|
||||
|
||||
// stats/dataTable
|
||||
statsContainerId: 'pf-stats-dialog-container', // class for statistics container (dynamic ajax content)
|
||||
statsTableId: 'pf-stats-table', // id for statistics table element
|
||||
tableImageCellClass: 'pf-table-image-cell', // class for table "image" cells
|
||||
|
||||
// charts
|
||||
statsLineChartClass: 'pf-line-chart' // class for inline chart elements
|
||||
};
|
||||
|
||||
/**
|
||||
* init blank statistics dataTable
|
||||
* @param dialogElement
|
||||
*/
|
||||
let initStatsTable = function(dialogElement){
|
||||
let columnNumberWidth = 35;
|
||||
let lineColor = '#477372';
|
||||
|
||||
// render function for inline-chart columns
|
||||
let renderInlineChartColumn = function(data, type, row, meta){
|
||||
/*
|
||||
switch(data.type){
|
||||
case 'C': lineColor = '#5cb85c'; break;
|
||||
case 'U': lineColor = '#e28a0d'; break;
|
||||
case 'D': lineColor = '#a52521'; break;
|
||||
}*/
|
||||
|
||||
if( /^\d+$/.test(data.data) ){
|
||||
// single digit (e.g. single week filter)
|
||||
return data.data;
|
||||
}else{
|
||||
// period -> prepare line chart
|
||||
return '<span class="' + config.statsLineChartClass + '" data-peity=\'{ "stroke": "' + lineColor + '" }\'>' + data.data + '</span>';
|
||||
}
|
||||
};
|
||||
|
||||
// render function for numeric columns
|
||||
let renderNumericColumn = function(data, type, row, meta){
|
||||
return data.toLocaleString();
|
||||
};
|
||||
|
||||
// get table element
|
||||
// Due to "complex" table headers, they are already rendered and part of the stats.html file
|
||||
let table = dialogElement.find('#' + config.statsTableId);
|
||||
|
||||
let statsTable = table.DataTable({
|
||||
pageLength: 30,
|
||||
lengthMenu: [[10, 20, 30, 50], [10, 20, 30, 50]],
|
||||
paging: true,
|
||||
ordering: true,
|
||||
order: [ 16, 'desc' ],
|
||||
info: true,
|
||||
searching: true,
|
||||
hover: false,
|
||||
autoWidth: false,
|
||||
language: {
|
||||
emptyTable: 'No statistics found',
|
||||
zeroRecords: 'No characters found',
|
||||
lengthMenu: 'Show _MENU_ characters',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ characters'
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
title: '<i class="fa fa-hashtag"></i>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: 10,
|
||||
class: 'text-right',
|
||||
data: 'character.id'
|
||||
},{
|
||||
targets: 1,
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: 26,
|
||||
className: ['text-center', config.tableImageCellClass].join(' '),
|
||||
data: 'character',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Character/' + data.id + '_32.jpg" />';
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 2,
|
||||
title: 'name',
|
||||
width: 200,
|
||||
data: 'character',
|
||||
render: {
|
||||
_: 'name',
|
||||
sort: 'name'
|
||||
}
|
||||
},{
|
||||
targets: 3,
|
||||
title: 'last login',
|
||||
searchable: false,
|
||||
width: 70,
|
||||
className: ['text-right', 'separator-right'].join(' '),
|
||||
data: 'character',
|
||||
render: {
|
||||
_: 'lastLogin',
|
||||
sort: 'lastLogin'
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
$(cell).initTimestampCounter();
|
||||
}
|
||||
},{
|
||||
targets: 4,
|
||||
title: '<span title="created" data-toggle="tooltip">C </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'systemCreate',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
title: '<span title="updated" data-toggle="tooltip">U </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'systemUpdate',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 6,
|
||||
title: '<span title="deleted" data-toggle="tooltip">D </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'systemDelete',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 7,
|
||||
title: 'Σ ',
|
||||
searchable: false,
|
||||
width: 20,
|
||||
className: ['text-right', 'separator-right'].join(' ') ,
|
||||
data: 'systemSum',
|
||||
render: {
|
||||
_: renderNumericColumn
|
||||
}
|
||||
},{
|
||||
targets: 8,
|
||||
title: '<span title="created" data-toggle="tooltip">C </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'connectionCreate',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 9,
|
||||
title: '<span title="updated" data-toggle="tooltip">U </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'connectionUpdate',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 10,
|
||||
title: '<span title="deleted" data-toggle="tooltip">D </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'connectionDelete',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 11,
|
||||
title: 'Σ ',
|
||||
searchable: false,
|
||||
width: 20,
|
||||
className: ['text-right', 'separator-right'].join(' '),
|
||||
data: 'connectionSum',
|
||||
render: {
|
||||
_: renderNumericColumn
|
||||
}
|
||||
},{
|
||||
targets: 12,
|
||||
title: '<span title="created" data-toggle="tooltip">C </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'signatureCreate',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 13,
|
||||
title: '<span title="updated" data-toggle="tooltip">U </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'signatureUpdate',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 14,
|
||||
title: '<span title="deleted" data-toggle="tooltip">D </span>',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: columnNumberWidth,
|
||||
className: ['text-right', 'hidden-xs', 'hidden-sm'].join(' '),
|
||||
data: 'signatureDelete',
|
||||
render: {
|
||||
_: renderInlineChartColumn
|
||||
}
|
||||
},{
|
||||
targets: 15,
|
||||
title: 'Σ ',
|
||||
searchable: false,
|
||||
width: 20,
|
||||
className: ['text-right', 'separator-right'].join(' '),
|
||||
data: 'signatureSum',
|
||||
render: {
|
||||
_: renderNumericColumn
|
||||
}
|
||||
},{
|
||||
targets: 16,
|
||||
title: 'Σ ',
|
||||
searchable: false,
|
||||
width: 20,
|
||||
className: 'text-right',
|
||||
data: 'totalSum',
|
||||
render: {
|
||||
_: renderNumericColumn
|
||||
}
|
||||
}
|
||||
],
|
||||
initComplete: function(settings){
|
||||
let tableApi = this.api();
|
||||
|
||||
// initial statistics data request
|
||||
let requestData = getRequestDataFromTabPanels(dialogElement);
|
||||
getStatsData(requestData, {tableApi: tableApi, callback: drawStatsTable});
|
||||
},
|
||||
drawCallback: function(settings){
|
||||
this.api().rows().nodes().to$().each(function(i, row){
|
||||
$(row).find('.' + config.statsLineChartClass).peity('line', {
|
||||
fill: 'transparent',
|
||||
height: 18,
|
||||
min: 0,
|
||||
width: 50
|
||||
});
|
||||
});
|
||||
},
|
||||
footerCallback: function ( row, data, start, end, display ) {
|
||||
let api = this.api();
|
||||
let sumColumnIndexes = [7, 11, 15, 16];
|
||||
|
||||
// column data for "sum" columns over this page
|
||||
let pageTotalColumns = api
|
||||
.columns( sumColumnIndexes, { page: 'current'} )
|
||||
.data();
|
||||
|
||||
// sum columns for "total" sum
|
||||
pageTotalColumns.each(function(colData, index){
|
||||
pageTotalColumns[index] = colData.reduce(function(a, b){
|
||||
return a + b;
|
||||
}, 0);
|
||||
});
|
||||
|
||||
$(sumColumnIndexes).each(function(index, value){
|
||||
$( api.column( value ).footer() ).text( renderNumericColumn(pageTotalColumns[index]) );
|
||||
});
|
||||
},
|
||||
data: [] // will be added dynamic
|
||||
});
|
||||
|
||||
statsTable.on('order.dt search.dt', function(){
|
||||
statsTable.column(0, {search:'applied', order:'applied'}).nodes().each(function(cell, i){
|
||||
$(cell).html( (i + 1) + '. ');
|
||||
});
|
||||
}).draw();
|
||||
|
||||
let tooltipElements = dialogElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
};
|
||||
|
||||
/**
|
||||
* request raw statistics data and execute callback
|
||||
* @param requestData
|
||||
* @param context
|
||||
*/
|
||||
let getStatsData = function(requestData, context){
|
||||
|
||||
context.dynamicArea = $('#' + config.statsContainerId + ' .pf-dynamic-area');
|
||||
context.dynamicArea.showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.getStatisticsData,
|
||||
data: requestData,
|
||||
dataType: 'json',
|
||||
context: context
|
||||
}).done(function(data){
|
||||
this.dynamicArea.hideLoadingAnimation();
|
||||
|
||||
this.callback(data);
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
let reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': loadStatistics', text: reason, type: 'warning'});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* update dataTable with response data
|
||||
* update "header"/"filter" elements in dialog
|
||||
* @param responseData
|
||||
*/
|
||||
let drawStatsTable = function(responseData){
|
||||
let dialogElement = $('#' + config.statsDialogId);
|
||||
|
||||
// update filter/header -----------------------------------------------------------------------------
|
||||
let navigationListElements = $('.' + config.dialogNavigationClass);
|
||||
navigationListElements.find('a[data-type="typeId"][data-value="' + responseData.typeId + '"]').tab('show');
|
||||
navigationListElements.find('a[data-type="period"][data-value="' + responseData.period + '"]').tab('show');
|
||||
|
||||
// update period pagination -------------------------------------------------------------------------
|
||||
let prevButton = dialogElement.find('.' + config.dialogNavigationPrevClass);
|
||||
prevButton.data('newOffset', responseData.prev);
|
||||
prevButton.find('span').text('Week ' + responseData.prev.week + ', ' + responseData.prev.year);
|
||||
prevButton.css('visibility', 'visible');
|
||||
|
||||
let nextButton = dialogElement.find('.' + config.dialogNavigationNextClass);
|
||||
if(responseData.next){
|
||||
nextButton.data('newOffset', responseData.next);
|
||||
nextButton.find('span').text('Week ' + responseData.next.week + ', ' + responseData.next.year);
|
||||
nextButton.css('visibility', 'visible');
|
||||
}else{
|
||||
nextButton.css('visibility', 'hidden');
|
||||
}
|
||||
|
||||
// update current period information label ----------------------------------------------------------
|
||||
// if period == "weekly" there is no "offset" -> just a single week
|
||||
let offsetText = 'Week ' + responseData.start.week + ', ' + responseData.start.year;
|
||||
if(responseData.period !== 'weekly'){
|
||||
offsetText += ' <small><i class="fa fa-fw fa-minus"></i></small> ' +
|
||||
'Week ' + responseData.offset.week + ', ' + responseData.offset.year;
|
||||
}
|
||||
dialogElement.find('.' + config.dialogNavigationOffsetClass)
|
||||
.data('start', responseData.start)
|
||||
.data('period', responseData.period)
|
||||
.html(offsetText);
|
||||
|
||||
// clear and (re)-fill table ------------------------------------------------------------------------
|
||||
let formattedData = formatStatisticsData(responseData);
|
||||
this.tableApi.clear();
|
||||
this.tableApi.rows.add(formattedData).draw();
|
||||
};
|
||||
|
||||
/**
|
||||
* format statistics data for dataTable
|
||||
* -> e.g. format inline-chart data
|
||||
* @param statsData
|
||||
* @returns {Array}
|
||||
*/
|
||||
let formatStatisticsData = function(statsData){
|
||||
let formattedData = [];
|
||||
let yearStart = statsData.start.year;
|
||||
let weekStart = statsData.start.week;
|
||||
let weekCount = statsData.weekCount;
|
||||
let yearWeeks = statsData.yearWeeks;
|
||||
|
||||
let tempRand = function(min, max){
|
||||
return Math.random() * (max - min) + min;
|
||||
};
|
||||
|
||||
// format/sum week statistics data for inline charts
|
||||
let formatWeekData = function(weeksData){
|
||||
let currentYear = yearStart;
|
||||
let currentWeek = weekStart;
|
||||
|
||||
let formattedWeeksData = {
|
||||
systemCreate: [],
|
||||
systemUpdate: [],
|
||||
systemDelete: [],
|
||||
connectionCreate: [],
|
||||
connectionUpdate: [],
|
||||
connectionDelete: [],
|
||||
signatureCreate: [],
|
||||
signatureUpdate: [],
|
||||
signatureDelete: [],
|
||||
systemSum: 0,
|
||||
connectionSum: 0,
|
||||
signatureSum: 0
|
||||
};
|
||||
|
||||
for(let i = 0; i < weekCount; i++){
|
||||
let yearWeekProp = currentYear + '' + currentWeek;
|
||||
|
||||
if(weeksData.hasOwnProperty( yearWeekProp )){
|
||||
let weekData = weeksData[ yearWeekProp ];
|
||||
|
||||
// system -------------------------------------------------------------------------------
|
||||
formattedWeeksData.systemCreate.push( weekData.systemCreate );
|
||||
formattedWeeksData.systemSum += parseInt( weekData.systemCreate );
|
||||
|
||||
formattedWeeksData.systemUpdate.push( weekData.systemUpdate );
|
||||
formattedWeeksData.systemSum += parseInt( weekData.systemUpdate );
|
||||
|
||||
formattedWeeksData.systemDelete.push( weekData.systemDelete );
|
||||
formattedWeeksData.systemSum += parseInt( weekData.systemDelete );
|
||||
|
||||
// connection ---------------------------------------------------------------------------
|
||||
formattedWeeksData.connectionCreate.push( weekData.connectionCreate );
|
||||
formattedWeeksData.connectionSum += parseInt( weekData.connectionCreate );
|
||||
|
||||
formattedWeeksData.connectionUpdate.push( weekData.connectionUpdate );
|
||||
formattedWeeksData.connectionSum += parseInt( weekData.connectionUpdate );
|
||||
|
||||
formattedWeeksData.connectionDelete.push( weekData.connectionDelete );
|
||||
formattedWeeksData.connectionSum += parseInt( weekData.connectionDelete );
|
||||
|
||||
// signature ----------------------------------------------------------------------------
|
||||
formattedWeeksData.signatureCreate.push( weekData.signatureCreate );
|
||||
formattedWeeksData.signatureSum += parseInt( weekData.signatureCreate );
|
||||
|
||||
formattedWeeksData.signatureUpdate.push( weekData.signatureUpdate );
|
||||
formattedWeeksData.signatureSum += parseInt( weekData.signatureUpdate );
|
||||
|
||||
formattedWeeksData.signatureDelete.push( weekData.signatureDelete );
|
||||
formattedWeeksData.signatureSum += parseInt( weekData.signatureDelete );
|
||||
}else{
|
||||
// system -------------------------------------------------------------------------------
|
||||
formattedWeeksData.systemCreate.push(0);
|
||||
formattedWeeksData.systemUpdate.push(0);
|
||||
formattedWeeksData.systemDelete.push(0);
|
||||
|
||||
// connection ---------------------------------------------------------------------------
|
||||
formattedWeeksData.connectionCreate.push(0);
|
||||
formattedWeeksData.connectionUpdate.push(0);
|
||||
formattedWeeksData.connectionDelete.push(0);
|
||||
|
||||
// signature ----------------------------------------------------------------------------
|
||||
formattedWeeksData.signatureCreate.push(0);
|
||||
formattedWeeksData.signatureUpdate.push(0);
|
||||
formattedWeeksData.signatureDelete.push(0);
|
||||
}
|
||||
|
||||
currentWeek++;
|
||||
|
||||
if( currentWeek > yearWeeks[currentYear] ){
|
||||
currentWeek = 1;
|
||||
currentYear++;
|
||||
}
|
||||
}
|
||||
|
||||
// system ---------------------------------------------------------------------------------------
|
||||
formattedWeeksData.systemCreate = formattedWeeksData.systemCreate.join(',');
|
||||
formattedWeeksData.systemUpdate = formattedWeeksData.systemUpdate.join(',');
|
||||
formattedWeeksData.systemDelete = formattedWeeksData.systemDelete.join(',');
|
||||
|
||||
// connection -----------------------------------------------------------------------------------
|
||||
formattedWeeksData.connectionCreate = formattedWeeksData.connectionCreate.join(',');
|
||||
formattedWeeksData.connectionUpdate = formattedWeeksData.connectionUpdate.join(',');
|
||||
formattedWeeksData.connectionDelete = formattedWeeksData.connectionDelete.join(',');
|
||||
|
||||
// signature ------------------------------------------------------------------------------------
|
||||
formattedWeeksData.signatureCreate = formattedWeeksData.signatureCreate.join(',');
|
||||
formattedWeeksData.signatureUpdate = formattedWeeksData.signatureUpdate.join(',');
|
||||
formattedWeeksData.signatureDelete = formattedWeeksData.signatureDelete.join(',');
|
||||
|
||||
return formattedWeeksData;
|
||||
};
|
||||
|
||||
$.each(statsData.statistics, function(characterId, data){
|
||||
|
||||
let formattedWeeksData = formatWeekData(data.weeks);
|
||||
|
||||
let rowData = {
|
||||
character: {
|
||||
id: characterId,
|
||||
name: data.name,
|
||||
lastLogin: data.lastLogin
|
||||
},
|
||||
systemCreate: {
|
||||
type: 'C',
|
||||
data: formattedWeeksData.systemCreate
|
||||
},
|
||||
systemUpdate: {
|
||||
type: 'U',
|
||||
data: formattedWeeksData.systemUpdate
|
||||
},
|
||||
systemDelete: {
|
||||
type: 'D',
|
||||
data: formattedWeeksData.systemDelete
|
||||
},
|
||||
systemSum: formattedWeeksData.systemSum,
|
||||
connectionCreate: {
|
||||
type: 'C',
|
||||
data: formattedWeeksData.connectionCreate
|
||||
},
|
||||
connectionUpdate: {
|
||||
type: 'U',
|
||||
data: formattedWeeksData.connectionUpdate
|
||||
},
|
||||
connectionDelete: {
|
||||
type: 'D',
|
||||
data: formattedWeeksData.connectionDelete
|
||||
},
|
||||
connectionSum: formattedWeeksData.connectionSum,
|
||||
signatureCreate: {
|
||||
type: 'C',
|
||||
data: formattedWeeksData.signatureCreate
|
||||
},
|
||||
signatureUpdate: {
|
||||
type: 'U',
|
||||
data: formattedWeeksData.signatureUpdate
|
||||
},
|
||||
signatureDelete: {
|
||||
type: 'D',
|
||||
data: formattedWeeksData.signatureDelete
|
||||
},
|
||||
signatureSum: formattedWeeksData.signatureSum,
|
||||
totalSum: formattedWeeksData.systemSum + formattedWeeksData.connectionSum + formattedWeeksData.signatureSum
|
||||
};
|
||||
|
||||
formattedData.push(rowData);
|
||||
});
|
||||
|
||||
return formattedData;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dialogElement
|
||||
* @returns {{}}
|
||||
*/
|
||||
let getRequestDataFromTabPanels = function(dialogElement){
|
||||
let requestData = {};
|
||||
|
||||
// get data from "tab" panel links ------------------------------------------------------------------
|
||||
let navigationListElements = dialogElement.find('.' + config.dialogNavigationClass);
|
||||
navigationListElements.find('.' + config.dialogNavigationListItemClass + '.active a').each(function(){
|
||||
let linkElement = $(this);
|
||||
requestData[linkElement.data('type')]= linkElement.data('value');
|
||||
});
|
||||
|
||||
// get current period (no offset) data (if available) -----------------------------------------------
|
||||
let navigationOffsetElement = dialogElement.find('.' + config.dialogNavigationOffsetClass);
|
||||
let startData = navigationOffsetElement.data('start');
|
||||
let periodOld = navigationOffsetElement.data('period');
|
||||
|
||||
// if period switch was detected
|
||||
// -> "year" and "week" should not be send
|
||||
// -> start from "now"
|
||||
if(
|
||||
requestData.period === periodOld &&
|
||||
startData
|
||||
){
|
||||
requestData.year = startData.year;
|
||||
requestData.week = startData.week;
|
||||
}
|
||||
|
||||
return requestData;
|
||||
};
|
||||
|
||||
/**
|
||||
* check if "activity log" type is enabled for a group
|
||||
* @param type
|
||||
* @returns {boolean}
|
||||
*/
|
||||
let isTabTypeEnabled = function(type){
|
||||
let enabled = false;
|
||||
|
||||
switch(type){
|
||||
case 'private':
|
||||
if(Init.mapTypes.private.defaultConfig.activity_logging){
|
||||
enabled = true;
|
||||
}
|
||||
break;
|
||||
case 'corporation':
|
||||
if(
|
||||
Init.mapTypes.corporation.defaultConfig.activity_logging &&
|
||||
Util.getCurrentUserInfo('corporationId')
|
||||
){
|
||||
enabled = true;
|
||||
}
|
||||
break;
|
||||
case 'alliance':
|
||||
if(
|
||||
Init.mapTypes.alliance.defaultConfig.activity_logging &&
|
||||
Util.getCurrentUserInfo('allianceId')
|
||||
){
|
||||
enabled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return enabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* show activity stats dialog
|
||||
*/
|
||||
$.fn.showStatsDialog = function(){
|
||||
requirejs(['text!templates/dialog/stats.html', 'mustache', 'peityInlineChart'], function(template, Mustache) {
|
||||
|
||||
let data = {
|
||||
id: config.statsDialogId,
|
||||
dialogNavigationClass: config.dialogNavigationClass,
|
||||
dialogNavLiClass: config.dialogNavigationListItemClass,
|
||||
enablePrivateTab: isTabTypeEnabled('private'),
|
||||
enableCorporationTab: isTabTypeEnabled('corporation'),
|
||||
enableAllianceTab: isTabTypeEnabled('alliance'),
|
||||
statsContainerId: config.statsContainerId,
|
||||
statsTableId: config.statsTableId,
|
||||
dialogNavigationOffsetClass: config.dialogNavigationOffsetClass,
|
||||
dialogNavigationPrevClass: config.dialogNavigationPrevClass,
|
||||
dialogNavigationNextClass: config.dialogNavigationNextClass
|
||||
};
|
||||
|
||||
let content = Mustache.render(template, data);
|
||||
|
||||
let statsDialog = bootbox.dialog({
|
||||
title: 'Statistics',
|
||||
message: content,
|
||||
size: 'large',
|
||||
show: false,
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'close',
|
||||
className: 'btn-default'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// model events
|
||||
statsDialog.on('show.bs.modal', function(e) {
|
||||
let dialogElement = $(e.target);
|
||||
|
||||
initStatsTable(dialogElement);
|
||||
});
|
||||
|
||||
// Tab module events
|
||||
statsDialog.find('a[data-toggle="tab"]').on('show.bs.tab', function (e, b, c) {
|
||||
if( $(e.target).parent().hasClass('disabled') ){
|
||||
// no action on "disabled" tabs
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
statsDialog.find('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
let requestData = getRequestDataFromTabPanels(statsDialog);
|
||||
let tableApi = statsDialog.find('#' + config.statsTableId).DataTable();
|
||||
|
||||
getStatsData(requestData, {tableApi: tableApi, callback: drawStatsTable});
|
||||
});
|
||||
|
||||
// offset change links
|
||||
statsDialog.find('.' + config.dialogNavigationPrevClass + ', .' + config.dialogNavigationNextClass).on('click', function(){
|
||||
let offsetData = $(this).data('newOffset');
|
||||
if(offsetData){
|
||||
// this should NEVER fail!
|
||||
// get "base" request data (e.g. typeId, period)
|
||||
// --> overwrite period data with new period data
|
||||
let tmpRequestData = getRequestDataFromTabPanels(statsDialog);
|
||||
let requestData = $.extend({}, tmpRequestData, offsetData);
|
||||
let tableApi = statsDialog.find('#' + config.statsTableId).DataTable();
|
||||
|
||||
getStatsData(requestData, {tableApi: tableApi, callback: drawStatsTable});
|
||||
}
|
||||
});
|
||||
|
||||
// show dialog
|
||||
statsDialog.modal('show');
|
||||
});
|
||||
};
|
||||
});
|
||||
107
public/js/v1.2.5/app/ui/dialog/system_effects.js
Normal file
107
public/js/v1.2.5/app/ui/dialog/system_effects.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* system effects dialog
|
||||
*/
|
||||
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, Render, bootbox, MapUtil) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// system effect dialog
|
||||
systemEffectDialogWrapperClass: 'pf-system-effect-dialog-wrapper' // class for system effect dialog
|
||||
};
|
||||
|
||||
let cache = {
|
||||
systemEffectDialog: false // system effect info dialog
|
||||
};
|
||||
|
||||
/**
|
||||
* show system effect dialog
|
||||
*/
|
||||
$.fn.showSystemEffectInfoDialog = function(){
|
||||
|
||||
// cache table structure
|
||||
if(!cache.systemEffectDialog){
|
||||
|
||||
let dialogWrapperElement = $('<div>', {
|
||||
class: config.systemEffectDialogWrapperClass
|
||||
});
|
||||
|
||||
let systemEffectData = Util.getSystemEffectData();
|
||||
|
||||
$.each( systemEffectData.wh, function( effectName, effectData ) {
|
||||
|
||||
let table = $('<table>', {
|
||||
class: ['table', 'table-condensed'].join(' ')
|
||||
});
|
||||
|
||||
let tbody = $('<tbody>');
|
||||
let thead = $('<thead>');
|
||||
|
||||
let rows = [];
|
||||
|
||||
// get formatted system effect name
|
||||
let systemEffectName = MapUtil.getEffectInfoForSystem(effectName, 'name');
|
||||
let systemEffectClass = MapUtil.getEffectInfoForSystem(effectName, 'class');
|
||||
|
||||
$.each( effectData, function( areaId, areaData ) {
|
||||
|
||||
let systemType = 'C' + areaId;
|
||||
let securityClass = Util.getSecurityClassForSystem( systemType );
|
||||
|
||||
if(areaId === '1'){
|
||||
rows.push( $('<tr>') );
|
||||
thead.append( rows[0] );
|
||||
|
||||
rows[0].append(
|
||||
$('<td>').html( ' ' + systemEffectName).prepend(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-square', 'fa-fw', systemEffectClass].join(' ')
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
rows[0].append( $('<td>', {
|
||||
class: ['text-right', 'col-xs-1', securityClass].join(' ')
|
||||
}).text( systemType ));
|
||||
|
||||
$.each( areaData, function( i, data ) {
|
||||
|
||||
if(areaId === '1'){
|
||||
rows.push( $('<tr>') );
|
||||
tbody.append(rows[i + 1]);
|
||||
|
||||
// add label
|
||||
rows[i + 1].append( $('<td>').text( data.effect ));
|
||||
}
|
||||
|
||||
|
||||
rows[i + 1].append( $('<td>', {
|
||||
class: 'text-right'
|
||||
}).text( data.value ));
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
dialogWrapperElement.append( table.append( thead ).append( tbody ) );
|
||||
|
||||
cache.systemEffectDialog = dialogWrapperElement;
|
||||
});
|
||||
}
|
||||
|
||||
bootbox.dialog({
|
||||
title: 'System effect information',
|
||||
message: cache.systemEffectDialog
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
291
public/js/v1.2.5/app/ui/form_element.js
Normal file
291
public/js/v1.2.5/app/ui/form_element.js
Normal file
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* form elements
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, MapUtil) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* init a select element as "select2" for map selection
|
||||
*/
|
||||
$.fn.initMapSelect = function(){
|
||||
let selectElement = $(this);
|
||||
|
||||
$.when(
|
||||
selectElement.select2({
|
||||
dropdownParent: selectElement.parents('.modal-body'),
|
||||
theme: 'pathfinder',
|
||||
maximumSelectionLength: 5
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* init a select element as an ajax based "select2" object for system search
|
||||
* @param options
|
||||
*/
|
||||
$.fn.initSystemSelect = function(options){
|
||||
let selectElement = $(this);
|
||||
|
||||
let config = {
|
||||
maxSelectionLength: 1
|
||||
};
|
||||
options = $.extend({}, config, options);
|
||||
|
||||
// format result data
|
||||
function formatResultData (data) {
|
||||
|
||||
if (data.loading){
|
||||
return data.text;
|
||||
}
|
||||
|
||||
// show effect info just for wormholes
|
||||
let hideEffectClass = '';
|
||||
if(data.effect === ''){
|
||||
hideEffectClass = 'hide';
|
||||
}
|
||||
|
||||
let markup = '<div class="clearfix">';
|
||||
markup += '<div class="col-sm-5 pf-select-item-anchor">' + data.text + '</div>';
|
||||
markup += '<div class="col-sm-2 text-right ' + data.effectClass + '">';
|
||||
markup += '<i class="fa fa-fw fa-square ' + hideEffectClass + '"></i>';
|
||||
markup += '</div>';
|
||||
markup += '<div class="col-sm-2 text-right ' + data.secClass + '">' + data.security + '</div>';
|
||||
markup += '<div class="col-sm-3 text-right ' + data.trueSecClass + '">' + data.trueSec + '</div></div>';
|
||||
|
||||
return markup;
|
||||
}
|
||||
|
||||
$.when(
|
||||
selectElement.select2({
|
||||
ajax: {
|
||||
url: function(params){
|
||||
// add params to URL
|
||||
return Init.path.searchSystem + '/' + params.term.trim();
|
||||
},
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
timeout: 5000,
|
||||
cache: true,
|
||||
data: function(params) {
|
||||
// no url params here
|
||||
return;
|
||||
},
|
||||
processResults: function(data) {
|
||||
// parse the results into the format expected by Select2.
|
||||
return {
|
||||
results: data.map( function(item){
|
||||
|
||||
// "systemId" or "name"
|
||||
let id = item[options.key];
|
||||
let disabled = false;
|
||||
let trueSec = parseFloat(item.trueSec);
|
||||
let secClass = Util.getSecurityClassForSystem(item.security);
|
||||
let trueSecClass = Util.getTrueSecClassForSystem( trueSec );
|
||||
let effectClass = MapUtil.getEffectInfoForSystem(item.effect, 'class');
|
||||
|
||||
// check if system is dialed
|
||||
if(
|
||||
options.disabledOptions &&
|
||||
options.disabledOptions.indexOf(parseInt(id, 10)) !== -1
|
||||
){
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
// "fix" security level
|
||||
if(
|
||||
trueSec > 0 &&
|
||||
trueSec < 0.1
|
||||
){
|
||||
trueSec = 0.1;
|
||||
}else{
|
||||
trueSec = Math.round(trueSec * 10) / 10;
|
||||
}
|
||||
|
||||
return {
|
||||
id: id,
|
||||
text: item.name,
|
||||
systemId: parseInt(item.systemId),
|
||||
security: item.security,
|
||||
secClass: secClass,
|
||||
trueSec: trueSec.toFixed(1),
|
||||
trueSecClass: trueSecClass,
|
||||
effect: item.effect,
|
||||
effectClass: effectClass,
|
||||
disabled: disabled
|
||||
};
|
||||
})
|
||||
};
|
||||
},
|
||||
error: function (jqXHR, status, error) {
|
||||
if( !Util.isXHRAborted(jqXHR) ){
|
||||
|
||||
let reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
Util.showNotify({title: 'System select warning', text: reason + ' deleted', type: 'warning'});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
dropdownParent: selectElement.parents('.modal-body'),
|
||||
theme: 'pathfinder',
|
||||
minimumInputLength: 2,
|
||||
templateResult: formatResultData,
|
||||
placeholder: 'System name',
|
||||
allowClear: true,
|
||||
maximumSelectionLength: options.maxSelectionLength,
|
||||
escapeMarkup: function(markup){
|
||||
// let our custom formatter work
|
||||
return markup;
|
||||
}
|
||||
}).on('change', function(e){
|
||||
// select changed
|
||||
}).on('select2:open', function(){
|
||||
// clear selected system (e.g. default system)
|
||||
// => improves usability (not necessary). There is a small "x" whe it could be cleared manually
|
||||
if(
|
||||
options.maxSelectionLength === 1 &&
|
||||
$(this).val() !== null
|
||||
){
|
||||
$(this).val('').trigger('change');
|
||||
}
|
||||
})
|
||||
).done(function(a,b){
|
||||
// open select if not already pre-selected
|
||||
if($(this).val() === null){
|
||||
selectElement.select2('open');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* init a select element as an ajax based "select2" object for Access resources
|
||||
* character (private map), corporation (corp map), alliance (ally map)
|
||||
* @param options
|
||||
*/
|
||||
$.fn.initAccessSelect = function(options){
|
||||
|
||||
return this.each(function(){
|
||||
|
||||
let selectElement = $(this);
|
||||
|
||||
// format result data
|
||||
function formatResultData (data) {
|
||||
|
||||
if (data.loading){
|
||||
return data.text;
|
||||
}
|
||||
|
||||
// check if an option is already selected
|
||||
// do not show the same result twice
|
||||
let currentValues = selectElement.val();
|
||||
|
||||
if(
|
||||
currentValues &&
|
||||
currentValues.indexOf( data.id.toString() ) !== -1
|
||||
){
|
||||
return ;
|
||||
}
|
||||
|
||||
let imagePath = '';
|
||||
let previewContent = '';
|
||||
|
||||
switch(options.type){
|
||||
case 'character':
|
||||
imagePath = Init.url.ccpImageServer + 'Character/' + data.id + '_32.jpg';
|
||||
previewContent = '<img src="' + imagePath + '" style="max-width: 100%" />';
|
||||
break;
|
||||
case 'corporation':
|
||||
imagePath = Init.url.ccpImageServer + 'Corporation/' + data.id + '_32.png';
|
||||
previewContent = '<img src="' + imagePath + '" style="max-width: 100%" />';
|
||||
break;
|
||||
case 'alliance':
|
||||
imagePath = Init.url.ccpImageServer + 'Alliance/' + data.id + '_32.png';
|
||||
previewContent = '<img src="' + imagePath + '" style="max-width: 100%" />';
|
||||
break;
|
||||
}
|
||||
|
||||
let markup = '<div class="clearfix">';
|
||||
markup += '<div class="col-sm-2">' + previewContent + '</div>';
|
||||
markup += '<div class="col-sm-10">' + data.text + '</div></div>';
|
||||
|
||||
return markup;
|
||||
}
|
||||
|
||||
// format selection data
|
||||
function formatSelectionData (data){
|
||||
|
||||
if (data.loading){
|
||||
return data.text;
|
||||
}
|
||||
|
||||
let markup = '<div class="clearfix">';
|
||||
markup += '<div class="col-sm-10">' + data.text + '</div></div>';
|
||||
|
||||
return markup;
|
||||
}
|
||||
|
||||
$.when(
|
||||
selectElement.select2({
|
||||
ajax: {
|
||||
url: function(params){
|
||||
// add params to URL
|
||||
return Init.path.searchAccess + '/' + options.type + '/' + params.term;
|
||||
},
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
timeout: 5000,
|
||||
cache: true,
|
||||
data: function(params) {
|
||||
// no url params here
|
||||
return;
|
||||
},
|
||||
processResults: function(data, page) {
|
||||
// parse the results into the format expected by Select2.
|
||||
return {
|
||||
results: data.map( function(item){
|
||||
return {
|
||||
id: item.id,
|
||||
text: item.name
|
||||
};
|
||||
})
|
||||
};
|
||||
},
|
||||
error: function (jqXHR, status, error) {
|
||||
if( !Util.isXHRAborted(jqXHR) ){
|
||||
|
||||
let reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
Util.showNotify({title: 'Access select warning', text: reason + ' deleted', type: 'warning'});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
dropdownParent: selectElement.parents('.modal-body'),
|
||||
theme: 'pathfinder',
|
||||
minimumInputLength: 3,
|
||||
placeholder: options.type + ' names',
|
||||
allowClear: false,
|
||||
maximumSelectionLength: options.maxSelectionLength,
|
||||
templateResult: formatResultData,
|
||||
templateSelection: formatSelectionData,
|
||||
escapeMarkup: function(markup){
|
||||
// let our custom formatter work
|
||||
return markup;
|
||||
}
|
||||
}).on('change', function(e){
|
||||
// select changed
|
||||
|
||||
})
|
||||
).done(function(){
|
||||
// after init finish
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
239
public/js/v1.2.5/app/ui/header.js
Normal file
239
public/js/v1.2.5/app/ui/header.js
Normal file
@@ -0,0 +1,239 @@
|
||||
/**
|
||||
* Header animation
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'easePack',
|
||||
'tweenLite'
|
||||
], function($) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
previewElementClass: 'pf-header-preview-element' // class for "preview" elements
|
||||
};
|
||||
|
||||
|
||||
let width, height, largeHeader, canvas, ctx, points, target, animateHeader = true;
|
||||
|
||||
let canvasHeight = 355;
|
||||
let colorRGB = '108, 174, 173';
|
||||
let connectionCount = 4;
|
||||
|
||||
|
||||
let initHeader = function() {
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
target = {x: width * 1, y: 230};
|
||||
|
||||
largeHeader.style.height = height+'px';
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
ctx = canvas.getContext('2d');
|
||||
|
||||
// create points
|
||||
points = [];
|
||||
for(let x = 0; x < width; x = x + width/20) {
|
||||
for(let y = 0; y < height; y = y + height/15) {
|
||||
let px = x + Math.random()*width/15;
|
||||
let py = y + Math.random()*height/15;
|
||||
let p = {x: px, originX: px, y: py, originY: py };
|
||||
points.push(p);
|
||||
}
|
||||
}
|
||||
|
||||
// for each point find the 5 closest points
|
||||
for(let i = 0; i < points.length; i++) {
|
||||
let closest = [];
|
||||
let p1 = points[i];
|
||||
for(let j = 0; j < points.length; j++) {
|
||||
let p2 = points[j];
|
||||
if(p1 !== p2) {
|
||||
let placed = false;
|
||||
for(let k = 0; k < connectionCount; k++) {
|
||||
if(!placed) {
|
||||
if(closest[k] === undefined) {
|
||||
closest[k] = p2;
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let m = 0; m < connectionCount; m++) {
|
||||
if(!placed) {
|
||||
if(getDistance(p1, p2) < getDistance(p1, closest[m])) {
|
||||
closest[m] = p2;
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
p1.closest = closest;
|
||||
}
|
||||
|
||||
// assign a circle to each point
|
||||
for(let n in points) {
|
||||
let c = new Circle(points[n], 2+Math.random()*2, 'rgba(255,255,255,0.3)');
|
||||
points[n].circle = c;
|
||||
}
|
||||
};
|
||||
|
||||
// Event handling
|
||||
let addListeners = function() {
|
||||
if(!('ontouchstart' in window)) {
|
||||
window.addEventListener('mousemove', mouseMove);
|
||||
}
|
||||
window.addEventListener('scroll', scrollCheck);
|
||||
window.addEventListener('resize', resize);
|
||||
};
|
||||
|
||||
let mouseMove = function(e) {
|
||||
let posx = 0;
|
||||
let posy = 0;
|
||||
if (e.pageX || e.pageY) {
|
||||
posx = e.pageX;
|
||||
posy = e.pageY;
|
||||
}else if (e.clientX || e.clientY){
|
||||
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
|
||||
}
|
||||
target.x = posx;
|
||||
target.y = posy;
|
||||
};
|
||||
|
||||
let scrollCheck = function() {
|
||||
if(document.body.scrollTop > height){
|
||||
animateHeader = false;
|
||||
}else{
|
||||
animateHeader = true;
|
||||
}
|
||||
};
|
||||
|
||||
let resize = function() {
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
largeHeader.style.height = height+'px';
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
};
|
||||
|
||||
// animation
|
||||
let initAnimation = function() {
|
||||
animate();
|
||||
for(let i in points) {
|
||||
shiftPoint(points[i]);
|
||||
}
|
||||
};
|
||||
|
||||
let animate = function animate() {
|
||||
if(animateHeader) {
|
||||
ctx.clearRect(0,0,width,height);
|
||||
for(let i in points) {
|
||||
// detect points in range
|
||||
if(Math.abs(getDistance(target, points[i])) < 4000) {
|
||||
points[i].active = 0.25;
|
||||
points[i].circle.active = 0.45;
|
||||
} else if(Math.abs(getDistance(target, points[i])) < 20000) {
|
||||
points[i].active = 0.1;
|
||||
points[i].circle.active = 0.3;
|
||||
} else if(Math.abs(getDistance(target, points[i])) < 40000) {
|
||||
points[i].active = 0.02;
|
||||
points[i].circle.active = 0.1;
|
||||
} else {
|
||||
points[i].active = 0;
|
||||
points[i].circle.active = 0;
|
||||
}
|
||||
|
||||
drawLines(points[i]);
|
||||
points[i].circle.draw();
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(animate);
|
||||
};
|
||||
|
||||
let shiftPoint = function (p) {
|
||||
TweenLite.to(p, 1 + 1 * Math.random(), {x: p.originX - 50 + Math.random() * 100,
|
||||
y: p.originY - 50 + Math.random() * 100, ease: Circ.easeInOut,
|
||||
onComplete: function () {
|
||||
shiftPoint(p);
|
||||
}});
|
||||
};
|
||||
|
||||
// Canvas manipulation
|
||||
let drawLines = function (p) {
|
||||
if(!p.active) return;
|
||||
for(let i in p.closest) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(p.x, p.y);
|
||||
ctx.lineTo(p.closest[i].x, p.closest[i].y);
|
||||
ctx.strokeStyle = 'rgba(' + colorRGB +','+ p.active+')';
|
||||
ctx.stroke();
|
||||
}
|
||||
};
|
||||
|
||||
let Circle = function(pos,rad,color) {
|
||||
let _this = this;
|
||||
|
||||
// constructor
|
||||
(function() {
|
||||
_this.pos = pos || null;
|
||||
_this.radius = rad || null;
|
||||
_this.color = color || null;
|
||||
})();
|
||||
|
||||
this.draw = function() {
|
||||
if(!_this.active) return;
|
||||
ctx.beginPath();
|
||||
ctx.arc(_this.pos.x, _this.pos.y, _this.radius, 0, 2 * Math.PI, false);
|
||||
ctx.fillStyle = 'rgba(' + colorRGB + ','+ _this.active+')';
|
||||
ctx.fill();
|
||||
};
|
||||
};
|
||||
|
||||
// Util
|
||||
let getDistance = function(p1, p2) {
|
||||
return Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2);
|
||||
};
|
||||
|
||||
/**
|
||||
* init header animation
|
||||
* @param callback
|
||||
*/
|
||||
$.fn.initHeader = function(callback){
|
||||
largeHeader = $(this)[0];
|
||||
canvas = $(this).find('canvas:visible')[0];
|
||||
|
||||
// header preview elements
|
||||
$('.' + config.previewElementClass).velocity('transition.bounceIn', {
|
||||
duration: 600,
|
||||
stagger: 60,
|
||||
delay: 120,
|
||||
complete: function(){
|
||||
|
||||
// show header canvas animation
|
||||
if(canvas){
|
||||
// header animation
|
||||
initHeader();
|
||||
initAnimation();
|
||||
addListeners();
|
||||
|
||||
$(canvas).velocity('fadeIn', {
|
||||
duration: 900,
|
||||
visibility: 'visible',
|
||||
complete: function(){
|
||||
if(callback !== undefined){
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
150
public/js/v1.2.5/app/ui/logo.js
Normal file
150
public/js/v1.2.5/app/ui/logo.js
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* Logo
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'lazylinepainter'
|
||||
], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
|
||||
staticLogoId: 'pf-static-logo-svg', // id for "static" logo
|
||||
|
||||
logoPartTopRightClass: 'logo-ploygon-top-right', // class for logo part "top right"
|
||||
logoPartBottomLeftClass: 'logo-ploygon-bottom-left', // class for logo part "bottom left"
|
||||
logoPartBottomRightClass: 'logo-ploygon-bottom-right', // class for logo part "bottom right"
|
||||
logoPartTopLeftClass: 'logo-ploygon-top-left'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* draws the pathfinder logo to an element and add some animation features
|
||||
* @param callback
|
||||
* @param enableHover
|
||||
*/
|
||||
$.fn.drawLogo = function(callback, enableHover){
|
||||
let canvasElement = $(this);
|
||||
|
||||
let pathObj = {
|
||||
logo: {
|
||||
strokepath: [
|
||||
{
|
||||
path: 'M195.9 9.6 226.9 297.1 354.2 365 196.2 9.8 ',
|
||||
strokeColor: '#477372',
|
||||
duration: 1600
|
||||
},
|
||||
{
|
||||
path: 'M1.7 361.3 73.9 284.9 178.6 286.7 2.2 361.4 ',
|
||||
strokeColor: '#5cb85c',
|
||||
duration: 1000
|
||||
},
|
||||
{
|
||||
path: 'M192.9 286.7 121.2 318.6 335.6 363.5 193.4 286.7 ',
|
||||
strokeColor: '#375959',
|
||||
duration: 900
|
||||
},
|
||||
{
|
||||
path: 'M202.8 141.9 0.2 352.6 189.1 0.8 202.7 141.3 ',
|
||||
strokeColor: '#63676a',
|
||||
duration: 1500
|
||||
}
|
||||
],
|
||||
dimensions: {
|
||||
width: 355,
|
||||
height: 366
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// load Logo svg
|
||||
requirejs(['text!templates/ui/logo.html', 'mustache'], function(template, Mustache) {
|
||||
let logoData = {
|
||||
staticLogoId: config.staticLogoId,
|
||||
logoPartTopRightClass: config.logoPartTopRightClass,
|
||||
logoPartBottomLeftClass: config.logoPartBottomLeftClass,
|
||||
logoPartBottomRightClass: config.logoPartBottomRightClass,
|
||||
logoPartTopLeftClass: config.logoPartTopLeftClass
|
||||
};
|
||||
|
||||
let logoContent = Mustache.render(template, logoData);
|
||||
|
||||
canvasElement.html(logoContent);
|
||||
|
||||
// draw the logo
|
||||
canvasElement.lazylinepainter(
|
||||
{
|
||||
svgData: pathObj,
|
||||
strokeWidth: 2,
|
||||
drawSequential: false,
|
||||
delay: 300,
|
||||
overrideKey: 'logo',
|
||||
strokeJoin: 'bevel',
|
||||
onComplete: function(){
|
||||
|
||||
// hide lines
|
||||
canvasElement.find('svg:not(#' + config.staticLogoId + ')').velocity({
|
||||
opacity: 0
|
||||
},{
|
||||
delay: 100
|
||||
});
|
||||
|
||||
// show full logo
|
||||
canvasElement.find('#' + config.staticLogoId + '').velocity({
|
||||
opacity: 1
|
||||
},{
|
||||
delay: 100,
|
||||
duration: 200,
|
||||
complete: function(){
|
||||
|
||||
// execute callback
|
||||
if(typeof callback === 'function'){
|
||||
callback();
|
||||
}
|
||||
|
||||
// init logo animation
|
||||
if(enableHover === true){
|
||||
let logoElements = $('#' + config.staticLogoId + ' path');
|
||||
|
||||
let animate = [];
|
||||
logoElements.on('mouseover', function(e){
|
||||
let currentLogoElement = $(e.target);
|
||||
let currentLogoElementIndex = logoElements.index(currentLogoElement);
|
||||
|
||||
let animationXValue = currentLogoElement.attr('data-animationX');
|
||||
let animationYValue = currentLogoElement.attr('data-animationY');
|
||||
|
||||
let animationConfig = {};
|
||||
animationConfig.opacity = [1, 1];
|
||||
animationConfig.translateZ = [0, 0];
|
||||
animationConfig.translateX = [animationXValue, 0 ];
|
||||
animationConfig.translateY = [animationYValue, 0];
|
||||
|
||||
if(animate[currentLogoElementIndex] !== false){
|
||||
$(this).velocity(animationConfig,{
|
||||
duration: 120,
|
||||
begin: function(){
|
||||
animate[currentLogoElementIndex] = false;
|
||||
}
|
||||
}).velocity('reverse',{
|
||||
delay: 240,
|
||||
complete: function(){
|
||||
animate[currentLogoElementIndex] = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}).lazylinepainter('paint');
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
241
public/js/v1.2.5/app/ui/system_graph.js
Normal file
241
public/js/v1.2.5/app/ui/system_graph.js
Normal file
@@ -0,0 +1,241 @@
|
||||
/**
|
||||
* System graph module
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'morris'
|
||||
], function($, Init, Util, Morris) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// module info
|
||||
moduleClass: 'pf-module', // class for each module
|
||||
|
||||
// system graph module
|
||||
systemGraphModuleClass: 'pf-system-graph-module', // class for this module
|
||||
systemGraphClass: 'pf-system-graph', // class for each graph
|
||||
|
||||
// system graph labels
|
||||
systemGraphLabels: {
|
||||
jumps: {
|
||||
headline: 'Jumps',
|
||||
units: 'jumps',
|
||||
ykeys: ['y'],
|
||||
labels: ['jumps'],
|
||||
lineColors: ['#375959'],
|
||||
pointFillColors: ['#477372']
|
||||
},
|
||||
shipKills: {
|
||||
headline: 'Ship/POD Kills',
|
||||
units: 'kills',
|
||||
ykeys: ['y', 'z'],
|
||||
labels: ['Ship kills', 'POD kills'],
|
||||
lineColors: ['#375959', '#477372'],
|
||||
pointFillColors: ['#477372', '#568a89']
|
||||
},
|
||||
factionKills: {
|
||||
headline: 'NPC Kills',
|
||||
units: 'kills',
|
||||
ykeys: ['y'],
|
||||
labels: ['kills'],
|
||||
lineColors: ['#375959'],
|
||||
pointFillColors: ['#477372']
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get info for a given graph key
|
||||
* @param graphKey
|
||||
* @param option
|
||||
* @returns {string}
|
||||
*/
|
||||
var getInfoForGraph = function(graphKey, option){
|
||||
var info = '';
|
||||
|
||||
if(config.systemGraphLabels.hasOwnProperty(graphKey)){
|
||||
info = config.systemGraphLabels[graphKey][option];
|
||||
}
|
||||
|
||||
return info;
|
||||
};
|
||||
|
||||
/**
|
||||
* init Morris Graph
|
||||
* @param graphElement
|
||||
* @param graphKey
|
||||
* @param graphData
|
||||
*/
|
||||
var initGraph = function(graphElement, graphKey, graphData, eventLine){
|
||||
|
||||
if(graphData.length > 0){
|
||||
var labelYFormat = function(y){
|
||||
return Math.round(y);
|
||||
};
|
||||
|
||||
var graphConfig = {
|
||||
element: graphElement,
|
||||
data: graphData,
|
||||
xkey: 'x',
|
||||
ykeys: getInfoForGraph(graphKey, 'ykeys'),
|
||||
labels: getInfoForGraph(graphKey, 'labels'),
|
||||
parseTime: false,
|
||||
ymin: 0,
|
||||
yLabelFormat: labelYFormat,
|
||||
padding: 10,
|
||||
hideHover: true,
|
||||
pointSize: 3,
|
||||
lineColors: getInfoForGraph(graphKey, 'lineColors'),
|
||||
pointFillColors: getInfoForGraph(graphKey, 'pointFillColors'),
|
||||
pointStrokeColors: ['#141413'],
|
||||
lineWidth: 2,
|
||||
grid: true,
|
||||
gridStrokeWidth: 0.3,
|
||||
gridTextSize: 9,
|
||||
gridTextFamily: 'Oxygen Bold',
|
||||
gridTextColor: '#63676a',
|
||||
behaveLikeLine: false,
|
||||
goals: [],
|
||||
goalLineColors: ['#5cb85c'],
|
||||
smooth: true,
|
||||
fillOpacity: 0.2,
|
||||
resize: true,
|
||||
redraw: true,
|
||||
eventStrokeWidth: 2,
|
||||
eventLineColors: ['#5CB85C']
|
||||
};
|
||||
|
||||
if(eventLine >= 0){
|
||||
graphConfig.events = [eventLine];
|
||||
}
|
||||
|
||||
Morris.Area(graphConfig);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* draw graph module
|
||||
* @param parentElement
|
||||
* @param systemData
|
||||
*/
|
||||
var drawModule = function(parentElement, systemData){
|
||||
|
||||
// graph data is available for k-space systems
|
||||
if(systemData.type.id === 2){
|
||||
var requestData = {
|
||||
systemIds: [systemData.systemId]
|
||||
};
|
||||
|
||||
// calculate time offset until system created
|
||||
var serverData = Util.getServerTime();
|
||||
|
||||
var timestampNow = Math.floor(serverData.getTime() / 1000);
|
||||
var timeSinceUpdate = timestampNow - systemData.updated;
|
||||
|
||||
var timeInHours = Math.floor(timeSinceUpdate / 3600);
|
||||
var timeInMinutes = Math.floor((timeSinceUpdate % 3600) / 60);
|
||||
var timeInMinutesPercent = ( timeInMinutes / 60 ).toFixed(2);
|
||||
var eventLine = timeInHours + timeInMinutesPercent;
|
||||
|
||||
// graph is from right to left -> convert event line
|
||||
eventLine = 23 - eventLine;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.getSystemGraphData,
|
||||
data: requestData,
|
||||
dataType: 'json'
|
||||
}).done(function(systemGraphsData){
|
||||
|
||||
if( Object.keys(systemGraphsData).length > 0 ){
|
||||
// create new (hidden) module container
|
||||
var moduleElement = $('<div>', {
|
||||
class: [config.moduleClass, config.systemGraphModuleClass].join(' '),
|
||||
css: {opacity: 0}
|
||||
});
|
||||
|
||||
// insert at the correct position
|
||||
if($(parentElement).children().length === 1){
|
||||
$(parentElement).append(moduleElement);
|
||||
}else{
|
||||
$(parentElement).find('>:first-child').after(moduleElement);
|
||||
}
|
||||
|
||||
// row element
|
||||
var rowElement = $('<div>', {
|
||||
class: 'row'
|
||||
});
|
||||
moduleElement.append(rowElement);
|
||||
|
||||
$.each(systemGraphsData, function(systemId, graphsData){
|
||||
$.each(graphsData, function(graphKey, graphData){
|
||||
|
||||
var colElement = $('<div>', {
|
||||
class: ['col-xs-12', 'col-sm-6', 'col-md-4'].join(' ')
|
||||
});
|
||||
|
||||
var headlineElement = $('<h5>').text( getInfoForGraph(graphKey, 'headline') );
|
||||
|
||||
colElement.append(headlineElement);
|
||||
|
||||
var graphElement = $('<div>', {
|
||||
class: config.systemGraphClass
|
||||
});
|
||||
|
||||
colElement.append(graphElement);
|
||||
|
||||
rowElement.append(colElement);
|
||||
initGraph(graphElement, graphKey, graphData, eventLine);
|
||||
});
|
||||
});
|
||||
|
||||
moduleElement.append($('<div>', {
|
||||
css: {'clear': 'both'}
|
||||
}));
|
||||
|
||||
// show module
|
||||
moduleElement.velocity('transition.slideDownIn', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
delay: Init.animationSpeed.mapModule
|
||||
});
|
||||
}
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': System graph data', text: reason, type: 'warning'});
|
||||
$(document).setProgramStatus('problem');
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* main module load function
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.drawSystemGraphModule = function(systemData){
|
||||
|
||||
var parentElement = $(this);
|
||||
|
||||
// check if module already exists
|
||||
var moduleElement = parentElement.find('.' + config.systemGraphModuleClass);
|
||||
|
||||
if(moduleElement.length > 0){
|
||||
moduleElement.velocity('transition.slideDownOut', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
complete: function(tempElement){
|
||||
$(tempElement).remove();
|
||||
drawModule(parentElement, systemData);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
drawModule(parentElement, systemData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
});
|
||||
516
public/js/v1.2.5/app/ui/system_info.js
Normal file
516
public/js/v1.2.5/app/ui/system_info.js
Normal file
@@ -0,0 +1,516 @@
|
||||
/**
|
||||
* System info module
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'app/map/util'
|
||||
], function($, Init, Util, Render, MapUtil) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// module info
|
||||
moduleClass: 'pf-module', // class for each module
|
||||
|
||||
// system info module
|
||||
systemInfoModuleClass: 'pf-system-info-module', // module wrapper
|
||||
|
||||
// breadcrumb
|
||||
constellationLinkClass: 'pf-system-info-constellation', // class for "constellation" name
|
||||
regionLinkClass: 'pf-system-info-region', // class for "region" name
|
||||
typeLinkClass: 'pf-system-info-type', // class for "type" name
|
||||
|
||||
// info table
|
||||
systemInfoTableClass: 'pf-system-info-table', // class for system info table
|
||||
systemInfoNameInfoClass: 'pf-system-info-name', // class for "name" information element
|
||||
systemInfoEffectInfoClass: 'pf-system-info-effect', // class for "effect" information element
|
||||
systemInfoStatusLabelClass: 'pf-system-info-status-label', // class for "status" information element
|
||||
systemInfoStatusAttributeName: 'data-status', // attribute name for status label
|
||||
systemInfoWormholeClass: 'pf-system-info-wormhole-', // class prefix for static wormhole element
|
||||
|
||||
// description field
|
||||
descriptionArea: 'pf-system-info-description-area', // class for "description" area
|
||||
addDescriptionButtonClass: 'pf-system-info-description-button', // class for "add description" button
|
||||
moduleElementToolbarClass: 'pf-table-tools', // class for "module toolbar" element
|
||||
tableToolsActionClass: 'pf-table-tools-action', // class for "edit" action
|
||||
|
||||
descriptionTextareaElementClass: 'pf-system-info-description', // class for "description" textarea element (xEditable)
|
||||
descriptionTextareaCharCounter: 'pf-form-field-char-count' // class for "character counter" element for form field
|
||||
};
|
||||
|
||||
// disable Module update temporary (until. some requests/animations) are finished
|
||||
let disableModuleUpdate = true;
|
||||
|
||||
// animation speed values
|
||||
let animationSpeedToolbarAction = 200;
|
||||
|
||||
// max character length for system description
|
||||
let maxDescriptionLength = 512;
|
||||
|
||||
/**
|
||||
* set module observer and look for relevant system data to update
|
||||
*/
|
||||
let setModuleObserver = function(moduleElement){
|
||||
|
||||
$(document).off('pf:updateSystemInfoModule').on('pf:updateSystemInfoModule', function(e, data){
|
||||
if(data){
|
||||
moduleElement.updateSystemInfoModule(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the tool action element by animation
|
||||
* @param toolsActionElement
|
||||
*/
|
||||
let showToolsActionElement = function(toolsActionElement){
|
||||
toolsActionElement.velocity('stop').velocity({
|
||||
opacity: 1,
|
||||
height: '100%'
|
||||
},{
|
||||
duration: animationSpeedToolbarAction,
|
||||
display: 'block',
|
||||
visibility: 'visible'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* hides the tool action element by animation
|
||||
* @param toolsActionElement
|
||||
*/
|
||||
let hideToolsActionElement = function(toolsActionElement){
|
||||
toolsActionElement.velocity('stop').velocity('reverse', {
|
||||
display: 'none',
|
||||
visibility: 'hidden'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* update trigger function for this module
|
||||
* compare data and update module
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.updateSystemInfoModule = function(systemData){
|
||||
|
||||
// module update is disabled
|
||||
if(disableModuleUpdate === true){
|
||||
return;
|
||||
}
|
||||
|
||||
let moduleElement = $(this);
|
||||
|
||||
let systemId = moduleElement.data('id');
|
||||
|
||||
if(systemId === systemData.id){
|
||||
// update module
|
||||
|
||||
// system status =====================================================================================
|
||||
let systemStatusLabelElement = moduleElement.find('.' + config.systemInfoStatusLabelClass);
|
||||
let systemStatusId = parseInt( systemStatusLabelElement.attr( config.systemInfoStatusAttributeName ) );
|
||||
|
||||
if(systemStatusId !== systemData.status.id){
|
||||
// status changed
|
||||
|
||||
let currentStatusClass = Util.getStatusInfoForSystem(systemStatusId, 'class');
|
||||
let newStatusClass = Util.getStatusInfoForSystem(systemData.status.id, 'class');
|
||||
let newStatusLabel = Util.getStatusInfoForSystem(systemData.status.id, 'label');
|
||||
|
||||
systemStatusLabelElement.removeClass(currentStatusClass).addClass(newStatusClass).text(newStatusLabel);
|
||||
|
||||
// set new status attribute
|
||||
systemStatusLabelElement.attr( config.systemInfoStatusAttributeName, systemData.status.id);
|
||||
}
|
||||
|
||||
// description textarea element ======================================================================
|
||||
let descriptionTextareaElement = moduleElement.find('.' + config.descriptionTextareaElementClass);
|
||||
let description = descriptionTextareaElement.editable('getValue', true);
|
||||
|
||||
if(description !== systemData.description){
|
||||
// description changed
|
||||
|
||||
// description button
|
||||
let descriptionButton = moduleElement.find('.' + config.addDescriptionButtonClass);
|
||||
|
||||
// set new value
|
||||
descriptionTextareaElement.editable('setValue', systemData.description);
|
||||
|
||||
let actionElement = descriptionButton.siblings('.' + config.tableToolsActionClass);
|
||||
|
||||
if(systemData.description.length === 0){
|
||||
// show/activate description field
|
||||
|
||||
// show button if value is empty
|
||||
descriptionButton.show();
|
||||
|
||||
hideToolsActionElement(actionElement);
|
||||
}else{
|
||||
// hide/disable description field
|
||||
// hide tool button
|
||||
descriptionButton.hide();
|
||||
showToolsActionElement(actionElement);
|
||||
}
|
||||
}
|
||||
|
||||
// created/updated tooltip ===========================================================================
|
||||
|
||||
let nameRowElement = $(moduleElement).find('.' + config.systemInfoNameInfoClass);
|
||||
|
||||
let tooltipData = {
|
||||
created: systemData.created,
|
||||
updated: systemData.updated
|
||||
};
|
||||
|
||||
nameRowElement.addCharacterInfoTooltip( tooltipData );
|
||||
}
|
||||
|
||||
moduleElement.find('.' + config.descriptionArea).hideLoadingAnimation();
|
||||
};
|
||||
|
||||
/**
|
||||
* update a character counter field with current value length - maxCharLength
|
||||
* @param field
|
||||
* @param charCounterElement
|
||||
* @param maxCharLength
|
||||
*/
|
||||
let updateCounter = function(field, charCounterElement, maxCharLength){
|
||||
let value = field.val();
|
||||
let inputLength = value.length;
|
||||
|
||||
// line breaks are 2 characters!
|
||||
let newLines = value.match(/(\r\n|\n|\r)/g);
|
||||
let addition = 0;
|
||||
if (newLines != null) {
|
||||
addition = newLines.length;
|
||||
}
|
||||
inputLength += addition;
|
||||
|
||||
charCounterElement.text(maxCharLength - inputLength);
|
||||
|
||||
if(maxCharLength <= inputLength){
|
||||
charCounterElement.toggleClass('txt-color-red', true);
|
||||
}else{
|
||||
charCounterElement.toggleClass('txt-color-red', false);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parentElement
|
||||
* @param mapId
|
||||
* @param systemData
|
||||
*/
|
||||
let drawModule = function(parentElement, mapId, systemData){
|
||||
|
||||
// create new module container
|
||||
let moduleElement = $('<div>', {
|
||||
class: [config.moduleClass, config.systemInfoModuleClass].join(' '),
|
||||
css: {opacity: 0}
|
||||
});
|
||||
|
||||
// store systemId -> module can be updated with the correct data
|
||||
moduleElement.data('id', systemData.id);
|
||||
|
||||
parentElement.prepend(moduleElement);
|
||||
|
||||
// shattered wormhole info data
|
||||
let shatteredWormholeInfo = false;
|
||||
|
||||
// add security class for statics
|
||||
if(
|
||||
systemData.statics &&
|
||||
systemData.statics.length > 0
|
||||
){
|
||||
for(let i = 0; i < systemData.statics.length; i++){
|
||||
systemData.statics[i].class = Util.getSecurityClassForSystem( systemData.statics[i].security );
|
||||
}
|
||||
}else if(systemData.type.id === 1){
|
||||
// system type "wormhole" but no statics => "shattered wormhole"
|
||||
shatteredWormholeInfo = true;
|
||||
}
|
||||
|
||||
let effectName = MapUtil.getEffectInfoForSystem(systemData.effect, 'name');
|
||||
let effectClass = MapUtil.getEffectInfoForSystem(systemData.effect, 'class');
|
||||
|
||||
// systemInfo template config
|
||||
let moduleConfig = {
|
||||
name: 'modules/system_info',
|
||||
position: moduleElement,
|
||||
link: 'append',
|
||||
functions: {
|
||||
after: function(){
|
||||
let tempModuleElement = parentElement.find('.' + config.systemInfoModuleClass);
|
||||
|
||||
// lock "description" field until first update
|
||||
tempModuleElement.find('.' + config.descriptionArea).showLoadingAnimation();
|
||||
|
||||
// "add description" button
|
||||
let descriptionButton = tempModuleElement.find('.' + config.addDescriptionButtonClass);
|
||||
|
||||
// description textarea element
|
||||
let descriptionTextareaElement = tempModuleElement.find('.' + config.descriptionTextareaElementClass);
|
||||
|
||||
// init description textarea
|
||||
descriptionTextareaElement.editable({
|
||||
url: Init.path.saveSystem,
|
||||
dataType: 'json',
|
||||
pk: systemData.id,
|
||||
type: 'textarea',
|
||||
mode: 'inline',
|
||||
emptytext: '',
|
||||
onblur: 'cancel',
|
||||
showbuttons: true,
|
||||
value: '', // value is set by trigger function updateSystemInfoModule()
|
||||
rows: 5,
|
||||
name: 'description',
|
||||
inputclass: config.descriptionTextareaElementClass,
|
||||
tpl: '<textarea maxlength="' + maxDescriptionLength + '"></textarea>',
|
||||
params: function(params){
|
||||
|
||||
params.mapData = {
|
||||
id: mapId
|
||||
};
|
||||
|
||||
params.systemData = {};
|
||||
params.systemData.id = params.pk;
|
||||
params.systemData[params.name] = params.value;
|
||||
|
||||
// clear unnecessary data
|
||||
delete params.pk;
|
||||
delete params.name;
|
||||
delete params.value;
|
||||
|
||||
return params;
|
||||
},
|
||||
validate: function(value){
|
||||
if(value.length > 0 && $.trim(value).length === 0) {
|
||||
return {newValue: ''};
|
||||
}
|
||||
},
|
||||
success: function(response, newValue){
|
||||
Util.showNotify({title: 'System updated', text: 'Name: ' + response.name, type: 'success'});
|
||||
},
|
||||
error: function(jqXHR, newValue){
|
||||
let reason = '';
|
||||
let status = '';
|
||||
if(jqXHR.name){
|
||||
// save error new sig (mass save)
|
||||
reason = jqXHR.name;
|
||||
status = 'Error';
|
||||
}else{
|
||||
reason = jqXHR.responseJSON.text;
|
||||
status = jqXHR.status;
|
||||
}
|
||||
|
||||
Util.showNotify({title: status + ': save system information', text: reason, type: 'warning'});
|
||||
$(document).setProgramStatus('problem');
|
||||
return reason;
|
||||
}
|
||||
});
|
||||
|
||||
// on xEditable open -------------------------------------------------------------------------
|
||||
descriptionTextareaElement.on('shown', function(e, editable){
|
||||
let textarea = editable.input.$input;
|
||||
|
||||
// disable module update until description field is open
|
||||
disableModuleUpdate = true;
|
||||
|
||||
// create character counter
|
||||
let charCounter = $('<kbd>', {
|
||||
class: [config.descriptionTextareaCharCounter, 'txt-color', 'text-right'].join(' ')
|
||||
});
|
||||
textarea.parent().next().append(charCounter);
|
||||
|
||||
// update character counter
|
||||
updateCounter(textarea, charCounter, maxDescriptionLength);
|
||||
|
||||
textarea.on('keyup', function(){
|
||||
updateCounter($(this), charCounter, maxDescriptionLength);
|
||||
});
|
||||
});
|
||||
|
||||
// on xEditable close ------------------------------------------------------------------------
|
||||
descriptionTextareaElement.on('hidden', function(e){
|
||||
let value = $(this).editable('getValue', true);
|
||||
if(value.length === 0){
|
||||
// show button if value is empty
|
||||
hideToolsActionElement(descriptionButton.siblings('.' + config.tableToolsActionClass));
|
||||
descriptionButton.show();
|
||||
}
|
||||
|
||||
// enable module update
|
||||
disableModuleUpdate = false;
|
||||
});
|
||||
|
||||
// enable xEditable field on Button click ----------------------------------------------------
|
||||
descriptionButton.on('click', function(e){
|
||||
e.stopPropagation();
|
||||
let descriptionButton = $(this);
|
||||
|
||||
// hide tool buttons
|
||||
descriptionButton.hide();
|
||||
|
||||
// show field *before* showing the element
|
||||
descriptionTextareaElement.editable('show');
|
||||
|
||||
showToolsActionElement(descriptionButton.siblings('.' + config.tableToolsActionClass));
|
||||
});
|
||||
|
||||
// init tooltips -----------------------------------------------------------------------------
|
||||
let tooltipElements = tempModuleElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
|
||||
// init system effect popover ----------------------------------------------------------------
|
||||
let infoEffectElement = $(moduleElement).find('.' + config.systemInfoEffectInfoClass);
|
||||
|
||||
if(infoEffectElement.length){
|
||||
// effect row exists -> get effect data
|
||||
let systemEffectData = Util.getSystemEffectData( systemData.security, systemData.effect);
|
||||
|
||||
if(systemEffectData !== false){
|
||||
// transform data into table
|
||||
let systemEffectTable = Util.getSystemEffectTable( systemEffectData );
|
||||
|
||||
infoEffectElement.popover({
|
||||
html: true,
|
||||
trigger: 'hover',
|
||||
placement: 'top',
|
||||
delay: 200,
|
||||
title: 'System effects',
|
||||
container: 'body',
|
||||
content: systemEffectTable
|
||||
});
|
||||
}else{
|
||||
// effect data not found (e.g. !unknown! shattered system) -> hide "popover" icon icon
|
||||
infoEffectElement.children().hide();
|
||||
}
|
||||
}
|
||||
|
||||
// init static wormhole information ----------------------------------------------------------
|
||||
if(systemData.statics){
|
||||
for(let i = 0; i < systemData.statics.length; i++){
|
||||
let staticData = systemData.statics[i];
|
||||
let staticRowElement = tempModuleElement.find('.' + config.systemInfoWormholeClass + staticData.name);
|
||||
staticRowElement.addWormholeInfoTooltip(staticData);
|
||||
}
|
||||
}
|
||||
|
||||
// constellation popover ---------------------------------------------------------------------
|
||||
tempModuleElement.find('a.popup-ajax').popover({
|
||||
html: true,
|
||||
trigger: 'hover',
|
||||
placement: 'top',
|
||||
delay: 200,
|
||||
container: 'body',
|
||||
content: function(){
|
||||
return details_in_popup(this);
|
||||
}
|
||||
});
|
||||
|
||||
function details_in_popup(popoverElement){
|
||||
popoverElement = $(popoverElement);
|
||||
let popover = popoverElement.data('bs.popover');
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: popoverElement.data('url'),
|
||||
success: function(data){
|
||||
let systemEffectTable = Util.getSystemsInfoTable( data.systemData );
|
||||
popover.options.content = systemEffectTable;
|
||||
// reopen popover (new content size)
|
||||
popover.show();
|
||||
}
|
||||
});
|
||||
return 'Loading...';
|
||||
}
|
||||
|
||||
showModule(moduleElement);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let moduleData = {
|
||||
system: systemData,
|
||||
tableClass: config.systemInfoTableClass,
|
||||
nameInfoClass: config.systemInfoNameInfoClass,
|
||||
effectInfoClass: config.systemInfoEffectInfoClass,
|
||||
wormholePrefixClass: config.systemInfoWormholeClass,
|
||||
statusInfoClass: config.systemInfoStatusLabelClass,
|
||||
|
||||
systemTypeName: MapUtil.getSystemTypeInfo(systemData.type.id, 'name'),
|
||||
systemStatusId: systemData.status.id,
|
||||
systemStatusClass: Util.getStatusInfoForSystem(systemData.status.id, 'class'),
|
||||
systemStatusLabel: Util.getStatusInfoForSystem(systemData.status.id, 'label'),
|
||||
securityClass: Util.getSecurityClassForSystem( systemData.security ),
|
||||
trueSec: systemData.trueSec.toFixed(1),
|
||||
trueSecClass: Util.getTrueSecClassForSystem( systemData.trueSec ),
|
||||
effectName: effectName,
|
||||
effectClass: effectClass,
|
||||
moduleToolbarClass: config.moduleElementToolbarClass,
|
||||
descriptionButtonClass: config.addDescriptionButtonClass,
|
||||
tableToolsActionClass: config.tableToolsActionClass,
|
||||
descriptionTextareaClass: config.descriptionTextareaElementClass,
|
||||
|
||||
shatteredWormholeInfo: shatteredWormholeInfo,
|
||||
|
||||
ajaxConstellationInfoUrl: Init.path.getConstellationData,
|
||||
|
||||
systemConstellationLinkClass: config.constellationLinkClass,
|
||||
systemRegionLinkClass: config.regionLinkClass,
|
||||
systemTypeLinkClass: config.typeLinkClass
|
||||
|
||||
};
|
||||
|
||||
Render.showModule(moduleConfig, moduleData);
|
||||
};
|
||||
|
||||
/**
|
||||
* show system info module with animation
|
||||
* @param moduleElement
|
||||
*/
|
||||
let showModule = function(moduleElement){
|
||||
moduleElement.velocity('transition.slideDownIn', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
delay: Init.animationSpeed.mapModule,
|
||||
complete: function(){
|
||||
// set module observer
|
||||
setModuleObserver(moduleElement);
|
||||
|
||||
// enable auto update
|
||||
disableModuleUpdate = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* update system info module
|
||||
* @param mapId
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.drawSystemInfoModule = function(mapId, systemData){
|
||||
|
||||
let parentElement = $(this);
|
||||
|
||||
// check if module already exists
|
||||
let moduleElement = parentElement.find('.' + config.systemInfoModuleClass);
|
||||
|
||||
if(moduleElement.length > 0){
|
||||
moduleElement.velocity('transition.slideDownOut', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
complete: function(tempElement){
|
||||
$(tempElement).remove();
|
||||
|
||||
drawModule(parentElement, mapId, systemData);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
drawModule(parentElement, mapId, systemData);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
494
public/js/v1.2.5/app/ui/system_killboard.js
Normal file
494
public/js/v1.2.5/app/ui/system_killboard.js
Normal file
@@ -0,0 +1,494 @@
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'morris'
|
||||
], function($, Init, Util, Morris) {
|
||||
'use strict';
|
||||
|
||||
let config = {
|
||||
// module info
|
||||
moduleClass: 'pf-module', // class for each module
|
||||
|
||||
// headline toolbar
|
||||
systemModuleHeadlineIcon: 'pf-module-icon-button', // class for toolbar icons in the head
|
||||
|
||||
// system killboard module
|
||||
systemKillboardModuleClass: 'pf-system-killboard-module', // module wrapper
|
||||
systemKillboardGraphKillsClass: 'pf-system-killboard-graph-kills', // class for system kill graph
|
||||
|
||||
// system killboard list
|
||||
systemKillboardListClass: 'pf-system-killboard-list', // class for a list with kill entries
|
||||
systemKillboardListEntryClass: 'pf-system-killboard-list-entry', // class for a list entry
|
||||
systemKillboardListImgShip: 'pf-system-killboard-img-ship', // class for all ship images
|
||||
systemKillboardListImgAlly: 'pf-system-killboard-img-ally', // class for all alliance logos
|
||||
systemKillboardListImgCorp: 'pf-system-killboard-img-corp' // class for all corp logos
|
||||
};
|
||||
|
||||
let cache = {
|
||||
systemKillsGraphData: {} // data for system kills info graph
|
||||
};
|
||||
|
||||
/**
|
||||
* get label element with given content
|
||||
* @param text
|
||||
* @returns {*|XMLList}
|
||||
*/
|
||||
let getLabel = function(text, options){
|
||||
let label = $('<span>', {
|
||||
class: ['label', options.type, options.align].join(' ')
|
||||
}).text( text );
|
||||
|
||||
return label;
|
||||
};
|
||||
|
||||
|
||||
let showKillmails = function(moduleElement, killboardData){
|
||||
|
||||
// show number of killMails
|
||||
let killMailCounterMax = 20;
|
||||
let killMailCounter = 0;
|
||||
|
||||
// change order (show right to left)
|
||||
killboardData.tableData.reverse();
|
||||
|
||||
for(let i = 0; i < killboardData.tableData.length; i++){
|
||||
|
||||
// check if killMails exist in this hour
|
||||
if(killboardData.tableData[i].killmails){
|
||||
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
|
||||
moduleElement.append( $('<h5>').text(i + 'h ago'));
|
||||
|
||||
let killMailData = killboardData.tableData[i].killmails;
|
||||
|
||||
let listeElement = $('<ul>', {
|
||||
class: ['media-list', config.systemKillboardListClass].join(' ')
|
||||
});
|
||||
|
||||
for(let j = 0; j < killMailData.length; j++){
|
||||
killMailCounter++;
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
|
||||
let killData = killMailData[j];
|
||||
|
||||
let linkUrl = '//zkillboard.com/kill/' + killData.killID + '/';
|
||||
let victimImageUrl = Init.url.ccpImageServer + 'Type/' + killData.victim.shipTypeID + '_64.png';
|
||||
let killDate = getDateObjectByTimeString(killData.killTime);
|
||||
let killDateString = Util.convertDateToString(killDate);
|
||||
let killLossValue = Util.formatPrice( killData.zkb.totalValue );
|
||||
|
||||
// check for ally
|
||||
let victimAllyLogoUrl = '';
|
||||
let displayAlly = 'none';
|
||||
if(killData.victim.allianceID > 0){
|
||||
victimAllyLogoUrl = Init.url.ccpImageServer + 'Alliance/' + killData.victim.allianceID + '_32.png';
|
||||
displayAlly = 'block';
|
||||
}
|
||||
|
||||
// check for corp
|
||||
let victimCorpLogoUrl = '';
|
||||
let displayCorp = 'none';
|
||||
if(killData.victim.corporationID > 0){
|
||||
victimCorpLogoUrl = Init.url.ccpImageServer + 'Corporation/' + killData.victim.corporationID + '_32.png';
|
||||
displayCorp = 'inline';
|
||||
}
|
||||
|
||||
let liElement = $('<li>', {
|
||||
class: ['media', config.systemKillboardListEntryClass].join(' ')
|
||||
}).append(
|
||||
$('<a>', {
|
||||
href: linkUrl,
|
||||
target: '_blank'
|
||||
}).append(
|
||||
$('<img>', {
|
||||
src: victimImageUrl,
|
||||
class: ['media-object', 'pull-left', config.systemKillboardListImgShip].join(' ')
|
||||
})
|
||||
).append(
|
||||
$('<img>', {
|
||||
src: victimAllyLogoUrl,
|
||||
title: killData.victim.allianceName,
|
||||
class: ['pull-right', config.systemKillboardListImgAlly].join(' '),
|
||||
css: {display: displayAlly}
|
||||
}).attr('data-placement', 'left')
|
||||
).append(
|
||||
$('<div>', {
|
||||
class: 'media-body'
|
||||
}).append(
|
||||
$('<h5>', {
|
||||
class: 'media-heading',
|
||||
text: killData.victim.characterName
|
||||
}).prepend(
|
||||
$('<small>', {
|
||||
text: killDateString + ' - '
|
||||
})
|
||||
).prepend(
|
||||
$('<img>', {
|
||||
src: victimCorpLogoUrl,
|
||||
title: killData.victim.corporationName,
|
||||
class: [config.systemKillboardListImgCorp].join(' '),
|
||||
css: {display: displayCorp}
|
||||
})
|
||||
)
|
||||
).append(
|
||||
$('<h3>', {
|
||||
class: ['media-heading'].join(' ')
|
||||
}).append(
|
||||
$('<small>', {
|
||||
class: ['txt-color', 'txt-color-green', 'pull-right'].join(' '),
|
||||
text: killLossValue
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
listeElement.append(liElement);
|
||||
|
||||
}
|
||||
|
||||
moduleElement.append(listeElement);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// animate kill li-elements
|
||||
$('.' + config.systemKillboardListEntryClass).velocity('transition.expandIn', {
|
||||
stagger: 50,
|
||||
complete: function(){
|
||||
// init tooltips
|
||||
moduleElement.find('[title]').tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* updates the system info graph
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.updateSystemInfoGraphs = function(systemData){
|
||||
|
||||
let moduleElement = $(this);
|
||||
|
||||
|
||||
// headline toolbar icons
|
||||
let headlineToolbar = $('<h5>', {
|
||||
class: 'pull-right'
|
||||
}).append(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-external-link ', config.systemModuleHeadlineIcon].join(' '),
|
||||
title: 'zkillboard.com'
|
||||
}).on('click', function(e){
|
||||
window.open(
|
||||
'//zkillboard.com/system/' + systemData.systemId,
|
||||
'_blank'
|
||||
);
|
||||
}).attr('data-toggle', 'tooltip')
|
||||
);
|
||||
|
||||
moduleElement.append(headlineToolbar);
|
||||
|
||||
// headline
|
||||
let headline = $('<h5>', {
|
||||
text: 'Killboard'
|
||||
});
|
||||
|
||||
moduleElement.append(headline);
|
||||
|
||||
let killboardGraphElement = $('<div>', {
|
||||
class: config.systemKillboardGraphKillsClass
|
||||
});
|
||||
|
||||
moduleElement.append(killboardGraphElement);
|
||||
|
||||
let showHours = 24;
|
||||
let maxKillmailCount = 200; // limited by API
|
||||
|
||||
let labelOptions = {
|
||||
align: 'center-block'
|
||||
};
|
||||
let label = '';
|
||||
|
||||
// private function draws a "system kills" graph
|
||||
let drawGraph = function(data){
|
||||
|
||||
let tableData = data.tableData;
|
||||
|
||||
// change order (show right to left)
|
||||
tableData.reverse();
|
||||
|
||||
|
||||
|
||||
if(data.count === 0){
|
||||
labelOptions.type = 'label-success';
|
||||
label = getLabel( 'No kills found within the last 24h', labelOptions );
|
||||
killboardGraphElement.append( label );
|
||||
|
||||
minifyKillboardGraphElement(killboardGraphElement);
|
||||
return;
|
||||
}
|
||||
|
||||
let labelYFormat = function(y){
|
||||
return Math.round(y);
|
||||
};
|
||||
|
||||
// draw chart
|
||||
Morris.Bar({
|
||||
element: killboardGraphElement,
|
||||
resize: true,
|
||||
grid: true,
|
||||
gridStrokeWidth: 0.3,
|
||||
gridTextSize: 9,
|
||||
gridTextColor: '#63676a',
|
||||
gridTextFamily: 'Oxygen Bold',
|
||||
hideHover: true,
|
||||
data: tableData,
|
||||
xkey: 'label',
|
||||
ykeys: ['kills'],
|
||||
labels: ['Kills'],
|
||||
yLabelFormat: labelYFormat,
|
||||
xLabelMargin: 10,
|
||||
padding: 10,
|
||||
parseTime: false,
|
||||
barOpacity: 0.8,
|
||||
barRadius: [2, 2, 0, 0],
|
||||
barSizeRatio: 0.5,
|
||||
barGap: 3,
|
||||
barColors: function (row, series, type) {
|
||||
if (type === 'bar') {
|
||||
// highlight last row -> recent kills found
|
||||
if(this.xmax === row.x){
|
||||
return '#c2760c';
|
||||
}
|
||||
}
|
||||
|
||||
return '#375959';
|
||||
}
|
||||
});
|
||||
|
||||
// show hint for recent kills
|
||||
if(tableData[tableData.length - 1].kills > 0){
|
||||
labelOptions.type = 'label-warning';
|
||||
label = getLabel( tableData[tableData.length - 1].kills + ' kills within the last hour', labelOptions );
|
||||
killboardGraphElement.prepend( label );
|
||||
}
|
||||
};
|
||||
|
||||
// get recent KB stats (last 24h))
|
||||
let localDate = new Date();
|
||||
|
||||
// cache result for 5min
|
||||
let cacheKey = systemData.systemId + '_' + localDate.getHours() + '_' + ( Math.ceil( localDate.getMinutes() / 5 ) * 5);
|
||||
|
||||
if(cache.systemKillsGraphData.hasOwnProperty(cacheKey) ){
|
||||
// cached results
|
||||
|
||||
drawGraph( cache.systemKillsGraphData[cacheKey] );
|
||||
|
||||
// show killmail information
|
||||
showKillmails(moduleElement, cache.systemKillsGraphData[cacheKey]);
|
||||
}else{
|
||||
|
||||
// chart data
|
||||
let chartData = [];
|
||||
|
||||
for(let i = 0; i < showHours; i++){
|
||||
let tempData = {
|
||||
label: i + 'h',
|
||||
kills: 0
|
||||
};
|
||||
|
||||
chartData.push(tempData);
|
||||
}
|
||||
|
||||
// get kills within the last 24h
|
||||
let timeFrameInSeconds = 60 * 60 * 24;
|
||||
|
||||
// get current server time
|
||||
let serverDate= Util.getServerTime();
|
||||
|
||||
// if system is w-space system -> add link modifier
|
||||
let wSpaceLinkModifier = '';
|
||||
if(systemData.type.id === 1){
|
||||
wSpaceLinkModifier = 'w-space/';
|
||||
}
|
||||
|
||||
let url = Init.url.zKillboard;
|
||||
url += 'no-items/' + wSpaceLinkModifier + 'no-attackers/solarSystemID/' + systemData.systemId + '/pastSeconds/' + timeFrameInSeconds + '/';
|
||||
|
||||
killboardGraphElement.showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'GET',
|
||||
dataType: 'json'
|
||||
}).done(function(kbData) {
|
||||
|
||||
// the API wont return more than 200KMs ! - remember last bar block with complete KM information
|
||||
let lastCompleteDiffHourData = 0;
|
||||
|
||||
|
||||
// loop kills and count kills by hour
|
||||
for (let i = 0; i < kbData.length; i++) {
|
||||
let killmailData = kbData[i];
|
||||
|
||||
let killDate = getDateObjectByTimeString(killmailData.killTime);
|
||||
|
||||
// get time diff
|
||||
let timeDiffMin = Math.round(( serverDate - killDate ) / 1000 / 60);
|
||||
let timeDiffHour = Math.round(timeDiffMin / 60);
|
||||
|
||||
// update chart data
|
||||
if (chartData[timeDiffHour]) {
|
||||
chartData[timeDiffHour].kills++;
|
||||
|
||||
// add kill mail data
|
||||
if (chartData[timeDiffHour].killmails === undefined) {
|
||||
chartData[timeDiffHour].killmails = [];
|
||||
}
|
||||
chartData[timeDiffHour].killmails.push(killmailData);
|
||||
|
||||
if (timeDiffHour > lastCompleteDiffHourData) {
|
||||
lastCompleteDiffHourData = timeDiffHour;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// remove empty chart Data
|
||||
if (kbData.length >= maxKillmailCount) {
|
||||
chartData = chartData.splice(0, lastCompleteDiffHourData + 1);
|
||||
}
|
||||
|
||||
// fill cache
|
||||
cache.systemKillsGraphData[cacheKey] = {};
|
||||
cache.systemKillsGraphData[cacheKey].tableData = chartData;
|
||||
cache.systemKillsGraphData[cacheKey].count = kbData.length;
|
||||
|
||||
// draw table
|
||||
drawGraph(cache.systemKillsGraphData[cacheKey]);
|
||||
|
||||
// show killmail information
|
||||
showKillmails(moduleElement, cache.systemKillsGraphData[cacheKey]);
|
||||
|
||||
killboardGraphElement.hideLoadingAnimation();
|
||||
}).fail(function(e){
|
||||
|
||||
labelOptions.type = 'label-danger';
|
||||
label = getLabel( 'zKillboard is not responding', labelOptions );
|
||||
killboardGraphElement.prepend( label );
|
||||
|
||||
killboardGraphElement.hideLoadingAnimation();
|
||||
|
||||
minifyKillboardGraphElement(killboardGraphElement);
|
||||
|
||||
Util.showNotify({title: e.status + ': Get system kills', text: 'Loading failed', type: 'error'});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// init tooltips
|
||||
let tooltipElements = moduleElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* minify the killboard graph element e.g. if no kills where found, or on error
|
||||
* @param killboardGraphElement
|
||||
*/
|
||||
let minifyKillboardGraphElement = function(killboardGraphElement){
|
||||
killboardGraphElement.velocity({
|
||||
height: '20px',
|
||||
marginBottom: '0px'
|
||||
},{
|
||||
duration: Init.animationSpeed.mapModule
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* transform timestring
|
||||
* @param timeString
|
||||
* @returns {Date}
|
||||
*/
|
||||
let getDateObjectByTimeString = function(timeString){
|
||||
let match = timeString.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);
|
||||
let date = new Date(match[1], match[2] - 1, match[3], match[4], match[5], match[6]);
|
||||
|
||||
return date;
|
||||
};
|
||||
|
||||
/**
|
||||
* get module element
|
||||
* @param systemData
|
||||
* @returns {*|HTMLElement}
|
||||
*/
|
||||
let getModule = function(parentElement, systemData){
|
||||
|
||||
// create new module container
|
||||
let moduleElement = $('<div>', {
|
||||
class: [config.moduleClass, config.systemKillboardModuleClass].join(' '),
|
||||
css: {opacity: 0}
|
||||
});
|
||||
|
||||
parentElement.append(moduleElement);
|
||||
|
||||
// update graph
|
||||
moduleElement.updateSystemInfoGraphs(systemData);
|
||||
|
||||
return moduleElement;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* main module load function
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.drawSystemKillboardModule = function(systemData){
|
||||
|
||||
let parentElement = $(this);
|
||||
|
||||
// show route module
|
||||
let showModule = function(moduleElement){
|
||||
if(moduleElement){
|
||||
moduleElement.velocity('transition.slideDownIn', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
delay: Init.animationSpeed.mapModule
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// check if module already exists
|
||||
let moduleElement = parentElement.find('.' + config.systemKillboardModuleClass);
|
||||
|
||||
if(moduleElement.length > 0){
|
||||
moduleElement.velocity('transition.slideDownOut', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
complete: function(tempElement){
|
||||
$(tempElement).remove();
|
||||
|
||||
moduleElement = getModule(parentElement, systemData);
|
||||
showModule(moduleElement);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
moduleElement = getModule(parentElement, systemData);
|
||||
showModule(moduleElement);
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
1109
public/js/v1.2.5/app/ui/system_route.js
Normal file
1109
public/js/v1.2.5/app/ui/system_route.js
Normal file
File diff suppressed because it is too large
Load Diff
2461
public/js/v1.2.5/app/ui/system_signature.js
Normal file
2461
public/js/v1.2.5/app/ui/system_signature.js
Normal file
File diff suppressed because it is too large
Load Diff
2209
public/js/v1.2.5/app/util.js
Normal file
2209
public/js/v1.2.5/app/util.js
Normal file
File diff suppressed because it is too large
Load Diff
162
public/js/v1.2.5/app/worker/map.js
Normal file
162
public/js/v1.2.5/app/worker/map.js
Normal file
@@ -0,0 +1,162 @@
|
||||
'use strict';
|
||||
|
||||
// "fake" window object will contain "MsgWorker" after import
|
||||
let window = {}; // jshint ignore:line
|
||||
|
||||
// import "MsgWorker" class
|
||||
self.importScripts( self.name ); // jshint ignore:line
|
||||
|
||||
let MsgWorker = window.MsgWorker;
|
||||
let socket = null;
|
||||
let ports = [];
|
||||
let characterPorts = [];
|
||||
|
||||
// init "WebSocket" connection ========================================================================================
|
||||
let initSocket = (uri) => {
|
||||
let MsgWorkerOpen = new MsgWorker('ws:open');
|
||||
|
||||
if(socket === null){
|
||||
socket = new WebSocket(uri);
|
||||
|
||||
// "WebSocket" open -----------------------------------------------------------------------
|
||||
socket.onopen = (e) => {
|
||||
MsgWorkerOpen.meta({
|
||||
readyState: socket.readyState
|
||||
});
|
||||
|
||||
sendToCurrentPort(MsgWorkerOpen);
|
||||
};
|
||||
|
||||
// "WebSocket message ---------------------------------------------------------------------
|
||||
socket.onmessage = (e) => {
|
||||
let response = JSON.parse(e.data);
|
||||
|
||||
let MsgWorkerSend = new MsgWorker('ws:send');
|
||||
MsgWorkerSend.task( response.task );
|
||||
MsgWorkerSend.meta({
|
||||
readyState: this.readyState,
|
||||
characterIds: response.characterIds
|
||||
});
|
||||
MsgWorkerSend.data( response.load );
|
||||
|
||||
broadcastPorts(MsgWorkerSend);
|
||||
};
|
||||
|
||||
// "WebSocket" close ----------------------------------------------------------------------
|
||||
socket.onclose = (closeEvent) => {
|
||||
let MsgWorkerClosed = new MsgWorker('ws:closed');
|
||||
MsgWorkerClosed.meta({
|
||||
readyState: socket.readyState,
|
||||
code: closeEvent.code,
|
||||
reason: closeEvent.reason,
|
||||
wasClean: closeEvent.wasClean
|
||||
});
|
||||
|
||||
broadcastPorts(MsgWorkerClosed);
|
||||
socket = null; // reset WebSocket
|
||||
};
|
||||
|
||||
// "WebSocket" error ----------------------------------------------------------------------
|
||||
socket.onerror = (e) => {
|
||||
let MsgWorkerError = new MsgWorker('ws:error');
|
||||
MsgWorkerError.meta({
|
||||
readyState: socket.readyState
|
||||
});
|
||||
|
||||
sendToCurrentPort(MsgWorkerError);
|
||||
};
|
||||
}else{
|
||||
// socket still open
|
||||
MsgWorkerOpen.meta({
|
||||
readyState: socket.readyState
|
||||
});
|
||||
sendToCurrentPort(MsgWorkerOpen);
|
||||
}
|
||||
};
|
||||
|
||||
// send message to port(s) ============================================================================================
|
||||
let sendToCurrentPort = (load) => {
|
||||
ports[ports.length - 1].postMessage(load);
|
||||
};
|
||||
|
||||
let broadcastPorts = (load) => {
|
||||
// default: sent to all ports
|
||||
let sentToPorts = ports;
|
||||
|
||||
// check if send() is limited to some ports
|
||||
let meta = load.meta();
|
||||
if(
|
||||
meta &&
|
||||
meta.characterIds &&
|
||||
meta.characterIds !== 'undefined' &&
|
||||
meta.characterIds instanceof Array
|
||||
){
|
||||
// ... get ports for characterIds
|
||||
sentToPorts = getPortsByCharacterIds(meta.characterIds);
|
||||
}
|
||||
|
||||
for (let i = 0; i < sentToPorts.length; i++) {
|
||||
sentToPorts[i].postMessage(load);
|
||||
}
|
||||
};
|
||||
|
||||
// port functions =====================================================================================================
|
||||
let addPort = (port, characterId) => {
|
||||
characterId = parseInt(characterId);
|
||||
|
||||
if(characterId > 0){
|
||||
characterPorts.push({
|
||||
characterId: characterId,
|
||||
port: port
|
||||
});
|
||||
}else{
|
||||
ports.push(port);
|
||||
}
|
||||
};
|
||||
|
||||
let getPortsByCharacterIds = (characterIds) => {
|
||||
let ports = [];
|
||||
|
||||
for(let i = 0; i < characterPorts.length; i++){
|
||||
for(let j = 0; j < characterIds.length; j++){
|
||||
if(characterPorts[i].characterId === characterIds[j]){
|
||||
ports.push(characterPorts[i].port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ports;
|
||||
};
|
||||
|
||||
// "SharedWorker" connection ==========================================================================================
|
||||
self.addEventListener('connect', (event) => { // jshint ignore:line
|
||||
let port = event.ports[0];
|
||||
addPort(port);
|
||||
|
||||
port.addEventListener('message', (e) => {
|
||||
let MsgWorkerMessage = e.data;
|
||||
Object.setPrototypeOf(MsgWorkerMessage, MsgWorker.prototype);
|
||||
|
||||
switch(MsgWorkerMessage.command){
|
||||
case 'ws:init':
|
||||
let data = MsgWorkerMessage.data();
|
||||
// add character specific port (for broadcast) to individual ports (tabs)
|
||||
addPort(port, data.characterId);
|
||||
initSocket(data.uri);
|
||||
break;
|
||||
case 'ws:send':
|
||||
let MsgSocket = {
|
||||
task: MsgWorkerMessage.task(),
|
||||
load: MsgWorkerMessage.data()
|
||||
};
|
||||
|
||||
socket.send(JSON.stringify(MsgSocket));
|
||||
break;
|
||||
case 'ws:close':
|
||||
// closeSocket();
|
||||
break;
|
||||
}
|
||||
}, false);
|
||||
|
||||
port.start();
|
||||
}, false);
|
||||
55
public/js/v1.2.5/app/worker/message.js
Normal file
55
public/js/v1.2.5/app/worker/message.js
Normal file
@@ -0,0 +1,55 @@
|
||||
window.MsgWorker = class MessageWorker {
|
||||
|
||||
constructor(cmd){
|
||||
/**
|
||||
* "command" type (identifies this message)
|
||||
*/
|
||||
this.cmd = cmd;
|
||||
|
||||
/**
|
||||
* "task" what should be done with this message
|
||||
* @type {string}
|
||||
*/
|
||||
this.msgTask = '';
|
||||
|
||||
/**
|
||||
* "message" meta data (e.g. error/close data from WebSocket
|
||||
* @type {null}
|
||||
*/
|
||||
this.msgMeta = null;
|
||||
|
||||
/**
|
||||
* "message" body (load)
|
||||
* @type {null}
|
||||
*/
|
||||
this.msgBody = null;
|
||||
}
|
||||
|
||||
get command(){
|
||||
return this.cmd;
|
||||
}
|
||||
|
||||
task(task) {
|
||||
if(task){
|
||||
this.msgTask = task;
|
||||
}
|
||||
|
||||
return this.msgTask;
|
||||
}
|
||||
|
||||
meta(metaData) {
|
||||
if(metaData){
|
||||
this.msgMeta = metaData;
|
||||
}
|
||||
|
||||
return this.msgMeta;
|
||||
}
|
||||
|
||||
data(data) {
|
||||
if(data){
|
||||
this.msgBody = data;
|
||||
}
|
||||
|
||||
return this.msgBody;
|
||||
}
|
||||
};
|
||||
12
public/js/v1.2.5/lib/EasePack.min.js
vendored
Normal file
12
public/js/v1.2.5/lib/EasePack.min.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/*!
|
||||
* VERSION: beta 1.9.4
|
||||
* DATE: 2014-07-17
|
||||
* UPDATES AND DOCS AT: http://www.greensock.com
|
||||
*
|
||||
* @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
|
||||
* This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
|
||||
* Club GreenSock members, the software agreement that was issued with your membership.
|
||||
*
|
||||
* @author: Jack Doyle, jack@greensock.com
|
||||
**/
|
||||
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.Back",["easing.Ease"],function(t){var e,i,s,r=_gsScope.GreenSockGlobals||_gsScope,n=r.com.greensock,a=2*Math.PI,o=Math.PI/2,h=n._class,l=function(e,i){var s=h("easing."+e,function(){},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,s},_=t.register||function(){},u=function(t,e,i,s){var r=h("easing."+t,{easeOut:new e,easeIn:new i,easeInOut:new s},!0);return _(r,t),r},c=function(t,e,i){this.t=t,this.v=e,i&&(this.next=i,i.prev=this,this.c=i.v-e,this.gap=i.t-t)},p=function(e,i){var s=h("easing."+e,function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,r.config=function(t){return new s(t)},s},f=u("Back",p("BackOut",function(t){return(t-=1)*t*((this._p1+1)*t+this._p1)+1}),p("BackIn",function(t){return t*t*((this._p1+1)*t-this._p1)}),p("BackInOut",function(t){return 1>(t*=2)?.5*t*t*((this._p2+1)*t-this._p2):.5*((t-=2)*t*((this._p2+1)*t+this._p2)+2)})),m=h("easing.SlowMo",function(t,e,i){e=e||0===e?e:.7,null==t?t=.7:t>1&&(t=1),this._p=1!==t?e:0,this._p1=(1-t)/2,this._p2=t,this._p3=this._p1+this._p2,this._calcEnd=i===!0},!0),d=m.prototype=new t;return d.constructor=m,d.getRatio=function(t){var e=t+(.5-t)*this._p;return this._p1>t?this._calcEnd?1-(t=1-t/this._p1)*t:e-(t=1-t/this._p1)*t*t*t*e:t>this._p3?this._calcEnd?1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},m.ease=new m(.7,.7),d.config=m.config=function(t,e,i){return new m(t,e,i)},e=h("easing.SteppedEase",function(t){t=t||1,this._p1=1/t,this._p2=t+1},!0),d=e.prototype=new t,d.constructor=e,d.getRatio=function(t){return 0>t?t=0:t>=1&&(t=.999999999),(this._p2*t>>0)*this._p1},d.config=e.config=function(t){return new e(t)},i=h("easing.RoughEase",function(e){e=e||{};for(var i,s,r,n,a,o,h=e.taper||"none",l=[],_=0,u=0|(e.points||20),p=u,f=e.randomize!==!1,m=e.clamp===!0,d=e.template instanceof t?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;--p>-1;)i=f?Math.random():1/u*p,s=d?d.getRatio(i):i,"none"===h?r=g:"out"===h?(n=1-i,r=n*n*g):"in"===h?r=i*i*g:.5>i?(n=2*i,r=.5*n*n*g):(n=2*(1-i),r=.5*n*n*g),f?s+=Math.random()*r-.5*r:p%2?s+=.5*r:s-=.5*r,m&&(s>1?s=1:0>s&&(s=0)),l[_++]={x:i,y:s};for(l.sort(function(t,e){return t.x-e.x}),o=new c(1,1,null),p=u;--p>-1;)a=l[p],o=new c(a.x,a.y,o);this._prev=new c(0,0,0!==o.t?o:o.next)},!0),d=i.prototype=new t,d.constructor=i,d.getRatio=function(t){var e=this._prev;if(t>e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&e.t>=t;)e=e.prev;return this._prev=e,e.v+(t-e.t)/e.gap*e.c},d.config=function(t){return new i(t)},i.ease=new i,u("Bounce",l("BounceOut",function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}),l("BounceIn",function(t){return 1/2.75>(t=1-t)?1-7.5625*t*t:2/2.75>t?1-(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}),l("BounceInOut",function(t){var e=.5>t;return t=e?1-2*t:2*t-1,t=1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5})),u("Circ",l("CircOut",function(t){return Math.sqrt(1-(t-=1)*t)}),l("CircIn",function(t){return-(Math.sqrt(1-t*t)-1)}),l("CircInOut",function(t){return 1>(t*=2)?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)})),s=function(e,i,s){var r=h("easing."+e,function(t,e){this._p1=t||1,this._p2=e||s,this._p3=this._p2/a*(Math.asin(1/this._p1)||0)},!0),n=r.prototype=new t;return n.constructor=r,n.getRatio=i,n.config=function(t,e){return new r(t,e)},r},u("Elastic",s("ElasticOut",function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*a/this._p2)+1},.3),s("ElasticIn",function(t){return-(this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2))},.3),s("ElasticInOut",function(t){return 1>(t*=2)?-.5*this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2):.5*this._p1*Math.pow(2,-10*(t-=1))*Math.sin((t-this._p3)*a/this._p2)+1},.45)),u("Expo",l("ExpoOut",function(t){return 1-Math.pow(2,-10*t)}),l("ExpoIn",function(t){return Math.pow(2,10*(t-1))-.001}),l("ExpoInOut",function(t){return 1>(t*=2)?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))})),u("Sine",l("SineOut",function(t){return Math.sin(t*o)}),l("SineIn",function(t){return-Math.cos(t*o)+1}),l("SineInOut",function(t){return-.5*(Math.cos(Math.PI*t)-1)})),h("easing.EaseLookup",{find:function(e){return t.map[e]}},!0),_(r.SlowMo,"SlowMo","ease,"),_(i,"RoughEase","ease,"),_(e,"SteppedEase","ease,"),f},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();
|
||||
12
public/js/v1.2.5/lib/TweenLite.min.js
vendored
Normal file
12
public/js/v1.2.5/lib/TweenLite.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1377
public/js/v1.2.5/lib/blueimp-gallery.js
Normal file
1377
public/js/v1.2.5/lib/blueimp-gallery.js
Normal file
File diff suppressed because it is too large
Load Diff
190
public/js/v1.2.5/lib/blueimp-helper.js
Normal file
190
public/js/v1.2.5/lib/blueimp-helper.js
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* blueimp helper JS
|
||||
* https://github.com/blueimp/Gallery
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/* global define, window, document */
|
||||
|
||||
;(function () {
|
||||
'use strict'
|
||||
|
||||
function extend (obj1, obj2) {
|
||||
var prop
|
||||
for (prop in obj2) {
|
||||
if (obj2.hasOwnProperty(prop)) {
|
||||
obj1[prop] = obj2[prop]
|
||||
}
|
||||
}
|
||||
return obj1
|
||||
}
|
||||
|
||||
function Helper (query) {
|
||||
if (!this || this.find !== Helper.prototype.find) {
|
||||
// Called as function instead of as constructor,
|
||||
// so we simply return a new instance:
|
||||
return new Helper(query)
|
||||
}
|
||||
this.length = 0
|
||||
if (query) {
|
||||
if (typeof query === 'string') {
|
||||
query = this.find(query)
|
||||
}
|
||||
if (query.nodeType || query === query.window) {
|
||||
// Single HTML element
|
||||
this.length = 1
|
||||
this[0] = query
|
||||
} else {
|
||||
// HTML element collection
|
||||
var i = query.length
|
||||
this.length = i
|
||||
while (i) {
|
||||
i -= 1
|
||||
this[i] = query[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Helper.extend = extend
|
||||
|
||||
Helper.contains = function (container, element) {
|
||||
do {
|
||||
element = element.parentNode
|
||||
if (element === container) {
|
||||
return true
|
||||
}
|
||||
} while (element)
|
||||
return false
|
||||
}
|
||||
|
||||
Helper.parseJSON = function (string) {
|
||||
return window.JSON && JSON.parse(string)
|
||||
}
|
||||
|
||||
extend(Helper.prototype, {
|
||||
find: function (query) {
|
||||
var container = this[0] || document
|
||||
if (typeof query === 'string') {
|
||||
if (container.querySelectorAll) {
|
||||
query = container.querySelectorAll(query)
|
||||
} else if (query.charAt(0) === '#') {
|
||||
query = container.getElementById(query.slice(1))
|
||||
} else {
|
||||
query = container.getElementsByTagName(query)
|
||||
}
|
||||
}
|
||||
return new Helper(query)
|
||||
},
|
||||
|
||||
hasClass: function (className) {
|
||||
if (!this[0]) {
|
||||
return false
|
||||
}
|
||||
return new RegExp('(^|\\s+)' + className +
|
||||
'(\\s+|$)').test(this[0].className)
|
||||
},
|
||||
|
||||
addClass: function (className) {
|
||||
var i = this.length
|
||||
var element
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
if (!element.className) {
|
||||
element.className = className
|
||||
return this
|
||||
}
|
||||
if (this.hasClass(className)) {
|
||||
return this
|
||||
}
|
||||
element.className += ' ' + className
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
removeClass: function (className) {
|
||||
var regexp = new RegExp('(^|\\s+)' + className + '(\\s+|$)')
|
||||
var i = this.length
|
||||
var element
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
element.className = element.className.replace(regexp, ' ')
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
on: function (eventName, handler) {
|
||||
var eventNames = eventName.split(/\s+/)
|
||||
var i
|
||||
var element
|
||||
while (eventNames.length) {
|
||||
eventName = eventNames.shift()
|
||||
i = this.length
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
if (element.addEventListener) {
|
||||
element.addEventListener(eventName, handler, false)
|
||||
} else if (element.attachEvent) {
|
||||
element.attachEvent('on' + eventName, handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
off: function (eventName, handler) {
|
||||
var eventNames = eventName.split(/\s+/)
|
||||
var i
|
||||
var element
|
||||
while (eventNames.length) {
|
||||
eventName = eventNames.shift()
|
||||
i = this.length
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
if (element.removeEventListener) {
|
||||
element.removeEventListener(eventName, handler, false)
|
||||
} else if (element.detachEvent) {
|
||||
element.detachEvent('on' + eventName, handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
empty: function () {
|
||||
var i = this.length
|
||||
var element
|
||||
while (i) {
|
||||
i -= 1
|
||||
element = this[i]
|
||||
while (element.hasChildNodes()) {
|
||||
element.removeChild(element.lastChild)
|
||||
}
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
||||
first: function () {
|
||||
return new Helper(this[0])
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return Helper
|
||||
})
|
||||
} else {
|
||||
window.blueimp = window.blueimp || {}
|
||||
window.blueimp.helper = Helper
|
||||
}
|
||||
}())
|
||||
6
public/js/v1.2.5/lib/bootbox.min.js
vendored
Normal file
6
public/js/v1.2.5/lib/bootbox.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
263
public/js/v1.2.5/lib/bootstrap-confirmation.js
vendored
Normal file
263
public/js/v1.2.5/lib/bootstrap-confirmation.js
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
/*!
|
||||
* Bootstrap Confirmation v1.0.5
|
||||
* https://github.com/tavicu/bs-confirmation
|
||||
*/
|
||||
+function ($) {
|
||||
'use strict';
|
||||
|
||||
//var for check event at body can have only one.
|
||||
var event_body = false;
|
||||
|
||||
// CONFIRMATION PUBLIC CLASS DEFINITION
|
||||
// ===============================
|
||||
var Confirmation = function (element, options) {
|
||||
var that = this;
|
||||
|
||||
this.init('confirmation', element, options);
|
||||
|
||||
$(element).on('show.bs.confirmation', function(e) {
|
||||
that.options.onShow(e, this);
|
||||
|
||||
$(this).addClass('open');
|
||||
|
||||
var options = that.options;
|
||||
var all = options.all_selector;
|
||||
|
||||
if(options.singleton)
|
||||
{
|
||||
$(all).not(that.$element).each(function()
|
||||
{
|
||||
if( $(this).hasClass('open') )
|
||||
{
|
||||
$(this).confirmation('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(element).on('hide.bs.confirmation', function(e) {
|
||||
that.options.onHide(e, this);
|
||||
|
||||
$(this).removeClass('open');
|
||||
});
|
||||
|
||||
$(element).on('shown.bs.confirmation', function(e) {
|
||||
var options = that.options;
|
||||
var all = options.all_selector;
|
||||
|
||||
if(that.isPopout()) {
|
||||
if(!event_body) {
|
||||
event_body = $('body').on('click', function (e) {
|
||||
if(that.$element.is(e.target)) return;
|
||||
if(that.$element.has(e.target).length) return;
|
||||
if($('.popover').has(e.target).length) return;
|
||||
|
||||
that.hide();
|
||||
that.inState.click = false;
|
||||
|
||||
$('body').unbind(e);
|
||||
|
||||
event_body = false;
|
||||
|
||||
return;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(options.selector) {
|
||||
$(element).on('click.bs.confirmation', options.selector, function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
} else {
|
||||
$(element).on('click.bs.confirmation', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js');
|
||||
|
||||
Confirmation.VERSION = '1.0.5'
|
||||
|
||||
Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, {
|
||||
placement : 'right',
|
||||
title : 'Are you sure?',
|
||||
btnOkClass : 'btn btn-sm btn-danger',
|
||||
btnOkLabel : 'Delete',
|
||||
btnOkIcon : 'glyphicon glyphicon-ok',
|
||||
btnCancelClass : 'btn btn-sm btn-default',
|
||||
btnCancelLabel : 'Cancel',
|
||||
btnCancelIcon : 'glyphicon glyphicon-remove',
|
||||
href : '#',
|
||||
target : '_self',
|
||||
singleton : true,
|
||||
popout : true,
|
||||
onShow : function(event, element){},
|
||||
onHide : function(event, element){},
|
||||
onConfirm : function(event, element){},
|
||||
onCancel : function(event, element){},
|
||||
template : '<div class="popover"><div class="arrow"></div>'
|
||||
+ '<h3 class="popover-title"></h3>'
|
||||
+ '<div class="popover-content">'
|
||||
+ '<a data-apply="confirmation">Yes</a>'
|
||||
+ '<a data-dismiss="confirmation">No</a>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
});
|
||||
|
||||
|
||||
// NOTE: CONFIRMATION EXTENDS popover.js
|
||||
// ================================
|
||||
Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype);
|
||||
|
||||
Confirmation.prototype.constructor = Confirmation;
|
||||
|
||||
Confirmation.prototype.getDefaults = function () {
|
||||
return Confirmation.DEFAULTS;
|
||||
}
|
||||
|
||||
Confirmation.prototype.setContent = function () {
|
||||
var that = this;
|
||||
var $tip = this.tip();
|
||||
var title = this.getTitle();
|
||||
var $btnOk = $tip.find('[data-apply="confirmation"]');
|
||||
var $btnCancel = $tip.find('[data-dismiss="confirmation"]');
|
||||
var options = this.options
|
||||
|
||||
$btnOk.addClass(this.getBtnOkClass())
|
||||
.html(this.getBtnOkLabel())
|
||||
.prepend($('<i></i>').addClass(this.getBtnOkIcon()), " ")
|
||||
.attr('href', this.getHref())
|
||||
.attr('target', this.getTarget())
|
||||
.off('click').on('click', function(event) {
|
||||
options.onConfirm(event, that.$element);
|
||||
|
||||
// If the button is a submit one
|
||||
if (that.$element.attr('type') == 'submit')
|
||||
that.$element.closest('form:first').submit();
|
||||
|
||||
that.hide();
|
||||
that.inState.click = false;
|
||||
});
|
||||
|
||||
$btnCancel.addClass(this.getBtnCancelClass())
|
||||
.html(this.getBtnCancelLabel())
|
||||
.prepend($('<i></i>').addClass(this.getBtnCancelIcon()), " ")
|
||||
.off('click').on('click', function(event){
|
||||
options.onCancel(event, that.$element);
|
||||
|
||||
that.hide();
|
||||
that.inState.click = false;
|
||||
});
|
||||
|
||||
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
|
||||
|
||||
$tip.removeClass('fade top bottom left right in');
|
||||
|
||||
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
||||
// this manually by checking the contents.
|
||||
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
|
||||
}
|
||||
|
||||
Confirmation.prototype.getBtnOkClass = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call(this, $e[0]) : o.btnOkClass);
|
||||
}
|
||||
|
||||
Confirmation.prototype.getBtnOkLabel = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call(this, $e[0]) : o.btnOkLabel);
|
||||
}
|
||||
|
||||
Confirmation.prototype.getBtnOkIcon = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call(this, $e[0]) : o.btnOkIcon);
|
||||
}
|
||||
|
||||
Confirmation.prototype.getBtnCancelClass = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call(this, $e[0]) : o.btnCancelClass);
|
||||
}
|
||||
|
||||
Confirmation.prototype.getBtnCancelLabel = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call(this, $e[0]) : o.btnCancelLabel);
|
||||
}
|
||||
|
||||
Confirmation.prototype.getBtnCancelIcon = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call(this, $e[0]) : o.btnCancelIcon);
|
||||
}
|
||||
|
||||
Confirmation.prototype.getHref = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call(this, $e[0]) : o.href);
|
||||
}
|
||||
|
||||
Confirmation.prototype.getTarget = function () {
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call(this, $e[0]) : o.target);
|
||||
}
|
||||
|
||||
Confirmation.prototype.isPopout = function () {
|
||||
var popout;
|
||||
var $e = this.$element;
|
||||
var o = this.options;
|
||||
|
||||
popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call(this, $e[0]) : o.popout);
|
||||
|
||||
if(popout == 'false') popout = false;
|
||||
|
||||
return popout
|
||||
}
|
||||
|
||||
|
||||
// CONFIRMATION PLUGIN DEFINITION
|
||||
// =========================
|
||||
var old = $.fn.confirmation;
|
||||
|
||||
$.fn.confirmation = function (option) {
|
||||
var that = this;
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
var data = $this.data('bs.confirmation');
|
||||
var options = typeof option == 'object' && option;
|
||||
|
||||
options = options || {};
|
||||
options.all_selector = that.selector;
|
||||
|
||||
if (!data && option == 'destroy') return;
|
||||
if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options)));
|
||||
if (typeof option == 'string') data[option]();
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.confirmation.Constructor = Confirmation
|
||||
|
||||
|
||||
// CONFIRMATION NO CONFLICT
|
||||
// ===================
|
||||
$.fn.confirmation.noConflict = function () {
|
||||
$.fn.confirmation = old;
|
||||
|
||||
return this;
|
||||
}
|
||||
}(jQuery);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user