- v1.0.0 build
This commit is contained in:
@@ -211,7 +211,7 @@ class Setup extends Controller {
|
||||
|
||||
$environmentData[$var] = [
|
||||
'label' => $var,
|
||||
'value' => ((empty($value)) ? ' ' : $value),
|
||||
'value' => ((empty($value) && !is_int($value)) ? ' ' : $value),
|
||||
'check' => $check
|
||||
];
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ class Web extends \Web {
|
||||
$statusCode = $this->getStatusCodeFromHeaders( $result['headers'] );
|
||||
|
||||
switch($statusCode){
|
||||
case 100:
|
||||
case 200:
|
||||
// request succeeded -> check if response should be cached
|
||||
$ttl = $this->getCacheTimeFromHeaders( $result['headers'] );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[PATHFINDER]
|
||||
NAME = PATHFINDER
|
||||
; installed version (used for CSS/JS cache busting)
|
||||
VERSION = v1.0.0RC3
|
||||
VERSION = v1.0.0
|
||||
; contact information (DO NOT CHANGE)
|
||||
CONTACT = https://github.com/exodus4d
|
||||
; source code (DO NOT CHANGE)
|
||||
|
||||
2
public/js/v1.0.0/app.js
Normal file
2
public/js/v1.0.0/app.js
Normal file
@@ -0,0 +1,2 @@
|
||||
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",jquery:"lib/jquery-1.11.3.min",bootstrap:"lib/bootstrap.min",text:"lib/requirejs/text",mustache:"lib/mustache.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.concat.min",datatables:"lib/datatables/jquery.dataTables.min",datatablesResponsive:"lib/datatables/extensions/responsive/dataTables.responsive",datatablesTableTools:"lib/datatables/extensions/tabletools/js/dataTables.tableTools",xEditable:"lib/bootstrap-editable.min",morris:"lib/morris.min",raphael:"lib/raphael-min",bootbox:"lib/bootbox.min",easyPieChart:"lib/jquery.easypiechart.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",pnotify:"lib/pnotify/pnotify.core","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"]},datatables:{deps:["jquery"]},datatablesBootstrap:{deps:["datatables"]},datatablesResponsive:{deps:["datatables"]},datatablesTableTools:{deps:["datatables"]},xEditable:{deps:["bootstrap"]},bootbox:{deps:["jquery","bootstrap"],exports:"bootbox"},morris:{deps:["jquery","raphael"],exports:"Morris"},pnotify:{deps:["jquery"]},easyPieChart:{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
|
||||
1
public/js/v1.0.0/app.js.map
Normal file
1
public/js/v1.0.0/app.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["app.js.src.js"],"names":["mainScriptPath","document","body","getAttribute","jsBaseUrl","requirejs","config","baseUrl","paths","layout","dialog","templates","img","login","mappage","setup","jquery","bootstrap","text","mustache","velocity","velocityUI","slidebars","jsPlumb","farahey","customScrollbar","datatables","datatablesResponsive","datatablesTableTools","xEditable","morris","raphael","bootbox","easyPieChart","dragToSelect","hoverIntent","fullScreen","select2","validator","lazylinepainter","blueImpGallery","blueImpGalleryHelper","blueImpGalleryBootstrap","bootstrapConfirmation","bootstrapToggle","lazyload","easePack","tweenLite","pnotify","pnotify.buttons","pnotify.confirm","pnotify.nonblock","pnotify.desktop","pnotify.history","pnotify.callbacks","pnotify.reference","shim","deps","datatablesBootstrap","exports","require"],"mappings":"AACA,GAAIA,gBAAiBC,SAASC,KAAKC,aAAa,eAI5CC,UAAYH,SAASC,KAAKC,aAAa,eAG3CE,WAAUC,QACNC,QAAS,KAETC,OACIC,OAAQ,SACRH,OAAQ,aACRI,OAAQ,gBACRC,UAAW,kBACXC,IAAK,YAGLC,MAAO,cACPC,QAAS,gBACTC,MAAO,cAEPC,OAAQ,wBACRC,UAAW,oBACXC,KAAM,qBACNC,SAAU,mBACVC,SAAU,mBACVC,WAAY,sBACZC,UAAW,gBACXC,QAAS,wBACTC,QAAS,kBACTC,gBAAiB,yCACjBC,WAAY,uCAEZC,qBAAsB,6DAEtBC,qBAAsB,gEACtBC,UAAW,6BACXC,OAAQ,iBACRC,QAAS,kBACTC,QAAS,kBACTC,aAAc,8BACdC,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,QAAS,2BACTC,kBAAmB,8BACnBC,kBAAmB,8BACnBC,mBAAoB,+BACpBC,kBAAmB,8BACnBC,kBAAmB,8BACnBC,oBAAqB,gCACrBC,oBAAqB,iCAGzBC,MACIvC,WACIwC,MAAO,WAEXjC,SACIiC,MAAO,YAEXrC,UACIqC,MAAO,WAEXpC,YACIoC,MAAO,aAEXnC,WACImC,MAAO,WAEXhC,iBACIgC,MAAO,WAEX/B,YACI+B,MAAO,WAEXC,qBACID,MAAO,eAEX9B,sBACI8B,MAAO,eAEX7B,sBACI6B,MAAO,eAEX5B,WACI4B,MAAO,cAEXzB,SACIyB,MAAO,SAAU,aACjBE,QAAS,WAEb7B,QACI2B,MAAO,SAAU,WACjBE,QAAS,UAEbX,SACIS,MAAQ,WAEZxB,cACIwB,MAAQ,WAEZvB,cACIuB,MAAQ,WAEZtB,aACIsB,MAAQ,WAEZrB,YACIqB,MAAQ,WAEZpB,SACIoB,MAAQ,UACRE,QAAS,WAEbrB,WACImB,MAAQ,SAAU,cAEtBlB,iBACIkB,MAAQ,SAAU,cAEtBjB,gBACIiB,MAAQ,WAEZd,uBACIc,MAAQ,cAEZb,iBACIa,MAAQ,WAEZZ,UACIY,MAAQ,aAQpBG,SAAQtD,QACJC,QAASH,WAIbC,YAAYL","file":"app.js.map"}
|
||||
16
public/js/v1.0.0/app/login.js
Normal file
16
public/js/v1.0.0/app/login.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0/app/login.js.map
Normal file
1
public/js/v1.0.0/app/login.js.map
Normal file
File diff suppressed because one or more lines are too long
34
public/js/v1.0.0/app/mappage.js
Normal file
34
public/js/v1.0.0/app/mappage.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0/app/mappage.js.map
Normal file
1
public/js/v1.0.0/app/mappage.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/v1.0.0/app/notification.js
Normal file
2
public/js/v1.0.0/app/notification.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0/app/notification.js.map
Normal file
1
public/js/v1.0.0/app/notification.js.map
Normal file
File diff suppressed because one or more lines are too long
13
public/js/v1.0.0/app/setup.js
Normal file
13
public/js/v1.0.0/app/setup.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0/app/setup.js.map
Normal file
1
public/js/v1.0.0/app/setup.js.map
Normal file
File diff suppressed because one or more lines are too long
131
public/js/v1.0.0/build.txt
Normal file
131
public/js/v1.0.0/build.txt
Normal file
@@ -0,0 +1,131 @@
|
||||
|
||||
app/login.js
|
||||
----------------
|
||||
lib/jquery-1.11.3.min.js
|
||||
app/init.js
|
||||
app/config/system_effect.js
|
||||
app/config/signature_type.js
|
||||
lib/bootstrap.min.js
|
||||
lib/bootbox.min.js
|
||||
app/ccp.js
|
||||
lib/velocity.min.js
|
||||
lib/velocity.ui.min.js
|
||||
lib/jquery.mCustomScrollbar.concat.min.js
|
||||
lib/validator.min.js
|
||||
lib/bootstrap-editable.min.js
|
||||
lib/jquery.easypiechart.min.js
|
||||
lib/jquery.hoverIntent.minified.js
|
||||
lib/bootstrap-confirmation.js
|
||||
lib/bootstrap2-toggle.min.js
|
||||
app/util.js
|
||||
lib/mustache.min.js
|
||||
app/render.js
|
||||
lib/blueimp-helper.js
|
||||
lib/blueimp-gallery.js
|
||||
lib/jquery.lazyload.min.js
|
||||
lib/EasePack.min.js
|
||||
lib/TweenLite.min.js
|
||||
app/ui/header.js
|
||||
lib/jquery.lazylinepainter-1.5.1.min.js
|
||||
app/ui/logo.js
|
||||
app/ui/demo_map.js
|
||||
app/ui/dialog/account_settings.js
|
||||
app/ui/dialog/notification.js
|
||||
app/ui/dialog/manual.js
|
||||
app/ui/dialog/releases.js
|
||||
app/ui/dialog/credit.js
|
||||
app/login.js
|
||||
lib/requirejs/text.js
|
||||
|
||||
app/mappage.js
|
||||
----------------
|
||||
lib/jquery-1.11.3.min.js
|
||||
app/init.js
|
||||
app/config/system_effect.js
|
||||
app/config/signature_type.js
|
||||
lib/bootstrap.min.js
|
||||
lib/bootbox.min.js
|
||||
app/ccp.js
|
||||
lib/velocity.min.js
|
||||
lib/velocity.ui.min.js
|
||||
lib/jquery.mCustomScrollbar.concat.min.js
|
||||
lib/validator.min.js
|
||||
lib/bootstrap-editable.min.js
|
||||
lib/jquery.easypiechart.min.js
|
||||
lib/jquery.hoverIntent.minified.js
|
||||
lib/bootstrap-confirmation.js
|
||||
lib/bootstrap2-toggle.min.js
|
||||
app/util.js
|
||||
lib/mustache.min.js
|
||||
app/render.js
|
||||
app/logging.js
|
||||
lib/requirejs/text.js
|
||||
text!img/logo.svg!strip
|
||||
text!templates/modules/header.html
|
||||
text!templates/modules/footer.html
|
||||
app/ui/dialog/notification.js
|
||||
app/ui/dialog/trust.js
|
||||
app/ui/dialog/map_info.js
|
||||
app/ui/dialog/account_settings.js
|
||||
app/ui/dialog/manual.js
|
||||
app/ui/dialog/map_settings.js
|
||||
app/ui/dialog/system_effects.js
|
||||
app/ui/dialog/jump_info.js
|
||||
app/ui/dialog/delete_account.js
|
||||
lib/jquery.lazylinepainter-1.5.1.min.js
|
||||
app/ui/logo.js
|
||||
app/ui/dialog/credit.js
|
||||
lib/slidebars.js
|
||||
lib/dom.jsPlumb-1.7.6.js
|
||||
lib/farahey-0.5.js
|
||||
app/map/magnetizing.js
|
||||
lib/jquery.dragToSelect.js
|
||||
lib/select2.min.js
|
||||
app/map/contextmenu.js
|
||||
app/map/overlay.js
|
||||
app/map/map.js
|
||||
app/counter.js
|
||||
app/ui/system_info.js
|
||||
lib/raphael-min.js
|
||||
lib/morris.min.js
|
||||
app/ui/system_graph.js
|
||||
app/ui/system_signature.js
|
||||
app/ui/system_route.js
|
||||
app/ui/system_killboard.js
|
||||
lib/datatables/jquery.dataTables.min.js
|
||||
lib/datatables/extensions/tabletools/js/dataTables.tableTools.js
|
||||
lib/datatables/extensions/responsive/dataTables.responsive.js
|
||||
app/module_map.js
|
||||
app/page.js
|
||||
app/ui/form_element.js
|
||||
app/mappage.js
|
||||
|
||||
app/setup.js
|
||||
----------------
|
||||
lib/jquery-1.11.3.min.js
|
||||
app/init.js
|
||||
app/config/system_effect.js
|
||||
app/config/signature_type.js
|
||||
lib/bootstrap.min.js
|
||||
lib/bootbox.min.js
|
||||
app/ccp.js
|
||||
lib/velocity.min.js
|
||||
lib/velocity.ui.min.js
|
||||
lib/jquery.mCustomScrollbar.concat.min.js
|
||||
lib/validator.min.js
|
||||
lib/bootstrap-editable.min.js
|
||||
lib/jquery.easypiechart.min.js
|
||||
lib/jquery.hoverIntent.minified.js
|
||||
lib/bootstrap-confirmation.js
|
||||
lib/bootstrap2-toggle.min.js
|
||||
app/util.js
|
||||
app/setup.js
|
||||
|
||||
app/notification.js
|
||||
----------------
|
||||
app/init.js
|
||||
lib/pnotify/pnotify.core.js
|
||||
lib/pnotify/pnotify.nonblock.js
|
||||
lib/pnotify/pnotify.desktop.js
|
||||
lib/pnotify/pnotify.callbacks.js
|
||||
app/notification.js
|
||||
2
public/js/v1.0.0/lib/bootstrap-image-gallery.js
vendored
Normal file
2
public/js/v1.0.0/lib/bootstrap-image-gallery.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!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"),c=a.clone().show().on("click",function(t){if(t.target===c[0]||t.target===c.children()[0]){t.preventDefault();t.stopPropagation();r.close()}}),l=i.call(this,o,function(t){e({type:t.type,target:c[0]});c.addClass("in")},n);c.find(".modal-title").text(l.title||String.fromCharCode(160));c.find(".modal-body").append(l);return c[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
|
||||
1
public/js/v1.0.0/lib/bootstrap-image-gallery.js.map
Normal file
1
public/js/v1.0.0/lib/bootstrap-image-gallery.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["bootstrap-image-gallery.js.src.js"],"names":["factory","define","amd","window","jQuery","blueimp","Gallery","$","extend","prototype","options","useBootstrapModal","close","imageFactory","videoFactory","textFactory","modalFactory","obj","callback","factoryInterface","this","call","that","modalTemplate","container","children","modal","clone","show","on","event","target","preventDefault","stopPropagation","element","type","addClass","find","text","title","String","fromCharCode","append","removeClass"],"mappings":"CAaC,SAAUA,GACP,YACsB,mBAAXC,SAAyBA,OAAOC,IAEvCD,QACI,SACA,kBACDD,GAEHA,EACIG,OAAOC,OACPD,OAAOE,QAAQC,UAGzB,SAAUC,EAAGD,GACX,YAEAC,GAAEC,OAAOF,EAAQG,UAAUC,SACvBC,mBAAmB,GAGvB,IAAIC,GAAQN,EAAQG,UAAUG,MAC1BC,EAAeP,EAAQG,UAAUI,aACjCC,EAAeR,EAAQG,UAAUK,aACjCC,EAAcT,EAAQG,UAAUM,WAEpCR,GAAEC,OAAOF,EAAQG,WAEbO,aAAc,SAAUC,EAAKC,EAAUC,EAAkBnB,GACrD,IAAKoB,KAAKV,QAAQC,mBAAqBQ,EACnC,MAAOnB,GAAQqB,KAAKD,KAAMH,EAAKC,EAAUC,EAE7C,IAAIG,GAAOF,KACPG,EAAgBhB,EAAEa,KAAKI,WAAWC,SAAS,UAC3CC,EAAQH,EAAcI,QAAQC,OACzBC,GAAG,QAAS,SAAUC,GAEnB,GAAIA,EAAMC,SAAWL,EAAM,IACnBI,EAAMC,SAAWL,EAAMD,WAAW,GAAI,CAC1CK,EAAME,gBACNF,GAAMG,iBACNX,GAAKV,WAGjBsB,EAAUlC,EAAQqB,KAAKD,KAAMH,EAAK,SAAUa,GACxCZ,GACIiB,KAAML,EAAMK,KACZJ,OAAQL,EAAM,IAElBA,GAAMU,SAAS,OAChBjB,EACPO,GAAMW,KAAK,gBAAgBC,KAAKJ,EAAQK,OAASC,OAAOC,aAAa,KACrEf,GAAMW,KAAK,eAAeK,OAAOR,EACjC,OAAOR,GAAM,IAGjBb,aAAc,SAAUI,EAAKC,EAAUC,GACnC,MAAOC,MAAKJ,aAAaC,EAAKC,EAAUC,EAAkBN,IAG9DC,aAAc,SAAUG,EAAKC,EAAUC,GACnC,MAAOC,MAAKJ,aAAaC,EAAKC,EAAUC,EAAkBL,IAG9DC,YAAa,SAAUE,EAAKC,EAAUC,GAClC,MAAOC,MAAKJ,aAAaC,EAAKC,EAAUC,EAAkBJ,IAG9DH,MAAO,WACHQ,KAAKI,UAAUa,KAAK,UAAUM,YAAY,KAC1C/B,GAAMS,KAAKD","file":"bootstrap-image-gallery.js.map"}
|
||||
2
public/js/v1.0.0/lib/datatables/dataTables.bootstrap.js
Normal file
2
public/js/v1.0.0/lib/datatables/dataTables.bootstrap.js
Normal file
@@ -0,0 +1,2 @@
|
||||
!function(e,t,a){var n=function(e,t){"use strict";e.extend(!0,t.defaults,{dom:"<'row'<'col-xs-6'l><'col-xs-6'f>r><'row'<'col-xs-12't>><'row'<'col-xs-6'i><'col-xs-6'p>>",renderer:"bootstrap"});e.extend(t.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm"});t.ext.renderer.pageButton.bootstrap=function(a,n,o,s,r,i){var l,d,c=new t.Api(a),u=a.oClasses,b=a.oLanguage.oPaginate,p=function(t,n){var s,f,T,x,m=function(t){t.preventDefault();e(t.currentTarget).hasClass("disabled")||c.page(t.data.action).draw(!1)};for(s=0,f=n.length;f>s;s++){x=n[s];if(e.isArray(x))p(t,x);else{l="";d="";switch(x){case"ellipsis":l="…";d="disabled";break;case"first":l=b.sFirst;d=x+(r>0?"":" disabled");break;case"previous":l=b.sPrevious;d=x+(r>0?"":" disabled");break;case"next":l=b.sNext;d=x+(i-1>r?"":" disabled");break;case"last":l=b.sLast;d=x+(i-1>r?"":" disabled");break;default:l=x+1;d=r===x?"active":""}if(l){T=e("<li>",{"class":u.sPageButton+" "+d,"aria-controls":a.sTableId,tabindex:a.iTabIndex,id:0===o&&"string"==typeof x?a.sTableId+"_"+x:null}).append(e("<a>",{href:"#"}).html(l)).appendTo(t);a.oApi._fnBindAction(T,{action:x},m)}}}};p(e(n).empty().html('<ul class="pagination"/>').children("ul"),s)};if(t.TableTools){e.extend(!0,t.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default",disabled:"disabled"},collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info"},select:{row:"active"}});e.extend(!0,t.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}})}};"function"==typeof define&&define.amd?define(["jquery",""],n):"object"==typeof exports?n(require("jquery"),require("datatables")):jQuery&&n(jQuery,jQuery.fn.dataTable)}(window,document);
|
||||
//# sourceMappingURL=dataTables.bootstrap.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["dataTables.bootstrap.js.src.js"],"names":["window","document","undefined","factory","$","DataTable","extend","defaults","dom","renderer","ext","classes","sWrapper","sFilterInput","sLengthSelect","pageButton","bootstrap","settings","host","idx","buttons","page","pages","btnDisplay","btnClass","api","Api","oClasses","lang","oLanguage","oPaginate","attach","container","i","ien","node","button","clickHandler","e","preventDefault","currentTarget","hasClass","data","action","draw","length","isArray","sFirst","sPrevious","sNext","sLast","class","sPageButton","aria-controls","sTableId","tabindex","iTabIndex","id","append","href","html","appendTo","oApi","_fnBindAction","empty","children","TableTools","normal","disabled","collection","print","info","select","row","DEFAULTS","oTags","liner","define","amd","exports","require","jQuery","fn","dataTable"],"mappings":"CAUA,SAAUA,EAAQC,EAAUC,GAE5B,GAAIC,GAAU,SAAUC,EAAGC,GAC3B,YAIAD,GAAEE,QAAQ,EAAMD,EAAUE,UACzBC,IACC,2FAGDC,SAAU,aAKXL,GAAEE,OAAQD,EAAUK,IAAIC,SACvBC,SAAe,8CACfC,aAAe,wBACfC,cAAe,yBAKhBT,GAAUK,IAAID,SAASM,WAAWC,UAAY,SAAWC,EAAUC,EAAMC,EAAKC,EAASC,EAAMC,GAC5F,GAGIC,GAAYC,EAHZC,EAAU,GAAIpB,GAAUqB,IAAKT,GAC7BN,EAAUM,EAASU,SACnBC,EAAUX,EAASY,UAAUC,UAG7BC,EAAS,SAAUC,EAAWZ,GACjC,GAAIa,GAAGC,EAAKC,EAAMC,EACdC,EAAe,SAAWC,GAC7BA,EAAEC,gBACInC,GAAEkC,EAAEE,eAAeC,SAAS,aACjChB,EAAIJ,KAAMiB,EAAEI,KAAKC,QAASC,MAAM,GAIlC,KAAMX,EAAE,EAAGC,EAAId,EAAQyB,OAAWX,EAAFD,EAAQA,IAAM,CAC7CG,EAAShB,EAAQa,EAEjB,IAAK7B,EAAE0C,QAASV,GACfL,EAAQC,EAAWI,OAEf,CACJb,EAAa,EACbC,GAAW,EAEX,QAASY,GACR,IAAK,WACJb,EAAa,UACbC,GAAW,UACX,MAED,KAAK,QACJD,EAAaK,EAAKmB,MAClBvB,GAAWY,GAAUf,EAAO,EAC3B,GAAK,YACN,MAED,KAAK,WACJE,EAAaK,EAAKoB,SAClBxB,GAAWY,GAAUf,EAAO,EAC3B,GAAK,YACN,MAED,KAAK,OACJE,EAAaK,EAAKqB,KAClBzB,GAAWY,GAAiBd,EAAM,EAAbD,EACpB,GAAK,YACN,MAED,KAAK,OACJE,EAAaK,EAAKsB,KAClB1B,GAAWY,GAAiBd,EAAM,EAAbD,EACpB,GAAK,YACN,MAED,SACCE,EAAaa,EAAS,CACtBZ,GAAWH,IAASe,EACnB,SAAW,GAId,GAAKb,EAAa,CACjBY,EAAO/B,EAAE,QACP+C,QAASxC,EAAQyC,YAAY,IAAI5B,EACjC6B,gBAAiBpC,EAASqC,SAC1BC,SAAYtC,EAASuC,UACrBC,GAAc,IAARtC,GAA+B,gBAAXiB,GACzBnB,EAASqC,SAAU,IAAKlB,EACxB,OAEDsB,OAAQtD,EAAE,OACTuD,KAAQ,MAERC,KAAMrC,IAEPsC,SAAU7B,EAEZf,GAAS6C,KAAKC,cACb5B,GAAOQ,OAAQP,GAASC,MAO7BN,GACC3B,EAAEc,GAAM8C,QAAQJ,KAAK,4BAA4BK,SAAS,MAC1D7C,GASF,IAAKf,EAAU6D,WAAa,CAE3B9D,EAAEE,QAAQ,EAAMD,EAAU6D,WAAWvD,SACpCqB,UAAa,iBACbZ,SACC+C,OAAU,kBACVC,SAAY,YAEbC,YACCrC,UAAa,8BACbZ,SACC+C,OAAU,GACVC,SAAY,aAGdE,OACCC,KAAQ,mBAETC,QACCC,IAAO,WAKTrE,GAAEE,QAAQ,EAAMD,EAAU6D,WAAWQ,SAASC,OAC7CN,YACCrC,UAAa,KACbI,OAAU,KACVwC,MAAS,QASW,mBAAXC,SAAyBA,OAAOC,IAC3CD,QAAS,SAAU,IAAK1E,GAEI,gBAAZ4E,SAEb5E,EAAS6E,QAAQ,UAAWA,QAAQ,eAE9BC,QAET9E,EAAS8E,OAAQA,OAAOC,GAAGC,YAIzBnF,OAAQC","file":"dataTables.bootstrap.js.map"}
|
||||
2
public/js/v1.0.0/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js
vendored
Normal file
2
public/js/v1.0.0/lib/datatables/extensions/tabletools/js/dataTables.tableTools.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/js/v1.0.0/lib/jquery.fullscreen.min.js
vendored
Normal file
2
public/js/v1.0.0/lib/jquery.fullscreen.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0/lib/jquery.fullscreen.min.js.map
Normal file
1
public/js/v1.0.0/lib/jquery.fullscreen.min.js.map
Normal file
File diff suppressed because one or more lines are too long
7
public/js/v1.0.0/lib/jsPlumb-2.0.5.js
Normal file
7
public/js/v1.0.0/lib/jsPlumb-2.0.5.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0/lib/jsPlumb-2.0.5.js.map
Normal file
1
public/js/v1.0.0/lib/jsPlumb-2.0.5.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/v1.0.0/lib/require.js
Normal file
2
public/js/v1.0.0/lib/require.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0/lib/require.js.map
Normal file
1
public/js/v1.0.0/lib/require.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -1,60 +0,0 @@
|
||||
/**
|
||||
* Global CCPEvE function wrapper
|
||||
*/
|
||||
|
||||
define(['jquery'], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* checks weather the program URL is IGB trusted or not
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var isTrusted = function(){
|
||||
var isPageTrusted = false;
|
||||
|
||||
if(isInGameBrowser()){
|
||||
var trustedAttribute = $('body').attr('data-trusted');
|
||||
if(trustedAttribute === '1'){
|
||||
isPageTrusted = true;
|
||||
}
|
||||
}else{
|
||||
// out of game browser is always trusted
|
||||
isPageTrusted = true;
|
||||
}
|
||||
|
||||
return isPageTrusted;
|
||||
};
|
||||
|
||||
/**
|
||||
* show IGB trust message
|
||||
*/
|
||||
var requestTrust = function(){
|
||||
|
||||
if(
|
||||
isInGameBrowser() &&
|
||||
!isTrusted()
|
||||
){
|
||||
CCPEVE.requestTrust( location.protocol + '//' + location.host );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* in-game or out-of-game browser
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var isInGameBrowser = function(){
|
||||
var inGame = false;
|
||||
if(typeof CCPEVE === 'object'){
|
||||
inGame = true;
|
||||
}
|
||||
|
||||
return inGame;
|
||||
};
|
||||
|
||||
return {
|
||||
isInGameBrowser: isInGameBrowser,
|
||||
isTrusted: isTrusted,
|
||||
requestTrust: requestTrust
|
||||
};
|
||||
});
|
||||
@@ -1,408 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
var 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
|
||||
var 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
|
||||
var 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'
|
||||
},
|
||||
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
|
||||
// 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: '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'
|
||||
},
|
||||
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' //*
|
||||
},
|
||||
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' //*
|
||||
},
|
||||
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'
|
||||
},
|
||||
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: 'Z142 - 0.0'
|
||||
},
|
||||
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: 'K346 - C3',
|
||||
8: 'M267 - C3',
|
||||
9: 'O477 - C3',
|
||||
10: 'X877 - C4',
|
||||
11: 'Y683 - C4',
|
||||
12: 'H296 - C5',
|
||||
13: 'H900 - C5',
|
||||
14: 'H296 - C5',
|
||||
15: 'N062 - C5',
|
||||
16: 'V911 - C5',
|
||||
17: 'U574 - C6',
|
||||
18: 'V753 - C6',
|
||||
19: 'W237 - C6',
|
||||
20: 'B274 - HS',
|
||||
21: 'D792 - HS',
|
||||
22: 'D845 - HS',
|
||||
23: 'N110 - HS',
|
||||
24: 'A239 - LS',
|
||||
25: 'C391 - LS',
|
||||
26: 'J244 - LS',
|
||||
27: 'U201 - LS',
|
||||
28: 'U210 - LS',
|
||||
29: 'C248 - NS',
|
||||
30: 'E545 - NS',
|
||||
31: 'K346 - NS',
|
||||
32: 'Z060 - NS'
|
||||
}
|
||||
}
|
||||
}, // 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 - NS'
|
||||
}
|
||||
},
|
||||
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 - NS'
|
||||
}
|
||||
},
|
||||
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 - NS'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return signatureTypes;
|
||||
});
|
||||
@@ -1,733 +0,0 @@
|
||||
/**
|
||||
* Created by exodus4d on 06.07.2015.
|
||||
* static system effects
|
||||
*/
|
||||
|
||||
|
||||
define([], function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
// system effects
|
||||
var 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;
|
||||
});
|
||||
@@ -1,101 +0,0 @@
|
||||
define(["jquery"], function($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var config = {
|
||||
counterDigitSmallClass: 'pf-digit-counter-small',
|
||||
counterDigitLargeClass: 'pf-digit-counter-large'
|
||||
};
|
||||
|
||||
var updateDateDiff = function(element, tempDate){
|
||||
|
||||
var date1 = new Date();
|
||||
var date2 = tempDate;
|
||||
//Customise date2 for your required future time
|
||||
|
||||
var diff = (date1 - date2)/1000;
|
||||
diff = Math.abs(Math.floor(diff));
|
||||
|
||||
var days = Math.floor(diff/(24*60*60));
|
||||
var leftSec = diff - days * 24*60*60;
|
||||
|
||||
var hrs = Math.floor(leftSec/(60*60));
|
||||
leftSec = leftSec - hrs * 60*60;
|
||||
|
||||
var min = Math.floor(leftSec/(60));
|
||||
leftSec = leftSec - min * 60;
|
||||
|
||||
|
||||
var 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(){
|
||||
|
||||
var element = $(this);
|
||||
|
||||
var timestamp = parseInt( element.text() );
|
||||
|
||||
// do not init twice
|
||||
if(timestamp > 0){
|
||||
// mark as init
|
||||
element.attr('data-counter', 'init');
|
||||
|
||||
var date = new Date( timestamp * 1000);
|
||||
|
||||
updateDateDiff(element, date);
|
||||
|
||||
var refreshIntervalId = window.setInterval(function(){
|
||||
|
||||
// update element with current time
|
||||
if( !element.hasClass('stopCounter')){
|
||||
updateDateDiff(element, date);
|
||||
}else{
|
||||
clearInterval( element.data('interval') );
|
||||
}
|
||||
}, 100);
|
||||
|
||||
element.data('interval', refreshIntervalId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,410 +0,0 @@
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
|
||||
define(['jquery'], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
sendInviteKey: 'api/user/sendInvite', // ajax URL - send registration key
|
||||
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
|
||||
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
|
||||
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
|
||||
// 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
|
||||
// GitHub API
|
||||
gitHubReleases: 'api/github/releases' // ajax URL - get release info from GitHub
|
||||
},
|
||||
url: {
|
||||
ccpImageServer: 'https://image.eveonline.com/', // CCP image Server
|
||||
zKillboard: 'https://zkillboard.com/api/' // killboard api
|
||||
},
|
||||
animationSpeed: {
|
||||
splashOverlay: 300, // "splash" loading overlay
|
||||
headerLink: 100, // links in head bar
|
||||
mapOverlay: 200, // show/hide duration for map overlays
|
||||
mapMoveSystem: 300, // 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/...
|
||||
},
|
||||
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: 'cytaclysmic'
|
||||
},
|
||||
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(' ')
|
||||
} ]
|
||||
]
|
||||
},
|
||||
preserve_mass: {
|
||||
cssClass: 'pf-map-connection-preserve-mass',
|
||||
overlays:[
|
||||
[ 'Label',
|
||||
{
|
||||
label: '<i class="fa fa-warning"></i> save mass',
|
||||
cssClass: ['pf-map-connection-overlay', 'mass'].join(' '),
|
||||
width:50, length:30,
|
||||
location: 0.5
|
||||
} ]
|
||||
]
|
||||
}
|
||||
},
|
||||
// signature groups
|
||||
signatureGroups: {
|
||||
1: {
|
||||
name: 'combat site', //*
|
||||
label: 'Combat'
|
||||
},
|
||||
2: {
|
||||
name: 'relic site', //*
|
||||
label: 'Relic'
|
||||
},
|
||||
3: {
|
||||
name: 'data site',
|
||||
label: 'Data'
|
||||
},
|
||||
4: {
|
||||
name: 'gas site',
|
||||
label: 'Gas'
|
||||
},
|
||||
5: {
|
||||
name: 'wormhole',
|
||||
label: 'Wormhole'
|
||||
},
|
||||
6: {
|
||||
name: 'ore site',
|
||||
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'
|
||||
},
|
||||
2: { // C2
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0'
|
||||
},
|
||||
3: { // C3
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0'
|
||||
},
|
||||
4: { // C4
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0'
|
||||
},
|
||||
5: { // C5
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0'
|
||||
},
|
||||
6: { // C6
|
||||
1: 'E004 - C1',
|
||||
2: 'L005 - C2',
|
||||
3: 'Z006 - C3',
|
||||
4: 'M001 - C4',
|
||||
5: 'C008 - C5',
|
||||
6: 'G008 - C6',
|
||||
7: 'Q003 - 0.0'
|
||||
},
|
||||
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'
|
||||
}
|
||||
},
|
||||
// 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'
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return Config;
|
||||
});
|
||||
@@ -1,499 +0,0 @@
|
||||
/**
|
||||
* logging
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox'
|
||||
], function($, Init, Util, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var logData = []; // cache object for all log entries
|
||||
var logDataTable = null; // "Datatables" Object
|
||||
|
||||
// Morris charts data
|
||||
var maxGraphDataCount = 30; // max date entries for a graph
|
||||
var chartData = {}; // chart Data object for all Morris Log graphs
|
||||
|
||||
var config = {
|
||||
dialogDynamicAreaClass: 'pf-dynamic-area', // class for dynamic areas
|
||||
logGraphClass: 'pf-log-graph' // class for all log Morris graphs
|
||||
};
|
||||
|
||||
/**
|
||||
* get log time string
|
||||
* @returns {string}
|
||||
*/
|
||||
var getLogTime = function(){
|
||||
|
||||
var serverTime = Util.getServerTime();
|
||||
|
||||
var logTime = serverTime.toLocaleTimeString('en-US', { hour12: false });
|
||||
|
||||
return logTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the logging dialog
|
||||
*/
|
||||
var showDialog = function(){
|
||||
|
||||
// dialog content
|
||||
|
||||
var content = $('<div>');
|
||||
|
||||
// content row for log graphs
|
||||
var rowElementGraphs = $('<div>', {
|
||||
class: 'row'
|
||||
});
|
||||
|
||||
content.append(rowElementGraphs);
|
||||
|
||||
|
||||
|
||||
var tableHeadline = $('<h4>', {
|
||||
text: ' Processes'
|
||||
}).prepend( $('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-lg', 'fa-list-alt'].join(' ')
|
||||
}));
|
||||
|
||||
// add content Structure to dome before table initialization
|
||||
content.append(tableHeadline);
|
||||
|
||||
// log table area --------------------------------------------------
|
||||
var logTableArea = $('<div>', {
|
||||
class: config.dialogDynamicAreaClass
|
||||
});
|
||||
|
||||
var logTable = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
|
||||
});
|
||||
|
||||
logTableArea.append(logTable);
|
||||
content.append(logTableArea);
|
||||
|
||||
// init log table
|
||||
logDataTable = logTable.DataTable( {
|
||||
paging: true,
|
||||
ordering: true,
|
||||
order: [ 1, 'desc' ],
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
pageLength: 15,
|
||||
lengthMenu: [[10, 15, 25, 50, 50], [10, 15, 25, 50, 50]],
|
||||
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
|
||||
var logDialog = bootbox.dialog({
|
||||
title: 'Task-Manager',
|
||||
message: content,
|
||||
size: 'large',
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'close',
|
||||
className: 'btn-default'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal dialog is shown
|
||||
logDialog.on('shown.bs.modal', function(e) {
|
||||
|
||||
// show Morris graphs ----------------------------------------------------------
|
||||
|
||||
// function for chart label formation
|
||||
var labelYFormat = function(y){
|
||||
return Math.round(y) + 'ms';
|
||||
};
|
||||
|
||||
for(var key in chartData) {
|
||||
if(chartData.hasOwnProperty(key)) {
|
||||
// create a chart for each key
|
||||
|
||||
var colElementGraph = $('<div>', {
|
||||
class: ['col-md-6'].join(' ')
|
||||
});
|
||||
|
||||
|
||||
// graph element
|
||||
var graphElement = $('<div>', {
|
||||
class: config.logGraphClass
|
||||
});
|
||||
|
||||
var graphArea = $('<div>', {
|
||||
class: config.dialogDynamicAreaClass
|
||||
}).append( graphElement );
|
||||
|
||||
// headline
|
||||
var headline = $('<h4>', {
|
||||
text: key
|
||||
}).prepend(
|
||||
$('<span>', {
|
||||
class: ['txt-color', 'txt-color-grayLight'].join(' '),
|
||||
text: 'Prozess-ID: '
|
||||
})
|
||||
);
|
||||
|
||||
// show update ping between function calls
|
||||
var updateElement = $('<small>', {
|
||||
class: ['txt-color', 'txt-color-blue', 'pull-right'].join(' ')
|
||||
});
|
||||
headline.append(updateElement).append('<br>');
|
||||
|
||||
// show average execution time
|
||||
var 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
|
||||
});
|
||||
|
||||
graphArea.hideLoadingAnimation();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// add TableTool Buttons
|
||||
var tt = new $.fn.DataTable.TableTools( logDataTable, {
|
||||
sSwfPath: require.toUrl('') + 'lib/datatables/extensions/tabletools/swf/copy_csv_xls.swf',
|
||||
aButtons: [ 'copy', 'csv', 'print' ]
|
||||
});
|
||||
|
||||
$(tt.fnContainer()).insertBefore('.bootbox-body div.dataTables_wrapper');
|
||||
|
||||
// add button icons
|
||||
$('.DTTT_button_csv').prepend( $('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-download'].join(' ')
|
||||
}));
|
||||
$('.DTTT_button_copy').prepend( $('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-clipboard'].join(' ')
|
||||
}));
|
||||
$('.DTTT_button_print').prepend( $('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-print'].join(' ')
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
// modal dialog is closed
|
||||
logDialog.on('hidden.bs.modal', function(e) {
|
||||
// clear memory -> destroy all charts
|
||||
for (var 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
|
||||
*/
|
||||
var 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
|
||||
chartData[key].data.unshift(duration);
|
||||
|
||||
if(chartData[key].data.length > maxGraphDataCount){
|
||||
chartData[key].data = chartData[key].data.slice(0, maxGraphDataCount);
|
||||
}
|
||||
|
||||
function getGraphData(data) {
|
||||
var tempChartData = {
|
||||
data: [],
|
||||
dataSum: 0,
|
||||
average: 0
|
||||
};
|
||||
|
||||
for(var x = 0; x < maxGraphDataCount; x++){
|
||||
var 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;
|
||||
}
|
||||
|
||||
var tempChartData = getGraphData(chartData[key].data);
|
||||
|
||||
// add new data to graph (Morris chart) - if is already initialized
|
||||
if(chartData[key].graph !== null){
|
||||
var avgElement = chartData[key].averageElement;
|
||||
var updateElement = chartData[key].updateElement;
|
||||
|
||||
var 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';
|
||||
|
||||
var avgStatus = getLogStatusByDuration(key, tempChartData.average);
|
||||
var 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('problem');
|
||||
}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}
|
||||
*/
|
||||
var getLogStatusByDuration = function(logKey, logDuration){
|
||||
|
||||
var 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}
|
||||
*/
|
||||
var getLogTypeIconClass = function(logType){
|
||||
|
||||
var logIconClass = '';
|
||||
|
||||
switch(logType){
|
||||
case 'client':
|
||||
logIconClass = 'fa-user';
|
||||
break;
|
||||
case 'server':
|
||||
logIconClass = 'fa-download';
|
||||
break;
|
||||
}
|
||||
|
||||
return logIconClass;
|
||||
};
|
||||
|
||||
/**
|
||||
* init logging -> set global log event
|
||||
*/
|
||||
var init = function(){
|
||||
|
||||
var maxEntries = 150;
|
||||
|
||||
// set global logging listener
|
||||
$(window).on('pf:log', function(e, logKey, options){
|
||||
|
||||
// check required logging information
|
||||
if(
|
||||
options &&
|
||||
options.duration &&
|
||||
options.description
|
||||
){
|
||||
var logDescription = options.description;
|
||||
var logDuration = options.duration;
|
||||
var logType = options.type;
|
||||
|
||||
// check log status by duration
|
||||
var logStatus = getLogStatusByDuration(logKey, logDuration);
|
||||
|
||||
var statusClass = Util.getLogInfo( logStatus, 'class' );
|
||||
|
||||
var typeIconClass = getLogTypeIconClass(logType);
|
||||
|
||||
// update graph data
|
||||
updateLogGraph(logKey, logDuration);
|
||||
|
||||
var 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 ---------------------------------
|
||||
var 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
|
||||
};
|
||||
});
|
||||
@@ -1,772 +0,0 @@
|
||||
/**
|
||||
* Main loginPage application
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'app/ccp',
|
||||
'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, CCP, Gallery, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
|
||||
// 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
|
||||
|
||||
// server panel
|
||||
serverPanelId: 'pf-server-panel', // id for EVE Online server status panel
|
||||
|
||||
// animation
|
||||
animateElementClass: 'pf-animate-on-visible' // class for elements that will be animated to show
|
||||
};
|
||||
|
||||
/**
|
||||
* set a cookie
|
||||
* @param cname
|
||||
* @param cvalue
|
||||
* @param exdays
|
||||
*/
|
||||
var setCookie = function(cname, cvalue, exdays) {
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
var expires = 'expires=' + d.toUTCString();
|
||||
document.cookie = cname + '=' + cvalue + '; ' + expires;
|
||||
};
|
||||
|
||||
/**
|
||||
* get cookie value by name
|
||||
* @param cname
|
||||
* @returns {*}
|
||||
*/
|
||||
var getCookie = function(cname) {
|
||||
var name = cname + '=';
|
||||
var ca = document.cookie.split(';');
|
||||
|
||||
for(var i = 0; i <ca.length; i++) {
|
||||
var 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 page observer
|
||||
*/
|
||||
var setPageObserver = function(){
|
||||
|
||||
// cookie hint --------------------------------------------------------
|
||||
if(getCookie('cookie') !== '1'){
|
||||
// hint not excepted
|
||||
$('#' + config.cookieHintId).collapse('show');
|
||||
}
|
||||
|
||||
$('#' + config.cookieHintId + ' .btn-success').on('click', function(){
|
||||
setCookie('cookie', 1, 365);
|
||||
});
|
||||
|
||||
// releases -----------------------------------------------------------
|
||||
$('.' + config.navigationVersionLinkClass).on('click', function(e){
|
||||
$.fn.releasesDialog();
|
||||
});
|
||||
|
||||
// manual -------------------------------------------------------------
|
||||
$('.' + config.navigationLinkManualClass).on('click', function(e){
|
||||
e.preventDefault();
|
||||
$.fn.showMapManual();
|
||||
});
|
||||
|
||||
// license ------------------------------------------------------------
|
||||
$('.' + config.navigationLinkLicenseClass).on('click', function(e){
|
||||
e.preventDefault();
|
||||
$.fn.showCreditsDialog(false, true);
|
||||
});
|
||||
|
||||
// tooltips -----------------------------------------------------------
|
||||
var mapTooltipOptions = {
|
||||
toggle: 'tooltip',
|
||||
container: 'body',
|
||||
delay: 150
|
||||
};
|
||||
|
||||
$('[title]').not('.slide img').tooltip(mapTooltipOptions);
|
||||
};
|
||||
|
||||
/**
|
||||
* show "registration key" dialog (see "Invite" feature)
|
||||
*/
|
||||
var showRequestRegistrationKeyDialog = function(){
|
||||
var data = {
|
||||
id: config.signatureReaderDialogId,
|
||||
formErrorContainerClass: Util.config.formErrorContainerClass,
|
||||
formWarningContainerClass: Util.config.formWarningContainerClass
|
||||
};
|
||||
|
||||
requirejs(['text!templates/dialog/registration.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
var registrationKeyDialog = bootbox.dialog({
|
||||
title: 'Registration Key',
|
||||
message: content,
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'cancel',
|
||||
className: 'btn-default'
|
||||
},
|
||||
success: {
|
||||
label: '<i class="fa fa-envelope fa-fw"></i> send',
|
||||
className: 'btn-success',
|
||||
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 = {
|
||||
settingsData: formValues
|
||||
};
|
||||
|
||||
var modalContent = registrationKeyDialog.find('.modal-content');
|
||||
modalContent.showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.sendInviteKey,
|
||||
data: requestData,
|
||||
dataType: 'json'
|
||||
}).done(function(responseData){
|
||||
|
||||
if(
|
||||
responseData.error &&
|
||||
responseData.error.length > 0
|
||||
){
|
||||
form.showFormMessage(responseData.error);
|
||||
}else{
|
||||
$('.modal').modal('hide');
|
||||
Util.showNotify({title: 'Registration Key send', text: 'Check your Mails', type: 'success'});
|
||||
}
|
||||
|
||||
modalContent.hideLoadingAnimation();
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
modalContent.hideLoadingAnimation();
|
||||
|
||||
var reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': send Registration Key', text: reason, type: 'error'});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init image carousel
|
||||
*/
|
||||
var initCarousel = function(){
|
||||
|
||||
// check if carousel exists (e.g. not in IGB browser
|
||||
if($('#' + config.galleryCarouselId).length === 0){
|
||||
return;
|
||||
}
|
||||
|
||||
// extent "blueimp" gallery for a textFactory method to show HTML templates
|
||||
Gallery.prototype.textFactory = function (obj, callback) {
|
||||
var newSlideContent = $('<div>')
|
||||
.addClass('text-content')
|
||||
.attr('title', obj.title);
|
||||
|
||||
var 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)
|
||||
var 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 ------------------------------------------------
|
||||
var carousel = new Gallery([
|
||||
{
|
||||
title: 'IGB',
|
||||
href: 'ui/map',
|
||||
type: 'text/html'
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/responsive.jpg',
|
||||
title: 'Responsive layout',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/pathfinder_1.jpg',
|
||||
title: 'Map view',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/pathfinder_3.jpg',
|
||||
title: 'Map information',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
},
|
||||
{
|
||||
href: 'public/img/landing/pathfinder_2.jpg',
|
||||
title: 'System information',
|
||||
type: 'image/jpg',
|
||||
thumbnail: ''
|
||||
}
|
||||
], {
|
||||
container: '#' + config.galleryCarouselId,
|
||||
carousel: true,
|
||||
startSlideshow: false,
|
||||
titleProperty: 'title',
|
||||
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
|
||||
|
||||
$('#' + 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();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* init image gallery
|
||||
*/
|
||||
var initGallery = function(){
|
||||
|
||||
requirejs(['blueImpGalleryBootstrap'], function() {
|
||||
// thumb links
|
||||
var thumbLinks = $('a[data-gallery="#pf-gallery"]');
|
||||
|
||||
var borderless = false;
|
||||
|
||||
var galleryElement = $('#' + config.galleryId);
|
||||
galleryElement.data('useBootstrapModal', !borderless);
|
||||
galleryElement.toggleClass('blueimp-gallery-controls', borderless);
|
||||
|
||||
// init gallery on click
|
||||
thumbLinks.on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
e = e || window.event;
|
||||
var target = e.target || e.srcElement;
|
||||
var link = target.src ? target.parentNode : target;
|
||||
|
||||
var options = {
|
||||
index: link,
|
||||
event: e,
|
||||
container: '#' + config.galleryId,
|
||||
titleProperty: 'description'
|
||||
};
|
||||
|
||||
new Gallery(thumbLinks, options);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var initYoutube = function(){
|
||||
|
||||
$('.youtube').each(function() {
|
||||
// Based on the YouTube ID, we can easily find the thumbnail image
|
||||
$(this).css('background-image', 'url(https://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
|
||||
var iFrameUrl = 'https://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
|
||||
var 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
|
||||
*/
|
||||
var initScrollspy = function(){
|
||||
// init scrollspy
|
||||
|
||||
// show elements that are currently in the viewport
|
||||
var showVisibleElements = function(){
|
||||
// find all elements that should be animated
|
||||
var visibleElements = $('.' + config.animateElementClass).isInViewport();
|
||||
|
||||
$(visibleElements).removeClass( config.animateElementClass );
|
||||
|
||||
$(visibleElements).velocity('transition.flipXIn', {
|
||||
duration: 600,
|
||||
stagger: 60,
|
||||
delay: 500,
|
||||
complete: function(element){
|
||||
$(element).find('.fade').addClass('in');
|
||||
},
|
||||
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
|
||||
var anchorTag = $(this).attr('data-anchor');
|
||||
|
||||
// scroll to container
|
||||
$(anchorTag).velocity('scroll', {
|
||||
duration: 300,
|
||||
easing: 'swing'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* get current EVE-Online server status
|
||||
* -> show "server panel"
|
||||
*/
|
||||
var initServerStatus = function(){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.getServerStatus,
|
||||
dataType: 'json'
|
||||
}).done(function(responseData, textStatus, request){
|
||||
|
||||
if(responseData.hasOwnProperty('status')){
|
||||
var data = responseData.status;
|
||||
data.serverPanelId = config.serverPanelId;
|
||||
|
||||
var statusClass = '';
|
||||
switch(data.serviceStatus.eve.toLowerCase()){
|
||||
case 'online': statusClass = 'txt-color-green'; break;
|
||||
case 'vip': statusClass = 'txt-color-orange'; break;
|
||||
case 'offline': statusClass = 'txt-color-redDarker'; break;
|
||||
}
|
||||
data.serviceStatus.style = statusClass;
|
||||
|
||||
requirejs(['text!templates/ui/server_panel.html', 'mustache'], function(template, Mustache) {
|
||||
var content = Mustache.render(template, data);
|
||||
$('#' + config.headerId).prepend(content);
|
||||
$('#' + config.serverPanelId).velocity('transition.slideLeftBigIn', {
|
||||
duration: 240
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}).fail(handleAjaxErrorResponse);
|
||||
};
|
||||
|
||||
/**
|
||||
* load character data from cookie information
|
||||
* -> all validation is done server side!
|
||||
*/
|
||||
var initCharacterSelect = function(){
|
||||
|
||||
/**
|
||||
* init panel animation for an element
|
||||
* @param imageWrapperElement
|
||||
*/
|
||||
var initCharacterAnimation = function(imageWrapperElement){
|
||||
|
||||
imageWrapperElement.velocity('stop').delay(300).velocity('transition.flipBounceXIn', {
|
||||
display: 'inline-block',
|
||||
stagger: 60,
|
||||
drag: true,
|
||||
duration: 600
|
||||
});
|
||||
|
||||
// Hover effect for character info layer
|
||||
imageWrapperElement.hoverIntent(function(e){
|
||||
var characterInfoElement = $(this).find('.' + config.characterImageInfoClass);
|
||||
|
||||
characterInfoElement.velocity('finish').velocity({
|
||||
width: ['100%', [ 400, 15 ] ]
|
||||
},{
|
||||
easing: 'easeInSine'
|
||||
});
|
||||
}, function(e){
|
||||
var characterInfoElement = $(this).find('.' + config.characterImageInfoClass);
|
||||
|
||||
characterInfoElement.velocity('finish').velocity({
|
||||
width: 0
|
||||
},{
|
||||
duration: 150,
|
||||
easing: 'easeInOutSine'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* update all character panels -> set CSS class (e.g. after some panels were added/removed,..)
|
||||
*/
|
||||
var updateCharacterPanels = function(){
|
||||
var characterRows = $('.' + config.characterSelectionClass + ' .pf-dynamic-area').parent();
|
||||
var rowClassIdentifier = ((12 / characterRows.length ) <= 3) ? 3 : (12 / characterRows.length);
|
||||
$(characterRows).removeClass().addClass('col-sm-' + rowClassIdentifier);
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
var 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();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// request character data for each character panel
|
||||
$('.' + config.characterSelectionClass + ' .pf-dynamic-area').each(function(){
|
||||
var characterElement = $(this);
|
||||
|
||||
characterElement.showLoadingAnimation();
|
||||
|
||||
var requestData = {
|
||||
cookie: characterElement.data('cookie')
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.getCookieCharacterData,
|
||||
data: requestData,
|
||||
dataType: 'json',
|
||||
context: {
|
||||
href: characterElement.data('href'),
|
||||
cookieName: requestData.cookie,
|
||||
characterElement: characterElement
|
||||
}
|
||||
}).done(function(responseData, textStatus, request){
|
||||
var characterElement = this.characterElement;
|
||||
characterElement.hideLoadingAnimation();
|
||||
|
||||
if(
|
||||
responseData.error &&
|
||||
responseData.error.length > 0
|
||||
){
|
||||
$('.' + config.dynamicMessageContainerClass).showMessage({
|
||||
type: responseData.error[0].type,
|
||||
title: 'Character verification failed',
|
||||
text: responseData.error[0].message
|
||||
});
|
||||
}
|
||||
|
||||
if(responseData.hasOwnProperty('character')){
|
||||
|
||||
var data = {
|
||||
link: this.href,
|
||||
cookieName: this.cookieName,
|
||||
character: responseData.character
|
||||
};
|
||||
|
||||
requirejs(['text!templates/ui/character_panel.html', 'mustache'], function(template, Mustache) {
|
||||
var content = Mustache.render(template, data);
|
||||
characterElement.html(content);
|
||||
|
||||
// show character panel (animation settings)
|
||||
initCharacterAnimation(characterElement.find('.' + config.characterImageWrapperClass));
|
||||
});
|
||||
}else{
|
||||
// character data not available -> remove panel
|
||||
removeCharacterPanel(this.characterElement);
|
||||
}
|
||||
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var 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
|
||||
*/
|
||||
var handleAjaxErrorResponse = function(jqXHR, status, error){
|
||||
|
||||
var type = status;
|
||||
var title = 'Status ' + jqXHR.status + ': ' + error;
|
||||
var message = '';
|
||||
|
||||
if(jqXHR.responseText){
|
||||
var errorObj = $.parseJSON(jqXHR.responseText);
|
||||
|
||||
if(
|
||||
errorObj.error &&
|
||||
errorObj.error.length > 0
|
||||
){
|
||||
for(var i = 0; i < errorObj.error.length; i++){
|
||||
var 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(){
|
||||
|
||||
// show app information in browser console
|
||||
Util.showVersionInfo();
|
||||
|
||||
// show log off message
|
||||
var isLogOut = location.search.split('logout')[1];
|
||||
if(isLogOut !== undefined){
|
||||
|
||||
// show logout dialog
|
||||
var 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);
|
||||
}
|
||||
}
|
||||
|
||||
// show get registration key dialog
|
||||
var showRegistrationDialog = location.search.split('register')[1];
|
||||
if(showRegistrationDialog !== undefined){
|
||||
showRequestRegistrationKeyDialog();
|
||||
}
|
||||
|
||||
// init "lazy loading" for images
|
||||
$('.' + config.galleryThumbImageClass).lazyload({
|
||||
threshold : 300
|
||||
});
|
||||
|
||||
// hide splash loading animation
|
||||
$('.' + config.splashOverlayClass).hideSplashOverlay();
|
||||
|
||||
// init server status information
|
||||
initServerStatus();
|
||||
|
||||
initCharacterSelect();
|
||||
|
||||
// init carousel
|
||||
initCarousel();
|
||||
|
||||
// init scrollspy
|
||||
initScrollspy();
|
||||
|
||||
// init gallery
|
||||
initGallery();
|
||||
|
||||
// init youtube videos
|
||||
initYoutube();
|
||||
|
||||
// show logo -> hide animation in IGB
|
||||
if( !CCP.isInGameBrowser() ){
|
||||
$('#' + config.logoContainerId).drawLogo(function(){
|
||||
|
||||
// init header animation
|
||||
$('#' + config.headerContainerId).initHeader(function(){
|
||||
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
setPageObserver();
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -1,111 +0,0 @@
|
||||
/**
|
||||
* context menu
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/ccp'
|
||||
], function($, CCP) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$.fn.contextMenu = function (settings) {
|
||||
|
||||
// animation
|
||||
var animationInType = CCP.isInGameBrowser() ? 'fadeIn' : 'transition.flipXIn';
|
||||
var animationInDuration = CCP.isInGameBrowser() ? 0 : 150;
|
||||
var animationOutType = CCP.isInGameBrowser() ? 'fadeOut' : 'transition.flipXOut';
|
||||
var animationOutDuration = CCP.isInGameBrowser() ? 0 : 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();
|
||||
|
||||
var contextMenu = $(settings.menuSelector);
|
||||
|
||||
var menuLiElements = contextMenu.find('li');
|
||||
|
||||
// show all menu entries
|
||||
menuLiElements.show();
|
||||
|
||||
// disable specific menu entries
|
||||
for(var 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(var 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(){
|
||||
// set context menu "click" observer
|
||||
$(this).off('click').one('click', {component: component, position:{x: originalEvent.offsetX, y: originalEvent.offsetY}}, function (e) {
|
||||
// hide contextmenu
|
||||
$(this).hide();
|
||||
|
||||
var params = {
|
||||
selectedMenu: $(e.target),
|
||||
component: e.data.component,
|
||||
position: e.data.position
|
||||
};
|
||||
|
||||
settings.menuSelected.call(this, params);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//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) {
|
||||
var mouseWidth = e.pageX;
|
||||
var pageWidth = $(window).width();
|
||||
var 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) {
|
||||
var mouseHeight = e.pageY;
|
||||
var pageHeight = $(window).height();
|
||||
var menuHeight = $(settings.menuSelector).height();
|
||||
|
||||
// opening menu would pass the bottom of the page
|
||||
if (mouseHeight + menuHeight > pageHeight &&
|
||||
menuHeight < mouseHeight) {
|
||||
return mouseHeight - menuHeight;
|
||||
}
|
||||
return mouseHeight;
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,156 +0,0 @@
|
||||
/**
|
||||
* Map "magnetizing" feature
|
||||
* jsPlumb extension used: http://morrisonpitt.com/farahey/
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'farahey'
|
||||
], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
systemClass: 'pf-system' // class for all systems
|
||||
};
|
||||
|
||||
/**
|
||||
* Cached current "Magnetizer" object
|
||||
* @type {Magnetizer}
|
||||
*/
|
||||
var m8 = null;
|
||||
|
||||
/**
|
||||
* init a jsPlumb (map) Element for "magnetised" function.
|
||||
* this is optional and prevents systems from being overlapped
|
||||
*/
|
||||
$.fn.initMagnetizer = function(){
|
||||
var mapContainer = this;
|
||||
|
||||
var systemsOnMap = mapContainer.find('.' + config.systemClass);
|
||||
|
||||
/**
|
||||
* helper function
|
||||
* get current system offset
|
||||
* @param system
|
||||
* @returns {{left, top}}
|
||||
* @private
|
||||
*/
|
||||
var _offset = function(system) {
|
||||
|
||||
var _ = function(p) {
|
||||
var v = system.style[p];
|
||||
return parseInt(v.substring(0, v.length - 2));
|
||||
};
|
||||
|
||||
return {
|
||||
left:_('left'),
|
||||
top:_('top')
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* helper function
|
||||
* set new syste offset
|
||||
* @param system
|
||||
* @param o
|
||||
* @private
|
||||
*/
|
||||
var _setOffset = function(system, o) {
|
||||
|
||||
var 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
|
||||
*/
|
||||
var _dragFilter = function(id) {
|
||||
|
||||
return !$('#' + id).hasClass('jsPlumb_dragged');
|
||||
};
|
||||
|
||||
// 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: systemsOnMap,
|
||||
filter:_dragFilter,
|
||||
padding:[8, 8]
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$.fn.destroyMagnetizer = function(){
|
||||
var mapContainer = this;
|
||||
|
||||
// remove cached "magnetizer" instance
|
||||
m8 = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* update system positions for "all" systems that are effected by drag&drop
|
||||
* @param map
|
||||
* @param e
|
||||
*/
|
||||
var executeAtEvent = function(map, e){
|
||||
|
||||
// check if magnetizer is active
|
||||
if(m8 !== null && e ){
|
||||
m8.executeAtEvent(e);
|
||||
map.repaintEverything();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* rearrange all systems of a map
|
||||
* needs "magnetization" to be active
|
||||
* @param map
|
||||
*/
|
||||
var executeAtCenter = function(map){
|
||||
if(m8 !== null){
|
||||
m8.executeAtCenter();
|
||||
map.repaintEverything();
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
executeAtCenter: executeAtCenter,
|
||||
executeAtEvent: executeAtEvent
|
||||
};
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,273 +0,0 @@
|
||||
/**
|
||||
* map overlay functions
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util'
|
||||
], function($, Init, Util) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
logTimerCount: 3, // map log timer in seconds
|
||||
|
||||
// map
|
||||
mapWrapperClass: 'pf-map-wrapper', // wrapper div (scrollable)
|
||||
|
||||
// map overlays
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
// overlay options (all available map options shown in overlay)
|
||||
var options = {
|
||||
filter: {
|
||||
title: 'active filter',
|
||||
class: 'pf-map-overlay-filter',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-filter']
|
||||
},
|
||||
mapSnapToGrid: {
|
||||
title: 'active grid',
|
||||
class: 'pf-map-overlay-grid',
|
||||
iconClass: ['glyphicon', 'glyphicon-th']
|
||||
},
|
||||
mapMagnetizer: {
|
||||
title: 'active magnetizer',
|
||||
class: 'pf-map-overlay-magnetizer',
|
||||
iconClass: ['fa', 'fa-fw', 'fa-magnet']
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get map overlay element by type e.g. timer/counter, info - overlay
|
||||
* @param overlayType
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.getMapOverlay = function(overlayType){
|
||||
|
||||
var mapWrapperElement = $(this).parents('.' + config.mapWrapperClass);
|
||||
|
||||
var mapOverlay = null;
|
||||
switch(overlayType){
|
||||
case 'timer':
|
||||
mapOverlay = mapWrapperElement.find('.' + config.mapOverlayTimerClass);
|
||||
break;
|
||||
case 'info':
|
||||
mapOverlay = mapWrapperElement.find('.' + config.mapOverlayInfoClass);
|
||||
break;
|
||||
}
|
||||
|
||||
return mapOverlay;
|
||||
};
|
||||
|
||||
/**
|
||||
* draws the map update counter to the map overlay timer
|
||||
* @param percent
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.setMapUpdateCounter = function(percent, value){
|
||||
|
||||
var mapOverlayTimer = $(this);
|
||||
|
||||
// check if counter already exists
|
||||
var 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 by an overlay
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.getMapCounter = function(){
|
||||
|
||||
var mapOverlayTimer = $(this);
|
||||
|
||||
return mapOverlayTimer.find('.' + Init.classes.pieChart.pieChartMapCounterClass);
|
||||
};
|
||||
|
||||
/**
|
||||
* start the map update counter or reset
|
||||
*/
|
||||
$.fn.startMapUpdateCounter = function(){
|
||||
|
||||
var mapOverlayTimer = $(this);
|
||||
var counterChart = mapOverlayTimer.getMapCounter();
|
||||
|
||||
var maxSeconds = config.logTimerCount;
|
||||
|
||||
var counterChartLabel = counterChart.find('span');
|
||||
|
||||
var percentPerCount = 100 / maxSeconds;
|
||||
|
||||
// update counter
|
||||
var updateChart = function(tempSeconds){
|
||||
var 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
|
||||
var timer = function(){
|
||||
// decrease timer
|
||||
var 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// get current seconds (in case the timer is already running)
|
||||
var currentSeconds = counterChart.data('currentSeconds');
|
||||
|
||||
// start values for timer and chart
|
||||
counterChart.data('currentSeconds', maxSeconds);
|
||||
updateChart(maxSeconds);
|
||||
|
||||
if(
|
||||
currentSeconds === undefined ||
|
||||
currentSeconds < 0
|
||||
){
|
||||
// start timer
|
||||
var mapUpdateCounter = setInterval(timer, 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){
|
||||
var mapOverlayInfo = $(this);
|
||||
|
||||
var showOverlay = false;
|
||||
|
||||
var mapOverlayIconClass = options[option].class;
|
||||
|
||||
// look for the overlay icon that should be updated
|
||||
var iconElement = mapOverlayInfo.find('.' + mapOverlayIconClass);
|
||||
|
||||
if(iconElement){
|
||||
if(viewType === 'show'){
|
||||
showOverlay = true;
|
||||
iconElement.velocity('fadeIn');
|
||||
}else if(viewType === 'hide'){
|
||||
iconElement.hide();
|
||||
|
||||
// check if there is any visible icon remaining
|
||||
var 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 {any|JQuery|*}
|
||||
*/
|
||||
$.fn.initMapOverlays = function(){
|
||||
return this.each(function(){
|
||||
var parentElement = $(this);
|
||||
|
||||
var mapOverlayTimer = $('<div>', {
|
||||
class: [config.mapOverlayClass, config.mapOverlayTimerClass].join(' ')
|
||||
});
|
||||
parentElement.append(mapOverlayTimer);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// add map overlay info. after scrollbar is initialized
|
||||
var mapOverlayInfo = $('<div>', {
|
||||
class: [config.mapOverlayClass, config.mapOverlayInfoClass].join(' ')
|
||||
});
|
||||
|
||||
// add all overlay elements
|
||||
for (var prop in options) {
|
||||
if(options.hasOwnProperty(prop)){
|
||||
mapOverlayInfo.append(
|
||||
$('<i>', {
|
||||
class: options[prop].iconClass.concat( ['pull-right', options[prop].class] ).join(' ')
|
||||
}).attr('title', options[prop].title).tooltip({
|
||||
placement: 'left',
|
||||
container: 'body'
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
parentElement.append(mapOverlayInfo);
|
||||
|
||||
// reset map update timer
|
||||
mapOverlayTimer.setMapUpdateCounter(100, config.logTimerCount);
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,318 +0,0 @@
|
||||
/**
|
||||
* Main map application
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'app/logging',
|
||||
'app/ccp',
|
||||
'app/page',
|
||||
'app/ui/form_element',
|
||||
'app/module_map'
|
||||
], function($, Init, Util, Render, Logging, CCP, Page) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* main init "map" page
|
||||
*/
|
||||
$(function(){
|
||||
// load page
|
||||
$('body').loadPageStructure();
|
||||
|
||||
// show app information in browser console
|
||||
Util.showVersionInfo();
|
||||
|
||||
// init logging
|
||||
Logging.init();
|
||||
|
||||
if( !CCP.isTrusted() ){
|
||||
// show trust message
|
||||
$(document).trigger('pf:showTrustDialog');
|
||||
return;
|
||||
}
|
||||
var mapModule = $('#' + Util.config.mapModuleId);
|
||||
|
||||
// map init load static data =======================================================
|
||||
$.getJSON( Init.path.initMap, function( initData ) {
|
||||
|
||||
|
||||
if( initData.error.length > 0 ){
|
||||
for(var 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.maxSharedCount = initData.maxSharedCount;
|
||||
Init.routes = initData.routes;
|
||||
|
||||
// init tab change observer, Once the timers are available
|
||||
Page.initTabChangeObserver();
|
||||
|
||||
// init map module
|
||||
mapModule.initMapModule();
|
||||
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
|
||||
$(document).trigger('pf:shutdown', {reason: reason});
|
||||
});
|
||||
|
||||
/**
|
||||
* main function for init all map relevant trigger calls
|
||||
*/
|
||||
$.fn.initMapModule = function(){
|
||||
|
||||
var mapModule = $(this);
|
||||
|
||||
// log keys ------------------------------------------------------------------------
|
||||
|
||||
// ajax request update map data
|
||||
var logKeyServerMapData = 'UPDATE_SERVER_MAP';
|
||||
|
||||
// update client map data
|
||||
var logKeyClientMapData = 'UPDATE_CLIENT_MAP';
|
||||
|
||||
// ajax request update map user data
|
||||
var logKeyServerUserData = 'UPDATE_SERVER_USER_DATA';
|
||||
|
||||
// update client map user data
|
||||
var logKeyClientUserData = 'UPDATE_CLIENT_USER_DATA';
|
||||
|
||||
// main update intervals/trigger (heartbeat)
|
||||
var updateTimeouts = {
|
||||
mapUpdate: 0,
|
||||
userUpdate: 0
|
||||
};
|
||||
|
||||
// ping for main map update ========================================================
|
||||
var triggerMapUpdatePing = function(){
|
||||
|
||||
// check each execution time if map module is still available
|
||||
var check = $('#' + mapModule.attr('id')).length;
|
||||
|
||||
if(check === 0){
|
||||
// program crash stop any update
|
||||
return;
|
||||
}
|
||||
|
||||
// get updated map data
|
||||
var updatedMapData = mapModule.getMapModuleDataForUpdate();
|
||||
|
||||
// wrap array to object
|
||||
updatedMapData = {mapData: updatedMapData};
|
||||
|
||||
// start log
|
||||
Util.timeStart(logKeyServerMapData);
|
||||
|
||||
// store updatedMapData
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.updateMapData,
|
||||
data: updatedMapData,
|
||||
dataType: 'json'
|
||||
}).done(function(data){
|
||||
|
||||
// log request time
|
||||
var duration = Util.timeStop(logKeyServerMapData);
|
||||
Util.log(logKeyServerMapData, {duration: duration, type: 'server', description: 'request map data'});
|
||||
|
||||
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.mapData.length === 0){
|
||||
// clear all existing maps
|
||||
mapModule.clearMapModule();
|
||||
|
||||
// no map data available -> show "new map" dialog
|
||||
$(document).trigger('pf:menuShowMapSettings', {tab: 'new'});
|
||||
}else{
|
||||
// map data found
|
||||
|
||||
// start log
|
||||
Util.timeStart(logKeyClientMapData);
|
||||
|
||||
// load/update main map module
|
||||
mapModule.updateMapModule(data.mapData);
|
||||
|
||||
// log client map update time
|
||||
duration = Util.timeStop(logKeyClientMapData);
|
||||
Util.log(logKeyClientMapData, {duration: duration, type: 'client', description: 'update map'});
|
||||
}
|
||||
|
||||
// get the current update delay (this can change if a user is inactive)
|
||||
var mapUpdateDelay = Util.getCurrentTriggerDelay( logKeyServerMapData, 0 );
|
||||
|
||||
// init new trigger
|
||||
updateTimeouts.mapUpdate = setTimeout(function(){
|
||||
triggerMapUpdatePing();
|
||||
}, mapUpdateDelay);
|
||||
|
||||
// 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(function(){
|
||||
triggerUserUpdatePing();
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
}).fail(handleAjaxErrorResponse);
|
||||
};
|
||||
|
||||
// ping for user data update =======================================================
|
||||
var triggerUserUpdatePing = function(){
|
||||
|
||||
// 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
|
||||
//
|
||||
var mapIds = [];
|
||||
var activeMap = Util.getMapModule().getActiveMap();
|
||||
if(activeMap){
|
||||
mapIds = [ activeMap.data('id') ];
|
||||
}
|
||||
|
||||
var updatedUserData = {
|
||||
mapIds: mapIds,
|
||||
systemData: Util.getCurrentSystemData()
|
||||
};
|
||||
|
||||
Util.timeStart(logKeyServerUserData);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.updateUserData,
|
||||
data: updatedUserData,
|
||||
dataType: 'json'
|
||||
}).done(function(data){
|
||||
|
||||
// log request time
|
||||
var 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)
|
||||
var userData = Util.setCurrentUserData(data.userData);
|
||||
|
||||
if(userData.character === undefined){
|
||||
// no active character found -> show settings dialog
|
||||
|
||||
Util.showNotify({title: 'Main character not set', text: 'Check your API data and set a main character', type: 'error'});
|
||||
|
||||
$(document).triggerMenuEvent('ShowSettingsDialog');
|
||||
}
|
||||
|
||||
// store current map user data (cache)
|
||||
if(data.mapUserData !== undefined){
|
||||
Util.setCurrentMapUserData(data.mapUserData);
|
||||
}
|
||||
|
||||
// start log
|
||||
Util.timeStart(logKeyClientUserData);
|
||||
|
||||
// active character data found
|
||||
mapModule.updateMapModuleData();
|
||||
|
||||
// log client user data update time
|
||||
duration = Util.timeStop(logKeyClientUserData);
|
||||
Util.log(logKeyClientUserData, {duration: duration, type: 'client', description:'update users'});
|
||||
|
||||
// update system info panels
|
||||
if(data.system){
|
||||
mapModule.updateSystemModuleData(data.system);
|
||||
}
|
||||
|
||||
// get the current update delay (this can change if a user is inactive)
|
||||
var mapUserUpdateDelay = Util.getCurrentTriggerDelay( logKeyServerUserData, 0 );
|
||||
|
||||
// init new trigger
|
||||
updateTimeouts.userUpdate = setTimeout(function(){
|
||||
triggerUserUpdatePing();
|
||||
}, mapUserUpdateDelay);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}).fail(handleAjaxErrorResponse);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Ajax error response handler function for main-ping functions
|
||||
* @param jqXHR
|
||||
* @param status
|
||||
* @param error
|
||||
*/
|
||||
var handleAjaxErrorResponse = function(jqXHR, status, error){
|
||||
// clear both main update request trigger timer
|
||||
clearUpdateTimeouts();
|
||||
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
var errorData = [];
|
||||
|
||||
if(jqXHR.responseText){
|
||||
var errorObj = $.parseJSON(jqXHR.responseText);
|
||||
|
||||
if(
|
||||
errorObj.error &&
|
||||
errorObj.error.length > 0
|
||||
){
|
||||
errorData = errorObj.error;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).trigger('pf:shutdown', {reason: reason, error: errorData});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* clear both main update timeouts
|
||||
* -> stop program from working -> shutdown
|
||||
*/
|
||||
var clearUpdateTimeouts = function(){
|
||||
for(var intervalKey in updateTimeouts) {
|
||||
|
||||
if(updateTimeouts.hasOwnProperty(intervalKey)){
|
||||
clearTimeout( updateTimeouts[intervalKey] );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// initial start of the map update function
|
||||
triggerMapUpdatePing();
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,769 +0,0 @@
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/map/map',
|
||||
'app/counter',
|
||||
'app/ui/system_info',
|
||||
'app/ui/system_graph',
|
||||
'app/ui/system_signature',
|
||||
'app/ui/system_route',
|
||||
'app/ui/system_killboard',
|
||||
'datatablesTableTools',
|
||||
'datatablesResponsive'
|
||||
], function($, Init, Util, Map) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
|
||||
};
|
||||
|
||||
var mapTabChangeBlocked = false; // flag for preventing map tab switch
|
||||
|
||||
/**
|
||||
* get all maps for a maps module
|
||||
* @param mapModule
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.getMaps = function(){
|
||||
|
||||
var maps = $(this).find('.' + config.mapClass);
|
||||
|
||||
return maps;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the current active map for
|
||||
* @returns {*}
|
||||
*/
|
||||
$.fn.getActiveMap = function(){
|
||||
|
||||
var map = $(this).find('.active.' + config.mapTabContentClass + ' .' + config.mapClass);
|
||||
|
||||
if(map.length === 0){
|
||||
map = false;
|
||||
}
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
/**
|
||||
* set Tab Observer, events are triggered within map.js
|
||||
* @param mapContentModule
|
||||
*/
|
||||
$.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
|
||||
*/
|
||||
var 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
|
||||
*/
|
||||
var drawSystemModules = function(tabContentElement){
|
||||
|
||||
var currentSystemData = Util.getCurrentSystemData();
|
||||
|
||||
// get Table cell for system Info
|
||||
var firstCell = $(tabContentElement).find('.' + config.mapTabContentCellFirst);
|
||||
var 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.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
|
||||
*/
|
||||
var setModuleObserver = function(){
|
||||
|
||||
// toggle height for a module
|
||||
$(document).off('click.toggleModuleHeight').on('click.toggleModuleHeight', '.' + config.moduleClass, function(e){
|
||||
var moduleElement = $(this);
|
||||
// get click position
|
||||
var posX = moduleElement.offset().left;
|
||||
var posY = moduleElement.offset().top;
|
||||
var clickX = e.pageX - posX;
|
||||
var 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 )){
|
||||
var moduleHeight = moduleElement.data('origHeight');
|
||||
moduleElement.velocity('finish').velocity({
|
||||
height: [ moduleHeight + 'px', [ 400, 15 ] ]
|
||||
},{
|
||||
duration: 400,
|
||||
easing: 'easeInSine',
|
||||
complete: function(){
|
||||
moduleElement.removeClass( config.moduleClosedClass );
|
||||
moduleElement.removeData();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
moduleElement.velocity('finish').velocity({
|
||||
height: [ '36px', [ 400, 15 ] ]
|
||||
},{
|
||||
duration: 400,
|
||||
easing: 'easeInSine',
|
||||
complete: function(){
|
||||
moduleElement.addClass( config.moduleClosedClass );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* updates only visible/active map module
|
||||
* @returns {boolean}
|
||||
*/
|
||||
$.fn.updateMapModuleData = function(){
|
||||
var mapModule = $(this);
|
||||
|
||||
// get all active map elements for module
|
||||
var mapElement = mapModule.getActiveMap();
|
||||
|
||||
if(mapElement !== false){
|
||||
var mapId = mapElement.data('id');
|
||||
|
||||
var currentMapUserData = Util.getCurrentMapUserData(mapId);
|
||||
|
||||
// update map with current user data
|
||||
if(currentMapUserData){
|
||||
mapElement.updateUserData(currentMapUserData);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* update system info panels (below map)
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.updateSystemModuleData = function(systemData){
|
||||
var mapModule = $(this);
|
||||
|
||||
if(systemData){
|
||||
// check if current open system is still the requested info system
|
||||
var currentSystemData = Util.getCurrentSystemData();
|
||||
|
||||
if(currentSystemData){
|
||||
if(systemData.id === currentSystemData.systemData.id){
|
||||
// trigger system update event
|
||||
$(document).trigger('pf:updateSystemModules', [systemData]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* load all structure elements into a TabsContent div (tab body)
|
||||
*/
|
||||
$.fn.initContentStructure = function(){
|
||||
|
||||
return this.each(function(){
|
||||
// init bootstrap Grid
|
||||
var 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}
|
||||
*/
|
||||
var getTabElement = function(options){
|
||||
|
||||
var tabElement = $('<div>', {
|
||||
id: config.mapTabElementId
|
||||
});
|
||||
|
||||
var tabBar = $('<ul>', {
|
||||
class: ['nav', 'nav-tabs'].join(' '),
|
||||
id: options.barId
|
||||
}).attr('role', 'tablist');
|
||||
|
||||
var 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){
|
||||
var 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
|
||||
var mapIconElement = tabElement.find('.' + config.mapTabIconClass);
|
||||
mapIconElement.removeClass().addClass([config.mapTabIconClass, 'fa', 'fa-fw', options.icon].join(' '));
|
||||
|
||||
// change "shared" icon
|
||||
var mapSharedIconElement = tabElement.find('.' + config.mapTabSharedIconClass);
|
||||
mapSharedIconElement.hide();
|
||||
|
||||
// check if the map is a "shared" map
|
||||
if(options.access){
|
||||
if(
|
||||
options.access.user.length > 1 ||
|
||||
options.access.corporation.length > 1 ||
|
||||
options.access.alliance.length > 1
|
||||
){
|
||||
mapSharedIconElement.show();
|
||||
}
|
||||
}
|
||||
|
||||
// change map name label
|
||||
var tabLinkTextElement = tabElement.find('.' + config.mapTabLinkTextClass);
|
||||
tabLinkTextElement.text(options.name);
|
||||
|
||||
// change tabClass
|
||||
var listElement = tabElement.parent();
|
||||
|
||||
// new tab classes
|
||||
var 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');
|
||||
}
|
||||
|
||||
var 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){
|
||||
|
||||
var tabElement = $(this);
|
||||
var tabBar = tabElement.find('ul.nav-tabs');
|
||||
var tabContent = tabElement.find('div.tab-content');
|
||||
|
||||
var listElement = $('<li>').attr('role', 'presentation');
|
||||
|
||||
if(options.right === true){
|
||||
listElement.addClass('pull-right');
|
||||
}
|
||||
|
||||
// link element
|
||||
var linkElement = $('<a>').attr('role', 'tab');
|
||||
|
||||
// map icon element
|
||||
var mapIconElement = $('<i>', {
|
||||
class: config.mapTabIconClass
|
||||
});
|
||||
|
||||
// map shared icon element
|
||||
var mapSharedIconElement = $('<i>', {
|
||||
class: [config.mapTabSharedIconClass, 'fa', 'fa-fw', 'fa-share-alt'].join(' '),
|
||||
title: 'shared map'
|
||||
});
|
||||
|
||||
// text element
|
||||
var textElement = $('<span>', {
|
||||
class: config.mapTabLinkTextClass
|
||||
});
|
||||
|
||||
var newListElement = listElement.append(
|
||||
linkElement.append(mapIconElement).append(textElement).append(mapSharedIconElement)
|
||||
);
|
||||
|
||||
tabBar.append( newListElement );
|
||||
|
||||
// update Tab element -> set data
|
||||
linkElement.updateTabData(options);
|
||||
|
||||
// tabs content =======================================================
|
||||
var 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){
|
||||
|
||||
var tabLinkElement = $(this);
|
||||
var mapId = tabLinkElement.data('map-id');
|
||||
|
||||
// ignore "add" tab. no need for map change
|
||||
if(mapId > 0){
|
||||
var 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){
|
||||
|
||||
var tabElement = $(this);
|
||||
|
||||
var linkElement = tabElement.find('a[href="#' + config.mapTabIdPrefix + mapId + '"]');
|
||||
|
||||
var deletedTabName = '';
|
||||
|
||||
if(linkElement.length > 0){
|
||||
deletedTabName = linkElement.find('.' + config.mapTabLinkTextClass).text();
|
||||
|
||||
var liElement = linkElement.parent();
|
||||
var contentElement = tabElement.find('div[id="' + config.mapTabIdPrefix + mapId + '"]');
|
||||
|
||||
var 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(){
|
||||
|
||||
var mapModuleElement = $(this);
|
||||
|
||||
var tabMapElement = $('#' + config.mapTabElementId);
|
||||
|
||||
if(tabMapElement.length > 0){
|
||||
var tabElements = mapModuleElement.getMapTabElements();
|
||||
|
||||
for(var i = 0; i < tabElements.length; i++){
|
||||
var tabElement = $(tabElements[i]);
|
||||
var mapId = tabElement.data('map-id');
|
||||
|
||||
if(mapId > 0){
|
||||
tabMapElement.deleteTab(mapId);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* load/update map module into element (all maps)
|
||||
* @param mapData
|
||||
* @returns {boolean}
|
||||
*/
|
||||
$.fn.updateMapModule = function(mapData){
|
||||
|
||||
if(mapData.length === 0){
|
||||
return true;
|
||||
}
|
||||
|
||||
// store current map data global (cache)
|
||||
// temp store current map data to prevent data-change while function execution!
|
||||
var tempMapData = Util.setCurrentMapData(mapData);
|
||||
|
||||
var mapModuleElement = $(this);
|
||||
|
||||
// check if tabs module is already loaded
|
||||
var tabMapElement = $('#' + config.mapTabElementId);
|
||||
|
||||
// check if tabs have changed
|
||||
var tabsChanged = false;
|
||||
|
||||
if(tabMapElement.length > 0){
|
||||
// tab element already exists
|
||||
var tabElements = mapModuleElement.getMapTabElements();
|
||||
|
||||
// map ID that is currently active
|
||||
var activeMapId = 0;
|
||||
|
||||
// mapIds that are currently active
|
||||
var activeMapIds = [];
|
||||
|
||||
// check whether a tab/map is still active
|
||||
for(var i = 0; i < tabElements.length; i++){
|
||||
var tabElement = $(tabElements[i]);
|
||||
var mapId = tabElement.data('map-id');
|
||||
|
||||
if(mapId > 0){
|
||||
|
||||
var 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
|
||||
var 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
|
||||
|
||||
var 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');
|
||||
}
|
||||
var activeMapData = Util.getCurrentMapData(activeMapId);
|
||||
|
||||
if(activeMapData !== false){
|
||||
// update active map with new mapData
|
||||
var currentTabContentElement = $('#' + config.mapTabIdPrefix + activeMapId);
|
||||
$( currentTabContentElement).loadMap( activeMapData, {} );
|
||||
}
|
||||
}else{
|
||||
// create Tab Element
|
||||
|
||||
tabsChanged = true;
|
||||
|
||||
var options = {
|
||||
barId: config.mapTabBarId
|
||||
};
|
||||
|
||||
tabMapElement = getTabElement(options);
|
||||
|
||||
// add new tab for each map
|
||||
for(var j = 0; j < tempMapData.length; j++){
|
||||
|
||||
var data = tempMapData[j];
|
||||
tabMapElement.addTab(data.config);
|
||||
}
|
||||
|
||||
// add "add" button
|
||||
var tabAddOptions = {
|
||||
id: 0,
|
||||
type: {
|
||||
classTab: Util.getInfoForMap( 'standard', 'classTab')
|
||||
},
|
||||
icon: 'fa-plus',
|
||||
name: 'add',
|
||||
right: true
|
||||
};
|
||||
|
||||
tabMapElement.addTab(tabAddOptions);
|
||||
|
||||
|
||||
mapModuleElement.prepend(tabMapElement);
|
||||
|
||||
// set first Tab active
|
||||
tabMapElement.find('.' + config.mapTabClass + ':first a').tab('show');
|
||||
|
||||
// ==============================================================
|
||||
|
||||
// this new created module
|
||||
var 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();
|
||||
|
||||
// load first map i in first tab content container
|
||||
$( tabContentElements[0] ).loadMap( tempMapData[0], {showAnimation: true} );
|
||||
}
|
||||
|
||||
if(tabsChanged === true){
|
||||
|
||||
// remove previous event handlers
|
||||
var 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) {
|
||||
var mapId = $(e.target).data('map-id');
|
||||
|
||||
if(mapId === 0){
|
||||
// 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) {
|
||||
var mapId = $(e.target).data('map-id');
|
||||
var tabMapData = Util.getCurrentMapData(mapId);
|
||||
|
||||
if(tabMapData !== false){
|
||||
// load map
|
||||
var currentTabContentElement = $('#' + config.mapTabIdPrefix + mapId);
|
||||
|
||||
$( currentTabContentElement).loadMap( tabMapData, {showAnimation: true} );
|
||||
|
||||
// "wake up" scrollbar for map and get previous state back
|
||||
var 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) {
|
||||
|
||||
var newMapId = $(e.relatedTarget).data('map-id');
|
||||
var oldMapId = $(e.target).data('map-id');
|
||||
|
||||
// disable map if new map is selected -> not "add button"
|
||||
if(newMapId > 0){
|
||||
|
||||
var currentTabContentElement = $('#' + config.mapTabIdPrefix + oldMapId);
|
||||
|
||||
// disable scrollbar for map that will be hidden. "freeze" current state
|
||||
var scrollableElement = currentTabContentElement.find('.' + config.mapWrapperClass);
|
||||
$(scrollableElement).mCustomScrollbar( 'disable' );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
var mapElements = $(this).getMaps();
|
||||
|
||||
var data = [];
|
||||
for(var i = 0; i < mapElements.length; i++){
|
||||
// get all changed (system / connection) data from this map
|
||||
var 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;
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,207 +0,0 @@
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'pnotify',
|
||||
//'pnotify.buttons',
|
||||
//'pnotify.confirm',
|
||||
'pnotify.nonblock',
|
||||
'pnotify.desktop',
|
||||
//'pnotify.history',
|
||||
'pnotify.callbacks'
|
||||
], function($, Init, PNotify) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
title: '',
|
||||
text: '',
|
||||
type: '', // 'info', 'success', error, 'warning'
|
||||
icon: false,
|
||||
opacity: 0.8,
|
||||
styling: 'fontawesome', // 'fontawesome', 'bootstrap3', 'jqueryui'
|
||||
animate_speed: 200, // effect animation
|
||||
position_animate_speed: 100, // 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',
|
||||
// animation settings
|
||||
animation: {
|
||||
'effect_in': 'fade',
|
||||
'options_in': {
|
||||
easing: 'linear'
|
||||
},
|
||||
'effect_out': 'fade',
|
||||
'options_out': {
|
||||
easing: 'linear'
|
||||
}
|
||||
},
|
||||
// nonblock extension parameter (click through notifications)
|
||||
nonblock: {
|
||||
nonblock: true,
|
||||
nonblock_opacity: 0.2
|
||||
},
|
||||
// desktop extension "Web Notifications"
|
||||
desktop: {
|
||||
desktop: false, // change for enable
|
||||
icon: Init.path.img + 'notifications/logo.png' // default image for desktop notifications
|
||||
}
|
||||
};
|
||||
|
||||
// stack container for all notifications
|
||||
var stack = {
|
||||
bottomRight: {
|
||||
stack: {
|
||||
dir1: 'up',
|
||||
dir2: 'left',
|
||||
firstpos1: 30,
|
||||
firstpos2: 10,
|
||||
spacing1: 5,
|
||||
spacing2: 5,
|
||||
push: 'bottom'
|
||||
},
|
||||
addclass: 'stack-bottomright',
|
||||
width: '250px',
|
||||
opacity: 0.8
|
||||
},
|
||||
barTop: {
|
||||
stack: {
|
||||
dir1: 'down',
|
||||
dir2: 'right',
|
||||
push: 'top',
|
||||
spacing1: 0,
|
||||
spacing2: 0,
|
||||
|
||||
},
|
||||
addclass: 'stack-bar-top',
|
||||
width: '80%',
|
||||
opacity: 1
|
||||
},
|
||||
barBottom: {
|
||||
stack: {
|
||||
dir1: 'up',
|
||||
dir2: 'right',
|
||||
firstpos1: 30,
|
||||
spacing1: 0,
|
||||
spacing2: 0
|
||||
},
|
||||
addclass: 'stack-bar-bottom',
|
||||
width: '100%',
|
||||
opacity: 1
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* show a notification in browser and/or "Web Notifications" in OS
|
||||
* @param customConfig
|
||||
*/
|
||||
var showNotify = function(customConfig, settings){
|
||||
|
||||
customConfig = $.extend({}, 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);
|
||||
|
||||
}else{
|
||||
customConfig.delay = 5000;
|
||||
customConfig.desktop.desktop = false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
customConfig.opacity = stack[settings.stack].opacity;
|
||||
}else{
|
||||
customConfig.stack = stack.bottomRight.stack;
|
||||
customConfig.addclass = stack.bottomRight.addclass;
|
||||
customConfig.opacity = stack.bottomRight.opacity;
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
var startTabBlink = function(blinkTitle){
|
||||
|
||||
var initBlink = (function(blinkTitle){
|
||||
|
||||
var currentTitle = document.title;
|
||||
|
||||
var timeoutId;
|
||||
var blink = function(){
|
||||
document.title = document.title === blinkTitle ? currentTitle : blinkTitle;
|
||||
};
|
||||
|
||||
var clear = function() {
|
||||
clearInterval(timeoutId);
|
||||
document.title = currentTitle;
|
||||
window.onmousemove = null;
|
||||
timeoutId = null;
|
||||
};
|
||||
|
||||
return function () {
|
||||
if (!timeoutId) {
|
||||
timeoutId = setInterval(blink, 1000);
|
||||
window.onmousemove = clear;
|
||||
}
|
||||
};
|
||||
|
||||
}( blinkTitle ));
|
||||
|
||||
initBlink();
|
||||
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
showNotify: showNotify,
|
||||
startTabBlink: startTabBlink
|
||||
};
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
};
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* Main setupPage application
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util'
|
||||
], function($, Init, Util) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
splashOverlayClass: 'pf-splash' // class for "splash" overlay
|
||||
};
|
||||
|
||||
/**
|
||||
* set page observer
|
||||
*/
|
||||
var setPageObserver = function(){
|
||||
|
||||
// collapse ---------------------------------------
|
||||
$('body').find('[data-toggle="collapse"]').css({cursor: 'pointer'}).on('click', function(){
|
||||
$(this).find('.pf-animate-rotate').toggleClass('right');
|
||||
});
|
||||
|
||||
// buttons ----------------------------------------
|
||||
$('body').find('.btn').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);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* main init "setup" page
|
||||
*/
|
||||
$(function(){
|
||||
|
||||
// show app information in browser console --------
|
||||
Util.showVersionInfo();
|
||||
|
||||
// hide splash loading animation ------------------
|
||||
$('.' + config.splashOverlayClass).hideSplashOverlay();
|
||||
|
||||
setPageObserver();
|
||||
});
|
||||
});
|
||||
@@ -1,314 +0,0 @@
|
||||
/**
|
||||
* 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);
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,210 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
|
||||
// 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
|
||||
* @param options
|
||||
* @returns {boolean}
|
||||
*/
|
||||
$.fn.showSettingsDialog = function(options){
|
||||
|
||||
// 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,
|
||||
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 weather 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[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
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* 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: $('body').data('version')
|
||||
};
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,116 +0,0 @@
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* jump info dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var 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) {
|
||||
|
||||
var data = {};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
var signatureReaderDialog = bootbox.dialog({
|
||||
className: config.jumpInfoDialogClass,
|
||||
title: 'Wormhole jump information',
|
||||
message: content
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,172 +0,0 @@
|
||||
/**
|
||||
* map manual dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var 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) {
|
||||
|
||||
var data = {
|
||||
dialogNavigationClass: config.dialogNavigationClass,
|
||||
dialogNavLiClass: config.dialogNavigationListItemClass,
|
||||
scrollspyId: config.mapManualScrollspyId,
|
||||
pieChartClass : Init.classes.pieChart.pieChartMapCounterClass,
|
||||
mapCounterClass : Init.classes.pieChart.pieChartMapCounterClass
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
// show dialog
|
||||
var 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
|
||||
var modalOffsetTop = 200;
|
||||
|
||||
// disable on scroll event
|
||||
var disableOnScrollEvent = false;
|
||||
|
||||
// scroll breakpoints
|
||||
var scrolLBreakpointElements = null;
|
||||
// scroll navigation links
|
||||
var scrollNavLiElements = null;
|
||||
|
||||
mapManualDialog.on('shown.bs.modal', function(e) {
|
||||
// modal on open
|
||||
scrolLBreakpointElements = $('.pf-manual-scroll-break');
|
||||
scrollNavLiElements = $('.' + config.dialogNavigationListItemClass);
|
||||
});
|
||||
|
||||
var scrollspyElement = $('#' + config.mapManualScrollspyId);
|
||||
|
||||
var whileScrolling = function(){
|
||||
|
||||
if(disableOnScrollEvent === false){
|
||||
for(var i = 0; i < scrolLBreakpointElements.length; i++){
|
||||
var 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
|
||||
var mainNavigationLinks = $('.' + config.dialogNavigationClass).find('a');
|
||||
// text anchor links
|
||||
var subNavigationLinks = scrollspyElement.find('a[data-target]');
|
||||
|
||||
var navigationLinks = mainNavigationLinks.add(subNavigationLinks);
|
||||
|
||||
navigationLinks.on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
disableOnScrollEvent = true;
|
||||
|
||||
// scroll to anchor
|
||||
scrollspyElement.mCustomScrollbar("scrollTo", $(this).attr('data-target'));
|
||||
|
||||
var 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
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,869 +0,0 @@
|
||||
/**
|
||||
* map info dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/ccp',
|
||||
'bootbox'
|
||||
], function($, Init, Util, CCP, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
|
||||
systemIdPrefix: 'pf-system-', // id prefix for a system
|
||||
|
||||
loadingOptions: { // config for loading overlay
|
||||
icon: {
|
||||
size: 'fa-2x'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// confirmation dialog settings (e.g. delete row)
|
||||
var 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){
|
||||
|
||||
var mapElement = $(this);
|
||||
|
||||
mapElement.empty();
|
||||
|
||||
mapElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
var countSystems = mapData.data.systems.length;
|
||||
var countConnections = mapData.data.connections.length;
|
||||
|
||||
// map type
|
||||
var mapTypes = Util.getMapTypes();
|
||||
var mapTypeName = '';
|
||||
var mapTypeClass = '';
|
||||
for(var i = 0; i < mapTypes.length; i++){
|
||||
if(mapTypes[i].id === mapData.config.type.id){
|
||||
mapTypeName = mapTypes[i].name;
|
||||
mapTypeClass = mapTypes[i].class;
|
||||
}
|
||||
}
|
||||
|
||||
var 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: mapTypeClass
|
||||
}).text( mapTypeName )
|
||||
);
|
||||
|
||||
mapElement.append(dlElementLeft);
|
||||
|
||||
var 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>').text( countSystems )
|
||||
).append(
|
||||
$('<dt>').text( 'Connections' )
|
||||
).append(
|
||||
$('<dd>').text( countConnections )
|
||||
);
|
||||
|
||||
mapElement.append(dlElementRight);
|
||||
|
||||
// init map lifetime counter
|
||||
$('.' + config.mapInfoLifetimeCounterClass).initTimestampCounter();
|
||||
|
||||
|
||||
|
||||
mapElement.hideLoadingAnimation();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* loads the system info table into an element
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.loadSystemInfoTable = function(mapData){
|
||||
|
||||
var systemsElement = $(this);
|
||||
|
||||
systemsElement.empty();
|
||||
|
||||
var 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
|
||||
var tooltipElements = systemsElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
});
|
||||
|
||||
// prepare data for dataTables
|
||||
var systemsData = [];
|
||||
for(var i = 0; i < mapData.data.systems.length; i++){
|
||||
var tempSystemData = mapData.data.systems[i];
|
||||
|
||||
var 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: Util.getSystemTypeInfo(tempSystemData.type.id, 'name'),
|
||||
type_sort: tempSystemData.type.id
|
||||
};
|
||||
|
||||
// security
|
||||
var securityClass = Util.getSecurityClassForSystem(tempSystemData.security);
|
||||
tempData.security = {
|
||||
security: '<span class="' + securityClass + '">' + tempSystemData.security + '</span>',
|
||||
security_sort: tempSystemData.security
|
||||
};
|
||||
|
||||
// name
|
||||
tempData.name = tempSystemData.name;
|
||||
|
||||
// region
|
||||
tempData.region = tempSystemData.region.name;
|
||||
|
||||
// static
|
||||
var statics = [];
|
||||
for(var j = 0; j < tempSystemData.statics.length; j++){
|
||||
var security = tempSystemData.statics[j].security;
|
||||
var secClass = Util.getSecurityClassForSystem(security);
|
||||
statics.push('<span class="' + secClass + '">' + security + '</span>');
|
||||
}
|
||||
tempData.static = statics.join(' ');
|
||||
|
||||
// status
|
||||
var 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
|
||||
var systemEffectClass = Util.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
|
||||
var 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);
|
||||
}
|
||||
|
||||
var 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: [
|
||||
{ name: 'desktop', width: Infinity },
|
||||
{ name: 'tablet', width: 1200 },
|
||||
{ name: 'fablet', width: 780 },
|
||||
{ name: 'phone', width: 480 }
|
||||
],
|
||||
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: '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
|
||||
var diff = new Date().getTime() - cellData * 1000;
|
||||
var 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) {
|
||||
var tempTableElement = this;
|
||||
|
||||
var tempConfirmationSettings = confirmationSettings;
|
||||
tempConfirmationSettings.title = 'Delete system';
|
||||
tempConfirmationSettings.onConfirm = function(e, target){
|
||||
var deleteRowElement = $(target).parents('tr');
|
||||
|
||||
var activeMap = Util.getMapModule().getActiveMap();
|
||||
var systemElement = $('#' + config.systemIdPrefix + mapData.config.id + '-' + rowData.id);
|
||||
|
||||
if(systemElement){
|
||||
// trigger system delete event
|
||||
activeMap.trigger('pf:deleteSystems', [{
|
||||
systems: [systemElement],
|
||||
callback: function(){
|
||||
// callback function after ajax "delete" success
|
||||
// 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) ------------------------------
|
||||
var connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
var mapDataNew = activeMap.getMapDataFromClient({forceData: true});
|
||||
|
||||
connectionsElement.loadConnectionInfoTable(mapDataNew);
|
||||
}
|
||||
}]);
|
||||
}
|
||||
};
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(tempConfirmationSettings);
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* loads the connection info table into an element
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.loadConnectionInfoTable = function(mapData){
|
||||
var connectionsElement = $(this);
|
||||
|
||||
connectionsElement.empty();
|
||||
|
||||
var 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
|
||||
var connectionData = [];
|
||||
for(var j = 0; j < mapData.data.connections.length; j++){
|
||||
var tempConnectionData = mapData.data.connections[j];
|
||||
|
||||
var tempConData = {};
|
||||
|
||||
tempConData.id = tempConnectionData.id;
|
||||
|
||||
tempConData.scope = {
|
||||
scope: Util.getScopeInfoForConnection(tempConnectionData.scope, 'label'),
|
||||
scope_sort: tempConnectionData.scope
|
||||
};
|
||||
|
||||
// source system name
|
||||
tempConData.source = tempConnectionData.sourceName;
|
||||
|
||||
// connection
|
||||
var connectionClasses = [];
|
||||
for(var k = 0; k < tempConnectionData.type.length; k++){
|
||||
connectionClasses.push( Util.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);
|
||||
}
|
||||
|
||||
var 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
|
||||
var diff = new Date().getTime() - cellData * 1000;
|
||||
var 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) {
|
||||
var tempTableElement = this;
|
||||
|
||||
var tempConfirmationSettings = confirmationSettings;
|
||||
tempConfirmationSettings.title = 'Delete connection';
|
||||
tempConfirmationSettings.onConfirm = function(e, target){
|
||||
var deleteRowElement = $(target).parents('tr');
|
||||
|
||||
// deleteSignatures(row);
|
||||
var 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);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.loadUsersInfoTable = function(mapData){
|
||||
var usersElement = $(this);
|
||||
|
||||
usersElement.empty();
|
||||
|
||||
var 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();
|
||||
});
|
||||
|
||||
// users table ========================================================
|
||||
// prepare users data for dataTables
|
||||
var currentMapUserData = Util.getCurrentMapUserData( mapData.config.id );
|
||||
var usersData = [];
|
||||
|
||||
if(
|
||||
currentMapUserData &&
|
||||
currentMapUserData.data &&
|
||||
currentMapUserData.data.systems
|
||||
){
|
||||
for(var i = 0; i < currentMapUserData.data.systems.length; i++){
|
||||
var tempSystemUserData = currentMapUserData.data.systems[i];
|
||||
for(var j = 0; j < tempSystemUserData.user.length; j++){
|
||||
usersData.push( tempSystemUserData.user[j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var userDataTable = userTable.dataTable( {
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [ 1, '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: ['text-center', config.tableImageCellClass].join(' '),
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Render/' + data.typeId + '_32.png" />';
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 1,
|
||||
title: 'ship',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: 'typeName',
|
||||
sort: 'typeName'
|
||||
}
|
||||
},{
|
||||
targets: 2,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: [config.tableImageCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Character/' + data + '_32.jpg" />';
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 3,
|
||||
title: 'pilot',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'name'
|
||||
},{
|
||||
targets: 4,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: [config.tableImageCellClass, config.tableImageSmallCellClass].join(' '),
|
||||
data: 'corporation',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Corporation/' + data.id + '_32.png" />';
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
title: 'corporation',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'corporation',
|
||||
render: {
|
||||
_: 'name'
|
||||
}
|
||||
},{
|
||||
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'
|
||||
}
|
||||
},{
|
||||
targets: 8,
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '26px',
|
||||
className: ['text-center', config.tableActionCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<i class="fa fa-fw fa-comment"></i>';
|
||||
}
|
||||
},
|
||||
visible: (CCP.isInGameBrowser() === true),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
||||
$(cell).on('click', function(e) {
|
||||
CCPEVE.startConversation(cellData);
|
||||
});
|
||||
}
|
||||
},{
|
||||
targets: 9,
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '26px',
|
||||
className: ['text-center', config.tableImageCellClass, config.tableImageSmallCellClass, config.tableActionCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Type/20070_32.png" />';
|
||||
}
|
||||
},
|
||||
visible: (CCP.isInGameBrowser() === true),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
||||
$(cell).on('click', function(e) {
|
||||
CCPEVE.inviteToFleet(cellData);
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the map information modal dialog
|
||||
*/
|
||||
$.fn.showMapInfoDialog = function(){
|
||||
|
||||
var activeMap = Util.getMapModule().getActiveMap();
|
||||
var mapData = activeMap.getMapDataFromClient({forceData: true});
|
||||
|
||||
if(mapData !== false){
|
||||
requirejs(['text!templates/dialog/map_info.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var 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
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
var 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
|
||||
|
||||
var mapElement = $('#' + config.mapInfoId);
|
||||
var systemsElement = $('#' + config.mapInfoSystemsId);
|
||||
var connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
var usersElement = $('#' + config.mapInfoUsersId);
|
||||
|
||||
|
||||
// set refresh button observer
|
||||
$('#' + config.dialogMapInfoRefreshId).on('click', function(){
|
||||
var menuAction = $(this).attr('data-action');
|
||||
if(menuAction === 'refresh'){
|
||||
// get new map data
|
||||
var 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);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,611 +0,0 @@
|
||||
/**
|
||||
* map settings dialogs
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/ccp'
|
||||
], function($, Init, Util, Render, bootbox, CCP) {
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
|
||||
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}
|
||||
*/
|
||||
var formatFilename = function(filename){
|
||||
filename = filename.replace(/[^a-zA-Z0-9]/g,'_');
|
||||
|
||||
var nowDate = new Date();
|
||||
var 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
|
||||
var mapInfoDialogElement = $('#' + config.newMapDialogId);
|
||||
if(!mapInfoDialogElement.is(':visible')){
|
||||
|
||||
requirejs([
|
||||
'text!templates/dialog/map.html',
|
||||
'text!templates/form/map_settings.html',
|
||||
'mustache'
|
||||
], function(templateMapDialog, templateMapSettings, Mustache) {
|
||||
|
||||
var dialogTitle = 'Map settings';
|
||||
|
||||
// if there are no maps -> hide settings tab
|
||||
var hideSettingsTab = false;
|
||||
var hideEditTab = false;
|
||||
var hideDownloadTab = false;
|
||||
|
||||
if(mapData === false){
|
||||
hideSettingsTab = true;
|
||||
hideEditTab = true;
|
||||
hideDownloadTab = true;
|
||||
}
|
||||
|
||||
// available map "types" for a new or existing map
|
||||
var mapTypes = Util.getMapTypes(true);
|
||||
|
||||
var data = {
|
||||
scope: Util.getMapScopes(),
|
||||
type: mapTypes,
|
||||
icon: Util.getMapIcons(),
|
||||
formErrorContainerClass: Util.config.formErrorContainerClass,
|
||||
formWarningContainerClass: Util.config.formWarningContainerClass,
|
||||
formInfoContainerClass: Util.config.formInfoContainerClass
|
||||
};
|
||||
|
||||
// render "new map" tab content -------------------------------------------
|
||||
var contentNewMap = Mustache.render(templateMapSettings, data);
|
||||
|
||||
// render "edit map" tab content ------------------------------------------
|
||||
var contentEditMap = Mustache.render(templateMapSettings, data);
|
||||
contentEditMap = $(contentEditMap);
|
||||
|
||||
// current map access info
|
||||
var accessCharacter = [];
|
||||
var accessCorporation = [];
|
||||
var accessAlliance = [];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// render main dialog -----------------------------------------------------
|
||||
data = {
|
||||
id: config.newMapDialogId,
|
||||
mapData: mapData,
|
||||
type: mapTypes,
|
||||
isInGameBrowser: CCP.isInGameBrowser(),
|
||||
|
||||
// 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 --------------
|
||||
characterSelectId: config.characterSelectId,
|
||||
corporationSelectId: config.corporationSelectId,
|
||||
allianceSelectId: config.allianceSelectId,
|
||||
|
||||
// map access objects --------
|
||||
accessCharacter: accessCharacter,
|
||||
accessCorporation: accessCorporation,
|
||||
accessAlliance: accessAlliance,
|
||||
|
||||
// access limitations --------
|
||||
maxCharacter: Init.maxSharedCount.character,
|
||||
maxCorporation: Init.maxSharedCount.corporation,
|
||||
maxAlliance: Init.maxSharedCount.alliance,
|
||||
|
||||
// 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) {
|
||||
var filename = render(mapName);
|
||||
return formatFilename(filename);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var contentDialog = Mustache.render(templateMapDialog, data);
|
||||
contentDialog = $(contentDialog);
|
||||
|
||||
// set tab content
|
||||
$('#' + config.dialogMapCreateContainerId, contentDialog).html(contentNewMap);
|
||||
$('#' + config.dialogMapEditContainerId, contentDialog).html(contentEditMap);
|
||||
|
||||
// disable modal focus event -> otherwise select2 is not working! -> quick fix
|
||||
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
|
||||
|
||||
var 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
|
||||
var form = $('#' + config.newMapDialogId).find('form').filter(':visible');
|
||||
|
||||
// validate form
|
||||
form.validator('validate');
|
||||
|
||||
// validate select2 fields (settings tab)
|
||||
form.find('select').each(function(){
|
||||
var selectField = $(this);
|
||||
var selectValues = selectField.val();
|
||||
|
||||
if(selectValues === null){
|
||||
selectField.parents('.form-group').addClass('has-error');
|
||||
}else{
|
||||
selectField.parents('.form-group').removeClass('has-error');
|
||||
}
|
||||
});
|
||||
|
||||
// check weather the form is valid
|
||||
var formValid = form.isValidForm();
|
||||
|
||||
if(formValid === true){
|
||||
|
||||
// lock dialog
|
||||
var dialogContent = mapInfoDialog.find('.modal-content');
|
||||
dialogContent.showLoadingAnimation();
|
||||
|
||||
var newMapData = {formData: form.getFormValues()};
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: Init.path.saveMap,
|
||||
data: newMapData,
|
||||
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
|
||||
var 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) {
|
||||
var 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();
|
||||
|
||||
// events for tab change
|
||||
mapInfoDialog.find('.navbar a').on('shown.bs.tab', function(e){
|
||||
|
||||
var selectElementCharacter = mapInfoDialog.find('#' + config.characterSelectId);
|
||||
var selectElementCorporation = mapInfoDialog.find('#' + config.corporationSelectId);
|
||||
var 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();
|
||||
}
|
||||
});
|
||||
|
||||
// show form messages -------------------------------------
|
||||
// get current active form(tab)
|
||||
var 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" ========================================================================
|
||||
var downloadTabElement = mapInfoDialog.find('#' + config.dialogMapDownloadContainerId);
|
||||
if(downloadTabElement.length){
|
||||
// tab exists
|
||||
|
||||
// export map data ------------------------------------------------------------------------
|
||||
downloadTabElement.find('#' + config.buttonExportId).on('click', { mapData: mapData }, function(e){
|
||||
|
||||
var exportForm = $('#' + config.dialogMapExportFormId);
|
||||
var validExportForm = exportForm.isValidForm();
|
||||
|
||||
if(validExportForm){
|
||||
// set map data right before download
|
||||
$(this).setExportMapData(e.data.mapData);
|
||||
}else{
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// import map data ------------------------------------------------------------------------
|
||||
// check if "FileReader" API is supported
|
||||
var 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();
|
||||
|
||||
var infoContainerElement = importFormElement.find('#' + config.dialogMapImportInfoId);
|
||||
infoContainerElement.hide().empty();
|
||||
importFormElement.hideFormMessage('all');
|
||||
|
||||
var output = [];
|
||||
var files = e.target.files;
|
||||
|
||||
for (var 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
|
||||
var importData = {};
|
||||
importData.mapData = [];
|
||||
var files = [];
|
||||
var filesCount = 0;
|
||||
var filesCountFail = 0;
|
||||
|
||||
// onLoad for FileReader API
|
||||
var 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);
|
||||
}
|
||||
};
|
||||
|
||||
var handleDragOver = function(dragEvent) {
|
||||
dragEvent.stopPropagation();
|
||||
dragEvent.preventDefault();
|
||||
dragEvent.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
|
||||
};
|
||||
|
||||
var handleFileSelect = function(evt){
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
|
||||
importData = importFormElement.getFormValues();
|
||||
importData.mapData = [];
|
||||
filesCount = 0;
|
||||
filesCountFail = 0;
|
||||
|
||||
files = evt.dataTransfer.files; // FileList object.
|
||||
|
||||
for (var file; !!(file = files[filesCount]); filesCount++){
|
||||
var reader = new FileReader();
|
||||
reader.onload = readerOnLoad;
|
||||
reader.readAsText(file);
|
||||
}
|
||||
};
|
||||
|
||||
var 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');
|
||||
var validImportForm = importFormElement.isValidForm();
|
||||
|
||||
if(validImportForm){
|
||||
importData = importFormElement.getFormValues();
|
||||
importData.mapData = [];
|
||||
|
||||
var fileElement = downloadTabElement.find('#' + config.fieldImportId);
|
||||
files = fileElement[0].files;
|
||||
filesCount = 0;
|
||||
filesCountFail = 0;
|
||||
|
||||
for (var file; !!(file = files[filesCount]); filesCount++){
|
||||
var 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.'}]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* import new map(s) data
|
||||
* @param importData
|
||||
*/
|
||||
var importMaps = function(importData){
|
||||
|
||||
var importForm = $('#' + config.dialogMapImportFormId);
|
||||
importForm.hideFormMessage('all');
|
||||
|
||||
// lock dialog
|
||||
var 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
|
||||
|
||||
Util.showNotify({title: 'Import finished', text: 'Map(s) imported', type: 'success'});
|
||||
}
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var 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){
|
||||
|
||||
var fieldExport = $('#' + config.fieldExportId);
|
||||
var filename = '';
|
||||
var mapDataEncoded = '';
|
||||
|
||||
if(fieldExport.length){
|
||||
filename = fieldExport.val();
|
||||
|
||||
if(filename.length > 0){
|
||||
// remove object properties that should not be included in export
|
||||
// -> e.g. jsPlumb object,...
|
||||
var allowedKeys = ['config', 'data'];
|
||||
|
||||
var replace = function(obj, keys) {
|
||||
var dup = {};
|
||||
for (var key in obj) {
|
||||
if (keys.indexOf(key) !== -1) {
|
||||
dup[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return dup;
|
||||
};
|
||||
|
||||
mapDataEncoded = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify( replace(mapData, allowedKeys) ));
|
||||
}
|
||||
}
|
||||
|
||||
return this.each(function(){
|
||||
var exportButton = $(this);
|
||||
exportButton.attr('href', 'data:' + mapDataEncoded);
|
||||
exportButton.attr('download', filename + '.json');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* init select2 fields within the settings dialog
|
||||
* @param mapInfoDialog
|
||||
*/
|
||||
var initSettingsSelectFields = function(mapInfoDialog){
|
||||
|
||||
var selectElementCharacter = mapInfoDialog.find('#' + config.characterSelectId);
|
||||
var selectElementCorporation = mapInfoDialog.find('#' + config.corporationSelectId);
|
||||
var selectElementAlliance = mapInfoDialog.find('#' + config.allianceSelectId);
|
||||
|
||||
// init character select live search
|
||||
selectElementCharacter.initAccessSelect({
|
||||
type: 'character',
|
||||
maxSelectionLength: Init.maxSharedCount.character
|
||||
});
|
||||
|
||||
// init corporation select live search
|
||||
selectElementCorporation.initAccessSelect({
|
||||
type: 'corporation',
|
||||
maxSelectionLength: Init.maxSharedCount.corporation
|
||||
});
|
||||
|
||||
// init alliance select live search
|
||||
selectElementAlliance.initAccessSelect({
|
||||
type: 'alliance',
|
||||
maxSelectionLength: Init.maxSharedCount.alliance
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the delete map Dialog
|
||||
* @param mapData
|
||||
*/
|
||||
$.fn.showDeleteMapDialog = function(mapData){
|
||||
|
||||
var mapName = mapData.config.name;
|
||||
|
||||
var mapDeleteDialog = bootbox.confirm('Delete map "' + mapName + '"?', function(result){
|
||||
if(result){
|
||||
|
||||
var 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'});
|
||||
|
||||
$(mapDeleteDialog).modal('hide');
|
||||
}).fail(function( jqXHR, status, error) {
|
||||
var reason = status + ' ' + error;
|
||||
Util.showNotify({title: jqXHR.status + ': deleteMap', text: reason, type: 'warning'});
|
||||
$(document).setProgramStatus('problem');
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* notification dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/ccp',
|
||||
'app/render',
|
||||
'bootbox'
|
||||
], function($, Init, Util, CCP, Render, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var 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 pageElement
|
||||
*/
|
||||
var showPageContent = function(dialog){
|
||||
|
||||
var headlineElement = dialog.find('h1');
|
||||
|
||||
// don´t show animation in IGB
|
||||
if( !CCP.isInGameBrowser() ){
|
||||
headlineElement.delay(300).velocity('transition.shrinkIn', {
|
||||
duration: 500
|
||||
}).delay(800);
|
||||
|
||||
headlineElement.velocity({
|
||||
scale: 1.05
|
||||
}, {
|
||||
duration: 600,
|
||||
loop: 5
|
||||
});
|
||||
}else{
|
||||
headlineElement.css({opacity: 1});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* show "notification" dialog
|
||||
* @param dialogData
|
||||
*/
|
||||
$.fn.showNotificationDialog = function(dialogData){
|
||||
|
||||
// check if there is already a notification dialog open
|
||||
var notificationDialogClassDialoges = $('.' + config.notificationDialogClass);
|
||||
|
||||
if(notificationDialogClassDialoges.length === 0){
|
||||
|
||||
// close all modals
|
||||
$('.modal').modal('hide');
|
||||
|
||||
requirejs(['text!templates/dialog/notification.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
id: config.notificationDialogId,
|
||||
content: dialogData.content
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
// show dialog
|
||||
var 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
|
||||
var dialog = $(this);
|
||||
|
||||
dialog.find('.bootbox-close-button').remove();
|
||||
dialog.find('button').blur();
|
||||
|
||||
// show error message
|
||||
showPageContent(dialog);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
@@ -1,98 +0,0 @@
|
||||
/**
|
||||
* 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(){
|
||||
|
||||
requirejs(['text!templates/dialog/releases.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
test: 'blaBla'
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,106 +0,0 @@
|
||||
/**
|
||||
* system effects dialog
|
||||
*/
|
||||
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
], function($, Init, Util, Render, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// system effect dialog
|
||||
systemEffectDialogWrapperClass: 'pf-system-effect-dialog-wrapper' // class for system effect dialog
|
||||
};
|
||||
|
||||
var cache = {
|
||||
systemEffectDialog: false // system effect info dialog
|
||||
};
|
||||
|
||||
/**
|
||||
* show system effect dialog
|
||||
*/
|
||||
$.fn.showSystemEffectInfoDialog = function(){
|
||||
|
||||
// cache table structure
|
||||
if(!cache.systemEffectDialog){
|
||||
|
||||
var dialogWrapperElement = $('<div>', {
|
||||
class: config.systemEffectDialogWrapperClass
|
||||
});
|
||||
|
||||
var systemEffectData = Util.getSystemEffectData();
|
||||
|
||||
$.each( systemEffectData.wh, function( effectName, effectData ) {
|
||||
|
||||
var table = $('<table>', {
|
||||
class: ['table', 'table-condensed'].join(' ')
|
||||
});
|
||||
|
||||
var tbody = $('<tbody>');
|
||||
var thead = $('<thead>');
|
||||
|
||||
var rows = [];
|
||||
|
||||
// get formatted system effect name
|
||||
var systemEffectName = Util.getEffectInfoForSystem(effectName, 'name');
|
||||
var systemEffectClass = Util.getEffectInfoForSystem(effectName, 'class');
|
||||
|
||||
$.each( effectData, function( areaId, areaData ) {
|
||||
|
||||
var systemType = 'C' + areaId;
|
||||
var 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
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,138 +0,0 @@
|
||||
/**
|
||||
* set IGB trust dialog
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render',
|
||||
'bootbox',
|
||||
'app/ccp'
|
||||
], function($, Init, Util, Render, bootbox, CCP) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
|
||||
// trust dialog
|
||||
trustDialogId: 'pf-trust-dialog', // id for "trust" dialog
|
||||
trustDialogFirstPageId: 'pf-trust-first-page', // id for first page
|
||||
trustDialogSecondPageId: 'pf-trust-second-page' // id for second page
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* show/animate dialog page content
|
||||
* @param pageElement
|
||||
*/
|
||||
var showPageContent = function(pageElement){
|
||||
|
||||
pageElement.find('h1').delay(300).velocity('transition.shrinkIn', {
|
||||
duration: 500
|
||||
}).delay(800);
|
||||
|
||||
pageElement.find('h1').velocity({
|
||||
scale: 1.05
|
||||
}, {
|
||||
duration: 600,
|
||||
loop: 5
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* show "trust" dialog
|
||||
*/
|
||||
$.fn.showTrustDialog = function(){
|
||||
|
||||
requirejs(['text!templates/dialog/trust.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
id: config.trustDialogId,
|
||||
firstPageId: config.trustDialogFirstPageId,
|
||||
secondPageId: config.trustDialogSecondPageId
|
||||
};
|
||||
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
|
||||
|
||||
// show dialog
|
||||
var trustDialog = bootbox.dialog({
|
||||
title: 'Trust Page',
|
||||
message: content,
|
||||
buttons: {
|
||||
logout: {
|
||||
label: '<i class="fa fa-fw fa-power-off"></i> logout',
|
||||
className: ['btn-default', 'pull-left'].join(' '),
|
||||
callback: function() {
|
||||
|
||||
$(document).trigger('pf:menuLogout');
|
||||
}
|
||||
},
|
||||
trust: {
|
||||
label: '<i class="fa fa-fw fa-lock"></i> set "Trust"',
|
||||
className: 'btn-primary',
|
||||
callback: function(){
|
||||
var dialog = $(this);
|
||||
|
||||
// request trust
|
||||
CCP.requestTrust();
|
||||
|
||||
var firstPageElement = dialog.find('#' + config.trustDialogFirstPageId);
|
||||
var secondPageElement = dialog.find('#' + config.trustDialogSecondPageId);
|
||||
|
||||
// toggle buttons
|
||||
dialog.find('.btn-primary').hide();
|
||||
dialog.find('.btn-success').removeClass('hide');
|
||||
|
||||
|
||||
// toggle pages
|
||||
firstPageElement.velocity('slideUp', {
|
||||
duration: Init.animationSpeed.dialogEvents,
|
||||
complete: function(){
|
||||
secondPageElement.velocity('slideDown', {
|
||||
duration: Init.animationSpeed.dialogEvents,
|
||||
display: 'block'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// show reload button
|
||||
showPageContent(secondPageElement);
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
reload: {
|
||||
label: '<i class="fa fa-fw fa-repeat"></i> reload',
|
||||
className: ['btn-success', 'hide'].join(' '),
|
||||
callback: function(){
|
||||
// reload page
|
||||
location.reload();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
trustDialog.on('shown.bs.modal', function(e) {
|
||||
// remove close button
|
||||
var dialog = $(this);
|
||||
|
||||
dialog.find('.bootbox-close-button').remove();
|
||||
dialog.find('button').blur();
|
||||
|
||||
// show trust message
|
||||
var firstPageElement = dialog.find('#' + config.trustDialogFirstPageId);
|
||||
showPageContent(firstPageElement);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
@@ -1,274 +0,0 @@
|
||||
/**
|
||||
* form elements
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util'
|
||||
], function($, Init, Util) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* init a select element as "select2" for map selection
|
||||
*/
|
||||
$.fn.initMapSelect = function(){
|
||||
var selectElement = $(this);
|
||||
|
||||
$.when(
|
||||
selectElement.select2({
|
||||
dropdownParent: 'body',
|
||||
theme: 'pathfinder',
|
||||
maximumSelectionLength: 5
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* init a select element as an ajax based "select2" object for system search
|
||||
* @param options
|
||||
*/
|
||||
$.fn.initSystemSelect = function(options){
|
||||
var selectElement = $(this);
|
||||
|
||||
// format result data
|
||||
function formatResultData (data) {
|
||||
|
||||
if (data.loading){
|
||||
return data.text;
|
||||
}
|
||||
|
||||
// show effect info just for wormholes
|
||||
var hideEffectClass = '';
|
||||
if(data.effect === ''){
|
||||
hideEffectClass = 'hide';
|
||||
}
|
||||
|
||||
var 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;
|
||||
},
|
||||
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" is the system name!
|
||||
var systemId = item[options.key];
|
||||
var disabled = false;
|
||||
var trueSec = parseFloat(item.trueSec);
|
||||
var secClass = Util.getSecurityClassForSystem(item.security);
|
||||
var trueSecClass = Util.getTrueSecClassForSystem( trueSec );
|
||||
var effectClass = Util.getEffectInfoForSystem(item.effect, 'class');
|
||||
|
||||
// check if system is dialed
|
||||
if(
|
||||
options.disabledOptions &&
|
||||
options.disabledOptions.indexOf(parseInt(systemId, 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: systemId,
|
||||
text: item.name,
|
||||
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) ){
|
||||
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
Util.showNotify({title: 'System select warning', text: reason + ' deleted', type: 'warning'});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
dropdownParent: 'body',
|
||||
theme: 'pathfinder',
|
||||
minimumInputLength: 2,
|
||||
templateResult: formatResultData,
|
||||
placeholder: 'System name',
|
||||
allowClear: true,
|
||||
escapeMarkup: function (markup) {
|
||||
// let our custom formatter work
|
||||
return markup;
|
||||
}
|
||||
}).on('change', function(e){
|
||||
// select changed
|
||||
})
|
||||
).done(function(){
|
||||
// open select
|
||||
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(){
|
||||
|
||||
var 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
|
||||
var currentValues = selectElement.val();
|
||||
|
||||
if(
|
||||
currentValues &&
|
||||
currentValues.indexOf( data.id.toString() ) !== -1
|
||||
){
|
||||
return ;
|
||||
}
|
||||
|
||||
var imagePath = '';
|
||||
var 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;
|
||||
}
|
||||
|
||||
var 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;
|
||||
}
|
||||
|
||||
var 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) ){
|
||||
|
||||
var reason = status + ' ' + jqXHR.status + ': ' + error;
|
||||
Util.showNotify({title: 'Access select warning', text: reason + ' deleted', type: 'warning'});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
dropdownParent: 'body',
|
||||
theme: 'pathfinder',
|
||||
minimumInputLength: 3,
|
||||
placeholder: '',
|
||||
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
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,239 +0,0 @@
|
||||
/**
|
||||
* Header animation
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'easePack',
|
||||
'tweenLite'
|
||||
], function($) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
previewElementClass: 'pf-header-preview-element' // class for "preview" elements
|
||||
};
|
||||
|
||||
|
||||
var width, height, largeHeader, canvas, ctx, points, target, animateHeader = true;
|
||||
|
||||
var canvasHeight = 450;
|
||||
var colorRGB = '108, 174, 173';
|
||||
var connectionCount = 4;
|
||||
|
||||
|
||||
var initHeader = function() {
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
target = {x: width * 0.8, y: 230};
|
||||
|
||||
largeHeader.style.height = height+'px';
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
ctx = canvas.getContext('2d');
|
||||
|
||||
// create points
|
||||
points = [];
|
||||
for(var x = 0; x < width; x = x + width/20) {
|
||||
for(var y = 0; y < height; y = y + height/15) {
|
||||
var px = x + Math.random()*width/15;
|
||||
var py = y + Math.random()*height/15;
|
||||
var p = {x: px, originX: px, y: py, originY: py };
|
||||
points.push(p);
|
||||
}
|
||||
}
|
||||
|
||||
// for each point find the 5 closest points
|
||||
for(var i = 0; i < points.length; i++) {
|
||||
var closest = [];
|
||||
var p1 = points[i];
|
||||
for(var j = 0; j < points.length; j++) {
|
||||
var p2 = points[j];
|
||||
if(p1 !== p2) {
|
||||
var placed = false;
|
||||
for(var k = 0; k < connectionCount; k++) {
|
||||
if(!placed) {
|
||||
if(closest[k] === undefined) {
|
||||
closest[k] = p2;
|
||||
placed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(var 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(var n in points) {
|
||||
var c = new Circle(points[n], 2+Math.random()*2, 'rgba(255,255,255,0.3)');
|
||||
points[n].circle = c;
|
||||
}
|
||||
};
|
||||
|
||||
// Event handling
|
||||
var addListeners = function() {
|
||||
if(!('ontouchstart' in window)) {
|
||||
window.addEventListener('mousemove', mouseMove);
|
||||
}
|
||||
window.addEventListener('scroll', scrollCheck);
|
||||
window.addEventListener('resize', resize);
|
||||
};
|
||||
|
||||
var mouseMove = function(e) {
|
||||
var posx = 0;
|
||||
var 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;
|
||||
};
|
||||
|
||||
var scrollCheck = function() {
|
||||
if(document.body.scrollTop > height){
|
||||
animateHeader = false;
|
||||
}else{
|
||||
animateHeader = true;
|
||||
}
|
||||
};
|
||||
|
||||
var resize = function() {
|
||||
width = window.innerWidth;
|
||||
height = canvasHeight;
|
||||
largeHeader.style.height = height+'px';
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
};
|
||||
|
||||
// animation
|
||||
var initAnimation = function() {
|
||||
animate();
|
||||
for(var i in points) {
|
||||
shiftPoint(points[i]);
|
||||
}
|
||||
};
|
||||
|
||||
var animate = function animate() {
|
||||
if(animateHeader) {
|
||||
ctx.clearRect(0,0,width,height);
|
||||
for(var 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);
|
||||
};
|
||||
|
||||
var 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
|
||||
var drawLines = function (p) {
|
||||
if(!p.active) return;
|
||||
for(var 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();
|
||||
}
|
||||
};
|
||||
|
||||
var Circle = function(pos,rad,color) {
|
||||
var _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
|
||||
var 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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,149 +0,0 @@
|
||||
/**
|
||||
* Logo
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'lazylinepainter'
|
||||
], function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
*/
|
||||
$.fn.drawLogo = function(callback, enableHover){
|
||||
var canvasElement = $(this);
|
||||
|
||||
var 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) {
|
||||
var logoData = {
|
||||
staticLogoId: config.staticLogoId,
|
||||
logoPartTopRightClass: config.logoPartTopRightClass,
|
||||
logoPartBottomLeftClass: config.logoPartBottomLeftClass,
|
||||
logoPartBottomRightClass: config.logoPartBottomRightClass,
|
||||
logoPartTopLeftClass: config.logoPartTopLeftClass
|
||||
};
|
||||
|
||||
var 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){
|
||||
var logoElements = $('#' + config.staticLogoId + ' path');
|
||||
|
||||
var animate = [];
|
||||
logoElements.on('mouseover', function(e){
|
||||
var currentLogoElement = $(e.target);
|
||||
var currentLogoElementIndex = logoElements.index(currentLogoElement);
|
||||
|
||||
var animationXValue = currentLogoElement.attr('data-animationX');
|
||||
var animationYValue = currentLogoElement.attr('data-animationY');
|
||||
|
||||
var 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');
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
@@ -1,241 +0,0 @@
|
||||
/**
|
||||
* 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( !$.isEmptyObject(systemGraphsData) ){
|
||||
// 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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -1,485 +0,0 @@
|
||||
/**
|
||||
* System info module
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/render'
|
||||
], function($, Init, Util, Render) {
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
moduleToolbarActionId: 'pf-system-info-collapse-container', // id for "module toolbar action" element
|
||||
descriptionTextareaElementClass: 'pf-system-info-description', // class for "description" textarea element (xEditable)
|
||||
descriptionTextareaTooltipClass: 'pf-system-info-description-tooltip' // class for "description" tooltip
|
||||
};
|
||||
|
||||
// disable Module update temporary (until. some requests/animations) are finished
|
||||
var disableModuleUpdate = true;
|
||||
|
||||
// animation speed values
|
||||
var animationSpeedToolbarAction = 200;
|
||||
|
||||
/**
|
||||
* set module observer and look for relevant system data to update
|
||||
*/
|
||||
var setModuleObserver = function(moduleElement){
|
||||
$(document).on('pf:updateSystemModules', function(e, data){
|
||||
if(data){
|
||||
moduleElement.updateSystemInfoModule(data);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* shows the tool action element by animation
|
||||
*/
|
||||
var showToolsActionElement = function(){
|
||||
|
||||
// "toolbar action" element
|
||||
var toolsActionElement = $('#' + config.moduleToolbarActionId);
|
||||
|
||||
toolsActionElement.velocity('stop').velocity({
|
||||
opacity: 1,
|
||||
height: '75px'
|
||||
},{
|
||||
duration: animationSpeedToolbarAction,
|
||||
display: 'block',
|
||||
visibility: 'visible'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* hides the tool action element by animation
|
||||
*/
|
||||
var hideToolsActionElement = function(){
|
||||
|
||||
// "toolbar action" element
|
||||
var toolsActionElement = $('#' + config.moduleToolbarActionId);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var moduleElement = $(this);
|
||||
|
||||
var systemId = moduleElement.data('id');
|
||||
|
||||
if(systemId === systemData.id){
|
||||
// update module
|
||||
|
||||
// system status =====================================================================================
|
||||
var systemStatusLabelElement = moduleElement.find('.' + config.systemInfoStatusLabelClass);
|
||||
var systemStatusId = parseInt( systemStatusLabelElement.attr( config.systemInfoStatusAttributeName ) );
|
||||
|
||||
|
||||
if(systemStatusId !== systemData.status.id){
|
||||
// status changed
|
||||
|
||||
var currentStatusClass = Util.getStatusInfoForSystem(systemStatusId, 'class');
|
||||
var newStatusClass = Util.getStatusInfoForSystem(systemData.status.id, 'class');
|
||||
var 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 ======================================================================
|
||||
var descriptionTextareaElement = moduleElement.find('.' + config.descriptionTextareaElementClass);
|
||||
|
||||
var description = descriptionTextareaElement.editable('getValue', true);
|
||||
|
||||
if(description !== systemData.description){
|
||||
// description changed
|
||||
|
||||
// description button
|
||||
var descriptionButton = moduleElement.find('.' + config.addDescriptionButtonClass);
|
||||
|
||||
// set new value
|
||||
descriptionTextareaElement.editable('setValue', systemData.description);
|
||||
|
||||
if(systemData.description.length === 0){
|
||||
// show/activate description field
|
||||
|
||||
// show button if value is empty
|
||||
descriptionButton.show();
|
||||
|
||||
|
||||
hideToolsActionElement();
|
||||
|
||||
}else{
|
||||
// hide/disable description field
|
||||
|
||||
// hide tool button
|
||||
descriptionButton.hide();
|
||||
|
||||
showToolsActionElement();
|
||||
}
|
||||
}
|
||||
|
||||
// created/updated tooltip ===========================================================================
|
||||
|
||||
var nameRowElement = $(moduleElement).find('.' + config.systemInfoNameInfoClass);
|
||||
|
||||
var tooltipData = {
|
||||
created: systemData.created,
|
||||
updated: systemData.updated
|
||||
};
|
||||
|
||||
nameRowElement.addCharacterInfoTooltip( tooltipData );
|
||||
}
|
||||
|
||||
$('.' + config.descriptionArea).hideLoadingAnimation();
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parentElement
|
||||
* @param mapId
|
||||
* @param systemData
|
||||
*/
|
||||
var drawModule = function(parentElement, mapId, systemData){
|
||||
|
||||
// create new module container
|
||||
var 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
|
||||
var shatteredWormholeInfo = false;
|
||||
|
||||
// add security class for statics
|
||||
if(
|
||||
systemData.statics &&
|
||||
systemData.statics.length > 0
|
||||
){
|
||||
for(var 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;
|
||||
}
|
||||
|
||||
var effectName = Util.getEffectInfoForSystem(systemData.effect, 'name');
|
||||
var effectClass = Util.getEffectInfoForSystem(systemData.effect, 'class');
|
||||
|
||||
// systemInfo template config
|
||||
var moduleConfig = {
|
||||
name: 'modules/system_info',
|
||||
position: moduleElement,
|
||||
link: 'append',
|
||||
functions: {
|
||||
after: function(){
|
||||
// lock "description" field until first update
|
||||
$('.' + config.descriptionArea).showLoadingAnimation();
|
||||
|
||||
|
||||
var tempModuleElement = $('.' + config.systemInfoModuleClass);
|
||||
|
||||
// "add description" button
|
||||
var descriptionButton = tempModuleElement.find('.' + config.addDescriptionButtonClass);
|
||||
|
||||
// description textarea element
|
||||
var 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,
|
||||
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){
|
||||
|
||||
var reason = '';
|
||||
var 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){
|
||||
// disable module update until description field is open
|
||||
disableModuleUpdate = true;
|
||||
|
||||
// disable tooltip
|
||||
tempModuleElement.find('.' + config.descriptionTextareaTooltipClass).tooltip('disable');
|
||||
});
|
||||
|
||||
// on xEditable close ------------------------------------------------------------------------
|
||||
descriptionTextareaElement.on('hidden', function(e){
|
||||
var value = $(this).editable('getValue', true);
|
||||
|
||||
if(value.length === 0){
|
||||
|
||||
// show button if value is empty
|
||||
hideToolsActionElement();
|
||||
|
||||
descriptionButton.show();
|
||||
}else{
|
||||
// enable tooltip
|
||||
tempModuleElement.find('.' + config.descriptionTextareaTooltipClass).tooltip('enable');
|
||||
}
|
||||
|
||||
// enable module update
|
||||
disableModuleUpdate = false;
|
||||
});
|
||||
|
||||
// enable xEditable field on Button click ----------------------------------------------------
|
||||
descriptionButton.on('click', function(e){
|
||||
e.stopPropagation();
|
||||
|
||||
// hide tool buttons
|
||||
descriptionButton.hide();
|
||||
|
||||
// show field *before* showing the element
|
||||
descriptionTextareaElement.editable('show');
|
||||
|
||||
showToolsActionElement();
|
||||
});
|
||||
|
||||
|
||||
// init tooltips -----------------------------------------------------------------------------
|
||||
var tooltipElements = $('.' + config.systemInfoModuleClass + ' [data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip();
|
||||
|
||||
// init system effect popover ----------------------------------------------------------------
|
||||
var systemEffectData = Util.getSystemEffectData( systemData.security, systemData.effect);
|
||||
|
||||
if(systemEffectData !== false){
|
||||
var infoEffectElement = $(moduleElement).find('.' + config.systemInfoEffectInfoClass);
|
||||
|
||||
// transform data into table
|
||||
var systemEffectTable = Util.getSystemEffectTable( systemEffectData );
|
||||
|
||||
infoEffectElement.popover({
|
||||
html: true,
|
||||
trigger: 'hover',
|
||||
placement: 'top',
|
||||
delay: 200,
|
||||
title: 'System effects',
|
||||
container: 'body',
|
||||
content: systemEffectTable
|
||||
});
|
||||
}
|
||||
|
||||
// init static wormhole information ----------------------------------------------------------
|
||||
if(systemData.statics){
|
||||
for(var i = 0; i < systemData.statics.length; i++){
|
||||
var staticData = systemData.statics[i];
|
||||
var 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);
|
||||
var popover = popoverElement.data('bs.popover');
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: popoverElement.data('url'),
|
||||
success: function(data){
|
||||
var systemEffectTable = Util.getSystemsInfoTable( data.systemData );
|
||||
popover.options.content = systemEffectTable;
|
||||
// reopen popover (new content size)
|
||||
popover.show();
|
||||
}
|
||||
});
|
||||
return 'Loading...';
|
||||
}
|
||||
|
||||
showModule(moduleElement);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var moduleData = {
|
||||
system: systemData,
|
||||
tableClass: config.systemInfoTableClass,
|
||||
nameInfoClass: config.systemInfoNameInfoClass,
|
||||
effectInfoClass: config.systemInfoEffectInfoClass,
|
||||
wormholePrefixClass: config.systemInfoWormholeClass,
|
||||
statusInfoClass: config.systemInfoStatusLabelClass,
|
||||
|
||||
systemTypeName: Util.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,
|
||||
moduleToolbarActionId: config.moduleToolbarActionId,
|
||||
descriptionTextareaClass: config.descriptionTextareaElementClass,
|
||||
descriptionTooltipClass: config.descriptionTextareaTooltipClass,
|
||||
|
||||
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
|
||||
*/
|
||||
var 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){
|
||||
|
||||
var parentElement = $(this);
|
||||
|
||||
// check if module already exists
|
||||
var 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);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,495 +0,0 @@
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'morris'
|
||||
], function($, Init, Util, Morris) {
|
||||
'use strict';
|
||||
|
||||
var 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
|
||||
|
||||
};
|
||||
|
||||
var cache = {
|
||||
systemKillsGraphData: {} // data for system kills info graph
|
||||
};
|
||||
|
||||
/**
|
||||
* get label element with given content
|
||||
* @param text
|
||||
* @returns {*|XMLList}
|
||||
*/
|
||||
var getLabel = function(text, options){
|
||||
var label = $('<span>', {
|
||||
class: ['label', options.type, options.align].join(' ')
|
||||
}).text( text );
|
||||
|
||||
return label;
|
||||
};
|
||||
|
||||
|
||||
var showKillmails = function(moduleElement, killboardData){
|
||||
|
||||
// show number of killMails
|
||||
var killMailCounterMax = 20;
|
||||
var killMailCounter = 0;
|
||||
|
||||
// change order (show right to left)
|
||||
killboardData.tableData.reverse();
|
||||
|
||||
for(var 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'));
|
||||
|
||||
var killMailData = killboardData.tableData[i].killmails;
|
||||
|
||||
var listeElement = $('<ul>', {
|
||||
class: ['media-list', config.systemKillboardListClass].join(' ')
|
||||
});
|
||||
|
||||
for(var j = 0; j < killMailData.length; j++){
|
||||
killMailCounter++;
|
||||
if(killMailCounter >= killMailCounterMax){
|
||||
break;
|
||||
}
|
||||
|
||||
var killData = killMailData[j];
|
||||
|
||||
var linkUrl = 'https://zkillboard.com/kill/' + killData.killID + '/';
|
||||
var victimImageUrl = 'https://image.eveonline.com/Type/' + killData.victim.shipTypeID + '_64.png';
|
||||
var killDate = getDateObjectByTimeString(killData.killTime);
|
||||
var killDateString = Util.convertDateToString(killDate);
|
||||
var killLossValue = Util.formatPrice( killData.zkb.totalValue );
|
||||
|
||||
// check for ally
|
||||
var victimAllyLogoUrl = '';
|
||||
var displayAlly = 'none';
|
||||
if(killData.victim.allianceID > 0){
|
||||
victimAllyLogoUrl = 'https://image.eveonline.com/Alliance/' + killData.victim.allianceID + '_32.png';
|
||||
displayAlly = 'block';
|
||||
}
|
||||
|
||||
// check for corp
|
||||
var victimCorpLogoUrl = '';
|
||||
var displayCorp = 'none';
|
||||
if(killData.victim.corporationID > 0){
|
||||
victimCorpLogoUrl = 'https://image.eveonline.com/Corporation/' + killData.victim.corporationID + '_32.png';
|
||||
displayCorp = 'inline';
|
||||
}
|
||||
|
||||
var 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){
|
||||
|
||||
var moduleElement = $(this);
|
||||
|
||||
|
||||
// headline toolbar icons
|
||||
var 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(
|
||||
'https://zkillboard.com/system/' + systemData.systemId,
|
||||
'_blank'
|
||||
);
|
||||
}).attr('data-toggle', 'tooltip')
|
||||
);
|
||||
|
||||
moduleElement.append(headlineToolbar);
|
||||
|
||||
// headline
|
||||
var headline = $('<h5>', {
|
||||
text: 'Killboard'
|
||||
});
|
||||
|
||||
moduleElement.append(headline);
|
||||
|
||||
var killboardGraphElement = $('<div>', {
|
||||
class: config.systemKillboardGraphKillsClass
|
||||
});
|
||||
|
||||
moduleElement.append(killboardGraphElement);
|
||||
|
||||
var showHours = 24;
|
||||
var maxKillmailCount = 200; // limited by API
|
||||
|
||||
var labelOptions = {
|
||||
align: 'center-block'
|
||||
};
|
||||
var label = '';
|
||||
|
||||
// private function draws a "system kills" graph
|
||||
var drawGraph = function(data){
|
||||
|
||||
var 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;
|
||||
}
|
||||
|
||||
var 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))
|
||||
var localDate = new Date();
|
||||
|
||||
// cache result for 5min
|
||||
var 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
|
||||
var chartData = [];
|
||||
|
||||
for(var i = 0; i < showHours; i++){
|
||||
var tempData = {
|
||||
label: i + 'h',
|
||||
kills: 0
|
||||
};
|
||||
|
||||
chartData.push(tempData);
|
||||
}
|
||||
|
||||
// get kills within the last 24h
|
||||
var timeFrameInSeconds = 60 * 60 * 24;
|
||||
|
||||
// get current server time
|
||||
var serverDate= Util.getServerTime();
|
||||
|
||||
// if system is w-space system -> add link modifier
|
||||
var wSpaceLinkModifier = '';
|
||||
if(systemData.type.id === 1){
|
||||
wSpaceLinkModifier = 'w-space/';
|
||||
}
|
||||
|
||||
var 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
|
||||
var lastCompleteDiffHourData = 0;
|
||||
|
||||
|
||||
// loop kills and count kills by hour
|
||||
for (var i = 0; i < kbData.length; i++) {
|
||||
var killmailData = kbData[i];
|
||||
|
||||
var killDate = getDateObjectByTimeString(killmailData.killTime);
|
||||
|
||||
// get time diff
|
||||
var timeDiffMin = Math.round(( serverDate - killDate ) / 1000 / 60);
|
||||
var 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();
|
||||
}).error(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
|
||||
var 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
|
||||
*/
|
||||
var minifyKillboardGraphElement = function(killboardGraphElement){
|
||||
killboardGraphElement.velocity({
|
||||
height: '20px',
|
||||
marginBottom: '0px'
|
||||
},{
|
||||
duration: Init.animationSpeed.mapModule
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* transform timestring
|
||||
* @param timeString
|
||||
* @returns {Date}
|
||||
*/
|
||||
var getDateObjectByTimeString = function(timeString){
|
||||
var match = timeString.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);
|
||||
var 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}
|
||||
*/
|
||||
var getModule = function(parentElement, systemData){
|
||||
|
||||
// create new module container
|
||||
var 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){
|
||||
|
||||
var parentElement = $(this);
|
||||
|
||||
// show route module
|
||||
var showModule = function(moduleElement){
|
||||
if(moduleElement){
|
||||
moduleElement.velocity('transition.slideDownIn', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
delay: Init.animationSpeed.mapModule
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// check if module already exists
|
||||
var 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);
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
@@ -1,747 +0,0 @@
|
||||
/**
|
||||
* system route module
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'bootbox'
|
||||
], function($, Init, Util, bootbox) {
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// module info
|
||||
moduleClass: 'pf-module', // class for each module
|
||||
|
||||
routeCacheTTL: 10, // route cache timer (client) in seconds
|
||||
|
||||
// system route module
|
||||
systemRouteModuleClass: 'pf-system-route-module', // class for this module
|
||||
|
||||
// headline toolbar
|
||||
systemModuleHeadlineIcon: 'pf-module-icon-button', // class for toolbar icons in the head
|
||||
systemModuleHeadlineIconSearch: 'pf-module-icon-button-search', // class for "search" icon
|
||||
systemModuleHeadlineIconRefresh: 'pf-module-icon-button-refresh', // class for "refresh" icon
|
||||
|
||||
systemSecurityClassPrefix: 'pf-system-security-', // prefix class for system security level (color)
|
||||
|
||||
// dialog
|
||||
routeDialogId: 'pf-route-dialog', // id for route dialog
|
||||
systemDialogSelectClass: 'pf-system-dialog-select', // class for system select Element
|
||||
systemInfoRoutesTableClass: 'pf-system-route-table', // class for route tables
|
||||
mapSelectId: 'pf-route-dialog-map-select', // id for "map" select
|
||||
|
||||
sigTableActionCellClass: 'pf-table-action-cell' // class for "action" cells
|
||||
|
||||
};
|
||||
|
||||
// cache for system routes
|
||||
var cache = {
|
||||
systemRoutes: {} // jump information between solar systems
|
||||
};
|
||||
|
||||
/**
|
||||
* callback function, adds new row to a dataTable with jump information for a route
|
||||
* @param context
|
||||
* @param routesData
|
||||
*/
|
||||
var callbackAddRouteRow = function(context, routesData){
|
||||
|
||||
if(routesData.length > 0){
|
||||
for(var i = 0; i < routesData.length; i++){
|
||||
var routeData = routesData[i];
|
||||
|
||||
// format routeData
|
||||
var rowData = formatRouteData(routeData);
|
||||
|
||||
if(rowData.route){
|
||||
var cacheKey = routeData.systemFrom.toLowerCase() + '_' + routeData.systemTo.toLowerCase();
|
||||
|
||||
// update route cache
|
||||
cache.systemRoutes[cacheKey] = {
|
||||
data: rowData,
|
||||
updated: Util.getServerTime().getTime() / 1000
|
||||
};
|
||||
|
||||
var rowElement = addRow(context, rowData);
|
||||
|
||||
rowElement.initTooltips({
|
||||
container: 'body'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// redraw dataTable
|
||||
context.dataTable.draw();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* add a new dataTable row to the routes table
|
||||
* @param context
|
||||
* @param rowData
|
||||
* @returns {*}
|
||||
*/
|
||||
var addRow = function(context, rowData){
|
||||
var dataTable = context.dataTable;
|
||||
var rowElement = null;
|
||||
var row = null;
|
||||
var animationStatus = 'changed';
|
||||
|
||||
// search for an existing row (e.g. on mass "table refresh" [all routes])
|
||||
// get rowIndex where column 0 (equals to "systemTo") matches rowData.systemTo
|
||||
var indexes = dataTable.rows().eq(0).filter( function (rowIdx) {
|
||||
return (dataTable.cell(rowIdx, 0 ).data() === rowData.systemTo);
|
||||
});
|
||||
|
||||
if(indexes.length > 0){
|
||||
// update row with FIRST index
|
||||
// -> systemFrom should be unique!
|
||||
row = dataTable.row( parseInt(indexes[0]) );
|
||||
// update row data
|
||||
row.data(rowData);
|
||||
}else{
|
||||
// no existing route found -> add new row
|
||||
row = dataTable.row.add( rowData );
|
||||
|
||||
animationStatus = 'added';
|
||||
}
|
||||
|
||||
if(row.length > 0){
|
||||
rowElement = row.nodes().to$();
|
||||
|
||||
if(animationStatus !== null){
|
||||
rowElement.data('animationStatus', animationStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return rowElement;
|
||||
};
|
||||
|
||||
/**
|
||||
* update complete routes table (refresh all)
|
||||
* @param moduleElement
|
||||
* @param dataTable
|
||||
*/
|
||||
var updateRoutesTable = function(moduleElement, dataTable){
|
||||
var context = {
|
||||
moduleElement: moduleElement,
|
||||
dataTable: dataTable
|
||||
};
|
||||
|
||||
var routeData = [];
|
||||
dataTable.rows().every( function() {
|
||||
|
||||
var data = this.data();
|
||||
routeData.push({
|
||||
mapIds: data.mapIds,
|
||||
systemFrom: data.systemFrom,
|
||||
systemTo: data.systemTo
|
||||
});
|
||||
} );
|
||||
|
||||
getRouteData({routeData: routeData}, context, callbackAddRouteRow);
|
||||
};
|
||||
|
||||
/**
|
||||
* show route dialog. User can search for systems and jump-info for each system is added to a data table
|
||||
* @param dialogData
|
||||
*/
|
||||
var showFindRouteDialog = function(dialogData){
|
||||
|
||||
var mapSelectOptions = [];
|
||||
var currentMapData = Util.getCurrentMapData();
|
||||
if(currentMapData !== false){
|
||||
for(var i = 0; i < currentMapData.length; i++){
|
||||
mapSelectOptions.push({
|
||||
id: currentMapData[i].config.id,
|
||||
name: currentMapData[i].config.name,
|
||||
selected: (dialogData.mapId === currentMapData[i].config.id)
|
||||
});
|
||||
}
|
||||
}
|
||||
var data = {
|
||||
id: config.routeDialogId,
|
||||
selectClass: config.systemDialogSelectClass,
|
||||
mapSelectId: config.mapSelectId,
|
||||
systemFrom: dialogData.systemFrom,
|
||||
mapSelectOptions: mapSelectOptions
|
||||
};
|
||||
|
||||
requirejs(['text!templates/dialog/route.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
// disable modal focus event -> otherwise select2 is not working! -> quick fix
|
||||
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
|
||||
|
||||
var findRouteDialog = bootbox.dialog({
|
||||
title: 'Route finder',
|
||||
message: content,
|
||||
show: false,
|
||||
buttons: {
|
||||
close: {
|
||||
label: 'cancel',
|
||||
className: 'btn-default',
|
||||
callback: function(){
|
||||
$(findRouteDialog).modal('hide');
|
||||
}
|
||||
},
|
||||
success: {
|
||||
label: '<i class="fa fa-fw fa-search"></i> search route',
|
||||
className: 'btn-primary',
|
||||
callback: function () {
|
||||
// add new route to route table
|
||||
|
||||
// get form Values
|
||||
var form = $('#' + config.routeDialogId).find('form');
|
||||
|
||||
var routeDialogData = $(form).getFormValues();
|
||||
|
||||
// validate form
|
||||
form.validator('validate');
|
||||
|
||||
// check weather the form is valid
|
||||
var formValid = form.isValidForm();
|
||||
|
||||
if(formValid === false){
|
||||
// don't close dialog
|
||||
return false;
|
||||
}
|
||||
|
||||
var context = {
|
||||
moduleElement: dialogData.moduleElement,
|
||||
dataTable: dialogData.dataTable
|
||||
};
|
||||
|
||||
var requestData = {
|
||||
routeData: [{
|
||||
mapIds: routeDialogData.mapIds,
|
||||
systemFrom: dialogData.systemFrom,
|
||||
systemTo: routeDialogData.systemTo,
|
||||
stargates: routeDialogData.hasOwnProperty('stargates') ? parseInt( routeDialogData.stargates ) : 0,
|
||||
jumpbridges: routeDialogData.hasOwnProperty('jumpbridges') ? parseInt( routeDialogData.jumpbridges ) : 0,
|
||||
wormholes: routeDialogData.hasOwnProperty('wormholes') ? parseInt( routeDialogData.wormholes ) : 0,
|
||||
wormholesReduced: routeDialogData.hasOwnProperty('wormholesReduced') ? parseInt( routeDialogData.wormholesReduced ) : 0,
|
||||
wormholesCritical: routeDialogData.hasOwnProperty('wormholesCritical') ? parseInt( routeDialogData.wormholesCritical ) : 0
|
||||
}]
|
||||
};
|
||||
|
||||
getRouteData(requestData, context, callbackAddRouteRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
findRouteDialog.on('show.bs.modal', function(e) {
|
||||
findRouteDialog.initTooltips();
|
||||
|
||||
// init some dialog/form observer
|
||||
setDialogObserver( $(this) );
|
||||
|
||||
// init map select ----------------------------------------------------------------
|
||||
var mapSelect = $(this).find('#' + config.mapSelectId);
|
||||
mapSelect.initMapSelect();
|
||||
});
|
||||
|
||||
|
||||
findRouteDialog.on('shown.bs.modal', function(e) {
|
||||
|
||||
// init system select live search ------------------------------------------------
|
||||
// -> add some delay until modal transition has finished
|
||||
var systemTargetSelect = $(this).find('.' + config.systemDialogSelectClass);
|
||||
systemTargetSelect.delay(240).initSystemSelect({key: 'name'});
|
||||
});
|
||||
|
||||
// show dialog
|
||||
findRouteDialog.modal('show');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* set event observer for route finder dialog
|
||||
* @param routeDialog
|
||||
*/
|
||||
var setDialogObserver = function(routeDialog){
|
||||
var wormholeCheckbox = routeDialog.find('input[type="checkbox"][name="wormholes"]');
|
||||
var wormholeReducedCheckbox = routeDialog.find('input[type="checkbox"][name="wormholesReduced"]');
|
||||
var wormholeCriticalCheckbox = routeDialog.find('input[type="checkbox"][name="wormholesCritical"]');
|
||||
|
||||
// store current "checked" state for each box ---------------------------------------------
|
||||
var storeCheckboxStatus = function(){
|
||||
wormholeReducedCheckbox.data('selectState', wormholeReducedCheckbox.prop('checked'));
|
||||
wormholeCriticalCheckbox.data('selectState', wormholeCriticalCheckbox.prop('checked'));
|
||||
};
|
||||
|
||||
// on wormhole checkbox change ------------------------------------------------------------
|
||||
var onWormholeCheckboxChange = function(){
|
||||
|
||||
if( $(this).is(':checked') ){
|
||||
wormholeReducedCheckbox.prop('disabled', false);
|
||||
wormholeCriticalCheckbox.prop('disabled', false);
|
||||
|
||||
wormholeReducedCheckbox.prop('checked', wormholeReducedCheckbox.data('selectState'));
|
||||
wormholeCriticalCheckbox.prop('checked', wormholeCriticalCheckbox.data('selectState'));
|
||||
}else{
|
||||
storeCheckboxStatus();
|
||||
|
||||
wormholeReducedCheckbox.prop('checked', false);
|
||||
wormholeReducedCheckbox.prop('disabled', true);
|
||||
wormholeCriticalCheckbox.prop('checked', false);
|
||||
wormholeCriticalCheckbox.prop('disabled', true);
|
||||
}
|
||||
}.bind(wormholeCheckbox);
|
||||
|
||||
wormholeCheckbox.on('change', onWormholeCheckboxChange);
|
||||
|
||||
// initial checkbox check
|
||||
storeCheckboxStatus();
|
||||
onWormholeCheckboxChange();
|
||||
};
|
||||
|
||||
/**
|
||||
* requests route data from eveCentral API and execute callback
|
||||
* @param requestData
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
var getRouteData = function(requestData, context, callback){
|
||||
|
||||
context.moduleElement.showLoadingAnimation();
|
||||
|
||||
$.ajax({
|
||||
url: Init.path.searchRoute,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: requestData,
|
||||
context: context
|
||||
}).done(function(routesData){
|
||||
|
||||
this.moduleElement.hideLoadingAnimation();
|
||||
|
||||
// execute callback
|
||||
callback(this, routesData.routesData);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* format route data from API request into dataTable row format
|
||||
* @param routeData
|
||||
* @returns {{}}
|
||||
*/
|
||||
var formatRouteData = function(routeData){
|
||||
|
||||
var reloadButton = '<i class="fa ' + ['fa-refresh'].join(' ') + '"></i>';
|
||||
var deleteButton = '<i class="fa ' + ['fa-close', 'txt-color', 'txt-color-redDarker'].join(' ') + '"></i>';
|
||||
|
||||
// default row data (e.g. no route found)
|
||||
var tableRowData = {
|
||||
systemFrom: routeData.systemFrom,
|
||||
systemTo: routeData.systemTo,
|
||||
jumps: {
|
||||
value: 0,
|
||||
formatted: '---'
|
||||
},
|
||||
avgTrueSec: {
|
||||
value: '',
|
||||
formatted: ''
|
||||
},
|
||||
route: 'not found',
|
||||
stargates: routeData.stargates,
|
||||
jumpbridges: routeData.jumpbridges,
|
||||
wormholes: routeData.wormholes,
|
||||
wormholesReduced: routeData.wormholesReduced,
|
||||
wormholesCritical: routeData.wormholesCritical,
|
||||
reload: {
|
||||
button: reloadButton
|
||||
},
|
||||
clear: {
|
||||
button: deleteButton
|
||||
},
|
||||
maps: routeData.maps,
|
||||
mapIds: routeData.mapIds //map data (mapIds is "redundant")
|
||||
};
|
||||
|
||||
if(
|
||||
routeData.routePossible === true &&
|
||||
routeData.route.length > 0
|
||||
){
|
||||
// route data available
|
||||
|
||||
// add route Data
|
||||
var jumpData = [];
|
||||
var avgSecTemp = 0;
|
||||
|
||||
// loop all systems on this route
|
||||
for(var i = 0; i < routeData.route.length; i++){
|
||||
var routeNodeData = routeData.route[i];
|
||||
// format system name (camelCase)
|
||||
var systemName = routeNodeData.system.charAt(0).toUpperCase() + routeNodeData.system.slice(1).toLowerCase();
|
||||
|
||||
var systemSec = Number(routeNodeData.security).toFixed(1).toString();
|
||||
var tempSystemSec = systemSec;
|
||||
|
||||
if(tempSystemSec <= 0){
|
||||
tempSystemSec = '0-0';
|
||||
}
|
||||
|
||||
var systemSecClass = config.systemSecurityClassPrefix + tempSystemSec.replace('.', '-');
|
||||
|
||||
var system = '<i class="fa fa-square ' + systemSecClass + '" ';
|
||||
system += 'data-toggle="tooltip" data-placement="bottom" data-container="body" ';
|
||||
system += 'title="' + systemName + ' [' + systemSec + '] "></i>';
|
||||
jumpData.push( system );
|
||||
|
||||
avgSecTemp += Number(routeNodeData.security);
|
||||
}
|
||||
|
||||
var avgSec = ( avgSecTemp / routeData.route.length).toFixed(2);
|
||||
var avgSecForClass = Number(avgSec).toFixed(1);
|
||||
|
||||
if(avgSecForClass <= 0){
|
||||
avgSecForClass = '0.0';
|
||||
}
|
||||
|
||||
var avgSecClass = config.systemSecurityClassPrefix + avgSecForClass.toString().replace('.', '-');
|
||||
|
||||
tableRowData.jumps = {
|
||||
value: routeData.routeJumps,
|
||||
formatted: routeData.routeJumps
|
||||
};
|
||||
|
||||
tableRowData.avgTrueSec = {
|
||||
value: avgSec,
|
||||
formatted: '<span class="' + avgSecClass + '">' + avgSec + '</span>'
|
||||
};
|
||||
tableRowData.route = jumpData.join(' ');
|
||||
}
|
||||
|
||||
return tableRowData;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the route finder moduleElement
|
||||
* @returns {*}
|
||||
*/
|
||||
var getModule = function(){
|
||||
|
||||
// create new module container
|
||||
var moduleElement = $('<div>', {
|
||||
class: [config.moduleClass, config.systemRouteModuleClass].join(' ')
|
||||
});
|
||||
|
||||
// headline toolbar icons
|
||||
var headlineToolbar = $('<h5>', {
|
||||
class: 'pull-right'
|
||||
}).append(
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-search', config.systemModuleHeadlineIcon, config.systemModuleHeadlineIconSearch].join(' '),
|
||||
title: 'find route'
|
||||
}).attr('data-html', 'true').attr('data-toggle', 'tooltip'),
|
||||
$('<i>', {
|
||||
class: ['fa', 'fa-fw', 'fa-refresh', config.systemModuleHeadlineIcon, config.systemModuleHeadlineIconRefresh].join(' '),
|
||||
title: 'refresh all'
|
||||
}).attr('data-html', 'true').attr('data-toggle', 'tooltip')
|
||||
);
|
||||
|
||||
moduleElement.append(headlineToolbar);
|
||||
|
||||
// headline
|
||||
var headline = $('<h5>', {
|
||||
class: 'pull-left',
|
||||
text: 'Routes'
|
||||
});
|
||||
|
||||
moduleElement.append(headline);
|
||||
|
||||
// crate new route table
|
||||
var table = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border', config.systemInfoRoutesTableClass].join(' ')
|
||||
});
|
||||
|
||||
moduleElement.append( $(table) );
|
||||
|
||||
// init empty table
|
||||
var routesTable = table.DataTable( {
|
||||
paging: false,
|
||||
ordering: true,
|
||||
order: [ 1, 'asc' ],
|
||||
info: false,
|
||||
searching: false,
|
||||
hover: false,
|
||||
autoWidth: false,
|
||||
rowId: 'systemTo',
|
||||
language: {
|
||||
emptyTable: 'No routes added'
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
orderable: true,
|
||||
title: 'system ',
|
||||
data: 'systemTo'
|
||||
},{
|
||||
targets: 1,
|
||||
orderable: true,
|
||||
title: '<span title="jumps" data-toggle="tooltip"><i class="fa fa-arrows-h"></i> </span>',
|
||||
width: '18px',
|
||||
class: 'text-right',
|
||||
data: 'jumps',
|
||||
render: {
|
||||
_: 'formatted',
|
||||
sort: 'value'
|
||||
}
|
||||
},{
|
||||
targets: 2,
|
||||
orderable: true,
|
||||
title: '<span title="average security" data-toggle="tooltip">Ø </span>',
|
||||
width: '15px',
|
||||
class: 'text-right',
|
||||
data: 'avgTrueSec',
|
||||
render: {
|
||||
_: 'formatted',
|
||||
sort: 'value'
|
||||
}
|
||||
},{
|
||||
targets: 3,
|
||||
orderable: false,
|
||||
title: 'route',
|
||||
data: 'route'
|
||||
},{
|
||||
targets: 4,
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '10px',
|
||||
class: ['text-center', config.sigTableActionCellClass].join(' '),
|
||||
data: 'reload',
|
||||
render: {
|
||||
_: 'button'
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
var tempTableApi = this.api();
|
||||
|
||||
$(cell).on('click', function(e) {
|
||||
// get current row data (important!)
|
||||
// -> "rowData" param is not current state, values are "on createCell()" state
|
||||
rowData = tempTableApi.row( $(cell).parents('tr')).data();
|
||||
|
||||
var context = {
|
||||
moduleElement: moduleElement,
|
||||
dataTable: tempTableApi
|
||||
};
|
||||
|
||||
var requestData = {
|
||||
routeData: [{
|
||||
mapIds: rowData.mapIds,
|
||||
systemFrom: rowData.systemFrom,
|
||||
systemTo: rowData.systemTo,
|
||||
stargates: rowData.stargates ? 1 : 0,
|
||||
jumpbridges: rowData.jumpbridges ? 1 : 0,
|
||||
wormholes: rowData.wormholes ? 1 : 0,
|
||||
wormholesReduced: rowData.wormholesReduced ? 1 : 0,
|
||||
wormholesCritical: rowData.wormholesCritical ? 1 : 0
|
||||
}]
|
||||
};
|
||||
|
||||
getRouteData(requestData, context, callbackAddRouteRow);
|
||||
});
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '10px',
|
||||
class: ['text-center', config.sigTableActionCellClass].join(' '),
|
||||
data: 'clear',
|
||||
render: {
|
||||
_: 'button'
|
||||
},
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
||||
var tempTableElement = this;
|
||||
|
||||
var confirmationSettings = {
|
||||
container: 'body',
|
||||
placement: 'left',
|
||||
btnCancelClass: 'btn btn-sm btn-default',
|
||||
btnCancelLabel: 'cancel',
|
||||
btnCancelIcon: 'fa fa-fw fa-ban',
|
||||
title: 'delete route',
|
||||
btnOkClass: 'btn btn-sm btn-danger',
|
||||
btnOkLabel: 'delete',
|
||||
btnOkIcon: 'fa fa-fw fa-close',
|
||||
onConfirm : function(e, target){
|
||||
var deleteRowElement = $(cell).parents('tr');
|
||||
tempTableElement.api().rows(deleteRowElement).remove().draw();
|
||||
}
|
||||
};
|
||||
|
||||
// init confirmation dialog
|
||||
$(cell).confirmation(confirmationSettings);
|
||||
}
|
||||
}
|
||||
],
|
||||
drawCallback: function(settings){
|
||||
|
||||
var animationRows = this.api().rows().nodes().to$().filter(function() {
|
||||
return (
|
||||
$(this).data('animationStatus') ||
|
||||
$(this).data('animationTimer')
|
||||
);
|
||||
});
|
||||
|
||||
for(var i = 0; i < animationRows.length; i++){
|
||||
$(animationRows[i]).pulseTableRow($(animationRows[i]).data('animationStatus'));
|
||||
$(animationRows[i]).removeData('animationStatus');
|
||||
}
|
||||
|
||||
},
|
||||
data: [] // will be added dynamic
|
||||
});
|
||||
|
||||
// init tooltips for this module
|
||||
var tooltipElements = moduleElement.find('[data-toggle="tooltip"]');
|
||||
tooltipElements.tooltip({
|
||||
container: 'body'
|
||||
});
|
||||
|
||||
return moduleElement;
|
||||
};
|
||||
|
||||
/**
|
||||
* init route module
|
||||
* -> request route path fore "default" trade hub systems
|
||||
* @param moduleElement
|
||||
* @param mapId
|
||||
* @param systemData
|
||||
*/
|
||||
var initModule = function(moduleElement, mapId, systemData){
|
||||
|
||||
var systemFrom = systemData.name;
|
||||
var systemsTo = ['Jita', 'Amarr', 'Rens', 'Dodixie'];
|
||||
|
||||
var routesTableElement = moduleElement.find('.' + config.systemInfoRoutesTableClass);
|
||||
|
||||
var routesTable = routesTableElement.DataTable();
|
||||
|
||||
// init refresh routes --------------------------------------------------------------------
|
||||
moduleElement.find('.' + config.systemModuleHeadlineIconRefresh).on('click', function(e){
|
||||
updateRoutesTable(moduleElement, routesTable);
|
||||
});
|
||||
|
||||
// init search routes dialog --------------------------------------------------------------
|
||||
moduleElement.find('.' + config.systemModuleHeadlineIconSearch).on('click', function(e){
|
||||
var dialogData = {
|
||||
moduleElement: moduleElement,
|
||||
mapId: mapId,
|
||||
systemFrom: systemFrom,
|
||||
dataTable: routesTable
|
||||
};
|
||||
|
||||
showFindRouteDialog(dialogData);
|
||||
});
|
||||
|
||||
// fill routesTable with data -------------------------------------------------------------
|
||||
var requestRouteData = [];
|
||||
var currentTimestamp = Util.getServerTime().getTime();
|
||||
|
||||
for(var i = 0; i < systemsTo.length; i++){
|
||||
var systemTo = systemsTo[i];
|
||||
|
||||
if(systemFrom !== systemTo){
|
||||
var cacheKey = 'route_' + mapId + '_' + systemFrom.toUpperCase() + '_' + systemTo.toUpperCase();
|
||||
|
||||
if(
|
||||
cache.systemRoutes.hasOwnProperty(cacheKey) &&
|
||||
Math.round(
|
||||
( currentTimestamp - (new Date( cache.systemRoutes[cacheKey].updated * 1000).getTime())) / 1000
|
||||
) <= config.routeCacheTTL
|
||||
){
|
||||
// route data is cached (client side)
|
||||
var context = {
|
||||
dataTable: routesTable
|
||||
};
|
||||
|
||||
addRow(context, cache.systemRoutes[cacheKey].data);
|
||||
}else{
|
||||
// get route data
|
||||
|
||||
requestRouteData.push({
|
||||
mapIds: [mapId],
|
||||
systemFrom: systemFrom,
|
||||
systemTo: systemTo,
|
||||
stargates: 1,
|
||||
jumpbridges: 1,
|
||||
wormholes: 1,
|
||||
wormholesReduced: 1,
|
||||
wormholesCritical: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if routes data is not cached and is requested
|
||||
if(requestRouteData.length > 0){
|
||||
var contextData = {
|
||||
moduleElement: moduleElement,
|
||||
dataTable: routesTable
|
||||
};
|
||||
|
||||
var requestData = {
|
||||
routeData: requestRouteData
|
||||
};
|
||||
|
||||
getRouteData(requestData, contextData, callbackAddRouteRow);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* updates an dom element with the system route module
|
||||
* @param mapId
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.drawSystemRouteModule = function(mapId, systemData){
|
||||
|
||||
var parentElement = $(this);
|
||||
|
||||
// show route module
|
||||
var showModule = function(moduleElement){
|
||||
if(moduleElement){
|
||||
moduleElement.css({ opacity: 0 });
|
||||
parentElement.append(moduleElement);
|
||||
|
||||
moduleElement.velocity('transition.slideDownIn', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
delay: Init.animationSpeed.mapModule,
|
||||
complete: function(){
|
||||
initModule(moduleElement, mapId, systemData);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// check if module already exists
|
||||
var moduleElement = parentElement.find('.' + config.systemRouteModuleClass);
|
||||
|
||||
if(moduleElement.length > 0){
|
||||
moduleElement.velocity('transition.slideDownOut', {
|
||||
duration: Init.animationSpeed.mapModule,
|
||||
complete: function(tempElement){
|
||||
$(tempElement).remove();
|
||||
|
||||
moduleElement = getModule();
|
||||
showModule(moduleElement);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
moduleElement = getModule();
|
||||
showModule(moduleElement);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
12
public/js/v1.0.0RC3/lib/EasePack.min.js
vendored
12
public/js/v1.0.0RC3/lib/EasePack.min.js
vendored
@@ -1,12 +0,0 @@
|
||||
/*!
|
||||
* 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.0.0RC3/lib/TweenLite.min.js
vendored
12
public/js/v1.0.0RC3/lib/TweenLite.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* blueimp helper JS 1.2.0
|
||||
* 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,
|
||||
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+|$)'),
|
||||
i = this.length,
|
||||
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+/),
|
||||
i,
|
||||
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+/),
|
||||
i,
|
||||
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,
|
||||
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.0.0RC3/lib/bootbox.min.js
vendored
6
public/js/v1.0.0RC3/lib/bootbox.min.js
vendored
File diff suppressed because one or more lines are too long
249
public/js/v1.0.0RC3/lib/bootstrap-confirmation.js
vendored
249
public/js/v1.0.0RC3/lib/bootstrap-confirmation.js
vendored
@@ -1,249 +0,0 @@
|
||||
+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;
|
||||
|
||||
that.$element.on('click.dismiss.bs.confirmation', '[data-dismiss="confirmation"]', $.proxy(that.hide, that));
|
||||
|
||||
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.$element.confirmation('hide');
|
||||
|
||||
$('body').unbind(e);
|
||||
|
||||
event_body = false;
|
||||
|
||||
return;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(element).on('click', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js');
|
||||
|
||||
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">'
|
||||
+ '<div class="btn-group">'
|
||||
+ '<a data-dismiss="confirmation">No</a>'
|
||||
+ '<a data-apply="confirmation">Yes</a>'
|
||||
+ '</div>'
|
||||
+ '</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) {
|
||||
that.$element.confirmation('hide');
|
||||
|
||||
options.onConfirm(event, that.$element);
|
||||
});
|
||||
|
||||
$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.$element.confirmation('hide');
|
||||
});
|
||||
|
||||
$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($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($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($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($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($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($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($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($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($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);
|
||||
File diff suppressed because one or more lines are too long
7
public/js/v1.0.0RC3/lib/bootstrap.min.js
vendored
7
public/js/v1.0.0RC3/lib/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,8 +0,0 @@
|
||||
/*! ========================================================================
|
||||
* Bootstrap Toggle: bootstrap2-toggle.js v2.2.0
|
||||
* http://www.bootstraptoggle.com
|
||||
* ========================================================================
|
||||
* Copyright 2014 Min Hur, The New York Times Company
|
||||
* Licensed under MIT
|
||||
* ======================================================================== */
|
||||
+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.toggle"),f="object"==typeof b&&b;e||d.data("bs.toggle",e=new c(this,f)),"string"==typeof b&&e[b]&&e[b]()})}var c=function(b,c){this.$element=a(b),this.options=a.extend({},this.defaults(),c),this.render()};c.VERSION="2.2.0",c.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"default",size:"normal",style:"",width:null,height:null},c.prototype.defaults=function(){return{on:this.$element.attr("data-on")||c.DEFAULTS.on,off:this.$element.attr("data-off")||c.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||c.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||c.DEFAULTS.offstyle,size:this.$element.attr("data-size")||c.DEFAULTS.size,style:this.$element.attr("data-style")||c.DEFAULTS.style,width:this.$element.attr("data-width")||c.DEFAULTS.width,height:this.$element.attr("data-height")||c.DEFAULTS.height}},c.prototype.render=function(){this._onstyle="btn-"+this.options.onstyle,this._offstyle="btn-"+this.options.offstyle;var b="large"===this.options.size?"btn-large":"small"===this.options.size?"btn-small":"mini"===this.options.size?"btn-mini":"",c=a('<label class="btn">').html(this.options.on).addClass(this._onstyle+" "+b),d=a('<label class="btn">').html(this.options.off).addClass(this._offstyle+" "+b+" active"),e=a('<span class="toggle-handle btn btn-default">').addClass(b),f=a('<div class="toggle-group">').append(c,d,e),g=a('<div class="toggle btn" data-toggle="toggle">').addClass(this.$element.prop("checked")?this._onstyle:this._offstyle+" off").addClass(b).addClass(this.options.style);this.$element.wrap(g),a.extend(this,{$toggle:this.$element.parent(),$toggleOn:c,$toggleOff:d,$toggleGroup:f}),this.$toggle.append(f);var h=this.options.width||Math.max(c.width(),d.width())+e.outerWidth()/2,i=this.options.height||Math.max(c.height(),d.height());c.addClass("toggle-on"),d.addClass("toggle-off"),this.$toggle.css({width:h,height:i}),this.options.height&&(c.css("line-height",c.height()+"px"),d.css("line-height",d.height()+"px")),this.update(!0),this.trigger(!0)},c.prototype.toggle=function(){this.$element.prop("checked")?this.off():this.on()},c.prototype.on=function(a){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._offstyle+" off").addClass(this._onstyle),this.$element.prop("checked",!0),void(a||this.trigger()))},c.prototype.off=function(a){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._onstyle).addClass(this._offstyle+" off"),this.$element.prop("checked",!1),void(a||this.trigger()))},c.prototype.enable=function(){this.$toggle.removeAttr("disabled"),this.$element.prop("disabled",!1)},c.prototype.disable=function(){this.$toggle.attr("disabled","disabled"),this.$element.prop("disabled",!0)},c.prototype.update=function(a){this.$element.prop("disabled")?this.disable():this.enable(),this.$element.prop("checked")?this.on(a):this.off(a)},c.prototype.trigger=function(b){this.$element.off("change.bs.toggle"),b||this.$element.change(),this.$element.on("change.bs.toggle",a.proxy(function(){this.update()},this))},c.prototype.destroy=function(){this.$element.off("change.bs.toggle"),this.$toggleGroup.remove(),this.$element.removeData("bs.toggle"),this.$element.unwrap()};var d=a.fn.bootstrapToggle;a.fn.bootstrapToggle=b,a.fn.bootstrapToggle.Constructor=c,a.fn.toggle.noConflict=function(){return a.fn.bootstrapToggle=d,this},a(function(){a("input[type=checkbox][data-toggle^=toggle]").bootstrapToggle()}),a(document).on("click.bs.toggle","div[data-toggle^=toggle]",function(b){var c=a(this).find("input[type=checkbox]");c.bootstrapToggle("toggle"),b.preventDefault()})}(jQuery);
|
||||
@@ -1,873 +0,0 @@
|
||||
/*! Responsive 1.0.6
|
||||
* 2014-2015 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @summary Responsive
|
||||
* @description Responsive tables plug-in for DataTables
|
||||
* @version 1.0.6
|
||||
* @file dataTables.responsive.js
|
||||
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
||||
* @contact www.sprymedia.co.uk/contact
|
||||
* @copyright Copyright 2014-2015 SpryMedia Ltd.
|
||||
*
|
||||
* This source file is free software, available under the following license:
|
||||
* MIT license - http://datatables.net/license/mit
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
||||
*
|
||||
* For details please refer to: http://www.datatables.net
|
||||
*/
|
||||
|
||||
(function(window, document, undefined) {
|
||||
|
||||
|
||||
var factory = function( $, DataTable ) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Responsive is a plug-in for the DataTables library that makes use of
|
||||
* DataTables' ability to change the visibility of columns, changing the
|
||||
* visibility of columns so the displayed columns fit into the table container.
|
||||
* The end result is that complex tables will be dynamically adjusted to fit
|
||||
* into the viewport, be it on a desktop, tablet or mobile browser.
|
||||
*
|
||||
* Responsive for DataTables has two modes of operation, which can used
|
||||
* individually or combined:
|
||||
*
|
||||
* * Class name based control - columns assigned class names that match the
|
||||
* breakpoint logic can be shown / hidden as required for each breakpoint.
|
||||
* * Automatic control - columns are automatically hidden when there is no
|
||||
* room left to display them. Columns removed from the right.
|
||||
*
|
||||
* In additional to column visibility control, Responsive also has built into
|
||||
* options to use DataTables' child row display to show / hide the information
|
||||
* from the table that has been hidden. There are also two modes of operation
|
||||
* for this child row display:
|
||||
*
|
||||
* * Inline - when the control element that the user can use to show / hide
|
||||
* child rows is displayed inside the first column of the table.
|
||||
* * Column - where a whole column is dedicated to be the show / hide control.
|
||||
*
|
||||
* Initialisation of Responsive is performed by:
|
||||
*
|
||||
* * Adding the class `responsive` or `dt-responsive` to the table. In this case
|
||||
* Responsive will automatically be initialised with the default configuration
|
||||
* options when the DataTable is created.
|
||||
* * Using the `responsive` option in the DataTables configuration options. This
|
||||
* can also be used to specify the configuration options, or simply set to
|
||||
* `true` to use the defaults.
|
||||
*
|
||||
* @class
|
||||
* @param {object} settings DataTables settings object for the host table
|
||||
* @param {object} [opts] Configuration options
|
||||
* @requires jQuery 1.7+
|
||||
* @requires DataTables 1.10.1+
|
||||
*
|
||||
* @example
|
||||
* $('#example').DataTable( {
|
||||
* responsive: true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
var Responsive = function ( settings, opts ) {
|
||||
// Sanity check that we are using DataTables 1.10 or newer
|
||||
if ( ! DataTable.versionCheck || ! DataTable.versionCheck( '1.10.1' ) ) {
|
||||
throw 'DataTables Responsive requires DataTables 1.10.1 or newer';
|
||||
}
|
||||
|
||||
this.s = {
|
||||
dt: new DataTable.Api( settings ),
|
||||
columns: []
|
||||
};
|
||||
|
||||
// Check if responsive has already been initialised on this table
|
||||
if ( this.s.dt.settings()[0].responsive ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// details is an object, but for simplicity the user can give it as a string
|
||||
if ( opts && typeof opts.details === 'string' ) {
|
||||
opts.details = { type: opts.details };
|
||||
}
|
||||
|
||||
this.c = $.extend( true, {}, Responsive.defaults, DataTable.defaults.responsive, opts );
|
||||
settings.responsive = this;
|
||||
this._constructor();
|
||||
};
|
||||
|
||||
Responsive.prototype = {
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialise the Responsive instance
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_constructor: function ()
|
||||
{
|
||||
var that = this;
|
||||
var dt = this.s.dt;
|
||||
|
||||
dt.settings()[0]._responsive = this;
|
||||
|
||||
// Use DataTables' private throttle function to avoid processor thrashing
|
||||
$(window).on( 'resize.dtr orientationchange.dtr', dt.settings()[0].oApi._fnThrottle( function () {
|
||||
that._resize();
|
||||
} ) );
|
||||
|
||||
// Destroy event handler
|
||||
dt.on( 'destroy.dtr', function () {
|
||||
$(window).off( 'resize.dtr orientationchange.dtr draw.dtr' );
|
||||
} );
|
||||
|
||||
// Reorder the breakpoints array here in case they have been added out
|
||||
// of order
|
||||
this.c.breakpoints.sort( function (a, b) {
|
||||
return a.width < b.width ? 1 :
|
||||
a.width > b.width ? -1 : 0;
|
||||
} );
|
||||
|
||||
// Determine which columns are already hidden, and should therefore
|
||||
// remain hidden. todo - should this be done? See thread 22677
|
||||
//
|
||||
// this.s.alwaysHidden = dt.columns(':hidden').indexes();
|
||||
|
||||
this._classLogic();
|
||||
this._resizeAuto();
|
||||
|
||||
// Details handler
|
||||
var details = this.c.details;
|
||||
if ( details.type ) {
|
||||
that._detailsInit();
|
||||
this._detailsVis();
|
||||
|
||||
dt.on( 'column-visibility.dtr', function () {
|
||||
that._detailsVis();
|
||||
} );
|
||||
|
||||
// Redraw the details box on each draw. This is used until
|
||||
// DataTables implements a native `updated` event for rows
|
||||
dt.on( 'draw.dtr', function () {
|
||||
dt.rows( {page: 'current'} ).iterator( 'row', function ( settings, idx ) {
|
||||
var row = dt.row( idx );
|
||||
|
||||
if ( row.child.isShown() ) {
|
||||
var info = that.c.details.renderer( dt, idx );
|
||||
row.child( info, 'child' ).show();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
$(dt.table().node()).addClass( 'dtr-'+details.type );
|
||||
}
|
||||
|
||||
// First pass - draw the table for the current viewport size
|
||||
this._resize();
|
||||
},
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Private methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calculate the visibility for the columns in a table for a given
|
||||
* breakpoint. The result is pre-determined based on the class logic if
|
||||
* class names are used to control all columns, but the width of the table
|
||||
* is also used if there are columns which are to be automatically shown
|
||||
* and hidden.
|
||||
*
|
||||
* @param {string} breakpoint Breakpoint name to use for the calculation
|
||||
* @return {array} Array of boolean values initiating the visibility of each
|
||||
* column.
|
||||
* @private
|
||||
*/
|
||||
_columnsVisiblity: function ( breakpoint )
|
||||
{
|
||||
var dt = this.s.dt;
|
||||
var columns = this.s.columns;
|
||||
var i, ien;
|
||||
|
||||
// Class logic - determine which columns are in this breakpoint based
|
||||
// on the classes. If no class control (i.e. `auto`) then `-` is used
|
||||
// to indicate this to the rest of the function
|
||||
var display = $.map( columns, function ( col ) {
|
||||
return col.auto && col.minWidth === null ?
|
||||
false :
|
||||
col.auto === true ?
|
||||
'-' :
|
||||
$.inArray( breakpoint, col.includeIn ) !== -1;
|
||||
} );
|
||||
|
||||
// Auto column control - first pass: how much width is taken by the
|
||||
// ones that must be included from the non-auto columns
|
||||
var requiredWidth = 0;
|
||||
for ( i=0, ien=display.length ; i<ien ; i++ ) {
|
||||
if ( display[i] === true ) {
|
||||
requiredWidth += columns[i].minWidth;
|
||||
}
|
||||
}
|
||||
|
||||
// Second pass, use up any remaining width for other columns. For
|
||||
// scrolling tables we need to subtract the width of the scrollbar. It
|
||||
// may not be requires which makes this sub-optimal, but it would
|
||||
// require another full redraw to make complete use of those extra few
|
||||
// pixels
|
||||
var scrolling = dt.settings()[0].oScroll;
|
||||
var bar = scrolling.sY || scrolling.sX ? scrolling.iBarWidth : 0;
|
||||
var widthAvailable = dt.table().container().offsetWidth - bar;
|
||||
var usedWidth = widthAvailable - requiredWidth;
|
||||
|
||||
// Control column needs to always be included. This makes it sub-
|
||||
// optimal in terms of using the available with, but to stop layout
|
||||
// thrashing or overflow. Also we need to account for the control column
|
||||
// width first so we know how much width is available for the other
|
||||
// columns, since the control column might not be the first one shown
|
||||
for ( i=0, ien=display.length ; i<ien ; i++ ) {
|
||||
if ( columns[i].control ) {
|
||||
usedWidth -= columns[i].minWidth;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow columns to be shown (counting from the left) until we run out
|
||||
// of room
|
||||
var empty = false;
|
||||
for ( i=0, ien=display.length ; i<ien ; i++ ) {
|
||||
if ( display[i] === '-' && ! columns[i].control ) {
|
||||
// Once we've found a column that won't fit we don't let any
|
||||
// others display either, or columns might disappear in the
|
||||
// middle of the table
|
||||
if ( empty || usedWidth - columns[i].minWidth < 0 ) {
|
||||
empty = true;
|
||||
display[i] = false;
|
||||
}
|
||||
else {
|
||||
display[i] = true;
|
||||
}
|
||||
|
||||
usedWidth -= columns[i].minWidth;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if the 'control' column should be shown (if there is one).
|
||||
// This is the case when there is a hidden column (that is not the
|
||||
// control column). The two loops look inefficient here, but they are
|
||||
// trivial and will fly through. We need to know the outcome from the
|
||||
// first , before the action in the second can be taken
|
||||
var showControl = false;
|
||||
|
||||
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
||||
if ( ! columns[i].control && ! columns[i].never && ! display[i] ) {
|
||||
showControl = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
||||
if ( columns[i].control ) {
|
||||
display[i] = showControl;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally we need to make sure that there is at least one column that
|
||||
// is visible
|
||||
if ( $.inArray( true, display ) === -1 ) {
|
||||
display[0] = true;
|
||||
}
|
||||
|
||||
return display;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Create the internal `columns` array with information about the columns
|
||||
* for the table. This includes determining which breakpoints the column
|
||||
* will appear in, based upon class names in the column, which makes up the
|
||||
* vast majority of this method.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_classLogic: function ()
|
||||
{
|
||||
var that = this;
|
||||
var calc = {};
|
||||
var breakpoints = this.c.breakpoints;
|
||||
var columns = this.s.dt.columns().eq(0).map( function (i) {
|
||||
var className = this.column(i).header().className;
|
||||
|
||||
return {
|
||||
className: className,
|
||||
includeIn: [],
|
||||
auto: false,
|
||||
control: false,
|
||||
never: className.match(/\bnever\b/) ? true : false
|
||||
};
|
||||
} );
|
||||
|
||||
// Simply add a breakpoint to `includeIn` array, ensuring that there are
|
||||
// no duplicates
|
||||
var add = function ( colIdx, name ) {
|
||||
var includeIn = columns[ colIdx ].includeIn;
|
||||
|
||||
if ( $.inArray( name, includeIn ) === -1 ) {
|
||||
includeIn.push( name );
|
||||
}
|
||||
};
|
||||
|
||||
var column = function ( colIdx, name, operator, matched ) {
|
||||
var size, i, ien;
|
||||
|
||||
if ( ! operator ) {
|
||||
columns[ colIdx ].includeIn.push( name );
|
||||
}
|
||||
else if ( operator === 'max-' ) {
|
||||
// Add this breakpoint and all smaller
|
||||
size = that._find( name ).width;
|
||||
|
||||
for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
|
||||
if ( breakpoints[i].width <= size ) {
|
||||
add( colIdx, breakpoints[i].name );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( operator === 'min-' ) {
|
||||
// Add this breakpoint and all larger
|
||||
size = that._find( name ).width;
|
||||
|
||||
for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
|
||||
if ( breakpoints[i].width >= size ) {
|
||||
add( colIdx, breakpoints[i].name );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( operator === 'not-' ) {
|
||||
// Add all but this breakpoint (xxx need extra information)
|
||||
|
||||
for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
|
||||
if ( breakpoints[i].name.indexOf( matched ) === -1 ) {
|
||||
add( colIdx, breakpoints[i].name );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Loop over each column and determine if it has a responsive control
|
||||
// class
|
||||
columns.each( function ( col, i ) {
|
||||
var classNames = col.className.split(' ');
|
||||
var hasClass = false;
|
||||
|
||||
// Split the class name up so multiple rules can be applied if needed
|
||||
for ( var k=0, ken=classNames.length ; k<ken ; k++ ) {
|
||||
var className = $.trim( classNames[k] );
|
||||
|
||||
if ( className === 'all' ) {
|
||||
// Include in all
|
||||
hasClass = true;
|
||||
col.includeIn = $.map( breakpoints, function (a) {
|
||||
return a.name;
|
||||
} );
|
||||
return;
|
||||
}
|
||||
else if ( className === 'none' || className === 'never' ) {
|
||||
// Include in none (default) and no auto
|
||||
hasClass = true;
|
||||
return;
|
||||
}
|
||||
else if ( className === 'control' ) {
|
||||
// Special column that is only visible, when one of the other
|
||||
// columns is hidden. This is used for the details control
|
||||
hasClass = true;
|
||||
col.control = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$.each( breakpoints, function ( j, breakpoint ) {
|
||||
// Does this column have a class that matches this breakpoint?
|
||||
var brokenPoint = breakpoint.name.split('-');
|
||||
var re = new RegExp( '(min\\-|max\\-|not\\-)?('+brokenPoint[0]+')(\\-[_a-zA-Z0-9])?' );
|
||||
var match = className.match( re );
|
||||
|
||||
if ( match ) {
|
||||
hasClass = true;
|
||||
|
||||
if ( match[2] === brokenPoint[0] && match[3] === '-'+brokenPoint[1] ) {
|
||||
// Class name matches breakpoint name fully
|
||||
column( i, breakpoint.name, match[1], match[2]+match[3] );
|
||||
}
|
||||
else if ( match[2] === brokenPoint[0] && ! match[3] ) {
|
||||
// Class name matched primary breakpoint name with no qualifier
|
||||
column( i, breakpoint.name, match[1], match[2] );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// If there was no control class, then automatic sizing is used
|
||||
if ( ! hasClass ) {
|
||||
col.auto = true;
|
||||
}
|
||||
} );
|
||||
|
||||
this.s.columns = columns;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Initialisation for the details handler
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_detailsInit: function ()
|
||||
{
|
||||
var that = this;
|
||||
var dt = this.s.dt;
|
||||
var details = this.c.details;
|
||||
|
||||
// The inline type always uses the first child as the target
|
||||
if ( details.type === 'inline' ) {
|
||||
details.target = 'td:first-child';
|
||||
}
|
||||
|
||||
// type.target can be a string jQuery selector or a column index
|
||||
var target = details.target;
|
||||
var selector = typeof target === 'string' ? target : 'td';
|
||||
|
||||
// Click handler to show / hide the details rows when they are available
|
||||
$( dt.table().body() ).on( 'click', selector, function (e) {
|
||||
// If the table is not collapsed (i.e. there is no hidden columns)
|
||||
// then take no action
|
||||
if ( ! $(dt.table().node()).hasClass('collapsed' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that the row is actually a DataTable's controlled node
|
||||
if ( ! dt.row( $(this).closest('tr') ).length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For column index, we determine if we should act or not in the
|
||||
// handler - otherwise it is already okay
|
||||
if ( typeof target === 'number' ) {
|
||||
var targetIdx = target < 0 ?
|
||||
dt.columns().eq(0).length + target :
|
||||
target;
|
||||
|
||||
if ( dt.cell( this ).index().column !== targetIdx ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// $().closest() includes itself in its check
|
||||
var row = dt.row( $(this).closest('tr') );
|
||||
|
||||
if ( row.child.isShown() ) {
|
||||
row.child( false );
|
||||
$( row.node() ).removeClass( 'parent' );
|
||||
}
|
||||
else {
|
||||
var info = that.c.details.renderer( dt, row[0] );
|
||||
row.child( info, 'child' ).show();
|
||||
$( row.node() ).addClass( 'parent' );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Update the child rows in the table whenever the column visibility changes
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_detailsVis: function ()
|
||||
{
|
||||
var that = this;
|
||||
var dt = this.s.dt;
|
||||
|
||||
// Find how many columns are hidden
|
||||
var hiddenColumns = dt.columns().indexes().filter( function ( idx ) {
|
||||
var col = dt.column( idx );
|
||||
|
||||
if ( col.visible() ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Only counts as hidden if it doesn't have the `never` class
|
||||
return $( col.header() ).hasClass( 'never' ) ? null : idx;
|
||||
} );
|
||||
var haveHidden = true;
|
||||
|
||||
if ( hiddenColumns.length === 0 || ( hiddenColumns.length === 1 && this.s.columns[ hiddenColumns[0] ].control ) ) {
|
||||
haveHidden = false;
|
||||
}
|
||||
|
||||
if ( haveHidden ) {
|
||||
// Show all existing child rows
|
||||
dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
|
||||
var row = dt.row( idx );
|
||||
|
||||
if ( row.child() ) {
|
||||
var info = that.c.details.renderer( dt, row[0] );
|
||||
|
||||
// The renderer can return false to have no child row
|
||||
if ( info === false ) {
|
||||
row.child.hide();
|
||||
}
|
||||
else {
|
||||
row.child( info, 'child' ).show();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
else {
|
||||
// Hide all existing child rows
|
||||
dt.rows( { page: 'current' } ).eq(0).each( function (idx) {
|
||||
dt.row( idx ).child.hide();
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Find a breakpoint object from a name
|
||||
* @param {string} name Breakpoint name to find
|
||||
* @return {object} Breakpoint description object
|
||||
*/
|
||||
_find: function ( name )
|
||||
{
|
||||
var breakpoints = this.c.breakpoints;
|
||||
|
||||
for ( var i=0, ien=breakpoints.length ; i<ien ; i++ ) {
|
||||
if ( breakpoints[i].name === name ) {
|
||||
return breakpoints[i];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Alter the table display for a resized viewport. This involves first
|
||||
* determining what breakpoint the window currently is in, getting the
|
||||
* column visibilities to apply and then setting them.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_resize: function ()
|
||||
{
|
||||
var dt = this.s.dt;
|
||||
var width = $(window).width();
|
||||
var breakpoints = this.c.breakpoints;
|
||||
var breakpoint = breakpoints[0].name;
|
||||
var columns = this.s.columns;
|
||||
var i, ien;
|
||||
|
||||
// Determine what breakpoint we are currently at
|
||||
for ( i=breakpoints.length-1 ; i>=0 ; i-- ) {
|
||||
if ( width <= breakpoints[i].width ) {
|
||||
breakpoint = breakpoints[i].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show the columns for that break point
|
||||
var columnsVis = this._columnsVisiblity( breakpoint );
|
||||
|
||||
// Set the class before the column visibility is changed so event
|
||||
// listeners know what the state is. Need to determine if there are
|
||||
// any columns that are not visible but can be shown
|
||||
var collapsedClass = false;
|
||||
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
|
||||
if ( columnsVis[i] === false && ! columns[i].never ) {
|
||||
collapsedClass = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$( dt.table().node() ).toggleClass('collapsed', collapsedClass );
|
||||
|
||||
dt.columns().eq(0).each( function ( colIdx, i ) {
|
||||
dt.column( colIdx ).visible( columnsVis[i] );
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Determine the width of each column in the table so the auto column hiding
|
||||
* has that information to work with. This method is never going to be 100%
|
||||
* perfect since column widths can change slightly per page, but without
|
||||
* seriously compromising performance this is quite effective.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_resizeAuto: function ()
|
||||
{
|
||||
var dt = this.s.dt;
|
||||
var columns = this.s.columns;
|
||||
|
||||
// Are we allowed to do auto sizing?
|
||||
if ( ! this.c.auto ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Are there any columns that actually need auto-sizing, or do they all
|
||||
// have classes defined
|
||||
if ( $.inArray( true, $.map( columns, function (c) { return c.auto; } ) ) === -1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clone the table with the current data in it
|
||||
var tableWidth = dt.table().node().offsetWidth;
|
||||
var columnWidths = dt.columns;
|
||||
var clonedTable = dt.table().node().cloneNode( false );
|
||||
var clonedHeader = $( dt.table().header().cloneNode( false ) ).appendTo( clonedTable );
|
||||
var clonedBody = $( dt.table().body().cloneNode( false ) ).appendTo( clonedTable );
|
||||
|
||||
$( dt.table().footer() ).clone( false ).appendTo( clonedTable );
|
||||
|
||||
// This is a bit slow, but we need to get a clone of each row that
|
||||
// includes all columns. As such, try to do this as little as possible.
|
||||
dt.rows( { page: 'current' } ).indexes().flatten().each( function ( idx ) {
|
||||
var clone = dt.row( idx ).node().cloneNode( true );
|
||||
|
||||
if ( dt.columns( ':hidden' ).flatten().length ) {
|
||||
$(clone).append( dt.cells( idx, ':hidden' ).nodes().to$().clone() );
|
||||
}
|
||||
|
||||
$(clone).appendTo( clonedBody );
|
||||
} );
|
||||
|
||||
var cells = dt.columns().header().to$().clone( false );
|
||||
$('<tr/>')
|
||||
.append( cells )
|
||||
.appendTo( clonedHeader );
|
||||
|
||||
// In the inline case extra padding is applied to the first column to
|
||||
// give space for the show / hide icon. We need to use this in the
|
||||
// calculation
|
||||
if ( this.c.details.type === 'inline' ) {
|
||||
$(clonedTable).addClass( 'dtr-inline collapsed' );
|
||||
}
|
||||
|
||||
var inserted = $('<div/>')
|
||||
.css( {
|
||||
width: 1,
|
||||
height: 1,
|
||||
overflow: 'hidden'
|
||||
} )
|
||||
.append( clonedTable );
|
||||
|
||||
// Remove columns which are not to be included
|
||||
inserted.find('th.never, td.never').remove();
|
||||
|
||||
inserted.insertBefore( dt.table().node() );
|
||||
|
||||
// The cloned header now contains the smallest that each column can be
|
||||
dt.columns().eq(0).each( function ( idx ) {
|
||||
columns[idx].minWidth = cells[ idx ].offsetWidth || 0;
|
||||
} );
|
||||
|
||||
inserted.remove();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* List of default breakpoints. Each item in the array is an object with two
|
||||
* properties:
|
||||
*
|
||||
* * `name` - the breakpoint name.
|
||||
* * `width` - the breakpoint width
|
||||
*
|
||||
* @name Responsive.breakpoints
|
||||
* @static
|
||||
*/
|
||||
Responsive.breakpoints = [
|
||||
{ name: 'desktop', width: Infinity },
|
||||
{ name: 'tablet-l', width: 1024 },
|
||||
{ name: 'tablet-p', width: 768 },
|
||||
{ name: 'mobile-l', width: 480 },
|
||||
{ name: 'mobile-p', width: 320 }
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Responsive default settings for initialisation
|
||||
*
|
||||
* @namespace
|
||||
* @name Responsive.defaults
|
||||
* @static
|
||||
*/
|
||||
Responsive.defaults = {
|
||||
/**
|
||||
* List of breakpoints for the instance. Note that this means that each
|
||||
* instance can have its own breakpoints. Additionally, the breakpoints
|
||||
* cannot be changed once an instance has been creased.
|
||||
*
|
||||
* @type {Array}
|
||||
* @default Takes the value of `Responsive.breakpoints`
|
||||
*/
|
||||
breakpoints: Responsive.breakpoints,
|
||||
|
||||
/**
|
||||
* Enable / disable auto hiding calculations. It can help to increase
|
||||
* performance slightly if you disable this option, but all columns would
|
||||
* need to have breakpoint classes assigned to them
|
||||
*
|
||||
* @type {Boolean}
|
||||
* @default `true`
|
||||
*/
|
||||
auto: true,
|
||||
|
||||
/**
|
||||
* Details control. If given as a string value, the `type` property of the
|
||||
* default object is set to that value, and the defaults used for the rest
|
||||
* of the object - this is for ease of implementation.
|
||||
*
|
||||
* The object consists of the following properties:
|
||||
*
|
||||
* * `renderer` - function that is called for display of the child row data.
|
||||
* The default function will show the data from the hidden columns
|
||||
* * `target` - Used as the selector for what objects to attach the child
|
||||
* open / close to
|
||||
* * `type` - `false` to disable the details display, `inline` or `column`
|
||||
* for the two control types
|
||||
*
|
||||
* @type {Object|string}
|
||||
*/
|
||||
details: {
|
||||
renderer: function ( api, rowIdx ) {
|
||||
var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
|
||||
var header = $( api.column( cell.column ).header() );
|
||||
var idx = api.cell( cell ).index();
|
||||
|
||||
if ( header.hasClass( 'control' ) || header.hasClass( 'never' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Use a non-public DT API method to render the data for display
|
||||
// This needs to be updated when DT adds a suitable method for
|
||||
// this type of data retrieval
|
||||
var dtPrivate = api.settings()[0];
|
||||
var cellData = dtPrivate.oApi._fnGetCellData(
|
||||
dtPrivate, idx.row, idx.column, 'display'
|
||||
);
|
||||
var title = header.text();
|
||||
if ( title ) {
|
||||
title = title + ':';
|
||||
}
|
||||
|
||||
return '<li data-dtr-index="'+idx.column+'">'+
|
||||
'<span class="dtr-title">'+
|
||||
title+
|
||||
'</span> '+
|
||||
'<span class="dtr-data">'+
|
||||
cellData+
|
||||
'</span>'+
|
||||
'</li>';
|
||||
} ).toArray().join('');
|
||||
|
||||
return data ?
|
||||
$('<ul data-dtr-index="'+rowIdx+'"/>').append( data ) :
|
||||
false;
|
||||
},
|
||||
|
||||
target: 0,
|
||||
|
||||
type: 'inline'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* API
|
||||
*/
|
||||
var Api = $.fn.dataTable.Api;
|
||||
|
||||
// Doesn't do anything - work around for a bug in DT... Not documented
|
||||
Api.register( 'responsive()', function () {
|
||||
return this;
|
||||
} );
|
||||
|
||||
Api.register( 'responsive.index()', function ( li ) {
|
||||
li = $(li);
|
||||
|
||||
return {
|
||||
column: li.data('dtr-index'),
|
||||
row: li.parent().data('dtr-index')
|
||||
};
|
||||
} );
|
||||
|
||||
Api.register( 'responsive.rebuild()', function () {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx._responsive ) {
|
||||
ctx._responsive._classLogic();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
Api.register( 'responsive.recalc()', function () {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx._responsive ) {
|
||||
ctx._responsive._resizeAuto();
|
||||
ctx._responsive._resize();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
/**
|
||||
* Version information
|
||||
*
|
||||
* @name Responsive.version
|
||||
* @static
|
||||
*/
|
||||
Responsive.version = '1.0.6';
|
||||
|
||||
|
||||
$.fn.dataTable.Responsive = Responsive;
|
||||
$.fn.DataTable.Responsive = Responsive;
|
||||
|
||||
// Attach a listener to the document which listens for DataTables initialisation
|
||||
// events so we can automatically initialise
|
||||
$(document).on( 'init.dt.dtr', function (e, settings, json) {
|
||||
if ( e.namespace !== 'dt' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $(settings.nTable).hasClass( 'responsive' ) ||
|
||||
$(settings.nTable).hasClass( 'dt-responsive' ) ||
|
||||
settings.oInit.responsive ||
|
||||
DataTable.defaults.responsive
|
||||
) {
|
||||
var init = settings.oInit.responsive;
|
||||
|
||||
if ( init !== false ) {
|
||||
new Responsive( settings, $.isPlainObject( init ) ? init : {} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return Responsive;
|
||||
}; // /factory
|
||||
|
||||
|
||||
// Define as an AMD module if possible
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
define( ['jquery', 'datatables'], factory );
|
||||
}
|
||||
else if ( typeof exports === 'object' ) {
|
||||
// Node/CommonJS
|
||||
factory( require('jquery'), require('datatables') );
|
||||
}
|
||||
else if ( jQuery && !jQuery.fn.dataTable.Responsive ) {
|
||||
// Otherwise simply initialise as normal, stopping multiple evaluation
|
||||
factory( jQuery, jQuery.fn.dataTable );
|
||||
}
|
||||
|
||||
|
||||
})(window, document);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,160 +0,0 @@
|
||||
/*! DataTables 1.10.7
|
||||
* ©2008-2015 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
(function(Ea,Q,k){var P=function(h){function W(a){var b,c,e={};h.each(a,function(d){if((b=d.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=d.replace(b[0],b[2].toLowerCase()),e[c]=d,"o"===b[1]&&W(a[d])});a._hungarianMap=e}function H(a,b,c){a._hungarianMap||W(a);var e;h.each(b,function(d){e=a._hungarianMap[d];if(e!==k&&(c||b[e]===k))"o"===e.charAt(0)?(b[e]||(b[e]={}),h.extend(!0,b[e],b[d]),H(a[e],b[e],c)):b[e]=b[d]})}function P(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;
|
||||
!a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&E(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&E(a,a,"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&db(a)}function eb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");
|
||||
A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&H(m.models.oSearch,a[b])}function fb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;b&&!h.isArray(b)&&(a.aDataSort=[b])}function gb(a){var a=a.oBrowser,b=h("<div/>").css({position:"absolute",top:0,left:0,height:1,width:1,overflow:"hidden"}).append(h("<div/>").css({position:"absolute",
|
||||
top:1,left:1,width:100,overflow:"scroll"}).append(h('<div class="test"/>').css({width:"100%",height:10}))).appendTo("body"),c=b.find(".test");a.bScrollOversize=100===c[0].offsetWidth;a.bScrollbarLeft=1!==Math.round(c.offset().left);b.remove()}function hb(a,b,c,e,d,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;e!==d;)a.hasOwnProperty(e)&&(g=j?b(g,a[e],e,a):a[e],j=!0,e+=f);return g}function Fa(a,b){var c=m.defaults.column,e=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:Q.createElement("th"),sTitle:c.sTitle?
|
||||
c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[e],mData:c.mData?c.mData:e,idx:e});a.aoColumns.push(c);c=a.aoPreSearchCols;c[e]=h.extend({},m.models.oSearch,c[e]);ka(a,e,h(b).data())}function ka(a,b,c){var b=a.aoColumns[b],e=a.oClasses,d=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=d.attr("width")||null;var f=(d.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),H(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&
|
||||
(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),h.extend(b,c),E(b,c,"sWidth","sWidthOrig"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),E(b,c,"aDataSort"));var g=b.mData,j=R(g),i=b.mRender?R(b.mRender):null,c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b.fnGetData=function(a,b,c){var e=j(a,b,k,c);return i&&b?i(e,b,a,c):e};b.fnSetData=function(a,b,c){return S(g)(a,b,c)};"number"!==typeof g&&
|
||||
(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,d.addClass(e.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=e.sSortableNone,b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=e.sSortableAsc,b.sSortingClassJUI=e.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=e.sSortableDesc,b.sSortingClassJUI=e.sSortJUIDescAllowed):(b.sSortingClass=e.sSortable,b.sSortingClassJUI=e.sSortJUI)}function X(a){if(!1!==a.oFeatures.bAutoWidth){var b=
|
||||
a.aoColumns;Ga(a);for(var c=0,e=b.length;c<e;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&Y(a);w(a,null,"column-sizing",[a])}function la(a,b){var c=Z(a,"bVisible");return"number"===typeof c[b]?c[b]:null}function $(a,b){var c=Z(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}function aa(a){return Z(a,"bVisible").length}function Z(a,b){var c=[];h.map(a.aoColumns,function(a,d){a[b]&&c.push(d)});return c}function Ha(a){var b=a.aoColumns,c=a.aoData,e=m.ext.type.detect,d,
|
||||
f,g,j,i,h,l,q,n;d=0;for(f=b.length;d<f;d++)if(l=b[d],n=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=e.length;g<j;g++){i=0;for(h=c.length;i<h;i++){n[i]===k&&(n[i]=x(a,i,d,"type"));q=e[g](n[i],a);if(!q&&g!==e.length-1)break;if("html"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType="string")}}function ib(a,b,c,e){var d,f,g,j,i,o,l=a.aoColumns;if(b)for(d=b.length-1;0<=d;d--){o=b[d];var q=o.targets!==k?o.targets:o.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<
|
||||
g;f++)if("number"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Fa(a);e(q[f],o)}else if("number"===typeof q[f]&&0>q[f])e(l.length+q[f],o);else if("string"===typeof q[f]){j=0;for(i=l.length;j<i;j++)("_all"==q[f]||h(l[j].nTh).hasClass(q[f]))&&e(j,o)}}if(c){d=0;for(a=c.length;d<a;d++)e(d,c[d])}}function K(a,b,c,e){var d=a.aoData.length,f=h.extend(!0,{},m.models.oRow,{src:c?"dom":"data"});f._aData=b;a.aoData.push(f);for(var b=a.aoColumns,f=0,g=b.length;f<g;f++)c&&Ia(a,d,f,x(a,d,f)),b[f].sType=null;a.aiDisplayMaster.push(d);
|
||||
(c||!a.oFeatures.bDeferRender)&&Ja(a,d,c,e);return d}function ma(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,d){c=na(a,d);return K(a,c.data,d,c.cells)})}function x(a,b,c,e){var d=a.iDraw,f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,c=f.fnGetData(g,e,{settings:a,row:b,col:c});if(c===k)return a.iDrawError!=d&&null===j&&(I(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b,4),a.iDrawError=d),j;if((c===g||null===c)&&
|
||||
null!==j)c=j;else if("function"===typeof c)return c.call(g);return null===c&&"display"==e?"":c}function Ia(a,b,c,e){a.aoColumns[c].fnSetData(a.aoData[b]._aData,e,{settings:a,row:b,col:c})}function Ka(a){return h.map(a.match(/(\\.|[^\.])+/g),function(a){return a.replace(/\\./g,".")})}function R(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=R(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,
|
||||
c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var c=function(a,b,f){var g,j;if(""!==f){j=Ka(f);for(var i=0,h=j.length;i<h;i++){f=j[i].match(ba);g=j[i].match(T);if(f){j[i]=j[i].replace(ba,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");i=0;for(h=a.length;i<h;i++)g.push(c(a[i],b,j));a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(T,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===
|
||||
k)return k;a=a[j[i]]}}return a};return function(b,d){return c(b,d,a)}}return function(b){return b[a]}}function S(a){if(h.isPlainObject(a))return S(a._);if(null===a)return function(){};if("function"===typeof a)return function(b,e,d){a(b,"set",e,d)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,e,d){var d=Ka(d),f;f=d[d.length-1];for(var g,j,i=0,h=d.length-1;i<h;i++){g=d[i].match(ba);j=d[i].match(T);if(g){d[i]=d[i].replace(ba,"");a[d[i]]=[];
|
||||
f=d.slice();f.splice(0,i+1);g=f.join(".");j=0;for(h=e.length;j<h;j++)f={},b(f,e[j],g),a[d[i]].push(f);return}j&&(d[i]=d[i].replace(T,""),a=a[d[i]](e));if(null===a[d[i]]||a[d[i]]===k)a[d[i]]={};a=a[d[i]]}if(f.match(T))a[f.replace(T,"")](e);else a[f.replace(ba,"")]=e};return function(c,e){return b(c,e,a)}}return function(b,e){b[a]=e}}function La(a){return D(a.aoData,"_aData")}function oa(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0}function pa(a,b,c){for(var e=-1,d=0,f=a.length;d<
|
||||
f;d++)a[d]==b?e=d:a[d]>b&&a[d]--; -1!=e&&c===k&&a.splice(e,1)}function ca(a,b,c,e){var d=a.aoData[b],f,g=function(c,f){for(;c.childNodes.length;)c.removeChild(c.firstChild);c.innerHTML=x(a,b,f,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===d.src)d._aData=na(a,d,e,e===k?k:d._aData).data;else{var j=d.anCells;if(j)if(e!==k)g(j[e],e);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}d._aSortData=null;d._aFilterData=null;g=a.aoColumns;if(e!==k)g[e].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;
|
||||
Ma(d)}}function na(a,b,c,e){var d=[],f=b.firstChild,g,j=0,i,o=a.aoColumns,l=a._rowReadObject,e=e||l?{}:[],q=function(a,b){if("string"===typeof a){var c=a.indexOf("@");-1!==c&&(c=a.substring(c+1),S(a)(e,b.getAttribute(c)))}},a=function(a){if(c===k||c===j)g=o[j],i=h.trim(a.innerHTML),g&&g._bAttrSrc?(S(g.mData._)(e,i),q(g.mData.sort,a),q(g.mData.type,a),q(g.mData.filter,a)):l?(g._setter||(g._setter=S(g.mData)),g._setter(e,i)):e[j]=i;j++};if(f)for(;f;){b=f.nodeName.toUpperCase();if("TD"==b||"TH"==b)a(f),
|
||||
d.push(f);f=f.nextSibling}else{d=b.anCells;f=0;for(b=d.length;f<b;f++)a(d[f])}return{data:e,cells:d}}function Ja(a,b,c,e){var d=a.aoData[b],f=d._aData,g=[],j,i,h,l,q;if(null===d.nTr){j=c||Q.createElement("tr");d.nTr=j;d.anCells=g;j._DT_RowIndex=b;Ma(d);l=0;for(q=a.aoColumns.length;l<q;l++){h=a.aoColumns[l];i=c?e[l]:Q.createElement(h.sCellType);g.push(i);if(!c||h.mRender||h.mData!==l)i.innerHTML=x(a,b,l,"display");h.sClass&&(i.className+=" "+h.sClass);h.bVisible&&!c?j.appendChild(i):!h.bVisible&&c&&
|
||||
i.parentNode.removeChild(i);h.fnCreatedCell&&h.fnCreatedCell.call(a.oInstance,i,x(a,b,l),f,b,l)}w(a,"aoRowCreatedCallback",null,[j,f,b])}d.nTr.setAttribute("role","row")}function Ma(a){var b=a.nTr,c=a._aData;if(b){c.DT_RowId&&(b.id=c.DT_RowId);if(c.DT_RowClass){var e=c.DT_RowClass.split(" ");a.__rowc=a.__rowc?Na(a.__rowc.concat(e)):e;h(b).removeClass(a.__rowc.join(" ")).addClass(c.DT_RowClass)}c.DT_RowAttr&&h(b).attr(c.DT_RowAttr);c.DT_RowData&&h(b).data(c.DT_RowData)}}function jb(a){var b,c,e,d,
|
||||
f,g=a.nTHead,j=a.nTFoot,i=0===h("th, td",g).length,o=a.oClasses,l=a.aoColumns;i&&(d=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],e=h(f.nTh).addClass(f.sClass),i&&e.appendTo(d),a.oFeatures.bSort&&(e.addClass(f.sSortingClass),!1!==f.bSortable&&(e.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),Oa(a,f.nTh,b))),f.sTitle!=e.html()&&e.html(f.sTitle),Pa(a,"header")(a,e,f,o);i&&da(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(o.sHeaderTH);
|
||||
h(j).find(">tr>th, >tr>td").addClass(o.sFooterTH);if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function ea(a,b,c){var e,d,f,g=[],j=[],i=a.aoColumns.length,o;if(b){c===k&&(c=!1);e=0;for(d=b.length;e<d;e++){g[e]=b[e].slice();g[e].nTr=b[e].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[e].splice(f,1);j.push([])}e=0;for(d=g.length;e<d;e++){if(a=g[e].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[e].length;f<b;f++)if(o=
|
||||
i=1,j[e][f]===k){a.appendChild(g[e][f].cell);for(j[e][f]=1;g[e+i]!==k&&g[e][f].cell==g[e+i][f].cell;)j[e+i][f]=1,i++;for(;g[e][f+o]!==k&&g[e][f].cell==g[e][f+o].cell;){for(c=0;c<i;c++)j[e+c][f+o]=1;o++}h(g[e][f].cell).attr("rowspan",i).attr("colspan",o)}}}}function M(a){var b=w(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,e=a.asStripeClasses,d=e.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==B(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=
|
||||
j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=-1);var g=a._iDisplayStart,o=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!kb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:o;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ja(a,l);l=q.nTr;if(0!==d){var n=e[c%d];q._sRowStripe!=n&&(h(l).removeClass(q._sRowStripe).addClass(n),q._sRowStripe=n)}w(a,"aoRowCallback",null,[l,q._aData,c,j]);b.push(l);c++}}else c=f.sZeroRecords,
|
||||
1==a.iDraw&&"ajax"==B(a)?c=f.sLoadingRecords:f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":d?e[0]:""}).append(h("<td />",{valign:"top",colSpan:aa(a),"class":a.oClasses.sRowEmpty}).html(c))[0];w(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],La(a),g,o,i]);w(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],La(a),g,o,i]);e=h(a.nTBody);e.children().detach();e.append(h(b));w(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=
|
||||
!1}}function N(a,b){var c=a.oFeatures,e=c.bFilter;c.bSort&&lb(a);e?fa(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;M(a);a._drawHold=!1}function mb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),e=a.oFeatures,d=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=d[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,o,l,q,n=0;n<f.length;n++){g=
|
||||
null;j=f[n];if("<"==j){i=h("<div/>")[0];o=f[n+1];if("'"==o||'"'==o){l="";for(q=2;f[n+q]!=o;)l+=f[n+q],q++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(o=l.split("."),i.id=o[0].substr(1,o[0].length-1),i.className=o[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;n+=q}d.append(i);d=h(i)}else if(">"==j)d=d.parent();else if("l"==j&&e.bPaginate&&e.bLengthChange)g=nb(a);else if("f"==j&&e.bFilter)g=ob(a);else if("r"==j&&e.bProcessing)g=pb(a);else if("t"==j)g=qb(a);else if("i"==
|
||||
j&&e.bInfo)g=rb(a);else if("p"==j&&e.bPaginate)g=sb(a);else if(0!==m.ext.feature.length){i=m.ext.feature;q=0;for(o=i.length;q<o;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),d.append(g))}c.replaceWith(d)}function da(a,b){var c=h(b).children("tr"),e,d,f,g,j,i,o,l,q,n;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<i;f++){e=c[f];for(d=e.firstChild;d;){if("TD"==d.nodeName.toUpperCase()||"TH"==d.nodeName.toUpperCase()){l=
|
||||
1*d.getAttribute("colspan");q=1*d.getAttribute("rowspan");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;o=g;n=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][o+j]={cell:d,unique:n},a[f+g].nTr=e}d=d.nextSibling}}}function qa(a,b,c){var e=[];c||(c=a.aoHeader,b&&(c=[],da(c,b)));for(var b=0,d=c.length;b<d;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!e[f]||!a.bSortCellsTop))e[f]=c[b][f].cell;return e}function ra(a,b,c){w(a,"aoServerParams","serverParams",[b]);
|
||||
if(b&&h.isArray(b)){var e={},d=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(d);c?(c=c[0],e[c]||(e[c]=[]),e[c].push(b.value)):e[b.name]=b.value});b=e}var f,g=a.ajax,j=a.oInstance,i=function(b){w(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var o=h.isFunction(f)?f(b,a):f,b=h.isFunction(f)&&o?o:h.extend(!0,b,o);delete g.data}o={data:b,success:function(b){var c=b.error||b.sError;c&&I(a,0,c);a.json=b;i(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,
|
||||
c){var f=w(a,null,"xhr",[a,null,a.jqXHR]);-1===h.inArray(!0,f)&&("parsererror"==c?I(a,0,"Invalid JSON response",1):4===b.readyState&&I(a,0,"Ajax error",7));C(a,!1)}};a.oAjaxData=b;w(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(o,{url:g||a.sAjaxSource})):h.isFunction(g)?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(o,g)),g.data=f)}function kb(a){return a.bAjaxDataGet?
|
||||
(a.iDraw++,C(a,!0),ra(a,tb(a),function(b){ub(a,b)}),!1):!0}function tb(a){var b=a.aoColumns,c=b.length,e=a.oFeatures,d=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,o,l,q=U(a);g=a._iDisplayStart;i=!1!==e.bPaginate?a._iDisplayLength:-1;var n=function(a,b){j.push({name:a,value:b})};n("sEcho",a.iDraw);n("iColumns",c);n("sColumns",D(b,"sName").join(","));n("iDisplayStart",g);n("iDisplayLength",i);var k={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:d.sSearch,regex:d.bRegex}};for(g=
|
||||
0;g<c;g++)o=b[g],l=f[g],i="function"==typeof o.mData?"function":o.mData,k.columns.push({data:i,name:o.sName,searchable:o.bSearchable,orderable:o.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),n("mDataProp_"+g,i),e.bFilter&&(n("sSearch_"+g,l.sSearch),n("bRegex_"+g,l.bRegex),n("bSearchable_"+g,o.bSearchable)),e.bSort&&n("bSortable_"+g,o.bSortable);e.bFilter&&(n("sSearch",d.sSearch),n("bRegex",d.bRegex));e.bSort&&(h.each(q,function(a,b){k.order.push({column:b.col,dir:b.dir});n("iSortCol_"+a,b.col);
|
||||
n("sSortDir_"+a,b.dir)}),n("iSortingCols",q.length));b=m.ext.legacy.ajax;return null===b?a.sAjaxSource?j:k:b?j:k}function ub(a,b){var c=sa(a,b),e=b.sEcho!==k?b.sEcho:b.draw,d=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(e){if(1*e<a.iDraw)return;a.iDraw=1*e}oa(a);a._iRecordsTotal=parseInt(d,10);a._iRecordsDisplay=parseInt(f,10);e=0;for(d=c.length;e<d;e++)K(a,c[e]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;
|
||||
M(a);a._bInitComplete||ta(a,b);a.bAjaxDataGet=!0;C(a,!1)}function sa(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?R(c)(b):b}function ob(a){var b=a.oClasses,c=a.sTableId,e=a.oLanguage,d=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=e.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),
|
||||
f=function(){var b=!this.value?"":this.value;b!=d.sSearch&&(fa(a,{sSearch:b,bRegex:d.bRegex,bSmart:d.bSmart,bCaseInsensitive:d.bCaseInsensitive}),a._iDisplayStart=0,M(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===B(a)?400:0,i=h("input",b).val(d.sSearch).attr("placeholder",e.sSearchPlaceholder).bind("keyup.DT search.DT input.DT paste.DT cut.DT",g?ua(f,g):f).bind("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==
|
||||
Q.activeElement&&i.val(d.sSearch)}catch(f){}});return b[0]}function fa(a,b,c){var e=a.oPreviousSearch,d=a.aoPreSearchCols,f=function(a){e.sSearch=a.sSearch;e.bRegex=a.bRegex;e.bSmart=a.bSmart;e.bCaseInsensitive=a.bCaseInsensitive};Ha(a);if("ssp"!=B(a)){vb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<d.length;b++)wb(a,d[b].sSearch,b,d[b].bEscapeRegex!==k?!d[b].bEscapeRegex:d[b].bRegex,d[b].bSmart,d[b].bCaseInsensitive);xb(a)}else f(b);a.bFiltered=
|
||||
!0;w(a,null,"search",[a])}function xb(a){for(var b=m.ext.search,c=a.aiDisplay,e,d,f=0,g=b.length;f<g;f++){for(var j=[],i=0,h=c.length;i<h;i++)d=c[i],e=a.aoData[d],b[f](a,e._aFilterData,d,e._aData,i)&&j.push(d);c.length=0;c.push.apply(c,j)}}function wb(a,b,c,e,d,f){if(""!==b)for(var g=a.aiDisplay,e=Qa(b,e,d,f),d=g.length-1;0<=d;d--)b=a.aoData[g[d]]._aFilterData[c],e.test(b)||g.splice(d,1)}function vb(a,b,c,e,d,f){var e=Qa(b,e,d,f),d=a.oPreviousSearch.sSearch,f=a.aiDisplayMaster,g;0!==m.ext.search.length&&
|
||||
(c=!0);g=yb(a);if(0>=b.length)a.aiDisplay=f.slice();else{if(g||c||d.length>b.length||0!==b.indexOf(d)||a.bSorted)a.aiDisplay=f.slice();b=a.aiDisplay;for(c=b.length-1;0<=c;c--)e.test(a.aoData[b[c]]._sFilterRow)||b.splice(c,1)}}function Qa(a,b,c,e){a=b?a:va(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',"")}).join(")(?=.*?")+").*$");return RegExp(a,e?"i":"")}function va(a){return a.replace(Yb,"\\$1")}
|
||||
function yb(a){var b=a.aoColumns,c,e,d,f,g,j,i,h,l=m.ext.type.search;c=!1;e=0;for(f=a.aoData.length;e<f;e++)if(h=a.aoData[e],!h._aFilterData){j=[];d=0;for(g=b.length;d<g;d++)c=b[d],c.bSearchable?(i=x(a,e,d,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(wa.innerHTML=i,i=Zb?wa.textContent:wa.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);h._aFilterData=j;h._sFilterRow=j.join(" ");c=!0}return c}
|
||||
function zb(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}function Ab(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function rb(a){var b=a.sTableId,c=a.aanFeatures.i,e=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Bb,sName:"information"}),e.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",b+"_info"));return e[0]}function Bb(a){var b=
|
||||
a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,e=a._iDisplayStart+1,d=a.fnDisplayEnd(),f=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Cb(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,e,d,f,g,j));h(b).html(j)}}function Cb(a,b){var c=a.fnFormatNumber,e=a._iDisplayStart+1,d=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===d;return b.replace(/_START_/g,c.call(a,e)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,
|
||||
c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(e/d))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/d)))}function ga(a){var b,c,e=a.iInitDisplayStart,d=a.aoColumns,f;c=a.oFeatures;if(a.bInitialised){mb(a);jb(a);ea(a,a.aoHeader);ea(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Ga(a);b=0;for(c=d.length;b<c;b++)f=d[b],f.sWidth&&(f.nTh.style.width=s(f.sWidth));N(a);d=B(a);"ssp"!=d&&("ajax"==d?ra(a,[],function(c){var f=sa(a,c);for(b=0;b<f.length;b++)K(a,f[b]);
|
||||
a.iInitDisplayStart=e;N(a);C(a,!1);ta(a,c)},a):(C(a,!1),ta(a)))}else setTimeout(function(){ga(a)},200)}function ta(a,b){a._bInitComplete=!0;b&&X(a);w(a,"aoInitComplete","init",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);w(a,null,"length",[a,c])}function nb(a){for(var b=a.oClasses,c=a.sTableId,e=a.aLengthMenu,d=h.isArray(e[0]),f=d?e[0]:e,e=d?e[1]:e,d=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)d[0][g]=new Option(e[g],
|
||||
f[g]);var i=h("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",d[0].outerHTML));h("select",i).val(a._iDisplayLength).bind("change.DT",function(){Ra(a,h(this).val());M(a)});h(a.nTable).bind("length.dt.DT",function(b,c,f){a===c&&h("select",i).val(f)});return i[0]}function sb(a){var b=a.sPaginationType,c=m.ext.pager[b],e="function"===typeof c,d=function(a){M(a)},b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],
|
||||
f=a.aanFeatures;e||c.fnInit(a,b,d);f.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(e){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),q,l=0;for(q=f.p.length;l<q;l++)Pa(a,"pageButton")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,d)},sName:"pagination"}));return b}function Ta(a,b,c){var e=a._iDisplayStart,d=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===d?e=0:"number"===typeof b?(e=b*d,e>f&&(e=0)):
|
||||
"first"==b?e=0:"previous"==b?(e=0<=d?e-d:0,0>e&&(e=0)):"next"==b?e+d<f&&(e+=d):"last"==b?e=Math.floor((f-1)/d)*d:I(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==e;a._iDisplayStart=e;b&&(w(a,null,"page",[a]),c&&M(a));return b}function pb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",b?"block":"none");w(a,
|
||||
null,"processing",[a,b])}function qb(a){var b=h(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var e=c.sX,d=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),o=h(b[0].cloneNode(!1)),l=b.children("tfoot");c.sX&&"100%"===b.attr("width")&&b.removeAttr("width");l.length||(l=null);c=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,
|
||||
width:e?!e?null:s(e):"100%"}).append(h("<div/>",{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({overflow:"auto",height:!d?null:s(d),width:!e?null:s(e)}).append(b));l&&c.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:e?!e?null:s(e):"100%"}).append(h("<div/>",{"class":f.sScrollFootInner}).append(o.removeAttr("id").css("margin-left",
|
||||
0).append("bottom"===j?g:null).append(b.children("tfoot")))));var b=c.children(),q=b[0],f=b[1],n=l?b[2]:null;if(e)h(f).on("scroll.DT",function(){var a=this.scrollLeft;q.scrollLeft=a;l&&(n.scrollLeft=a)});a.nScrollHead=q;a.nScrollBody=f;a.nScrollFoot=n;a.aoDrawCallback.push({fn:Y,sName:"scrolling"});return c[0]}function Y(a){var b=a.oScroll,c=b.sX,e=b.sXInner,d=b.sY,f=b.iBarWidth,g=h(a.nScrollHead),j=g[0].style,i=g.children("div"),o=i[0].style,l=i.children("table"),i=a.nScrollBody,q=h(i),n=i.style,
|
||||
k=h(a.nScrollFoot).children("div"),p=k.children("table"),m=h(a.nTHead),r=h(a.nTable),t=r[0],O=t.style,L=a.nTFoot?h(a.nTFoot):null,ha=a.oBrowser,w=ha.bScrollOversize,v,u,y,x,z,A=[],B=[],C=[],D,E=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};r.children("thead, tfoot").remove();z=m.clone().prependTo(r);v=m.find("tr");y=z.find("tr");z.find("th, td").removeAttr("tabindex");L&&(x=L.clone().prependTo(r),u=L.find("tr"),x=x.find("tr"));
|
||||
c||(n.width="100%",g[0].style.width="100%");h.each(qa(a,z),function(b,c){D=la(a,b);c.style.width=a.aoColumns[D].sWidth});L&&G(function(a){a.style.width=""},x);b.bCollapse&&""!==d&&(n.height=q[0].offsetHeight+m[0].offsetHeight+"px");g=r.outerWidth();if(""===c){if(O.width="100%",w&&(r.find("tbody").height()>i.offsetHeight||"scroll"==q.css("overflow-y")))O.width=s(r.outerWidth()-f)}else""!==e?O.width=s(e):g==q.width()&&q.height()<r.height()?(O.width=s(g-f),r.outerWidth()>g-f&&(O.width=s(g))):O.width=
|
||||
s(g);g=r.outerWidth();G(E,y);G(function(a){C.push(a.innerHTML);A.push(s(h(a).css("width")))},y);G(function(a,b){a.style.width=A[b]},v);h(y).height(0);L&&(G(E,x),G(function(a){B.push(s(h(a).css("width")))},x),G(function(a,b){a.style.width=B[b]},u),h(x).height(0));G(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+C[b]+"</div>";a.style.width=A[b]},y);L&&G(function(a,b){a.innerHTML="";a.style.width=B[b]},x);if(r.outerWidth()<g){u=i.scrollHeight>i.offsetHeight||
|
||||
"scroll"==q.css("overflow-y")?g+f:g;if(w&&(i.scrollHeight>i.offsetHeight||"scroll"==q.css("overflow-y")))O.width=s(u-f);(""===c||""!==e)&&I(a,1,"Possible column misalignment",6)}else u="100%";n.width=s(u);j.width=s(u);L&&(a.nScrollFoot.style.width=s(u));!d&&w&&(n.height=s(t.offsetHeight+f));d&&b.bCollapse&&(n.height=s(d),b=c&&t.offsetWidth>i.offsetWidth?f:0,t.offsetHeight<i.offsetHeight&&(n.height=s(t.offsetHeight+b)));b=r.outerWidth();l[0].style.width=s(b);o.width=s(b);l=r.height()>i.clientHeight||
|
||||
"scroll"==q.css("overflow-y");ha="padding"+(ha.bScrollbarLeft?"Left":"Right");o[ha]=l?f+"px":"0px";L&&(p[0].style.width=s(b),k[0].style.width=s(b),k[0].style[ha]=l?f+"px":"0px");q.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)i.scrollTop=0}function G(a,b,c){for(var e=0,d=0,f=b.length,g,j;d<f;){g=b[d].firstChild;for(j=c?c[d].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,e):a(g,e),e++),g=g.nextSibling,j=c?j.nextSibling:null;d++}}function Ga(a){var b=a.nTable,c=a.aoColumns,e=a.oScroll,d=e.sY,f=e.sX,
|
||||
g=e.sXInner,j=c.length,e=Z(a,"bVisible"),i=h("th",a.nTHead),o=b.getAttribute("width"),l=b.parentNode,k=!1,n,m;(n=b.style.width)&&-1!==n.indexOf("%")&&(o=n);for(n=0;n<e.length;n++)m=c[e[n]],null!==m.sWidth&&(m.sWidth=Db(m.sWidthOrig,l),k=!0);if(!k&&!f&&!d&&j==aa(a)&&j==i.length)for(n=0;n<j;n++)c[n].sWidth=s(i.eq(n).width());else{j=h(b).clone().css("visibility","hidden").removeAttr("id");j.find("tbody tr").remove();var p=h("<tr/>").appendTo(j.find("tbody"));j.find("tfoot th, tfoot td").css("width",
|
||||
"");i=qa(a,j.find("thead")[0]);for(n=0;n<e.length;n++)m=c[e[n]],i[n].style.width=null!==m.sWidthOrig&&""!==m.sWidthOrig?s(m.sWidthOrig):"";if(a.aoData.length)for(n=0;n<e.length;n++)k=e[n],m=c[k],h(Eb(a,k)).clone(!1).append(m.sContentPadding).appendTo(p);j.appendTo(l);f&&g?j.width(g):f?(j.css("width","auto"),j.width()<l.offsetWidth&&j.width(l.offsetWidth)):d?j.width(l.offsetWidth):o&&j.width(o);Fb(a,j[0]);if(f){for(n=g=0;n<e.length;n++)m=c[e[n]],d=h(i[n]).outerWidth(),g+=null===m.sWidthOrig?d:parseInt(m.sWidth,
|
||||
10)+d-h(i[n]).width();j.width(s(g));b.style.width=s(g)}for(n=0;n<e.length;n++)if(m=c[e[n]],d=h(i[n]).width())m.sWidth=s(d);b.style.width=s(j.css("width"));j.remove()}o&&(b.style.width=s(o));if((o||f)&&!a._reszEvt)b=function(){h(Ea).bind("resize.DT-"+a.sInstance,ua(function(){X(a)}))},a.oBrowser.bScrollOversize?setTimeout(b,1E3):b(),a._reszEvt=!0}function ua(a,b){var c=b!==k?b:200,e,d;return function(){var b=this,g=+new Date,j=arguments;e&&g<e+c?(clearTimeout(d),d=setTimeout(function(){e=k;a.apply(b,
|
||||
j)},c)):(e=g,a.apply(b,j))}}function Db(a,b){if(!a)return 0;var c=h("<div/>").css("width",s(a)).appendTo(b||Q.body),e=c[0].offsetWidth;c.remove();return e}function Fb(a,b){var c=a.oScroll;if(c.sX||c.sY)c=!c.sX?c.iBarWidth:0,b.style.width=s(h(b).outerWidth()-c)}function Eb(a,b){var c=Gb(a,b);if(0>c)return null;var e=a.aoData[c];return!e.nTr?h("<td/>").html(x(a,c,b,"display"))[0]:e.anCells[b]}function Gb(a,b){for(var c,e=-1,d=-1,f=0,g=a.aoData.length;f<g;f++)c=x(a,f,b,"display")+"",c=c.replace($b,""),
|
||||
c.length>e&&(e=c.length,d=f);return d}function s(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function Hb(){var a=m.__scrollbarWidth;if(a===k){var b=h("<p/>").css({position:"absolute",top:0,left:0,width:"100%",height:150,padding:0,overflow:"scroll",visibility:"hidden"}).appendTo("body"),a=b[0].offsetWidth-b[0].clientWidth;m.__scrollbarWidth=a;b.remove()}return a}function U(a){var b,c,e=[],d=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var o=[];
|
||||
f=function(a){a.length&&!h.isArray(a[0])?o.push(a):o.push.apply(o,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<o.length;a++){i=o[a][0];f=d[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=d[g].sType||"string",o[a]._idx===k&&(o[a]._idx=h.inArray(o[a][1],d[g].asSorting)),e.push({src:i,col:g,dir:o[a][1],index:o[a]._idx,type:j,formatter:m.ext.type.order[j+"-pre"]})}return e}function lb(a){var b,c,e=[],d=m.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;
|
||||
Ha(a);h=U(a);b=0;for(c=h.length;b<c;b++)j=h[b],j.formatter&&g++,Ib(a,j.col);if("ssp"!=B(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)e[i[b]]=b;g===h.length?i.sort(function(a,b){var c,d,g,j,i=h.length,k=f[a]._aSortData,m=f[b]._aSortData;for(g=0;g<i;g++)if(j=h[g],c=k[j.col],d=m[j.col],c=c<d?-1:c>d?1:0,0!==c)return"asc"===j.dir?c:-c;c=e[a];d=e[b];return c<d?-1:c>d?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,m=f[a]._aSortData,r=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=m[i.col],g=r[i.col],i=d[i.type+
|
||||
"-"+i.dir]||d["string-"+i.dir],c=i(c,g),0!==c)return c;c=e[a];g=e[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Jb(a){for(var b,c,e=a.aoColumns,d=U(a),a=a.oLanguage.oAria,f=0,g=e.length;f<g;f++){c=e[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<d.length&&d[0].col==f?(i.setAttribute("aria-sort","asc"==d[0].dir?"ascending":"descending"),c=j[d[0].index+1]||j[0]):c=j[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",
|
||||
b)}}function Ua(a,b,c,e){var d=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof d[0]&&(d=a.aaSorting=[d]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,D(d,"0")),-1!==c?(b=g(d[c],!0),null===b&&1===d.length&&(b=0),null===b?d.splice(c,1):(d[c][1]=f[b],d[c]._idx=b)):(d.push([b,f[0],0]),d[d.length-1]._idx=0)):d.length&&d[0][0]==b?(b=g(d[0]),d.length=1,d[0][1]=f[b],d[0]._idx=b):(d.length=0,d.push([b,f[0]]),d[0]._idx=
|
||||
0);N(a);"function"==typeof e&&e(a)}function Oa(a,b,c,e){var d=a.aoColumns[c];Va(b,{},function(b){!1!==d.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Ua(a,c,b.shiftKey,e);"ssp"!==B(a)&&C(a,!1)},0)):Ua(a,c,b.shiftKey,e))})}function xa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,e=U(a),d=a.oFeatures,f,g;if(d.bSort&&d.bSortClasses){d=0;for(f=b.length;d<f;d++)g=b[d].src,h(D(a.aoData,"anCells",g)).removeClass(c+(2>d?d+1:3));d=0;for(f=e.length;d<f;d++)g=e[d].src,h(D(a.aoData,"anCells",
|
||||
g)).addClass(c+(2>d?d+1:3))}a.aLastSort=e}function Ib(a,b){var c=a.aoColumns[b],e=m.ext.order[c.sSortDataType],d;e&&(d=e.call(a.oInstance,a,b,$(a,b)));for(var f,g=m.ext.type.order[c.sType+"-pre"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],c._aSortData||(c._aSortData=[]),!c._aSortData[b]||e)f=e?d[j]:x(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function ya(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),
|
||||
search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,e){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[e])}})};w(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,b)}}function Kb(a){var b,c,e=a.aoColumns;if(a.oFeatures.bStateSave){var d=a.fnStateLoadCallback.call(a.oInstance,a);if(d&&d.time&&(b=w(a,"aoStateLoadParams","stateLoadParams",[a,d]),-1===h.inArray(!1,b)&&(b=a.iStateDuration,!(0<b&&d.time<+new Date-1E3*b)&&e.length===
|
||||
d.columns.length))){a.oLoadedState=h.extend(!0,{},d);d.start!==k&&(a._iDisplayStart=d.start,a.iInitDisplayStart=d.start);d.length!==k&&(a._iDisplayLength=d.length);d.order!==k&&(a.aaSorting=[],h.each(d.order,function(b,c){a.aaSorting.push(c[0]>=e.length?[0,c[1]]:c)}));d.search!==k&&h.extend(a.oPreviousSearch,Ab(d.search));b=0;for(c=d.columns.length;b<c;b++){var f=d.columns[b];f.visible!==k&&(e[b].bVisible=f.visible);f.search!==k&&h.extend(a.aoPreSearchCols[b],Ab(f.search))}w(a,"aoStateLoaded","stateLoaded",
|
||||
[a,d])}}}function za(a){var b=m.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function I(a,b,c,e){c="DataTables warning: "+(null!==a?"table id="+a.sTableId+" - ":"")+c;e&&(c+=". For more information about this error, please see http://datatables.net/tn/"+e);if(b)Ea.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,w(a,null,"error",[a,e,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,e,c)}}function E(a,b,c,e){h.isArray(c)?
|
||||
h.each(c,function(c,f){h.isArray(f)?E(a,b,f[0],f[1]):E(a,b,f)}):(e===k&&(e=c),b[c]!==k&&(a[e]=b[c]))}function Lb(a,b,c){var e,d;for(d in b)b.hasOwnProperty(d)&&(e=b[d],h.isPlainObject(e)?(h.isPlainObject(a[d])||(a[d]={}),h.extend(!0,a[d],e)):a[d]=c&&"data"!==d&&"aaData"!==d&&h.isArray(e)?e.slice():e);return a}function Va(a,b,c){h(a).bind("click.DT",b,function(b){a.blur();c(b)}).bind("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).bind("selectstart.DT",function(){return!1})}function z(a,
|
||||
b,c,e){c&&a[b].push({fn:c,sName:e})}function w(a,b,c,e){var d=[];b&&(d=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,e)}));null!==c&&(b=h.Event(c+".dt"),h(a.nTable).trigger(b,e),d.push(b.result));return d}function Sa(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),e=a._iDisplayLength;b>=c&&(b=c-e);b-=b%e;if(-1===e||0>b)b=0;a._iDisplayStart=b}function Pa(a,b){var c=a.renderer,e=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?e[c[b]]||e._:"string"===typeof c?e[c]||e._:e._}function B(a){return a.oFeatures.bServerSide?
|
||||
"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function Wa(a,b){var c=[],c=Mb.numbers_length,e=Math.floor(c/2);b<=c?c=V(0,b):a<=e?(c=V(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-e?c=V(b-(c-2),b):(c=V(a-e+2,a+e-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function db(a){h.each({num:function(b){return Aa(b,a)},"num-fmt":function(b){return Aa(b,a,Xa)},"html-num":function(b){return Aa(b,a,Ba)},"html-num-fmt":function(b){return Aa(b,a,Ba,Xa)}},function(b,
|
||||
c){u.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(u.type.search[b+a]=u.type.search.html)})}function Nb(a){return function(){var b=[za(this[m.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return m.ext.internal[a].apply(this,b)}}var m,u,t,r,v,Ya={},Ob=/[\r\n]/g,Ba=/<.*?>/g,ac=/^[\w\+\-]/,bc=/[\w\+\-]$/,Yb=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),Xa=/[',$\u00a3\u20ac\u00a5%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi,J=function(a){return!a||!0===a||
|
||||
"-"===a?!0:!1},Pb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Qb=function(a,b){Ya[b]||(Ya[b]=RegExp(va(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(Ya[b],"."):a},Za=function(a,b,c){var e="string"===typeof a;if(J(a))return!0;b&&e&&(a=Qb(a,b));c&&e&&(a=a.replace(Xa,""));return!isNaN(parseFloat(a))&&isFinite(a)},Rb=function(a,b,c){return J(a)?!0:!(J(a)||"string"===typeof a)?null:Za(a.replace(Ba,""),b,c)?!0:null},D=function(a,b,c){var e=[],d=0,f=a.length;
|
||||
if(c!==k)for(;d<f;d++)a[d]&&a[d][b]&&e.push(a[d][b][c]);else for(;d<f;d++)a[d]&&e.push(a[d][b]);return e},ia=function(a,b,c,e){var d=[],f=0,g=b.length;if(e!==k)for(;f<g;f++)a[b[f]][c]&&d.push(a[b[f]][c][e]);else for(;f<g;f++)d.push(a[b[f]][c]);return d},V=function(a,b){var c=[],e;b===k?(b=0,e=a):(e=b,b=a);for(var d=b;d<e;d++)c.push(d);return c},Sb=function(a){for(var b=[],c=0,e=a.length;c<e;c++)a[c]&&b.push(a[c]);return b},Na=function(a){var b=[],c,e,d=a.length,f,g=0;e=0;a:for(;e<d;e++){c=a[e];for(f=
|
||||
0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b},A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ba=/\[.*?\]$/,T=/\(\)$/,wa=h("<div>")[0],Zb=wa.textContent!==k,$b=/<.*?>/g;m=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new t(za(this[u.iApiIndex])):new t(this)};this.fnAddData=function(a,b){var c=this.api(!0),e=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===
|
||||
k||b)&&c.draw();return e.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],e=c.oScroll;a===k||a?b.draw(!1):(""!==e.sX||""!==e.sY)&&Y(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var e=this.api(!0),a=e.rows(a),d=a.settings()[0],h=d.aoData[a[0][0]];a.remove();b&&b.call(this,d,h);(c===k||c)&&e.draw();return h};
|
||||
this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,e,d,h){d=this.api(!0);null===b||b===k?d.search(a,c,e,h):d.column(b).search(a,c,e,h);d.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var e=a.nodeName?a.nodeName.toLowerCase():"";return b!==k||"td"==e||"th"==e?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};
|
||||
this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===
|
||||
k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return za(this[u.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,e,d){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(d===k||d)&&h.columns.adjust();(e===k||e)&&h.draw();return 0};this.fnVersionCheck=u.fnVersionCheck;var b=this,c=a===k,e=this.length;c&&(a={});this.oApi=this.internal=u.internal;for(var d in m.ext.internal)d&&
|
||||
(this[d]=Nb(d));this.each(function(){var d={},d=1<e?Lb(d,a,!0):a,g=0,j,i=this.getAttribute("id"),o=!1,l=m.defaults,q=h(this);if("table"!=this.nodeName.toLowerCase())I(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{eb(l);fb(l.column);H(l,l,!0);H(l.column,l.column,!0);H(l,h.extend(d,q.data()));var n=m.settings,g=0;for(j=n.length;g<j;g++){var r=n[g];if(r.nTable==this||r.nTHead.parentNode==this||r.nTFoot&&r.nTFoot.parentNode==this){g=d.bRetrieve!==k?d.bRetrieve:l.bRetrieve;if(c||g)return r.oInstance;
|
||||
if(d.bDestroy!==k?d.bDestroy:l.bDestroy){r.oInstance.fnDestroy();break}else{I(r,0,"Cannot reinitialise DataTable",3);return}}if(r.sTableId==this.id){n.splice(g,1);break}}if(null===i||""===i)this.id=i="DataTables_Table_"+m.ext._unique++;var p=h.extend(!0,{},m.models.oSettings,{sDestroyWidth:q[0].style.width,sInstance:i,sTableId:i});p.nTable=this;p.oApi=b.internal;p.oInit=d;n.push(p);p.oInstance=1===b.length?b:q.dataTable();eb(d);d.oLanguage&&P(d.oLanguage);d.aLengthMenu&&!d.iDisplayLength&&(d.iDisplayLength=
|
||||
h.isArray(d.aLengthMenu[0])?d.aLengthMenu[0][0]:d.aLengthMenu[0]);d=Lb(h.extend(!0,{},l),d);E(p.oFeatures,d,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));E(p,d,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback",
|
||||
"renderer","searchDelay",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"],["bJQueryUI","bJUI"]]);E(p.oScroll,d,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);E(p.oLanguage,d,"fnInfoCallback");z(p,"aoDrawCallback",d.fnDrawCallback,"user");z(p,"aoServerParams",d.fnServerParams,"user");z(p,"aoStateSaveParams",d.fnStateSaveParams,"user");z(p,"aoStateLoadParams",
|
||||
d.fnStateLoadParams,"user");z(p,"aoStateLoaded",d.fnStateLoaded,"user");z(p,"aoRowCallback",d.fnRowCallback,"user");z(p,"aoRowCreatedCallback",d.fnCreatedRow,"user");z(p,"aoHeaderCallback",d.fnHeaderCallback,"user");z(p,"aoFooterCallback",d.fnFooterCallback,"user");z(p,"aoInitComplete",d.fnInitComplete,"user");z(p,"aoPreDrawCallback",d.fnPreDrawCallback,"user");i=p.oClasses;d.bJQueryUI?(h.extend(i,m.ext.oJUIClasses,d.oClasses),d.sDom===l.sDom&&"lfrtip"===l.sDom&&(p.sDom='<"H"lfr>t<"F"ip>'),p.renderer)?
|
||||
h.isPlainObject(p.renderer)&&!p.renderer.header&&(p.renderer.header="jqueryui"):p.renderer="jqueryui":h.extend(i,m.ext.classes,d.oClasses);q.addClass(i.sTable);if(""!==p.oScroll.sX||""!==p.oScroll.sY)p.oScroll.iBarWidth=Hb();!0===p.oScroll.sX&&(p.oScroll.sX="100%");p.iInitDisplayStart===k&&(p.iInitDisplayStart=d.iDisplayStart,p._iDisplayStart=d.iDisplayStart);null!==d.iDeferLoading&&(p.bDeferLoading=!0,g=h.isArray(d.iDeferLoading),p._iRecordsDisplay=g?d.iDeferLoading[0]:d.iDeferLoading,p._iRecordsTotal=
|
||||
g?d.iDeferLoading[1]:d.iDeferLoading);var t=p.oLanguage;h.extend(!0,t,d.oLanguage);""!==t.sUrl&&(h.ajax({dataType:"json",url:t.sUrl,success:function(a){P(a);H(l.oLanguage,a);h.extend(true,t,a);ga(p)},error:function(){ga(p)}}),o=!0);null===d.asStripeClasses&&(p.asStripeClasses=[i.sStripeOdd,i.sStripeEven]);var g=p.asStripeClasses,s=q.children("tbody").find("tr").eq(0);-1!==h.inArray(!0,h.map(g,function(a){return s.hasClass(a)}))&&(h("tbody tr",this).removeClass(g.join(" ")),p.asDestroyStripes=g.slice());
|
||||
n=[];g=this.getElementsByTagName("thead");0!==g.length&&(da(p.aoHeader,g[0]),n=qa(p));if(null===d.aoColumns){r=[];g=0;for(j=n.length;g<j;g++)r.push(null)}else r=d.aoColumns;g=0;for(j=r.length;g<j;g++)Fa(p,n?n[g]:null);ib(p,d.aoColumnDefs,r,function(a,b){ka(p,a,b)});if(s.length){var u=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h.each(na(p,s[0]).cells,function(a,b){var c=p.aoColumns[a];if(c.mData===a){var d=u(b,"sort")||u(b,"order"),e=u(b,"filter")||u(b,"search");if(d!==null||e!==
|
||||
null){c.mData={_:a+".display",sort:d!==null?a+".@data-"+d:k,type:d!==null?a+".@data-"+d:k,filter:e!==null?a+".@data-"+e:k};ka(p,a)}}})}var v=p.oFeatures;d.bStateSave&&(v.bStateSave=!0,Kb(p,d),z(p,"aoDrawCallback",ya,"state_save"));if(d.aaSorting===k){n=p.aaSorting;g=0;for(j=n.length;g<j;g++)n[g][1]=p.aoColumns[g].asSorting[0]}xa(p);v.bSort&&z(p,"aoDrawCallback",function(){if(p.bSorted){var a=U(p),b={};h.each(a,function(a,c){b[c.src]=c.dir});w(p,null,"order",[p,a,b]);Jb(p)}});z(p,"aoDrawCallback",
|
||||
function(){(p.bSorted||B(p)==="ssp"||v.bDeferRender)&&xa(p)},"sc");gb(p);g=q.children("caption").each(function(){this._captionSide=q.css("caption-side")});j=q.children("thead");0===j.length&&(j=h("<thead/>").appendTo(this));p.nTHead=j[0];j=q.children("tbody");0===j.length&&(j=h("<tbody/>").appendTo(this));p.nTBody=j[0];j=q.children("tfoot");if(0===j.length&&0<g.length&&(""!==p.oScroll.sX||""!==p.oScroll.sY))j=h("<tfoot/>").appendTo(this);0===j.length||0===j.children().length?q.addClass(i.sNoFooter):
|
||||
0<j.length&&(p.nTFoot=j[0],da(p.aoFooter,p.nTFoot));if(d.aaData)for(g=0;g<d.aaData.length;g++)K(p,d.aaData[g]);else(p.bDeferLoading||"dom"==B(p))&&ma(p,h(p.nTBody).children("tr"));p.aiDisplay=p.aiDisplayMaster.slice();p.bInitialised=!0;!1===o&&ga(p)}});b=null;return this};var Tb=[],y=Array.prototype,cc=function(a){var b,c,e=m.settings,d=h.map(e,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,d),-1!==b?[e[b]]:
|
||||
null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,d);return-1!==b?e[b]:null}).toArray()};t=function(a,b){if(!(this instanceof t))return new t(a,b);var c=[],e=function(a){(a=cc(a))&&c.push.apply(c,a)};if(h.isArray(a))for(var d=0,f=a.length;d<f;d++)e(a[d]);else e(a);this.context=Na(c);b&&this.push.apply(this,b.toArray?b.toArray():b);this.selector={rows:null,cols:null,opts:null};
|
||||
t.extend(this,this,Tb)};m.Api=t;t.prototype={any:function(){return 0!==this.flatten().length},concat:y.concat,context:[],each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new t(b[a],this[a]):null},filter:function(a){var b=[];if(y.filter)b=y.filter.call(this,a,this);else for(var c=0,e=this.length;c<e;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new t(this.context,b)},flatten:function(){var a=[];
|
||||
return new t(this.context,a.concat.apply(a,this.toArray()))},join:y.join,indexOf:y.indexOf||function(a,b){for(var c=b||0,e=this.length;c<e;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,e){var d=[],f,g,h,i,o,l=this.context,q,n,m=this.selector;"string"===typeof a&&(e=c,c=b,b=a,a=!1);g=0;for(h=l.length;g<h;g++){var p=new t(l[g]);if("table"===b)f=c.call(p,l[g],g),f!==k&&d.push(f);else if("columns"===b||"rows"===b)f=c.call(p,l[g],this[g],g),f!==k&&d.push(f);else if("column"===b||"column-rows"===
|
||||
b||"row"===b||"cell"===b){n=this[g];"column-rows"===b&&(q=Ca(l[g],m.opts));i=0;for(o=n.length;i<o;i++)f=n[i],f="cell"===b?c.call(p,l[g],f.row,f.column,g,i):c.call(p,l[g],f,g,i,q),f!==k&&d.push(f)}}return d.length||e?(a=new t(l,a?d.concat.apply([],d):d),b=a.selector,b.rows=m.rows,b.cols=m.cols,b.opts=m.opts,a):this},lastIndexOf:y.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(y.map)b=y.map.call(this,a,this);else for(var c=
|
||||
0,e=this.length;c<e;c++)b.push(a.call(this,this[c],c));return new t(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},pop:y.pop,push:y.push,reduce:y.reduce||function(a,b){return hb(this,a,b,0,this.length,1)},reduceRight:y.reduceRight||function(a,b){return hb(this,a,b,this.length-1,-1,-1)},reverse:y.reverse,selector:null,shift:y.shift,sort:y.sort,splice:y.splice,toArray:function(){return y.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},
|
||||
unique:function(){return new t(this.context,Na(this))},unshift:y.unshift};t.extend=function(a,b,c){if(c.length&&b&&(b instanceof t||b.__dt_wrapper)){var e,d,f,g=function(a,b,c){return function(){var d=b.apply(a,arguments);t.extend(d,d,c.methodExt);return d}};e=0;for(d=c.length;e<d;e++)f=c[e],b[f.name]="function"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,t.extend(a,b[f.name],f.propExt)}};t.register=r=function(a,b){if(h.isArray(a))for(var c=0,e=a.length;c<
|
||||
e;c++)t.register(a[c],b);else for(var d=a.split("."),f=Tb,g,j,c=0,e=d.length;c<e;c++){g=(j=-1!==d[c].indexOf("()"))?d[c].replace("()",""):d[c];var i;a:{i=0;for(var o=f.length;i<o;i++)if(f[i].name===g){i=f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===e-1?i.val=b:f=j?i.methodExt:i.propExt}};t.registerPlural=v=function(a,b,c){t.register(a,c);t.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof t?a.length?h.isArray(a[0])?new t(a.context,
|
||||
a[0]):a[0]:k:a})};r("tables()",function(a){var b;if(a){b=t;var c=this.context;if("number"===typeof a)a=[c[a]];else var e=h.map(c,function(a){return a.nTable}),a=h(e).filter(a).map(function(){var a=h.inArray(this,e);return c[a]}).toArray();b=new b(a)}else b=this;return b});r("table()",function(a){var a=this.tables(a),b=a.context;return b.length?new t(b[0]):a});v("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});v("tables().body()","table().body()",
|
||||
function(){return this.iterator("table",function(a){return a.nTBody},1)});v("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});v("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});v("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});r("draw()",function(a){return this.iterator("table",function(b){N(b,
|
||||
!1===a)})});r("page()",function(a){return a===k?this.page.info().page:this.iterator("table",function(b){Ta(b,a)})});r("page.info()",function(){if(0===this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a._iDisplayLength,e=a.fnRecordsDisplay(),d=-1===c;return{page:d?0:Math.floor(b/c),pages:d?1:Math.ceil(e/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:e}});r("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:
|
||||
k:this.iterator("table",function(b){Ra(b,a)})});var Ub=function(a,b,c){if(c){var e=new t(a);e.one("draw",function(){c(e.ajax.json())})}"ssp"==B(a)?N(a,b):(C(a,!0),ra(a,[],function(c){oa(a);for(var c=sa(a,c),e=0,g=c.length;e<g;e++)K(a,c[e]);N(a,b);C(a,!1)}))};r("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});r("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});r("ajax.reload()",function(a,b){return this.iterator("table",function(c){Ub(c,
|
||||
!1===b,a)})});r("ajax.url()",function(a){var b=this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});r("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Ub(c,!1===b,a)})});var $a=function(a,b,c,e,d){var f=[],g,j,i,o,l,q;i=typeof b;if(!b||"string"===i||"function"===i||b.length===k)b=[b];i=0;for(o=b.length;i<o;i++){j=
|
||||
b[i]&&b[i].split?b[i].split(","):[b[i]];l=0;for(q=j.length;l<q;l++)(g=c("string"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&f.push.apply(f,g)}a=u.selector[a];if(a.length){i=0;for(o=a.length;i<o;i++)f=a[i](e,d,f)}return f},ab=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:"none",order:"current",page:"all"},a)},bb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},
|
||||
Ca=function(a,b){var c,e,d,f=[],g=a.aiDisplay;c=a.aiDisplayMaster;var j=b.search;e=b.order;d=b.page;if("ssp"==B(a))return"removed"===j?[]:V(0,c.length);if("current"==d){c=a._iDisplayStart;for(e=a.fnDisplayEnd();c<e;c++)f.push(g[c])}else if("current"==e||"applied"==e)f="none"==j?c.slice():"applied"==j?g.slice():h.map(c,function(a){return-1===h.inArray(a,g)?a:null});else if("index"==e||"original"==e){c=0;for(e=a.aoData.length;c<e;c++)"none"==j?f.push(c):(d=h.inArray(c,g),(-1===d&&"removed"==j||0<=d&&
|
||||
"applied"==j)&&f.push(c))}return f};r("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var d=b;return $a("row",a,function(a){var b=Pb(a);if(b!==null&&!d)return[b];var j=Ca(c,d);if(b!==null&&h.inArray(b,j)!==-1)return[b];if(!a)return j;if(typeof a==="function")return h.map(j,function(b){var d=c.aoData[b];return a(b,d._aData,d.nTr)?b:null});b=Sb(ia(c.aoData,j,"nTr"));return a.nodeName&&h.inArray(a,b)!==-1?[a._DT_RowIndex]:h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},
|
||||
c,d)},1);c.selector.rows=a;c.selector.opts=b;return c});r("rows().nodes()",function(){return this.iterator("row",function(a,b){return a.aoData[b].nTr||k},1)});r("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ia(a.aoData,b,"_aData")},1)});v("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var e=b.aoData[c];return"search"===a?e._aFilterData:e._aSortData},1)});v("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",
|
||||
function(b,c){ca(b,c,a)})});v("rows().indexes()","row().index()",function(){return this.iterator("row",function(a,b){return b},1)});v("rows().remove()","row().remove()",function(){var a=this;return this.iterator("row",function(b,c,e){var d=b.aoData;d.splice(c,1);for(var f=0,g=d.length;f<g;f++)null!==d[f].nTr&&(d[f].nTr._DT_RowIndex=f);h.inArray(c,b.aiDisplay);pa(b.aiDisplayMaster,c);pa(b.aiDisplay,c);pa(a[e],c,!1);Sa(b)})});r("rows.add()",function(a){var b=this.iterator("table",function(b){var c,
|
||||
f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(ma(b,c)[0]):h.push(K(b,c));return h},1),c=this.rows(-1);c.pop();c.push.apply(c,b.toArray());return c});r("row()",function(a,b){return bb(this.rows(a,b))});r("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;b[0].aoData[this[0]]._aData=a;ca(b[0],this[0],"data");return this});r("row().node()",function(){var a=this.context;return a.length&&this.length?
|
||||
a[0].aoData[this[0]].nTr||null:null});r("row.add()",function(a){a instanceof h&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?ma(b,a)[0]:K(b,a)});return this.row(b[0])});var cb=function(a,b){var c=a.context;c.length&&(c=c[0].aoData[b!==k?b:a[0]],c._details&&(c._details.remove(),c._detailsShow=k,c._details=k))},Vb=function(a,b){var c=a.context;if(c.length&&a.length){var e=c[0].aoData[a[0]];if(e._details){(e._detailsShow=b)?e._details.insertAfter(e.nTr):
|
||||
e._details.detach();var d=c[0],f=new t(d),g=d.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<D(g,"_details").length&&(f.on("draw.dt.DT_details",function(a,b){d===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(d===b)for(var c,e=aa(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",e)}),f.on("destroy.dt.DT_details",
|
||||
function(a,b){if(d===b)for(var c=0,e=g.length;c<e;c++)g[c]._details&&cb(f,c)}))}}};r("row().child()",function(a,b){var c=this.context;if(a===k)return c.length&&this.length?c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)cb(this);else if(c.length&&this.length){var e=c[0],c=c[0].aoData[this[0]],d=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&"tr"===a.nodeName.toLowerCase()?d.push(a):(c=h("<tr><td/></tr>").addClass(b),
|
||||
h("td",c).addClass(b).html(a)[0].colSpan=aa(e),d.push(c[0]))};f(a,b);c._details&&c._details.remove();c._details=h(d);c._detailsShow&&c._details.insertAfter(c.nTr)}return this});r(["row().child.show()","row().child().show()"],function(){Vb(this,!0);return this});r(["row().child.hide()","row().child().hide()"],function(){Vb(this,!1);return this});r(["row().child.remove()","row().child().remove()"],function(){cb(this);return this});r("row().child.isShown()",function(){var a=this.context;return a.length&&
|
||||
this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var dc=/^(.+):(name|visIdx|visible)$/,Wb=function(a,b,c,e,d){for(var c=[],e=0,f=d.length;e<f;e++)c.push(x(a,d[e],b));return c};r("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var d=a,f=b,g=c.aoColumns,j=D(g,"sName"),i=D(g,"nTh");return $a("column",d,function(a){var b=Pb(a);if(a==="")return V(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var d=Ca(c,
|
||||
f);return h.map(g,function(b,f){return a(f,Wb(c,f,0,0,d),i[f])?f:null})}var k=typeof a==="string"?a.match(dc):"";if(k)switch(k[2]){case "visIdx":case "visible":b=parseInt(k[1],10);if(b<0){var m=h.map(g,function(a,b){return a.bVisible?b:null});return[m[m.length+b]]}return[la(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null})}else return h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray()},c,f)},1);c.selector.cols=a;c.selector.opts=b;return c});v("columns().header()",
|
||||
"column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});v("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});v("columns().data()","column().data()",function(){return this.iterator("column-rows",Wb,1)});v("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});v("columns().cache()","column().cache()",
|
||||
function(a){return this.iterator("column-rows",function(b,c,e,d,f){return ia(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});v("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,e,d){return ia(a.aoData,d,"anCells",b)},1)});v("columns().visible()","column().visible()",function(a,b){return this.iterator("column",function(c,e){if(a===k)return c.aoColumns[e].bVisible;var d=c.aoColumns,f=d[e],g=c.aoData,j,i,m;if(a!==k&&f.bVisible!==a){if(a){var l=
|
||||
h.inArray(!0,D(d,"bVisible"),e+1);j=0;for(i=g.length;j<i;j++)m=g[j].nTr,d=g[j].anCells,m&&m.insertBefore(d[e],d[l]||null)}else h(D(c.aoData,"anCells",e)).detach();f.bVisible=a;ea(c,c.aoHeader);ea(c,c.aoFooter);if(b===k||b)X(c),(c.oScroll.sX||c.oScroll.sY)&&Y(c);w(c,null,"column-visibility",[c,e,a]);ya(c)}})});v("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===a?$(b,c):c},1)});r("columns.adjust()",function(){return this.iterator("table",
|
||||
function(a){X(a)},1)});r("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return la(c,b);if("fromData"===a||"toVisible"===a)return $(c,b)}});r("column()",function(a,b){return bb(this.columns(a,b))});r("cells()",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",function(b){var d=a,e=ab(c),f=b.aoData,g=Ca(b,e),i=Sb(ia(f,g,"anCells")),
|
||||
j=h([].concat.apply([],i)),l,m=b.aoColumns.length,o,r,t,s,u,v;return $a("cell",d,function(a){var c=typeof a==="function";if(a===null||a===k||c){o=[];r=0;for(t=g.length;r<t;r++){l=g[r];for(s=0;s<m;s++){u={row:l,column:s};if(c){v=b.aoData[l];a(u,x(b,l,s),v.anCells?v.anCells[s]:null)&&o.push(u)}else o.push(u)}}return o}return h.isPlainObject(a)?[a]:j.filter(a).map(function(a,b){l=b.parentNode._DT_RowIndex;return{row:l,column:h.inArray(b,f[l].anCells)}}).toArray()},b,e)});var e=this.columns(b,c),d=this.rows(a,
|
||||
c),f,g,j,i,m,l=this.iterator("table",function(a,b){f=[];g=0;for(j=d[b].length;g<j;g++){i=0;for(m=e[b].length;i<m;i++)f.push({row:d[b][g],column:e[b][i]})}return f},1);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});v("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b].anCells)?a[c]:k},1)});r("cells().data()",function(){return this.iterator("cell",function(a,b,c){return x(a,b,c)},1)});v("cells().cache()","cell().cache()",function(a){a=
|
||||
"search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,e){return b.aoData[c][a][e]},1)});v("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,e){return x(b,c,e,a)},1)});v("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,b,c){return{row:b,column:c,columnVisible:$(a,c)}},1)});v("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,e){ca(b,c,a,e)})});r("cell()",
|
||||
function(a,b,c){return bb(this.cells(a,b,c))});r("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?x(b[0],c[0].row,c[0].column):k;Ia(b[0],c[0].row,c[0].column,a);ca(b[0],c[0].row,"data",c[0].column);return this});r("order()",function(a,b){var c=this.context;if(a===k)return 0!==c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:h.isArray(a[0])||(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});
|
||||
r("order.listener()",function(a,b,c){return this.iterator("table",function(e){Oa(e,a,b,c)})});r(["columns().order()","column().order()"],function(a){var b=this;return this.iterator("table",function(c,e){var d=[];h.each(b[e],function(b,c){d.push([c,a])});c.aaSorting=d})});r("search()",function(a,b,c,e){var d=this.context;return a===k?0!==d.length?d[0].oPreviousSearch.sSearch:k:this.iterator("table",function(d){d.oFeatures.bFilter&&fa(d,h.extend({},d.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:
|
||||
b,bSmart:null===c?!0:c,bCaseInsensitive:null===e?!0:e}),1)})});v("columns().search()","column().search()",function(a,b,c,e){return this.iterator("column",function(d,f){var g=d.aoPreSearchCols;if(a===k)return g[f].sSearch;d.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===e?!0:e}),fa(d,d.oPreviousSearch,1))})});r("state()",function(){return this.context.length?this.context[0].oSavedState:null});r("state.clear()",function(){return this.iterator("table",
|
||||
function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});r("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});r("state.save()",function(){return this.iterator("table",function(a){ya(a)})});m.versionCheck=m.fnVersionCheck=function(a){for(var b=m.version.split("."),a=a.split("."),c,e,d=0,f=a.length;d<f;d++)if(c=parseInt(b[d],10)||0,e=parseInt(a[d],10)||0,c!==e)return c>e;return!0};m.isDataTable=m.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;h.each(m.settings,
|
||||
function(a,d){var f=d.nScrollHead?h("table",d.nScrollHead)[0]:null,g=d.nScrollFoot?h("table",d.nScrollFoot)[0]:null;if(d.nTable===b||f===b||g===b)c=!0});return c};m.tables=m.fnTables=function(a){return h.map(m.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable})};m.util={throttle:ua,escapeRegex:va};m.camelToHungarian=H;r("$()",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,
|
||||
b){r(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0].match(/\.dt\b/)||(a[0]+=".dt");var e=h(this.tables().nodes());e[b].apply(e,a);return this})});r("clear()",function(){return this.iterator("table",function(a){oa(a)})});r("settings()",function(){return new t(this.context,this.context)});r("init()",function(){var a=this.context;return a.length?a[0].oInit:null});r("data()",function(){return this.iterator("table",function(a){return D(a.aoData,"_aData")}).flatten()});r("destroy()",
|
||||
function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,e=b.oClasses,d=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(d),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),q;b.bDestroying=!0;w(b,"aoDestroyCallback","destroy",[b]);a||(new t(b)).columns().visible(!0);k.unbind(".DT").find(":not(tbody *)").unbind(".DT");h(Ea).unbind(".DT-"+b.sInstance);d!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&d!=j.parentNode&&(i.children("tfoot").detach(),
|
||||
i.append(j));i.detach();k.detach();b.aaSorting=[];b.aaSortingFixed=[];xa(b);h(l).removeClass(b.asStripeClasses.join(" "));h("th, td",g).removeClass(e.sSortable+" "+e.sSortableAsc+" "+e.sSortableDesc+" "+e.sSortableNone);b.bJUI&&(h("th span."+e.sSortIcon+", td span."+e.sSortIcon,g).detach(),h("th, td",g).each(function(){var a=h("div."+e.sSortJUIWrapper,this);h(this).append(a.contents());a.detach()}));!a&&c&&c.insertBefore(d,b.nTableReinsertBefore);f.children().detach();f.append(l);i.css("width",b.sDestroyWidth).removeClass(e.sTable);
|
||||
(q=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%q])});c=h.inArray(b,m.settings);-1!==c&&m.settings.splice(c,1)})});h.each(["column","row","cell"],function(a,b){r(b+"s().every()",function(a){return this.iterator(b,function(e,d,f){a.call((new t(e))[b](d,f))})})});r("i18n()",function(a,b,c){var e=this.context[0],a=R(a)(e.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:a._);return a.replace("%d",c)});m.version="1.10.7";m.settings=
|
||||
[];m.models={};m.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};m.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null};m.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",
|
||||
sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};m.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,
|
||||
fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,
|
||||
fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},
|
||||
sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},m.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,
|
||||
sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null};W(m.defaults);m.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};W(m.defaults.column);m.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,
|
||||
bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],
|
||||
sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,
|
||||
bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==B(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==B(this)?1*this._iRecordsDisplay:
|
||||
this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,e=this.aiDisplay.length,d=this.oFeatures,f=d.bPaginate;return d.bServerSide?!1===f||-1===a?b+e:Math.min(b+a,this._iRecordsDisplay):!f||c>e||-1===a?e:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{}};m.ext=u={buttons:{},classes:{},errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},
|
||||
header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:m.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:m.version};h.extend(u,{afnFiltering:u.search,aTypes:u.type.detect,ofnSearch:u.type.search,oSort:u.type.order,afnSortData:u.order,aoFeatures:u.feature,oApi:u.internal,oStdClasses:u.classes,oPagination:u.pager});h.extend(m.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",
|
||||
sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",
|
||||
sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var Da="",Da="",F=Da+"ui-state-default",ja=Da+"css_right ui-icon ui-icon-",Xb=Da+"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";h.extend(m.ext.oJUIClasses,
|
||||
m.ext.classes,{sPageButton:"fg-button ui-button "+F,sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:F+" sorting_asc",sSortDesc:F+" sorting_desc",sSortable:F+" sorting",sSortableAsc:F+" sorting_asc_disabled",sSortableDesc:F+" sorting_desc_disabled",sSortableNone:F+" sorting_disabled",sSortJUIAsc:ja+"triangle-1-n",sSortJUIDesc:ja+"triangle-1-s",sSortJUI:ja+"carat-2-n-s",
|
||||
sSortJUIAscAllowed:ja+"carat-1-n",sSortJUIDescAllowed:ja+"carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+F,sScrollFoot:"dataTables_scrollFoot "+F,sHeaderTH:F,sFooterTH:F,sJUIHeader:Xb+" ui-corner-tl ui-corner-tr",sJUIFooter:Xb+" ui-corner-bl ui-corner-br"});var Mb=m.ext.pager;h.extend(Mb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},simple_numbers:function(a,b){return["previous",
|
||||
Wa(a,b),"next"]},full_numbers:function(a,b){return["first","previous",Wa(a,b),"next","last"]},_numbers:Wa,numbers_length:7});h.extend(!0,m.ext.renderer,{pageButton:{_:function(a,b,c,e,d,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i,k,l=0,m=function(b,e){var n,r,t,s,u=function(b){Ta(a,b.data.action,true)};n=0;for(r=e.length;n<r;n++){s=e[n];if(h.isArray(s)){t=h("<"+(s.DT_el||"div")+"/>").appendTo(b);m(t,s)}else{k=i="";switch(s){case "ellipsis":b.append('<span class="ellipsis">…</span>');break;
|
||||
case "first":i=j.sFirst;k=s+(d>0?"":" "+g.sPageButtonDisabled);break;case "previous":i=j.sPrevious;k=s+(d>0?"":" "+g.sPageButtonDisabled);break;case "next":i=j.sNext;k=s+(d<f-1?"":" "+g.sPageButtonDisabled);break;case "last":i=j.sLast;k=s+(d<f-1?"":" "+g.sPageButtonDisabled);break;default:i=s+1;k=d===s?g.sPageButtonActive:""}if(i){t=h("<a>",{"class":g.sPageButton+" "+k,"aria-controls":a.sTableId,"data-dt-idx":l,tabindex:a.iTabIndex,id:c===0&&typeof s==="string"?a.sTableId+"_"+s:null}).html(i).appendTo(b);
|
||||
Va(t,{action:s},u);l++}}}},n;try{n=h(Q.activeElement).data("dt-idx")}catch(r){}m(h(b).empty(),e);n&&h(b).find("[data-dt-idx="+n+"]").focus()}}});h.extend(m.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&(!ac.test(a)||!bc.test(a)))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||J(a)?"date":null},function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;
|
||||
return Rb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c,!0)?"html-num-fmt"+c:null},function(a){return J(a)||"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(m.ext.type.search,{html:function(a){return J(a)?a:"string"===typeof a?a.replace(Ob," ").replace(Ba,""):""},string:function(a){return J(a)?a:"string"===typeof a?a.replace(Ob," "):a}});var Aa=function(a,b,c,e){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Qb(a,b));a.replace&&(c&&(a=a.replace(c,"")),
|
||||
e&&(a=a.replace(e,"")));return 1*a};h.extend(u.type.order,{"date-pre":function(a){return Date.parse(a)||0},"html-pre":function(a){return J(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return J(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});db("");h.extend(!0,m.ext.renderer,{header:{_:function(a,b,c,e){h(a.nTable).on("order.dt.DT",function(d,
|
||||
f,g,h){if(a===f){d=c.idx;b.removeClass(c.sSortingClass+" "+e.sSortAsc+" "+e.sSortDesc).addClass(h[d]=="asc"?e.sSortAsc:h[d]=="desc"?e.sSortDesc:c.sSortingClass)}})},jqueryui:function(a,b,c,e){h("<div/>").addClass(e.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(e.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on("order.dt.DT",function(d,f,g,h){if(a===f){d=c.idx;b.removeClass(e.sSortAsc+" "+e.sSortDesc).addClass(h[d]=="asc"?e.sSortAsc:h[d]=="desc"?e.sSortDesc:c.sSortingClass);
|
||||
b.find("span."+e.sSortIcon).removeClass(e.sSortJUIAsc+" "+e.sSortJUIDesc+" "+e.sSortJUI+" "+e.sSortJUIAscAllowed+" "+e.sSortJUIDescAllowed).addClass(h[d]=="asc"?e.sSortJUIAsc:h[d]=="desc"?e.sSortJUIDesc:c.sSortingClassJUI)}})}}});m.render={number:function(a,b,c,e){return{display:function(d){if("number"!==typeof d&&"string"!==typeof d)return d;var f=0>d?"-":"",d=Math.abs(parseFloat(d)),g=parseInt(d,10),d=c?b+(d-g).toFixed(c).substring(2):"";return f+(e||"")+g.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
|
||||
a)+d}}}};h.extend(m.ext.internal,{_fnExternApiFunc:Nb,_fnBuildAjax:ra,_fnAjaxUpdate:kb,_fnAjaxParameters:tb,_fnAjaxUpdateDraw:ub,_fnAjaxDataSrc:sa,_fnAddColumn:Fa,_fnColumnOptions:ka,_fnAdjustColumnSizing:X,_fnVisibleToColumnIndex:la,_fnColumnIndexToVisible:$,_fnVisbleColumns:aa,_fnGetColumns:Z,_fnColumnTypes:Ha,_fnApplyColumnDefs:ib,_fnHungarianMap:W,_fnCamelToHungarian:H,_fnLanguageCompat:P,_fnBrowserDetect:gb,_fnAddData:K,_fnAddTr:ma,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==k?b._DT_RowIndex:
|
||||
null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:x,_fnSetCellData:Ia,_fnSplitObjNotation:Ka,_fnGetObjectDataFn:R,_fnSetObjectDataFn:S,_fnGetDataMaster:La,_fnClearTable:oa,_fnDeleteIndex:pa,_fnInvalidate:ca,_fnGetRowElements:na,_fnCreateTr:Ja,_fnBuildHead:jb,_fnDrawHead:ea,_fnDraw:M,_fnReDraw:N,_fnAddOptionsHtml:mb,_fnDetectHeader:da,_fnGetUniqueThs:qa,_fnFeatureHtmlFilter:ob,_fnFilterComplete:fa,_fnFilterCustom:xb,_fnFilterColumn:wb,_fnFilter:vb,_fnFilterCreateSearch:Qa,
|
||||
_fnEscapeRegex:va,_fnFilterData:yb,_fnFeatureHtmlInfo:rb,_fnUpdateInfo:Bb,_fnInfoMacros:Cb,_fnInitialise:ga,_fnInitComplete:ta,_fnLengthChange:Ra,_fnFeatureHtmlLength:nb,_fnFeatureHtmlPaginate:sb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:pb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:qb,_fnScrollDraw:Y,_fnApplyToChildren:G,_fnCalculateColumnWidths:Ga,_fnThrottle:ua,_fnConvertToWidth:Db,_fnScrollingWidthAdjust:Fb,_fnGetWidestNode:Eb,_fnGetMaxLenString:Gb,_fnStringToCss:s,_fnScrollBarWidth:Hb,_fnSortFlatten:U,
|
||||
_fnSort:lb,_fnSortAria:Jb,_fnSortListener:Ua,_fnSortAttachListener:Oa,_fnSortingClasses:xa,_fnSortData:Ib,_fnSaveState:ya,_fnLoadState:Kb,_fnSettingsFromNode:za,_fnLog:I,_fnMap:E,_fnBindAction:Va,_fnCallbackReg:z,_fnCallbackFire:w,_fnLengthOverflow:Sa,_fnRenderer:Pa,_fnDataSource:B,_fnRowAttributes:Ma,_fnCalculateEnd:function(){}});h.fn.dataTable=m;h.fn.dataTableSettings=m.settings;h.fn.dataTableExt=m.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(m,function(a,b){h.fn.DataTable[a]=
|
||||
b});return h.fn.dataTable};"function"===typeof define&&define.amd?define("datatables",["jquery"],P):"object"===typeof exports?module.exports=P(require("jquery")):jQuery&&!jQuery.fn.dataTable&&P(jQuery)})(window,document);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,350 +0,0 @@
|
||||
;(function() {
|
||||
|
||||
var root = this;
|
||||
var Farahey;
|
||||
if (typeof exports !== 'undefined') {
|
||||
Farahey = exports;
|
||||
} else {
|
||||
Farahey = root.Farahey = {};
|
||||
}
|
||||
|
||||
var findInsertionPoint = function(sortedArr, val, comparator) {
|
||||
var low = 0, high = sortedArr.length;
|
||||
var mid = -1, c = 0;
|
||||
while(low < high) {
|
||||
mid = parseInt((low + high)/2);
|
||||
c = comparator(sortedArr[mid], val);
|
||||
if(c < 0) {
|
||||
low = mid + 1;
|
||||
}else if(c > 0) {
|
||||
high = mid;
|
||||
}else {
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
return low;
|
||||
},
|
||||
geomSupport = typeof jsPlumbGeom !== "undefined" ? jsPlumbGeom : Biltong,
|
||||
insertSorted = function(array, value, comparator) {
|
||||
var ip = findInsertionPoint(array, value, comparator);
|
||||
array.splice(ip, 0, value);
|
||||
},
|
||||
distanceFromOriginComparator = function(r1, r2, origin) {
|
||||
var d1 = geomSupport.lineLength(origin, [ r1.x + (r1.w / 2), r1.y + (r1.h / 2)]),
|
||||
d2 = geomSupport.lineLength(origin, [ r2.x + (r2.w / 2), r2.y + (r2.h / 2)]);
|
||||
|
||||
return d1 < d2 ? -1 : d1 == d2 ? 0 : 1;
|
||||
},
|
||||
EntryComparator = function(origin, getSize) {
|
||||
var _origin = origin,
|
||||
_cache = {},
|
||||
_get = function(entry) {
|
||||
if (!_cache[entry[1]]) {
|
||||
var s = getSize(entry[2]);
|
||||
_cache[entry[1]] = {
|
||||
l:entry[0][0],
|
||||
t:entry[0][1],
|
||||
w:s[0],
|
||||
h:s[1],
|
||||
center:[entry[0][0] + (s[0] / 2), entry[0][1] + (s[1] / 2) ]
|
||||
};
|
||||
}
|
||||
return _cache[entry[1]];
|
||||
}
|
||||
this.setOrigin = function(o) {
|
||||
_origin = o;
|
||||
_cache = {};
|
||||
};
|
||||
this.compare = function(e1, e2) {
|
||||
var d1 = geomSupport.lineLength(_origin, _get(e1).center),
|
||||
d2 = geomSupport.lineLength(_origin, _get(e2).center);
|
||||
|
||||
return d1 < d2 ? -1 : d1 == d2 ? 0 : 1;
|
||||
};
|
||||
};
|
||||
|
||||
var _isOnEdge = function(r, axis, dim, v) { return (r[axis] <= v && v <= r[axis] + r[dim]); },
|
||||
_xAdj = [ function(r1, r2) { return r1.x + r1.w - r2.x; }, function(r1, r2) { return r1.x - (r2.x + r2.w); } ],
|
||||
_yAdj = [ function(r1, r2) { return r1.y + r1.h - r2.y; }, function(r1, r2) { return r1.y - (r2.y + r2.h); } ],
|
||||
_adj = [ null, [ _xAdj[0], _yAdj[1] ], [ _xAdj[0], _yAdj[0] ], [ _xAdj[1], _yAdj[0] ], [ _xAdj[1], _yAdj[1] ] ],
|
||||
_genAdj = function(r1, r2, m, b, s) {
|
||||
if (isNaN(m)) m = 0;
|
||||
var y = r2.y + r2.h,
|
||||
x = (m == Infinity || m == -Infinity) ? r2.x + (r2.w / 2) : (y - b) / m,
|
||||
theta = Math.atan(m);
|
||||
|
||||
if (_isOnEdge(r2, "x", "w", x)) {
|
||||
var rise = _adj[s][1](r1, r2),
|
||||
hyp = rise / Math.sin(theta),
|
||||
run = hyp * Math.cos(theta);
|
||||
return { left:run, top:rise };
|
||||
}
|
||||
else {
|
||||
var run = _adj[s][0](r1, r2),
|
||||
hyp = run / Math.cos(theta),
|
||||
rise = hyp * Math.sin(theta);
|
||||
return { left:run, top:rise };
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Calculates how far to move r2 from r1 so that it no longer overlaps.
|
||||
* if origin is supplied, then it means we want r2 to move along a vector joining r2's center to that point.
|
||||
* otherwise we want it to move along a vector joining the two rectangle centers.
|
||||
*/
|
||||
_calculateSpacingAdjustment = Farahey.calculateSpacingAdjustment = function(r1, r2) {
|
||||
var c1 = r1.center || [ r1.x + (r1.w / 2), r1.y + (r1.h / 2) ],
|
||||
c2 = r2.center || [ r2.x + (r2.w / 2), r2.y + (r2.h / 2) ],
|
||||
m = geomSupport.gradient(c1, c2),
|
||||
s = geomSupport.quadrant(c1, c2),
|
||||
b = (m == Infinity || m == -Infinity || isNaN(m)) ? 0 : c1[1] - (m * c1[0]);
|
||||
|
||||
return _genAdj(r1, r2, m, b, s);
|
||||
},
|
||||
// calculate a padded rectangle for the given element with offset & size, and desired padding.
|
||||
_paddedRectangle = Farahey.paddedRectangle = function(o, s, p) {
|
||||
return { x:o[0] - p[0], y: o[1] - p[1], w:s[0] + (2 * p[0]), h:s[1] + (2 * p[1]) };
|
||||
},
|
||||
_magnetize = function(positionArray, positions, sizes, padding,
|
||||
constrain, origin, filter,
|
||||
updateOnStep, stepInterval, stepCallback)
|
||||
{
|
||||
origin = origin || [0,0];
|
||||
stepCallback = stepCallback || function() { };
|
||||
|
||||
var focus = _paddedRectangle(origin, [1,1], padding),
|
||||
iterations = 100, iteration = 1, uncleanRun = true, adjustBy, constrainedAdjustment,
|
||||
_movedElements = {},
|
||||
_move = function(id, o, x, y) {
|
||||
_movedElements[id] = true;
|
||||
o[0] += x;
|
||||
o[1] += y;
|
||||
},
|
||||
step = function() {
|
||||
for (var i = 0; i < positionArray.length; i++) {
|
||||
var o1 = positions[positionArray[i][1]],
|
||||
oid = positionArray[i][1],
|
||||
a1 = positionArray[i][2], // angle to node from magnet origin
|
||||
s1 = sizes[positionArray[i][1]],
|
||||
// create a rectangle for first element: this encompasses the element and padding on each
|
||||
//side
|
||||
r1 = _paddedRectangle(o1, s1, padding);
|
||||
|
||||
if (filter(positionArray[i][1]) && geomSupport.intersects(focus, r1)) {
|
||||
adjustBy = _calculateSpacingAdjustment(focus, r1);
|
||||
constrainedAdjustment = constrain(positionArray[i][1], o1, adjustBy);
|
||||
_move(oid, o1, constrainedAdjustment.left, constrainedAdjustment.top);
|
||||
}
|
||||
|
||||
// now move others to account for this one, if necessary.
|
||||
// reset rectangle for node
|
||||
r1 = _paddedRectangle(o1, s1, padding);
|
||||
for (var j = 0; j < positionArray.length; j++) {
|
||||
if (i != j) {
|
||||
var o2 = positions[positionArray[j][1]],
|
||||
a2 = positionArray[j][2], // angle to node from magnet origin
|
||||
s2 = sizes[positionArray[j][1]],
|
||||
// create a rectangle for the second element, again by putting padding of the desired
|
||||
// amount around the bounds of the element.
|
||||
r2 = _paddedRectangle(o2, s2, padding);
|
||||
|
||||
// if the two rectangles intersect then figure out how much to move the second one by.
|
||||
if (geomSupport.intersects(r1, r2)) {
|
||||
// TODO in 0.3, instead of moving neither, the other node should move.
|
||||
if (filter(positionArray[j][1])) {
|
||||
uncleanRun = true;
|
||||
adjustBy = _calculateSpacingAdjustment(r1, r2),
|
||||
constrainedAdjustment = constrain(positionArray[j][1], o2, adjustBy);
|
||||
|
||||
_move(positionArray[j][1], o2, constrainedAdjustment.left, constrainedAdjustment.top);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (updateOnStep)
|
||||
stepCallback();
|
||||
|
||||
if (uncleanRun && iteration < iterations) {
|
||||
uncleanRun = false;
|
||||
iteration++;
|
||||
if (updateOnStep) {
|
||||
window.setTimeout(step, stepInterval);
|
||||
}
|
||||
else
|
||||
step();
|
||||
}
|
||||
};
|
||||
|
||||
step();
|
||||
return _movedElements;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @name Magnetizer
|
||||
* @classdesc Applies repulsive magnetism to a set of elements relative to a given point, with a specified
|
||||
* amount of padding around the point.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Magnetizer#constructor
|
||||
* @function
|
||||
* @param {Selector|Element} [container] Element that contains the elements to magnetize. Only required if you intend to use the `executeAtEvent` method.
|
||||
* @param {Function} [getContainerPosition] Function that returns the position of the container (as an object of the form `{left:.., top:..}`) when requested. Only required if you intend to use the `executeAtEvent` method.
|
||||
* @param {Function} getPosition A function that takes an element id and returns its position. It does not matter to which element this position is computed as long as you remain consistent with this method, `setPosition` and the `origin` property.
|
||||
* @param {Function} setPosition A function that takes an element id and position, and sets it. See note about offset parent above.
|
||||
* @param {Function} getSize A function that takes an element id and returns its size, in pixels.
|
||||
* @param {Integer[]} [padding] Optional padding for x and y directions. Defaults to 20 pixels in each direction.
|
||||
* @param {Function} [constrain] Optional function that takes an id and a proposed amount of movement in each axis, and returns the allowed amount of movement in each axis. You can use this to constrain your elements to a grid, for instance, or a path, etc.
|
||||
* @param {Integer[]} [origin] The origin of magnetization, in pixels. Defaults to 0,0. You can also supply this to the `execute` call.
|
||||
* @param {Selector|String[]|Element[]} elements List of elements on which to operate.
|
||||
* @param {Boolean} [executeNow=false] Whether or not to execute the routine immediately.
|
||||
* @param {Function} [filter] Optional function that takes an element id and returns whether or not that element can be moved.
|
||||
* @param {Boolean} [orderByDistanceFromOrigin=false] Whether or not to sort elements first by distance from origin. Can have better results but takes more time.
|
||||
*/
|
||||
root.Magnetizer = function(params) {
|
||||
var getPosition = params.getPosition,
|
||||
getSize = params.getSize,
|
||||
getId = params.getId,
|
||||
setPosition = params.setPosition,
|
||||
padding = params.padding || [20, 20],
|
||||
// expects a { left:.., top:... } object. returns how far it can actually go.
|
||||
constrain = params.constrain || function(id, current, delta) { return delta; },
|
||||
positionArray = [],
|
||||
positions = {},
|
||||
sizes = {},
|
||||
elements = params.elements || [],
|
||||
origin = params.origin || [0,0],
|
||||
executeNow = params.executeNow,
|
||||
minx, miny, maxx, maxy,
|
||||
getOrigin = this.getOrigin = function() { return origin; },
|
||||
filter = params.filter || function(_) { return true; },
|
||||
orderByDistanceFromOrigin = params.orderByDistanceFromOrigin,
|
||||
comparator = new EntryComparator(origin, getSize),
|
||||
updateOnStep = params.updateOnStep,
|
||||
stepInterval = params.stepInterval || 350,
|
||||
originDebugMarker,
|
||||
debug = params.debug,
|
||||
createOriginDebugger = function() {
|
||||
var d = document.createElement("div");
|
||||
d.style.position = "absolute";
|
||||
d.style.width = "10px";
|
||||
d.style.height = "10px";
|
||||
d.style.backgroundColor = "red";
|
||||
document.body.appendChild(d);
|
||||
originDebugMarker = d;
|
||||
},
|
||||
_addToPositionArray = function(p) {
|
||||
if (!orderByDistanceFromOrigin || positionArray.length == 0)
|
||||
positionArray.push(p);
|
||||
else {
|
||||
insertSorted(positionArray, p, comparator.compare);
|
||||
}
|
||||
},
|
||||
_updatePositions = function() {
|
||||
comparator.setOrigin(origin);
|
||||
positionArray = []; positions = {}; sizes = {};
|
||||
minx = miny = Infinity;
|
||||
maxx = maxy = -Infinity;
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var p = getPosition(elements[i]),
|
||||
s = getSize(elements[i]),
|
||||
id = getId(elements[i]);
|
||||
|
||||
positions[id] = [p.left, p.top];
|
||||
_addToPositionArray([ [p.left, p.top], id, elements[i]]);
|
||||
sizes[id] = s;
|
||||
minx = Math.min(minx, p.left);
|
||||
miny = Math.min(miny, p.top);
|
||||
maxx = Math.max(maxx, p.left + s[0]);
|
||||
maxy = Math.max(maxy, p.top + s[1]);
|
||||
}
|
||||
},
|
||||
_run = function() {
|
||||
if (elements.length > 1) {
|
||||
var _movedElements = _magnetize(positionArray, positions, sizes, padding, constrain, origin, filter, updateOnStep, stepInterval, _positionElements);
|
||||
_positionElements(_movedElements);
|
||||
}
|
||||
},
|
||||
_positionElements = function(_movedElements) {
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
var id = getId(elements[i]);
|
||||
if (_movedElements[id])
|
||||
setPosition(elements[i], { left:positions[id][0], top:positions[id][1] });
|
||||
}
|
||||
},
|
||||
setOrigin = function(o) {
|
||||
if (o != null) {
|
||||
origin = o;
|
||||
comparator.setOrigin(o);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Magnetizer#execute
|
||||
* @function
|
||||
* @desc Runs the magnetize routine.
|
||||
* @param {Integer[]} [o] Optional origin to use. You may have set this in the constructor and do not wish to supply it, or you may be happy with the default of [0,0].
|
||||
*/
|
||||
this.execute = function(o) {
|
||||
setOrigin(o);
|
||||
_updatePositions();
|
||||
_run();
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Magnetizer#executeAtCenter
|
||||
* @function
|
||||
* @desc Computes the center of all the nodes and then uses that as the magnetization origin when it runs the routine.
|
||||
*/
|
||||
this.executeAtCenter = function() {
|
||||
_updatePositions();
|
||||
setOrigin([
|
||||
(minx + maxx) / 2,
|
||||
(miny + maxy) / 2
|
||||
]);
|
||||
_run();
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Magnetizer#executeAtEvent
|
||||
* @function
|
||||
* @desc Runs the magnetize routine using the location of the given event as the origin. To use this
|
||||
* method you need to have provided a `container`, and a `getContainerPosition` function to the
|
||||
* constructor.
|
||||
* @param {Event} e Event to get origin location from.
|
||||
*/
|
||||
this.executeAtEvent = function(e) {
|
||||
var c = params.container,
|
||||
o = params.getContainerPosition(c),
|
||||
x = e.pageX - o.left + c[0].scrollLeft,
|
||||
y = e.pageY - o.top + c[0].scrollTop;
|
||||
|
||||
if (debug) {
|
||||
originDebugMarker.style.left = e.pageX + "px";
|
||||
originDebugMarker.style.top = e.pageY + "px";
|
||||
}
|
||||
|
||||
this.execute([x,y]);
|
||||
};
|
||||
|
||||
/**
|
||||
* @name Magnetize#setElements
|
||||
* @function
|
||||
* @desc Sets the current list of elements.
|
||||
* @param {Object[]} _els List of elements, in whatever format the magnetizer is setup to use.
|
||||
*/
|
||||
this.setElements = function(_els) {
|
||||
elements = _els;
|
||||
};
|
||||
|
||||
|
||||
if (debug)
|
||||
createOriginDebugger();
|
||||
|
||||
if (executeNow) this.execute();
|
||||
|
||||
};
|
||||
}).call(this);
|
||||
|
||||
5
public/js/v1.0.0RC3/lib/jquery-1.11.3.min.js
vendored
5
public/js/v1.0.0RC3/lib/jquery-1.11.3.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,381 +0,0 @@
|
||||
/*
|
||||
@title:
|
||||
Drag to Select
|
||||
|
||||
@version:
|
||||
1.1
|
||||
|
||||
@author:
|
||||
Andreas Lagerkvist
|
||||
|
||||
@date:
|
||||
2009-04-06
|
||||
|
||||
@url:
|
||||
http://andreaslagerkvist.com/jquery/drag-to-select/
|
||||
|
||||
@license:
|
||||
http://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
@copyright:
|
||||
2008 Andreas Lagerkvist (andreaslagerkvist.com)
|
||||
|
||||
@requires:
|
||||
jquery, jquery.dragToSelect.css
|
||||
|
||||
@does:
|
||||
Use this plug-in to allow your users to select certain elements by dragging a "select box". Works very similar to how you can drag-n-select files and folders in most OS:es.
|
||||
|
||||
@howto:
|
||||
$('#my-files').dragToSelect(selectables: 'li'); would make every li in the #my-files-element selectable by dragging. The li:s will recieve a "selected"-class when they are within range of the select box when user drops.
|
||||
|
||||
Make sure a parent-element of the selectables has position: relative as well as overflow: auto or scroll.
|
||||
|
||||
@exampleHTML:
|
||||
<ul>
|
||||
<li><img src="http://exscale.se/__files/3d/lamp-and-mates/lamp-and-mates-01_small.jpg" alt="Lamp and Mates" /></li>
|
||||
<li><img src="http://exscale.se/__files/3d/stugan-winter_small.jpg" alt="The Cottage - Winter time" /></li>
|
||||
<li><img src="http://exscale.se/__files/3d/ps2_small.jpg" alt="PS2" /></li>
|
||||
</ul>
|
||||
|
||||
@exampleJS:
|
||||
$('#jquery-drag-to-select-example').dragToSelect({
|
||||
selectables: 'li',
|
||||
onHide: function () {
|
||||
alert($('#jquery-drag-to-select-example li.selected').length + ' selected');
|
||||
}
|
||||
});
|
||||
*/
|
||||
jQuery.fn.dragToSelect = function (conf) {
|
||||
var c = typeof(conf) == 'object' ? conf : {};
|
||||
|
||||
// Config
|
||||
var config = jQuery.extend({
|
||||
className: 'pf-map-drag-to-select',
|
||||
activeClass: 'active',
|
||||
disabledClass: 'disabled',
|
||||
selectedClass: 'pf-system-selected',
|
||||
ignoredClass: 'pf-system-locked', // do not select locked systems
|
||||
scrollTH: 10,
|
||||
percentCovered: 25,
|
||||
selectables: false,
|
||||
autoScroll: false,
|
||||
selectOnMove: false,
|
||||
onShow: function () {return true;},
|
||||
onHide: function () {return true;},
|
||||
onRefresh: function () {return true;}
|
||||
}, c);
|
||||
|
||||
var realParent = jQuery(this);
|
||||
var parent = realParent;
|
||||
|
||||
// deselected items
|
||||
var deselectedItems = [];
|
||||
|
||||
do {
|
||||
if (/auto|scroll|hidden/.test(parent.css('overflow'))) {
|
||||
break;
|
||||
}
|
||||
parent = parent.parent();
|
||||
} while (parent[0].parentNode);
|
||||
|
||||
// Does user want to disable dragToSelect
|
||||
if (conf == 'disable') {
|
||||
parent.addClass(config.disabledClass);
|
||||
return this;
|
||||
}
|
||||
else if (conf == 'enable') {
|
||||
parent.removeClass(config.disabledClass);
|
||||
return this;
|
||||
}
|
||||
|
||||
var parentOffset = parent.offset();
|
||||
var parentDim = {
|
||||
left: parentOffset.left,
|
||||
top: parentOffset.top,
|
||||
width: parent.width(),
|
||||
height: parent.height()
|
||||
};
|
||||
|
||||
// Current origin of select box
|
||||
var selectBoxOrigin = {
|
||||
left: 0,
|
||||
top: 0
|
||||
};
|
||||
|
||||
// Create select box
|
||||
var selectBox = jQuery('<div/>')
|
||||
.appendTo(parent)
|
||||
.attr('class', config.className)
|
||||
.css('position', 'absolute');
|
||||
|
||||
// Shows the select box
|
||||
var showSelectBox = function (e) {
|
||||
if (parent.is('.' + config.disabledClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
selectBoxOrigin.left = e.pageX - parentDim.left + parent[0].scrollLeft;
|
||||
selectBoxOrigin.top = e.pageY - parentDim.top + parent[0].scrollTop;
|
||||
|
||||
var css = {
|
||||
left: selectBoxOrigin.left + 'px',
|
||||
top: selectBoxOrigin.top + 'px',
|
||||
width: '1px',
|
||||
height: '1px'
|
||||
};
|
||||
selectBox.addClass(config.activeClass).css(css);
|
||||
|
||||
config.onShow();
|
||||
};
|
||||
|
||||
// Refreshes the select box dimensions and possibly position
|
||||
var refreshSelectBox = function (e) {
|
||||
if (!selectBox.is('.' + config.activeClass) || parent.is('.' + config.disabledClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get scroll position
|
||||
var leftScroll = 0;
|
||||
var rightScroll = 0;
|
||||
|
||||
if(realParent.data('scrollLeft')){
|
||||
leftScroll = realParent.data('scrollLeft');
|
||||
}
|
||||
|
||||
if(realParent.data('scrollRight')){
|
||||
rightScroll = realParent.data('scrollRight');
|
||||
}
|
||||
|
||||
var left = e.pageX - parentDim.left + parent[0].scrollLeft;
|
||||
var top = e.pageY - parentDim.top + parent[0].scrollTop;
|
||||
var newLeft = left;
|
||||
var newTop = top;
|
||||
var tempWidth = selectBoxOrigin.left - newLeft ;
|
||||
var newHeight = selectBoxOrigin.top - newTop;
|
||||
|
||||
newLeft = selectBoxOrigin.left - leftScroll;
|
||||
var newWidth = left - selectBoxOrigin.left;
|
||||
|
||||
|
||||
if(newWidth < 0){
|
||||
newLeft = newLeft - tempWidth ;
|
||||
newWidth = newWidth * -1;
|
||||
}
|
||||
|
||||
|
||||
if (top > selectBoxOrigin.top) {
|
||||
newTop = selectBoxOrigin.top;
|
||||
newHeight = top - selectBoxOrigin.top;
|
||||
}
|
||||
|
||||
var css = {
|
||||
left: newLeft + 'px',
|
||||
top: newTop + 'px',
|
||||
width: newWidth + 'px',
|
||||
height: newHeight + 'px'
|
||||
};
|
||||
selectBox.css(css);
|
||||
|
||||
config.onRefresh();
|
||||
};
|
||||
|
||||
// Hides the select box
|
||||
var hideSelectBox = function (e) {
|
||||
if (!selectBox.is('.' + config.activeClass) || parent.is('.' + config.disabledClass)) {
|
||||
return;
|
||||
}
|
||||
if (config.onHide(selectBox, deselectedItems) !== false) {
|
||||
selectBox.removeClass(config.activeClass);
|
||||
}
|
||||
};
|
||||
|
||||
// Scrolls parent if needed
|
||||
var scrollPerhaps = function (e) {
|
||||
if (!selectBox.is('.' + config.activeClass) || parent.is('.' + config.disabledClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Scroll down
|
||||
if ((e.pageY + config.scrollTH) > (parentDim.top + parentDim.height)) {
|
||||
parent[0].scrollTop += config.scrollTH;
|
||||
}
|
||||
// Scroll up
|
||||
if ((e.pageY - config.scrollTH) < parentDim.top) {
|
||||
parent[0].scrollTop -= config.scrollTH;
|
||||
}
|
||||
// Scroll right
|
||||
if ((e.pageX + config.scrollTH) > (parentDim.left + parentDim.width)) {
|
||||
parent[0].scrollLeft += config.scrollTH;
|
||||
}
|
||||
// Scroll left
|
||||
if ((e.pageX - config.scrollTH) < parentDim.left) {
|
||||
parent[0].scrollLeft -= config.scrollTH;
|
||||
}
|
||||
};
|
||||
|
||||
// Selects all the elements in the select box's range
|
||||
var selectElementsInRange = function () {
|
||||
if (!selectBox.is('.' + config.activeClass) || parent.is('.' + config.disabledClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selectables = realParent.find(config.selectables + ':not(.' + config.ignoredClass + ')');
|
||||
var selectBoxOffset = selectBox.offset();
|
||||
var selectBoxDim = {
|
||||
left: selectBoxOffset.left,
|
||||
top: selectBoxOffset.top,
|
||||
width: selectBox.width(),
|
||||
height: selectBox.height()
|
||||
};
|
||||
|
||||
// reset deselected item array
|
||||
deselectedItems = [];
|
||||
|
||||
selectables.each(function (i) {
|
||||
var el = $(this);
|
||||
var elOffset = el.offset();
|
||||
var elDim = {
|
||||
left: elOffset.left,
|
||||
top: elOffset.top,
|
||||
width: el.width(),
|
||||
height: el.height()
|
||||
};
|
||||
|
||||
if (percentCovered(selectBoxDim, elDim) > config.percentCovered) {
|
||||
el.addClass(config.selectedClass);
|
||||
}else {
|
||||
|
||||
if(el.hasClass(config.selectedClass)){
|
||||
el.removeClass(config.selectedClass);
|
||||
deselectedItems.push(el);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// Returns the amount (in %) that dim1 covers dim2
|
||||
var percentCovered = function (dim1, dim2) {
|
||||
// The whole thing is covering the whole other thing
|
||||
if (
|
||||
(dim1.left <= dim2.left) &&
|
||||
(dim1.top <= dim2.top) &&
|
||||
((dim1.left + dim1.width) >= (dim2.left + dim2.width)) &&
|
||||
((dim1.top + dim1.height) > (dim2.top + dim2.height))
|
||||
) {
|
||||
return 100;
|
||||
}
|
||||
// Only parts may be covered, calculate percentage
|
||||
else {
|
||||
dim1.right = dim1.left + dim1.width;
|
||||
dim1.bottom = dim1.top + dim1.height;
|
||||
dim2.right = dim2.left + dim2.width;
|
||||
dim2.bottom = dim2.top + dim2.height;
|
||||
|
||||
var l = Math.max(dim1.left, dim2.left);
|
||||
var r = Math.min(dim1.right, dim2.right);
|
||||
var t = Math.max(dim1.top, dim2.top);
|
||||
var b = Math.min(dim1.bottom, dim2.bottom);
|
||||
|
||||
if (b >= t && r >= l) {
|
||||
/* $('<div/>').appendTo(document.body).css({
|
||||
background: 'red',
|
||||
position: 'absolute',
|
||||
left: l + 'px',
|
||||
top: t + 'px',
|
||||
width: (r - l) + 'px',
|
||||
height: (b - t) + 'px',
|
||||
zIndex: 100
|
||||
}); */
|
||||
|
||||
var percent = (((r - l) * (b - t)) / (dim2.width * dim2.height)) * 100;
|
||||
|
||||
// alert(percent + '% covered')
|
||||
|
||||
return percent;
|
||||
}
|
||||
}
|
||||
// Nothing covered, return 0
|
||||
return 0;
|
||||
};
|
||||
|
||||
// Do the right stuff then return this
|
||||
selectBox
|
||||
.mousemove(function (e) {
|
||||
|
||||
refreshSelectBox(e);
|
||||
|
||||
if (config.selectables && config.selectOnMove) {
|
||||
selectElementsInRange();
|
||||
}
|
||||
|
||||
if (config.autoScroll) {
|
||||
scrollPerhaps(e);
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
})
|
||||
.mouseup(function(e) {
|
||||
|
||||
if (config.selectables) {
|
||||
selectElementsInRange();
|
||||
}
|
||||
|
||||
hideSelectBox(e);
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
parent.mousedown(function (e) {
|
||||
|
||||
if(
|
||||
e.which === 1 && // left mouse down
|
||||
e.target === realParent[0] // prevent while dragging a system :)
|
||||
){
|
||||
|
||||
// Make sure user isn't clicking scrollbar (or disallow clicks far to the right actually)
|
||||
if ((e.pageX + 20) > jQuery(document.body).width()) {
|
||||
return;
|
||||
}
|
||||
|
||||
showSelectBox(e);
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
var dragSelectMousemove = function (e) {
|
||||
|
||||
refreshSelectBox(e);
|
||||
|
||||
if (config.selectables && config.selectOnMove) {
|
||||
|
||||
selectElementsInRange();
|
||||
}
|
||||
|
||||
if (config.autoScroll) {
|
||||
scrollPerhaps(e);
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
};
|
||||
parent.mousemove( dragSelectMousemove );
|
||||
|
||||
|
||||
parent.mouseup(function (e) {
|
||||
if (config.selectables) {
|
||||
selectElementsInRange();
|
||||
}
|
||||
|
||||
hideSelectBox(e);
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Be nice
|
||||
return this;
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
/**!
|
||||
* easyPieChart
|
||||
* Lightweight plugin to render simple, animated and retina optimized pie charts
|
||||
*
|
||||
* @license
|
||||
* @author Robert Fleischmann <rendro87@gmail.com> (http://robert-fleischmann.de)
|
||||
* @version 2.1.6
|
||||
**/
|
||||
!function(a,b){"object"==typeof exports?module.exports=b(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],b):b(a.jQuery)}(this,function(a){var b=function(a,b){var c,d=document.createElement("canvas");a.appendChild(d),"undefined"!=typeof G_vmlCanvasManager&&G_vmlCanvasManager.initElement(d);var e=d.getContext("2d");d.width=d.height=b.size;var f=1;window.devicePixelRatio>1&&(f=window.devicePixelRatio,d.style.width=d.style.height=[b.size,"px"].join(""),d.width=d.height=b.size*f,e.scale(f,f)),e.translate(b.size/2,b.size/2),e.rotate((-0.5+b.rotate/180)*Math.PI);var g=(b.size-b.lineWidth)/2;b.scaleColor&&b.scaleLength&&(g-=b.scaleLength+2),Date.now=Date.now||function(){return+new Date};var h=function(a,b,c){c=Math.min(Math.max(-1,c||0),1);var d=0>=c?!0:!1;e.beginPath(),e.arc(0,0,g,0,2*Math.PI*c,d),e.strokeStyle=a,e.lineWidth=b,e.stroke()},i=function(){var a,c;e.lineWidth=1,e.fillStyle=b.scaleColor,e.save();for(var d=24;d>0;--d)d%6===0?(c=b.scaleLength,a=0):(c=.6*b.scaleLength,a=b.scaleLength-c),e.fillRect(-b.size/2+a,0,c,1),e.rotate(Math.PI/12);e.restore()},j=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),k=function(){b.scaleColor&&i(),b.trackColor&&h(b.trackColor,b.trackWidth||b.lineWidth,1)};this.getCanvas=function(){return d},this.getCtx=function(){return e},this.clear=function(){e.clearRect(b.size/-2,b.size/-2,b.size,b.size)},this.draw=function(a){b.scaleColor||b.trackColor?e.getImageData&&e.putImageData?c?e.putImageData(c,0,0):(k(),c=e.getImageData(0,0,b.size*f,b.size*f)):(this.clear(),k()):this.clear(),e.lineCap=b.lineCap;var d;d="function"==typeof b.barColor?b.barColor(a):b.barColor,h(d,b.lineWidth,a/100)}.bind(this),this.animate=function(a,c){var d=Date.now();b.onStart(a,c);var e=function(){var f=Math.min(Date.now()-d,b.animate.duration),g=b.easing(this,f,a,c-a,b.animate.duration);this.draw(g),b.onStep(a,c,g),f>=b.animate.duration?b.onStop(a,c):j(e)}.bind(this);j(e)}.bind(this)},c=function(a,c){var d={barColor:"#ef1e25",trackColor:"#f9f9f9",scaleColor:"#dfe0e0",scaleLength:5,lineCap:"round",lineWidth:3,trackWidth:void 0,size:110,rotate:0,animate:{duration:1e3,enabled:!0},easing:function(a,b,c,d,e){return b/=e/2,1>b?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},onStart:function(){},onStep:function(){},onStop:function(){}};if("undefined"!=typeof b)d.renderer=b;else{if("undefined"==typeof SVGRenderer)throw new Error("Please load either the SVG- or the CanvasRenderer");d.renderer=SVGRenderer}var e={},f=0,g=function(){this.el=a,this.options=e;for(var b in d)d.hasOwnProperty(b)&&(e[b]=c&&"undefined"!=typeof c[b]?c[b]:d[b],"function"==typeof e[b]&&(e[b]=e[b].bind(this)));e.easing="string"==typeof e.easing&&"undefined"!=typeof jQuery&&jQuery.isFunction(jQuery.easing[e.easing])?jQuery.easing[e.easing]:d.easing,"number"==typeof e.animate&&(e.animate={duration:e.animate,enabled:!0}),"boolean"!=typeof e.animate||e.animate||(e.animate={duration:1e3,enabled:e.animate}),this.renderer=new e.renderer(a,e),this.renderer.draw(f),a.dataset&&a.dataset.percent?this.update(parseFloat(a.dataset.percent)):a.getAttribute&&a.getAttribute("data-percent")&&this.update(parseFloat(a.getAttribute("data-percent")))}.bind(this);this.update=function(a){return a=parseFloat(a),e.animate.enabled?this.renderer.animate(f,a):this.renderer.draw(a),f=a,this}.bind(this),this.disableAnimation=function(){return e.animate.enabled=!1,this},this.enableAnimation=function(){return e.animate.enabled=!0,this},g()};a.fn.easyPieChart=function(b){return this.each(function(){var d;a.data(this,"easyPieChart")||(d=a.extend({},b,a(this).data()),a.data(this,"easyPieChart",new c(this,d)))})}});
|
||||
@@ -1,9 +0,0 @@
|
||||
/*!
|
||||
* hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
|
||||
* http://cherne.net/brian/resources/jquery.hoverIntent.html
|
||||
*
|
||||
* You may use hoverIntent under the terms of the MIT license. Basically that
|
||||
* means you are free to use hoverIntent as long as this header is left intact.
|
||||
* Copyright 2007, 2014 Brian Cherne
|
||||
*/
|
||||
(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery);
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Lazy Line Painter
|
||||
* SVG Stroke animation.
|
||||
*
|
||||
* https://github.com/camoconnell/lazy-line-painter
|
||||
* http://www.camoconnell.com
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
*
|
||||
*/
|
||||
(function(e){var g={init:function(a){return this.each(function(){var b=e(this),c=b.data("lazyLinePainter");b.addClass("lazy-line");if(!c){var c=e.extend({width:null,height:null,strokeWidth:2,strokeColor:"#000",strokeOverColor:null,strokeCap:"round",strokeJoin:"round",strokeOpacity:1,arrowEnd:"none",onComplete:null,onStart:null,delay:null,overrideKey:null,drawSequential:!0,speedMultiplier:1,reverse:!1,responsive:!1},a),d=c.overrideKey?c.overrideKey:b.attr("id").replace("#",""),f=c.svgData[d].dimensions.width,
|
||||
l=c.svgData[d].dimensions.height;c.svgData=c.svgData[d].strokepath;null===c.width&&(c.width=f);null===c.height&&(c.height=l);c.responsive||b.css({width:c.width,height:c.height});d="0 0 "+f+" "+l;f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttributeNS(null,"viewBox",d);f.setAttribute("xmlns","http://www.w3.org/2000/svg");c.svg=e(f);b.append(c.svg);b.data("lazyLinePainter",c)}})},paint:function(){return this.each(function(){var a=e(this).data("lazyLinePainter"),b=function(){a.paths=
|
||||
[];a.longestDuration=0;for(var b=a.playhead=0,d=0,f=0,d=0;d<a.svgData.length;d++)b=a.svgData[d].duration*a.speedMultiplier,f+=b;for(d=0;d<a.svgData.length;d++){var e=m(a,d),h=e.getTotalLength();e.style.strokeDasharray=h+" "+h;e.style.strokeDashoffset=h;e.style.display="block";e.getBoundingClientRect();b=a.svgData[d].duration*a.speedMultiplier;b>a.longestDuration&&(a.longestDuration=b);var g;g=a.reverse?f-=b:a.playhead;a.paths.push({duration:b,drawStartTime:g,path:e,length:h});a.playhead+=b}a.totalDuration=
|
||||
a.drawSequential?a.playhead:a.longestDuration;a.rAF=requestAnimationFrame(function(b){k(b,a)});if(null!==a.onStart)a.onStart()};null===a.delay?b():setTimeout(b,a.delay)})},pauseResume:function(){return this.each(function(){var a=e(this).data("lazyLinePainter");a.paused?(a.paused=!1,requestAnimationFrame(function(b){n(b,a)})):(a.paused=!0,cancelAnimationFrame(a.rAF))})},erase:function(){return this.each(function(){var a=e(this).data("lazyLinePainter");a.startTime=null;a.elapsedTime=null;cancelAnimationFrame(a.rAF);
|
||||
a.svg.empty()})},destroy:function(){return this.each(function(){var a=e(this);a.removeData("lazyLinePainter");a.remove()})}},n=function(a,b){b.startTime=a-b.elapsedTime;requestAnimationFrame(function(a){k(a,b)})},k=function(a,b){b.startTime||(b.startTime=a);b.elapsedTime=a-b.startTime;for(var c=0;c<b.paths.length;c++){var d;b.drawSequential?(d=b.elapsedTime-b.paths[c].drawStartTime,0>d&&(d=0)):d=b.elapsedTime;d<b.paths[c].duration&&0<d?(d=d/b.paths[c].duration*b.paths[c].length,b.paths[c].path.style.strokeDashoffset=
|
||||
b.reverse||b.svgData[c].reverse?-b.paths[c].length+d:b.paths[c].length-d):d>b.paths[c].duration&&(b.paths[c].path.style.strokeDashoffset=0)}if(b.elapsedTime<b.totalDuration)b.rAF=requestAnimationFrame(function(a){k(a,b)});else if(null!==b.onComplete)b.onComplete()},m=function(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg","path"),d=e(c);a.svg.append(d);d.attr(p(a,a.svgData[b]));return c},p=function(a,b){return{d:b.path,stroke:b.strokeColor?b.strokeColor:a.strokeColor,"fill-opacity":0,
|
||||
"stroke-opacity":b.strokeOpacity?b.strokeOpacity:a.strokeOpacity,"stroke-width":b.strokeWidth?b.strokeWidth:a.strokeWidth,"stroke-linecap":b.strokeCap?b.strokeCap:a.strokeCap,"stroke-linejoin":b.strokeJoin?b.strokeJoin:a.strokeJoin}};e.fn.lazylinepainter=function(a){if(g[a])return g[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"!==typeof a&&a)console.log("opps - issue finding method");else return g.init.apply(this,arguments)}})(jQuery);
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! Lazy Load 1.9.5 - MIT license - Copyright 2010-2015 Mika Tuupola */
|
||||
!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);
|
||||
File diff suppressed because one or more lines are too long
7
public/js/v1.0.0RC3/lib/morris.min.js
vendored
7
public/js/v1.0.0RC3/lib/morris.min.js
vendored
File diff suppressed because one or more lines are too long
1
public/js/v1.0.0RC3/lib/mustache.min.js
vendored
1
public/js/v1.0.0RC3/lib/mustache.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,48 +0,0 @@
|
||||
// Callbacks
|
||||
// Uses AMD or browser globals for jQuery.
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as a module.
|
||||
define('pnotify.callbacks', ['jquery', 'pnotify'], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery, PNotify);
|
||||
}
|
||||
}(function($, PNotify){
|
||||
var _init = PNotify.prototype.init,
|
||||
_open = PNotify.prototype.open,
|
||||
_remove = PNotify.prototype.remove;
|
||||
PNotify.prototype.init = function(){
|
||||
if (this.options.before_init) {
|
||||
this.options.before_init(this.options);
|
||||
}
|
||||
_init.apply(this, arguments);
|
||||
if (this.options.after_init) {
|
||||
this.options.after_init(this);
|
||||
}
|
||||
};
|
||||
PNotify.prototype.open = function(){
|
||||
var ret;
|
||||
if (this.options.before_open) {
|
||||
ret = this.options.before_open(this);
|
||||
}
|
||||
if (ret !== false) {
|
||||
_open.apply(this, arguments);
|
||||
if (this.options.after_open) {
|
||||
this.options.after_open(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
PNotify.prototype.remove = function(timer_hide){
|
||||
var ret;
|
||||
if (this.options.before_close) {
|
||||
ret = this.options.before_close(this, timer_hide);
|
||||
}
|
||||
if (ret !== false) {
|
||||
_remove.apply(this, arguments);
|
||||
if (this.options.after_close) {
|
||||
this.options.after_close(this, timer_hide);
|
||||
}
|
||||
}
|
||||
};
|
||||
}));
|
||||
@@ -1,778 +0,0 @@
|
||||
/*
|
||||
PNotify 2.0.1 sciactive.com/pnotify/
|
||||
(C) 2014 Hunter Perrin
|
||||
license GPL/LGPL/MPL
|
||||
*/
|
||||
/*
|
||||
* ====== PNotify ======
|
||||
*
|
||||
* http://sciactive.com/pnotify/
|
||||
*
|
||||
* Copyright 2009-2014 Hunter Perrin
|
||||
*
|
||||
* Triple licensed under the GPL, LGPL, and MPL.
|
||||
* http://gnu.org/licenses/gpl.html
|
||||
* http://gnu.org/licenses/lgpl.html
|
||||
* http://mozilla.org/MPL/MPL-1.1.html
|
||||
*/
|
||||
|
||||
// Uses AMD or browser globals for jQuery.
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as a module.
|
||||
define('pnotify', ['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function($){
|
||||
var default_stack = {
|
||||
dir1: "down",
|
||||
dir2: "left",
|
||||
push: "bottom",
|
||||
spacing1: 25,
|
||||
spacing2: 25,
|
||||
context: $("body")
|
||||
};
|
||||
var timer, // Position all timer.
|
||||
body,
|
||||
jwindow = $(window);
|
||||
// Set global variables.
|
||||
var do_when_ready = function(){
|
||||
body = $("body");
|
||||
PNotify.prototype.options.stack.context = body;
|
||||
jwindow = $(window);
|
||||
// Reposition the notices when the window resizes.
|
||||
jwindow.bind('resize', function(){
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function(){ PNotify.positionAll(true) }, 10);
|
||||
});
|
||||
};
|
||||
PNotify = function(options){
|
||||
this.parseOptions(options);
|
||||
this.init();
|
||||
};
|
||||
$.extend(PNotify.prototype, {
|
||||
// The current version of PNotify.
|
||||
version: "2.0.1",
|
||||
|
||||
// === Options ===
|
||||
|
||||
// Options defaults.
|
||||
options: {
|
||||
// The notice's title.
|
||||
title: false,
|
||||
// Whether to escape the content of the title. (Not allow HTML.)
|
||||
title_escape: false,
|
||||
// The notice's text.
|
||||
text: false,
|
||||
// Whether to escape the content of the text. (Not allow HTML.)
|
||||
text_escape: false,
|
||||
// What styling classes to use. (Can be either jqueryui or bootstrap.)
|
||||
styling: "bootstrap3",
|
||||
// Additional classes to be added to the notice. (For custom styling.)
|
||||
addclass: "",
|
||||
// Class to be added to the notice for corner styling.
|
||||
cornerclass: "",
|
||||
// Display the notice when it is created.
|
||||
auto_display: true,
|
||||
// Width of the notice.
|
||||
width: "300px",
|
||||
// Minimum height of the notice. It will expand to fit content.
|
||||
min_height: "16px",
|
||||
// Type of the notice. "notice", "info", "success", or "error".
|
||||
type: "notice",
|
||||
// Set icon to true to use the default icon for the selected
|
||||
// style/type, false for no icon, or a string for your own icon class.
|
||||
icon: true,
|
||||
// Opacity of the notice.
|
||||
opacity: 1,
|
||||
// The animation to use when displaying and hiding the notice. "none",
|
||||
// "show", "fade", and "slide" are built in to jQuery. Others require jQuery
|
||||
// UI. Use an object with effect_in and effect_out to use different effects.
|
||||
animation: "fade",
|
||||
// Speed at which the notice animates in and out. "slow", "def" or "normal",
|
||||
// "fast" or number of milliseconds.
|
||||
animate_speed: "slow",
|
||||
// Specify a specific duration of position animation
|
||||
position_animate_speed: 500,
|
||||
// Display a drop shadow.
|
||||
shadow: true,
|
||||
// After a delay, remove the notice.
|
||||
hide: true,
|
||||
// Delay in milliseconds before the notice is removed.
|
||||
delay: 8000,
|
||||
// Reset the hide timer if the mouse moves over the notice.
|
||||
mouse_reset: true,
|
||||
// Remove the notice's elements from the DOM after it is removed.
|
||||
remove: true,
|
||||
// Change new lines to br tags.
|
||||
insert_brs: true,
|
||||
// Whether to remove notices from the global array.
|
||||
destroy: true,
|
||||
// The stack on which the notices will be placed. Also controls the
|
||||
// direction the notices stack.
|
||||
stack: default_stack
|
||||
},
|
||||
|
||||
// === Modules ===
|
||||
|
||||
// This object holds all the PNotify modules. They are used to provide
|
||||
// additional functionality.
|
||||
modules: {},
|
||||
// This runs an event on all the modules.
|
||||
runModules: function(event, arg){
|
||||
var curArg;
|
||||
for (var module in this.modules) {
|
||||
curArg = ((typeof arg === "object" && module in arg) ? arg[module] : arg);
|
||||
if (typeof this.modules[module][event] === 'function')
|
||||
this.modules[module][event](this, typeof this.options[module] === 'object' ? this.options[module] : {}, curArg);
|
||||
}
|
||||
},
|
||||
|
||||
// === Class Variables ===
|
||||
|
||||
state: "initializing", // The state can be "initializing", "opening", "open", "closing", and "closed".
|
||||
timer: null, // Auto close timer.
|
||||
styles: null,
|
||||
elem: null,
|
||||
container: null,
|
||||
title_container: null,
|
||||
text_container: null,
|
||||
animating: false, // Stores what is currently being animated (in or out).
|
||||
timerHide: false, // Stores whether the notice was hidden by a timer.
|
||||
|
||||
// === Events ===
|
||||
|
||||
init: function(){
|
||||
var that = this;
|
||||
|
||||
// First and foremost, we don't want our module objects all referencing the prototype.
|
||||
this.modules = {};
|
||||
$.extend(true, this.modules, PNotify.prototype.modules);
|
||||
|
||||
// Get our styling object.
|
||||
if (typeof this.options.styling === "object") {
|
||||
this.styles = this.options.styling;
|
||||
} else {
|
||||
this.styles = PNotify.styling[this.options.styling];
|
||||
}
|
||||
|
||||
// Create our widget.
|
||||
// Stop animation, reset the removal timer when the user mouses over.
|
||||
this.elem = $("<div />", {
|
||||
"class": "ui-pnotify "+this.options.addclass,
|
||||
"css": {"display": "none"},
|
||||
"mouseenter": function(e){
|
||||
if (that.options.mouse_reset && that.animating === "out") {
|
||||
if (!that.timerHide)
|
||||
return;
|
||||
that.cancelRemove();
|
||||
}
|
||||
// Stop the close timer.
|
||||
if (that.options.hide && that.options.mouse_reset) that.cancelRemove();
|
||||
},
|
||||
"mouseleave": function(e){
|
||||
// Start the close timer.
|
||||
if (that.options.hide && that.options.mouse_reset) that.queueRemove();
|
||||
PNotify.positionAll();
|
||||
}
|
||||
});
|
||||
// Create a container for the notice contents.
|
||||
this.container = $("<div />", {"class": this.styles.container+" ui-pnotify-container "+(this.options.type === "error" ? this.styles.error : (this.options.type === "info" ? this.styles.info : (this.options.type === "success" ? this.styles.success : this.styles.notice)))})
|
||||
.appendTo(this.elem);
|
||||
if (this.options.cornerclass !== "")
|
||||
this.container.removeClass("ui-corner-all").addClass(this.options.cornerclass);
|
||||
// Create a drop shadow.
|
||||
if (this.options.shadow)
|
||||
this.container.addClass("ui-pnotify-shadow");
|
||||
|
||||
|
||||
// Add the appropriate icon.
|
||||
if (this.options.icon !== false) {
|
||||
$("<div />", {"class": "ui-pnotify-icon"})
|
||||
.append($("<span />", {"class": this.options.icon === true ? (this.options.type === "error" ? this.styles.error_icon : (this.options.type === "info" ? this.styles.info_icon : (this.options.type === "success" ? this.styles.success_icon : this.styles.notice_icon))) : this.options.icon}))
|
||||
.prependTo(this.container);
|
||||
}
|
||||
|
||||
// Add a title.
|
||||
this.title_container = $("<h4 />", {
|
||||
"class": "ui-pnotify-title"
|
||||
})
|
||||
.appendTo(this.container);
|
||||
if (this.options.title === false)
|
||||
this.title_container.hide();
|
||||
else if (this.options.title_escape)
|
||||
this.title_container.text(this.options.title);
|
||||
else
|
||||
this.title_container.html(this.options.title);
|
||||
|
||||
// Add text.
|
||||
this.text_container = $("<div />", {
|
||||
"class": "ui-pnotify-text"
|
||||
})
|
||||
.appendTo(this.container);
|
||||
if (this.options.text === false)
|
||||
this.text_container.hide();
|
||||
else if (this.options.text_escape)
|
||||
this.text_container.text(this.options.text);
|
||||
else
|
||||
this.text_container.html(this.options.insert_brs ? String(this.options.text).replace(/\n/g, "<br />") : this.options.text);
|
||||
|
||||
// Set width and min height.
|
||||
if (typeof this.options.width === "string")
|
||||
this.elem.css("width", this.options.width);
|
||||
if (typeof this.options.min_height === "string")
|
||||
this.container.css("min-height", this.options.min_height);
|
||||
|
||||
|
||||
// Add the notice to the notice array.
|
||||
if (this.options.stack.push === "top")
|
||||
PNotify.notices = $.merge([this], PNotify.notices);
|
||||
else
|
||||
PNotify.notices = $.merge(PNotify.notices, [this]);
|
||||
// Now position all the notices if they are to push to the top.
|
||||
if (this.options.stack.push === "top")
|
||||
this.queuePosition(false, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
// Mark the stack so it won't animate the new notice.
|
||||
this.options.stack.animation = false;
|
||||
|
||||
// Run the modules.
|
||||
this.runModules('init');
|
||||
|
||||
// Display the notice.
|
||||
if (this.options.auto_display)
|
||||
this.open();
|
||||
return this;
|
||||
},
|
||||
|
||||
// This function is for updating the notice.
|
||||
update: function(options){
|
||||
// Save old options.
|
||||
var oldOpts = this.options;
|
||||
// Then update to the new options.
|
||||
this.parseOptions(oldOpts, options);
|
||||
// Update the corner class.
|
||||
if (this.options.cornerclass !== oldOpts.cornerclass)
|
||||
this.container.removeClass("ui-corner-all "+oldOpts.cornerclass).addClass(this.options.cornerclass);
|
||||
// Update the shadow.
|
||||
if (this.options.shadow !== oldOpts.shadow) {
|
||||
if (this.options.shadow)
|
||||
this.container.addClass("ui-pnotify-shadow");
|
||||
else
|
||||
this.container.removeClass("ui-pnotify-shadow");
|
||||
}
|
||||
// Update the additional classes.
|
||||
if (this.options.addclass === false)
|
||||
this.elem.removeClass(oldOpts.addclass);
|
||||
else if (this.options.addclass !== oldOpts.addclass)
|
||||
this.elem.removeClass(oldOpts.addclass).addClass(this.options.addclass);
|
||||
// Update the title.
|
||||
if (this.options.title === false)
|
||||
this.title_container.slideUp("fast");
|
||||
else if (this.options.title !== oldOpts.title) {
|
||||
if (this.options.title_escape)
|
||||
this.title_container.text(this.options.title);
|
||||
else
|
||||
this.title_container.html(this.options.title);
|
||||
if (oldOpts.title === false)
|
||||
this.title_container.slideDown(200)
|
||||
}
|
||||
// Update the text.
|
||||
if (this.options.text === false) {
|
||||
this.text_container.slideUp("fast");
|
||||
} else if (this.options.text !== oldOpts.text) {
|
||||
if (this.options.text_escape)
|
||||
this.text_container.text(this.options.text);
|
||||
else
|
||||
this.text_container.html(this.options.insert_brs ? String(this.options.text).replace(/\n/g, "<br />") : this.options.text);
|
||||
if (oldOpts.text === false)
|
||||
this.text_container.slideDown(200)
|
||||
}
|
||||
// Change the notice type.
|
||||
if (this.options.type !== oldOpts.type)
|
||||
this.container.removeClass(
|
||||
this.styles.error+" "+this.styles.notice+" "+this.styles.success+" "+this.styles.info
|
||||
).addClass(this.options.type === "error" ?
|
||||
this.styles.error :
|
||||
(this.options.type === "info" ?
|
||||
this.styles.info :
|
||||
(this.options.type === "success" ?
|
||||
this.styles.success :
|
||||
this.styles.notice
|
||||
)
|
||||
)
|
||||
);
|
||||
if (this.options.icon !== oldOpts.icon || (this.options.icon === true && this.options.type !== oldOpts.type)) {
|
||||
// Remove any old icon.
|
||||
this.container.find("div.ui-pnotify-icon").remove();
|
||||
if (this.options.icon !== false) {
|
||||
// Build the new icon.
|
||||
$("<div />", {"class": "ui-pnotify-icon"})
|
||||
.append($("<span />", {"class": this.options.icon === true ? (this.options.type === "error" ? this.styles.error_icon : (this.options.type === "info" ? this.styles.info_icon : (this.options.type === "success" ? this.styles.success_icon : this.styles.notice_icon))) : this.options.icon}))
|
||||
.prependTo(this.container);
|
||||
}
|
||||
}
|
||||
// Update the width.
|
||||
if (this.options.width !== oldOpts.width)
|
||||
this.elem.animate({width: this.options.width});
|
||||
// Update the minimum height.
|
||||
if (this.options.min_height !== oldOpts.min_height)
|
||||
this.container.animate({minHeight: this.options.min_height});
|
||||
// Update the opacity.
|
||||
if (this.options.opacity !== oldOpts.opacity)
|
||||
this.elem.fadeTo(this.options.animate_speed, this.options.opacity);
|
||||
// Update the timed hiding.
|
||||
if (!this.options.hide)
|
||||
this.cancelRemove();
|
||||
else if (!oldOpts.hide)
|
||||
this.queueRemove();
|
||||
this.queuePosition(true);
|
||||
|
||||
// Run the modules.
|
||||
this.runModules('update', oldOpts);
|
||||
return this;
|
||||
},
|
||||
|
||||
// Display the notice.
|
||||
open: function(){
|
||||
this.state = "opening";
|
||||
// Run the modules.
|
||||
this.runModules('beforeOpen');
|
||||
|
||||
var that = this;
|
||||
// If the notice is not in the DOM, append it.
|
||||
if (!this.elem.parent().length)
|
||||
this.elem.appendTo(this.options.stack.context ? this.options.stack.context : body);
|
||||
// Try to put it in the right position.
|
||||
if (this.options.stack.push !== "top")
|
||||
this.position(true);
|
||||
// First show it, then set its opacity, then hide it.
|
||||
if (this.options.animation === "fade" || this.options.animation.effect_in === "fade") {
|
||||
// If it's fading in, it should start at 0.
|
||||
this.elem.show().fadeTo(0, 0).hide();
|
||||
} else {
|
||||
// Or else it should be set to the opacity.
|
||||
if (this.options.opacity !== 1)
|
||||
this.elem.show().fadeTo(0, this.options.opacity).hide();
|
||||
}
|
||||
this.animateIn(function(){
|
||||
that.queuePosition(true);
|
||||
|
||||
// Now set it to hide.
|
||||
if (that.options.hide)
|
||||
that.queueRemove();
|
||||
|
||||
that.state = "open";
|
||||
|
||||
// Run the modules.
|
||||
that.runModules('afterOpen');
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// Remove the notice.
|
||||
remove: function(timer_hide) {
|
||||
this.state = "closing";
|
||||
this.timerHide = !!timer_hide; // Make sure it's a boolean.
|
||||
// Run the modules.
|
||||
this.runModules('beforeClose');
|
||||
|
||||
var that = this;
|
||||
if (this.timer) {
|
||||
window.clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
}
|
||||
this.animateOut(function(){
|
||||
that.state = "closed";
|
||||
// Run the modules.
|
||||
that.runModules('afterClose');
|
||||
that.queuePosition(true);
|
||||
// If we're supposed to remove the notice from the DOM, do it.
|
||||
if (that.options.remove)
|
||||
that.elem.detach();
|
||||
// Run the modules.
|
||||
that.runModules('beforeDestroy');
|
||||
// Remove object from PNotify.notices to prevent memory leak (issue #49)
|
||||
// unless destroy is off
|
||||
if (that.options.destroy) {
|
||||
if (PNotify.notices !== null) {
|
||||
var idx = $.inArray(that,PNotify.notices);
|
||||
if (idx !== -1) {
|
||||
PNotify.notices.splice(idx,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Run the modules.
|
||||
that.runModules('afterDestroy');
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// === Class Methods ===
|
||||
|
||||
// Get the DOM element.
|
||||
get: function(){ return this.elem; },
|
||||
|
||||
// Put all the options in the right places.
|
||||
parseOptions: function(options, moreOptions){
|
||||
this.options = $.extend(true, {}, PNotify.prototype.options);
|
||||
// This is the only thing that *should* be copied by reference.
|
||||
this.options.stack = PNotify.prototype.options.stack;
|
||||
var optArray = [options, moreOptions], curOpts;
|
||||
for (var curIndex in optArray) {
|
||||
curOpts = optArray[curIndex];
|
||||
if (typeof curOpts == "undefined")
|
||||
break;
|
||||
if (typeof curOpts !== 'object') {
|
||||
this.options.text = curOpts;
|
||||
} else {
|
||||
for (var option in curOpts) {
|
||||
if (this.modules[option]) {
|
||||
// Avoid overwriting module defaults.
|
||||
$.extend(true, this.options[option], curOpts[option]);
|
||||
} else {
|
||||
this.options[option] = curOpts[option];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Animate the notice in.
|
||||
animateIn: function(callback){
|
||||
// Declare that the notice is animating in. (Or has completed animating in.)
|
||||
this.animating = "in";
|
||||
var animation;
|
||||
if (typeof this.options.animation.effect_in !== "undefined")
|
||||
animation = this.options.animation.effect_in;
|
||||
else
|
||||
animation = this.options.animation;
|
||||
if (animation === "none") {
|
||||
this.elem.show();
|
||||
callback();
|
||||
} else if (animation === "show")
|
||||
this.elem.show(this.options.animate_speed, callback);
|
||||
else if (animation === "fade")
|
||||
this.elem.show().fadeTo(this.options.animate_speed, this.options.opacity, callback);
|
||||
else if (animation === "slide")
|
||||
this.elem.slideDown(this.options.animate_speed, callback);
|
||||
else if (typeof animation === "function")
|
||||
animation("in", callback, this.elem);
|
||||
else
|
||||
this.elem.show(animation, (typeof this.options.animation.options_in === "object" ? this.options.animation.options_in : {}), this.options.animate_speed, callback);
|
||||
if (this.elem.parent().hasClass('ui-effects-wrapper'))
|
||||
this.elem.parent().css({"position": "fixed", "overflow": "visible"});
|
||||
if (animation !== "slide")
|
||||
this.elem.css("overflow", "visible");
|
||||
this.container.css("overflow", "hidden");
|
||||
},
|
||||
|
||||
// Animate the notice out.
|
||||
animateOut: function(callback){
|
||||
// Declare that the notice is animating out. (Or has completed animating out.)
|
||||
this.animating = "out";
|
||||
var animation;
|
||||
if (typeof this.options.animation.effect_out !== "undefined")
|
||||
animation = this.options.animation.effect_out;
|
||||
else
|
||||
animation = this.options.animation;
|
||||
if (animation === "none") {
|
||||
this.elem.hide();
|
||||
callback();
|
||||
} else if (animation === "show")
|
||||
this.elem.hide(this.options.animate_speed, callback);
|
||||
else if (animation === "fade")
|
||||
this.elem.fadeOut(this.options.animate_speed, callback);
|
||||
else if (animation === "slide")
|
||||
this.elem.slideUp(this.options.animate_speed, callback);
|
||||
else if (typeof animation === "function")
|
||||
animation("out", callback, this.elem);
|
||||
else
|
||||
this.elem.hide(animation, (typeof this.options.animation.options_out === "object" ? this.options.animation.options_out : {}), this.options.animate_speed, callback);
|
||||
if (this.elem.parent().hasClass('ui-effects-wrapper'))
|
||||
this.elem.parent().css({"position": "fixed", "overflow": "visible"});
|
||||
if (animation !== "slide")
|
||||
this.elem.css("overflow", "visible");
|
||||
this.container.css("overflow", "hidden");
|
||||
},
|
||||
|
||||
// Position the notice. dont_skip_hidden causes the notice to
|
||||
// position even if it's not visible.
|
||||
position: function(dontSkipHidden){
|
||||
// Get the notice's stack.
|
||||
var s = this.options.stack,
|
||||
e = this.elem;
|
||||
if (e.parent().hasClass('ui-effects-wrapper'))
|
||||
e = this.elem.css({"left": "0", "top": "0", "right": "0", "bottom": "0"}).parent();
|
||||
if (typeof s.context === "undefined")
|
||||
s.context = body;
|
||||
if (!s) return;
|
||||
if (typeof s.nextpos1 !== "number")
|
||||
s.nextpos1 = s.firstpos1;
|
||||
if (typeof s.nextpos2 !== "number")
|
||||
s.nextpos2 = s.firstpos2;
|
||||
if (typeof s.addpos2 !== "number")
|
||||
s.addpos2 = 0;
|
||||
var hidden = e.css("display") === "none";
|
||||
// Skip this notice if it's not shown.
|
||||
if (!hidden || dontSkipHidden) {
|
||||
var curpos1, curpos2;
|
||||
// Store what will need to be animated.
|
||||
var animate = {};
|
||||
// Calculate the current pos1 value.
|
||||
var csspos1;
|
||||
switch (s.dir1) {
|
||||
case "down":
|
||||
csspos1 = "top";
|
||||
break;
|
||||
case "up":
|
||||
csspos1 = "bottom";
|
||||
break;
|
||||
case "left":
|
||||
csspos1 = "right";
|
||||
break;
|
||||
case "right":
|
||||
csspos1 = "left";
|
||||
break;
|
||||
}
|
||||
curpos1 = parseInt(e.css(csspos1).replace(/(?:\..*|[^0-9.])/g, ''));
|
||||
if (isNaN(curpos1))
|
||||
curpos1 = 0;
|
||||
// Remember the first pos1, so the first visible notice goes there.
|
||||
if (typeof s.firstpos1 === "undefined" && !hidden) {
|
||||
s.firstpos1 = curpos1;
|
||||
s.nextpos1 = s.firstpos1;
|
||||
}
|
||||
// Calculate the current pos2 value.
|
||||
var csspos2;
|
||||
switch (s.dir2) {
|
||||
case "down":
|
||||
csspos2 = "top";
|
||||
break;
|
||||
case "up":
|
||||
csspos2 = "bottom";
|
||||
break;
|
||||
case "left":
|
||||
csspos2 = "right";
|
||||
break;
|
||||
case "right":
|
||||
csspos2 = "left";
|
||||
break;
|
||||
}
|
||||
curpos2 = parseInt(e.css(csspos2).replace(/(?:\..*|[^0-9.])/g, ''));
|
||||
if (isNaN(curpos2))
|
||||
curpos2 = 0;
|
||||
// Remember the first pos2, so the first visible notice goes there.
|
||||
if (typeof s.firstpos2 === "undefined" && !hidden) {
|
||||
s.firstpos2 = curpos2;
|
||||
s.nextpos2 = s.firstpos2;
|
||||
}
|
||||
// Check that it's not beyond the viewport edge.
|
||||
if ((s.dir1 === "down" && s.nextpos1 + e.height() > (s.context.is(body) ? jwindow.height() : s.context.prop('scrollHeight')) ) ||
|
||||
(s.dir1 === "up" && s.nextpos1 + e.height() > (s.context.is(body) ? jwindow.height() : s.context.prop('scrollHeight')) ) ||
|
||||
(s.dir1 === "left" && s.nextpos1 + e.width() > (s.context.is(body) ? jwindow.width() : s.context.prop('scrollWidth')) ) ||
|
||||
(s.dir1 === "right" && s.nextpos1 + e.width() > (s.context.is(body) ? jwindow.width() : s.context.prop('scrollWidth')) ) ) {
|
||||
// If it is, it needs to go back to the first pos1, and over on pos2.
|
||||
s.nextpos1 = s.firstpos1;
|
||||
s.nextpos2 += s.addpos2 + (typeof s.spacing2 === "undefined" ? 25 : s.spacing2);
|
||||
s.addpos2 = 0;
|
||||
}
|
||||
// Animate if we're moving on dir2.
|
||||
if (s.animation && s.nextpos2 < curpos2) {
|
||||
switch (s.dir2) {
|
||||
case "down":
|
||||
animate.top = s.nextpos2+"px";
|
||||
break;
|
||||
case "up":
|
||||
animate.bottom = s.nextpos2+"px";
|
||||
break;
|
||||
case "left":
|
||||
animate.right = s.nextpos2+"px";
|
||||
break;
|
||||
case "right":
|
||||
animate.left = s.nextpos2+"px";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if(typeof s.nextpos2 === "number")
|
||||
e.css(csspos2, s.nextpos2+"px");
|
||||
}
|
||||
// Keep track of the widest/tallest notice in the column/row, so we can push the next column/row.
|
||||
switch (s.dir2) {
|
||||
case "down":
|
||||
case "up":
|
||||
if (e.outerHeight(true) > s.addpos2)
|
||||
s.addpos2 = e.height();
|
||||
break;
|
||||
case "left":
|
||||
case "right":
|
||||
if (e.outerWidth(true) > s.addpos2)
|
||||
s.addpos2 = e.width();
|
||||
break;
|
||||
}
|
||||
// Move the notice on dir1.
|
||||
if (typeof s.nextpos1 === "number") {
|
||||
// Animate if we're moving toward the first pos.
|
||||
if (s.animation && (curpos1 > s.nextpos1 || animate.top || animate.bottom || animate.right || animate.left)) {
|
||||
switch (s.dir1) {
|
||||
case "down":
|
||||
animate.top = s.nextpos1+"px";
|
||||
break;
|
||||
case "up":
|
||||
animate.bottom = s.nextpos1+"px";
|
||||
break;
|
||||
case "left":
|
||||
animate.right = s.nextpos1+"px";
|
||||
break;
|
||||
case "right":
|
||||
animate.left = s.nextpos1+"px";
|
||||
break;
|
||||
}
|
||||
} else
|
||||
e.css(csspos1, s.nextpos1+"px");
|
||||
}
|
||||
// Run the animation.
|
||||
if (animate.top || animate.bottom || animate.right || animate.left)
|
||||
e.animate(animate, {duration: this.options.position_animate_speed, queue: false});
|
||||
// Calculate the next dir1 position.
|
||||
switch (s.dir1) {
|
||||
case "down":
|
||||
case "up":
|
||||
s.nextpos1 += e.height() + (typeof s.spacing1 === "undefined" ? 25 : s.spacing1);
|
||||
break;
|
||||
case "left":
|
||||
case "right":
|
||||
s.nextpos1 += e.width() + (typeof s.spacing1 === "undefined" ? 25 : s.spacing1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
// Queue the position all function so it doesn't run repeatedly and
|
||||
// use up resources.
|
||||
queuePosition: function(animate, milliseconds){
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
if (!milliseconds)
|
||||
milliseconds = 10;
|
||||
timer = setTimeout(function(){ PNotify.positionAll(animate) }, milliseconds);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
// Cancel any pending removal timer.
|
||||
cancelRemove: function(){
|
||||
if (this.timer)
|
||||
window.clearTimeout(this.timer);
|
||||
if (this.state === "closing") {
|
||||
// If it's animating out, animate back in really quickly.
|
||||
this.elem.stop(true);
|
||||
this.state = "open";
|
||||
this.animating = "in";
|
||||
this.elem.css("height", "auto").animate({"width": this.options.width, "opacity": this.options.opacity}, "fast");
|
||||
}
|
||||
return this;
|
||||
},
|
||||
// Queue a removal timer.
|
||||
queueRemove: function(){
|
||||
var that = this;
|
||||
// Cancel any current removal timer.
|
||||
this.cancelRemove();
|
||||
this.timer = window.setTimeout(function(){
|
||||
that.remove(true);
|
||||
}, (isNaN(this.options.delay) ? 0 : this.options.delay));
|
||||
return this;
|
||||
}
|
||||
});
|
||||
// These functions affect all notices.
|
||||
$.extend(PNotify, {
|
||||
// This holds all the notices.
|
||||
notices: [],
|
||||
removeAll: function () {
|
||||
$.each(PNotify.notices, function(){
|
||||
if (this.remove)
|
||||
this.remove();
|
||||
});
|
||||
},
|
||||
positionAll: function (animate) {
|
||||
// This timer is used for queueing this function so it doesn't run
|
||||
// repeatedly.
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
// Reset the next position data.
|
||||
$.each(PNotify.notices, function(){
|
||||
var s = this.options.stack;
|
||||
if (!s) return;
|
||||
s.nextpos1 = s.firstpos1;
|
||||
s.nextpos2 = s.firstpos2;
|
||||
s.addpos2 = 0;
|
||||
s.animation = animate;
|
||||
});
|
||||
$.each(PNotify.notices, function(){
|
||||
this.position();
|
||||
});
|
||||
},
|
||||
styling: {
|
||||
jqueryui: {
|
||||
container: "ui-widget ui-widget-content ui-corner-all",
|
||||
notice: "ui-state-highlight",
|
||||
// (The actual jQUI notice icon looks terrible.)
|
||||
notice_icon: "ui-icon ui-icon-info",
|
||||
info: "",
|
||||
info_icon: "ui-icon ui-icon-info",
|
||||
success: "ui-state-default",
|
||||
success_icon: "ui-icon ui-icon-circle-check",
|
||||
error: "ui-state-error",
|
||||
error_icon: "ui-icon ui-icon-alert"
|
||||
},
|
||||
bootstrap2: {
|
||||
container: "alert",
|
||||
notice: "",
|
||||
notice_icon: "icon-exclamation-sign",
|
||||
info: "alert-info",
|
||||
info_icon: "icon-info-sign",
|
||||
success: "alert-success",
|
||||
success_icon: "icon-ok-sign",
|
||||
error: "alert-error",
|
||||
error_icon: "icon-warning-sign"
|
||||
},
|
||||
bootstrap3: {
|
||||
container: "alert",
|
||||
notice: "alert-warning",
|
||||
notice_icon: "glyphicon glyphicon-exclamation-sign",
|
||||
info: "alert-info",
|
||||
info_icon: "glyphicon glyphicon-info-sign",
|
||||
success: "alert-success",
|
||||
success_icon: "glyphicon glyphicon-ok-sign",
|
||||
error: "alert-danger",
|
||||
error_icon: "glyphicon glyphicon-warning-sign"
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
* uses icons from http://fontawesome.io/
|
||||
* version 4.0.3
|
||||
*/
|
||||
PNotify.styling.fontawesome = $.extend({}, PNotify.styling.bootstrap3);
|
||||
$.extend(PNotify.styling.fontawesome, {
|
||||
notice_icon: "fa fa-exclamation-circle",
|
||||
info_icon: "fa fa-info",
|
||||
success_icon: "fa fa-check",
|
||||
error_icon: "fa fa-warning"
|
||||
});
|
||||
|
||||
if (document.body)
|
||||
do_when_ready();
|
||||
else
|
||||
$(do_when_ready);
|
||||
return PNotify;
|
||||
}));
|
||||
@@ -1,143 +0,0 @@
|
||||
// Desktop
|
||||
// Uses AMD or browser globals for jQuery.
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as a module.
|
||||
define('pnotify.desktop', ['jquery', 'pnotify'], factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery, PNotify);
|
||||
}
|
||||
}(function($, PNotify){
|
||||
var permission;
|
||||
var notify = function(title, options){
|
||||
// Memoize based on feature detection.
|
||||
if ("Notification" in window) {
|
||||
notify = function (title, options) {
|
||||
return new Notification(title, options);
|
||||
};
|
||||
} else if ("mozNotification" in navigator) {
|
||||
notify = function (title, options) {
|
||||
// Gecko < 22
|
||||
return navigator.mozNotification
|
||||
.createNotification(title, options.body, options.icon)
|
||||
.show();
|
||||
};
|
||||
} else if ("webkitNotifications" in window) {
|
||||
notify = function (title, options) {
|
||||
return window.webkitNotifications.createNotification(
|
||||
options.icon,
|
||||
title,
|
||||
options.body
|
||||
);
|
||||
};
|
||||
} else {
|
||||
notify = function (title, options) {
|
||||
return null;
|
||||
};
|
||||
}
|
||||
return notify(title, options);
|
||||
};
|
||||
|
||||
|
||||
PNotify.prototype.options.desktop = {
|
||||
// Display the notification as a desktop notification.
|
||||
desktop: false,
|
||||
// The URL of the icon to display. If false, no icon will show. If null, a default icon will show.
|
||||
icon: null,
|
||||
// Using a tag lets you update an existing notice, or keep from duplicating notices between tabs.
|
||||
// If you leave tag null, one will be generated, facilitating the "update" function.
|
||||
// see: http://www.w3.org/TR/notifications/#tags-example
|
||||
tag: null
|
||||
};
|
||||
PNotify.prototype.modules.desktop = {
|
||||
tag: null,
|
||||
icon: null,
|
||||
genNotice: function(notice, options){
|
||||
if (options.icon === null) {
|
||||
this.icon = "http://sciactive.com/pnotify/includes/desktop/"+notice.options.type+".png";
|
||||
} else if (options.icon === false) {
|
||||
this.icon = null;
|
||||
} else {
|
||||
this.icon = options.icon;
|
||||
}
|
||||
if (this.tag === null || options.tag !== null) {
|
||||
this.tag = options.tag === null ? "PNotify-"+Math.round(Math.random() * 1000000) : options.tag;
|
||||
}
|
||||
notice.desktop = notify(notice.options.title, {
|
||||
icon: this.icon,
|
||||
body: notice.options.text,
|
||||
tag: this.tag
|
||||
});
|
||||
if (!("close" in notice.desktop)) {
|
||||
notice.desktop.close = function(){
|
||||
notice.desktop.cancel();
|
||||
};
|
||||
}
|
||||
notice.desktop.onclick = function(){
|
||||
notice.elem.trigger("click");
|
||||
};
|
||||
notice.desktop.onclose = function(){
|
||||
if (notice.state !== "closing" && notice.state !== "closed") {
|
||||
notice.remove();
|
||||
}
|
||||
};
|
||||
},
|
||||
init: function(notice, options){
|
||||
if (!options.desktop)
|
||||
return;
|
||||
permission = PNotify.desktop.checkPermission();
|
||||
if (permission != 0)
|
||||
return;
|
||||
this.genNotice(notice, options);
|
||||
},
|
||||
update: function(notice, options, oldOpts){
|
||||
if (permission != 0 || !options.desktop)
|
||||
return;
|
||||
this.genNotice(notice, options);
|
||||
},
|
||||
beforeOpen: function(notice, options){
|
||||
if (permission != 0 || !options.desktop)
|
||||
return;
|
||||
notice.elem.css({'left': '-10000px', 'display': 'none'});
|
||||
},
|
||||
afterOpen: function(notice, options){
|
||||
if (permission != 0 || !options.desktop)
|
||||
return;
|
||||
notice.elem.css({'left': '-10000px', 'display': 'none'});
|
||||
if ("show" in notice.desktop) {
|
||||
notice.desktop.show();
|
||||
}
|
||||
},
|
||||
beforeClose: function(notice, options){
|
||||
if (permission != 0 || !options.desktop)
|
||||
return;
|
||||
notice.elem.css({'left': '-10000px', 'display': 'none'});
|
||||
},
|
||||
afterClose: function(notice, options){
|
||||
if (permission != 0 || !options.desktop)
|
||||
return;
|
||||
notice.elem.css({'left': '-10000px', 'display': 'none'});
|
||||
notice.desktop.close();
|
||||
}
|
||||
};
|
||||
PNotify.desktop = {
|
||||
permission: function(){
|
||||
if (typeof Notification !== "undefined" && "requestPermission" in Notification) {
|
||||
Notification.requestPermission();
|
||||
} else if ("webkitNotifications" in window) {
|
||||
window.webkitNotifications.requestPermission();
|
||||
}
|
||||
},
|
||||
checkPermission: function(){
|
||||
if (typeof Notification !== "undefined" && "permission" in Notification) {
|
||||
return (Notification.permission == "granted" ? 0 : 1);
|
||||
} else if ("webkitNotifications" in window) {
|
||||
return window.webkitNotifications.checkPermission();
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
permission = PNotify.desktop.checkPermission();
|
||||
}));
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user