- improved "planets" popover, closed #684

- upgraded "hoverIntent" js lib `v1.8.0` → `v1.9.0`
This commit is contained in:
Mark Friedrich
2018-09-07 16:36:39 +02:00
parent 435a0cd9ee
commit bf8945c42c
17 changed files with 591 additions and 439 deletions

View File

@@ -286,6 +286,36 @@ define(['jquery'], ($) => {
label: 'rally point'
}
},
// planets
planets: {
barren: {
class: 'pf-planet-barren'
},
gas: {
class: 'pf-planet-gas'
},
ice: {
class: 'pf-planet-ice'
},
lava: {
class: 'pf-planet-lava'
},
oceanic: {
class: 'pf-planet-oceanic'
},
plasma: {
class: 'pf-planet-plasma'
},
shattered: {
class: 'pf-planet-shattered'
},
storm: {
class: 'pf-planet-storm'
},
temperate: {
class: 'pf-planet-temperate'
}
},
// easy-pie-charts
pieChart: {
class: 'pf-pie-chart', // class for all pie charts

View File

@@ -1424,7 +1424,15 @@ define([
options = $.extend({}, defaultOptions, options);
return this.each(function(){
$(this).popover(options);
if(planets.length){
// Abyss systems don´t have planets -> no tooltip
let element = $(this);
element.popover(options);
if(options.show){
element.popover('show');
}
}
});
};

View File

@@ -10,7 +10,7 @@ define([
'bootbox',
'app/counter',
'app/map/util'
], function($, Init, Util, Render, bootbox, Counter, MapUtil) {
], ($, Init, Util, Render, bootbox, Counter, MapUtil) => {
'use strict';
@@ -32,8 +32,10 @@ define([
mapInfoLogsId: 'pf-map-info-logs', // id for map info logs box
mapInfoLifetimeCounterClass: 'pf-map-info-lifetime-counter', // class for map lifetime counter
systemInfoPlanetsClass: 'pf-system-info-planets', // class for "planets" information element
// dataTable
tableId: 'pf-info-table-', // Table id prefix
tableToolsClass: 'pf-table-tools', // class for table "tools" section (e.g. Buttons)
tableCellImageClass: 'pf-table-image-cell', // class for table "image" cells
tableCellImageSmallClass: 'pf-table-image-small-cell', // class for table "small image" cells
@@ -215,13 +217,14 @@ define([
let systemsElement = $(this).empty();
let systemTable = $('<table>', {
id: Util.getTableId(config.tableId, mapData.config.id, '', 'systems'),
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
});
systemsElement.append(systemTable);
systemsElement.showLoadingAnimation(config.loadingOptions);
systemTable.on( 'init.dt', function () {
systemTable.on( 'init.dt', function (){
systemsElement.hideLoadingAnimation();
// init table tooltips
@@ -229,153 +232,14 @@ define([
tooltipElements.tooltip();
});
// prepare data for dataTables
let systemsData = [];
for(let i = 0; i < mapData.data.systems.length; i++){
let tempSystemData = mapData.data.systems[i];
let tempData = {};
// system id
tempData.id = tempSystemData.id;
// current position
if(tempSystemData.currentUser === true){
tempData.position = {
position: '<i class="fas fa-map-marker-alt fa-fw"></i>',
position_sort: 1
};
}else{
tempData.position = {
position: '',
position_sort: 0
};
}
// active pilots
if(tempSystemData.userCount > 0){
tempData.userCount = tempSystemData.userCount;
}else{
tempData.userCount = '';
}
// type
tempData.type = {
type: MapUtil.getSystemTypeInfo(tempSystemData.type.id, 'name'),
type_sort: tempSystemData.type.id
};
// security
let securityClass = Util.getSecurityClassForSystem(tempSystemData.security);
tempData.security = {
security: '<span class="' + securityClass + '">' + tempSystemData.security + '</span>',
security_sort: tempSystemData.security
};
// name
tempData.name = tempSystemData.name;
// alias
tempData.alias = (tempSystemData.alias === tempSystemData.name) ? '' : tempSystemData.alias;
// region
tempData.region = tempSystemData.region.name;
// static
let statics = [];
for(let wormholeName of tempSystemData.statics){
let wormholeData = Object.assign({}, Init.wormholes[wormholeName]);
let security = wormholeData.security;
let secClass = Util.getSecurityClassForSystem(security);
statics.push('<span class="' + secClass + '">' + security + '</span>');
}
tempData.static = statics.join('&nbsp;&nbsp;');
// status
let systemStatusClass = Util.getStatusInfoForSystem(tempSystemData.status.id, 'class');
if(systemStatusClass !== ''){
tempData.status = {
status: '<i class="far fa-square fa-fw ' + systemStatusClass + '"></i>',
status_sort: tempSystemData.status.id
};
}else{
tempData.status = {
status: '',
status_sort: tempSystemData.status.id
};
}
// effect
let systemEffectClass = MapUtil.getEffectInfoForSystem(tempSystemData.effect, 'class');
if(systemEffectClass !== ''){
tempData.effect = {
effect: '<i class="fas fa-square fa-fw ' + systemEffectClass + '"></i>',
effect_sort: tempSystemData.effect
};
}else{
tempData.effect = {
effect: '',
effect_sort: ''
};
}
// trueSec
let systemTrueSecClass = Util.getTrueSecClassForSystem(tempSystemData.trueSec);
if(systemTrueSecClass !== ''){
tempData.trueSec = {
trueSec: '<span class="' + systemTrueSecClass + '">' + tempSystemData.trueSec.toFixed(1) + '</span>',
trueSec_sort: tempSystemData.trueSec
};
}else{
tempData.trueSec = {
trueSec: '',
trueSec_sort: tempSystemData.trueSec
};
}
// shattered
if(tempSystemData.shattered){
tempData.shattered = {
shattered: '<i class="fas fa-skull fa-fw ' + Util.getSecurityClassForSystem('SH') + '"></i>',
shattered_sort: tempSystemData.shattered
};
}else{
tempData.shattered = {
shattered: '',
shattered_sort: 0
};
}
// locked
if(tempSystemData.locked === 1){
tempData.locked = {
locked: '<i class="fas fa-lock 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="fas fa-times txt-color txt-color-redDarker"></i>';
systemsData.push(tempData);
}
let systemsDataTable = systemTable.DataTable( {
let systemsDataTable = systemTable.DataTable({
pageLength: 20,
paging: true,
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
ordering: true,
order: [[ 9, 'desc' ], [ 3, 'asc' ]],
order: [14, 'desc'],
hover: false,
data: systemsData,
data: mapData.data.systems,
columnDefs: [],
language: {
emptyTable: 'Map is empty',
@@ -387,44 +251,53 @@ define([
{
name: 'type',
title: 'type',
width: '25px',
width: 25,
className: ['min-screen-l'].join(' '),
data: 'type',
render: {
_: 'type',
sort: 'type_sort'
_: (cellData, type, rowData, meta) => {
return MapUtil.getSystemTypeInfo(cellData.id, 'name');
}
}
},{
name: 'security',
title: '',
width: '1px',
searchable: false,
width: 1,
data: 'security',
render: {
_: 'security',
sort: 'security_sort'
display: (cellData, type, rowData, meta) => {
let securityClass = Util.getSecurityClassForSystem(cellData);
return '<span class="' + securityClass + '">' + cellData + '</span>';
}
}
},{
name: 'trueSec',
title: 'sec',
width: '18px',
width: 18,
className: ['text-center', 'min-screen-l'].join(' '),
searchable: false,
data: 'trueSec',
render: {
_: 'trueSec',
sort: 'trueSec_sort'
display: (cellData, type, rowData, meta) => {
let systemTrueSecClass = Util.getTrueSecClassForSystem(cellData);
return '<span class="' + systemTrueSecClass + '">' + cellData.toFixed(1) + '</span>';
}
}
},{
name: 'shattered',
title: '<i class="fas fa-skull" title="shattered" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: ['text-center', 'min-screen-l'].join(' '),
searchable: false,
data: 'shattered',
render: {
_: 'shattered',
sort: 'shattered_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData){
value = '<i class="fas fa-skull fa-fw ' + Util.getSecurityClassForSystem('SH') + '"></i>';
}
return value;
}
}
},{
name: 'name',
@@ -440,83 +313,148 @@ define([
},{
name: 'alias',
title: 'alias',
data: 'alias'
data: 'alias',
render: {
_: (cellData, type, rowData, meta) => {
return (cellData === rowData.name) ? '' : cellData;
}
}
},{
name: 'region',
title: 'region',
data: 'region'
data: 'region.name'
},{
name: 'planets',
title: '<i class="fas fa-circle" title="planets" data-toggle="tooltip"></i>',
width: 10,
className: ['text-right', config.systemInfoPlanetsClass, Util.config.helpDefaultClass, Util.config.popoverTriggerClass].join(' '),
searchable: false,
orderSequence: ['desc', 'asc'],
data: 'planets',
render: {
_: (cellData, type, rowData, meta) => {
return cellData.length;
}
}
},{
name: 'status',
title: '<i class="far fa-square" title="system&nbsp;status" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: 'text-center',
searchable: false,
data: 'status',
data: 'status.id',
render: {
_: 'status',
sort: 'status_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
let systemStatusClass = Util.getStatusInfoForSystem(cellData, 'class');
if(systemStatusClass !== ''){
value = '<i class="far fa-square fa-fw ' + systemStatusClass + '"></i>';
}
return value;
}
}
},{
name: 'effect',
title: '<i class="fas fa-square" title="system&nbsp;effect" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: 'text-center',
searchable: false,
data: 'effect',
render: {
_: 'effect',
sort: 'effect_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
let systemEffectClass = MapUtil.getEffectInfoForSystem(cellData, 'class');
if(systemEffectClass !== ''){
value = '<i class="fas fa-square fa-fw ' + systemEffectClass + '"></i>';
}
return value;
}
}
},{
name: 'static',
title: 'static',
width: '30px',
data: 'static'
name: 'statics',
title: 'statics',
width: 30,
searchable: false,
data: 'statics',
render: {
_: (cellData, type, rowData, meta) => {
let statics = [];
for(let wormholeName of cellData){
let wormholeData = Object.assign({}, Init.wormholes[wormholeName]);
let security = wormholeData.security;
let secClass = Util.getSecurityClassForSystem(security);
statics.push('<span class="' + secClass + '">' + security + '</span>');
}
return statics.join('&nbsp;&nbsp;');
}
}
},{
name: 'position',
title: '<i class="fas fa-map-marker-alt" title="your&nbsp;position" data-toggle="tooltip"></i>',
width: '8px',
width: 8,
className: 'text-center',
searchable: false,
data: 'position',
data: 'currentUser',
defaultContent: false,
render: {
_: 'position',
sort: 'position_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData === true){
value = '<i class="fas fa-map-marker-alt fa-fw"></i>';
}
return value;
}
}
},{
name: 'userCount',
title: '<i class="fas fa-plane" title="active&nbsp;pilots" data-toggle="tooltip"></i>',
width: '12px',
width: 12,
className: 'text-center',
searchable: false,
data: 'userCount'
data: 'userCount',
render: {
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData > 0){
value = cellData;
}
return value;
}
}
},{
name: 'locked',
title: '<i class="fas fa-lock" title="system&nbsp;locked" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: 'text-center',
searchable: false,
data: 'locked',
render: {
_: 'locked',
sort: 'locked_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData === 1){
value = '<i class="fas fa-lock fa-fw"></i>';
}
return value;
}
}
},{
name: 'updated',
title: 'updated',
width: '80px',
width: 80,
searchable: false,
className: ['text-right', config.tableCellCounterClass, 'min-screen-l'].join(' '),
data: 'updated'
data: 'updated.updated',
defaultContent: '',
},{
name: 'action',
title: '',
orderable: false,
searchable: false,
width: '10px',
width: 10,
className: ['text-center', config.tableCellActionClass].join(' '),
data: 'clear',
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
data: null,
defaultContent: '<i class="fas fa-times txt-color txt-color-redDarker"></i>',
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
let tempTableElement = this;
let tempConfirmationSettings = confirmationSettings;
@@ -582,7 +520,7 @@ define([
connectionsElement.showLoadingAnimation(config.loadingOptions);
// table init complete
connectionTable.on( 'init.dt', function () {
connectionTable.on( 'init.dt', function (){
connectionsElement.hideLoadingAnimation();
});
@@ -624,7 +562,7 @@ define([
connectionData.push(tempConData);
}
let connectionDataTable = connectionTable.dataTable( {
let connectionDataTable = connectionTable.dataTable({
pageLength: 20,
paging: true,
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
@@ -705,7 +643,7 @@ define([
width: '10px',
className: ['text-center', config.tableCellActionClass].join(' '),
data: 'clear',
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
let tempTableElement = this;
let tempConfirmationSettings = confirmationSettings;
@@ -749,7 +687,7 @@ define([
usersElement.showLoadingAnimation(config.loadingOptions);
// table init complete
userTable.on( 'init.dt', function () {
userTable.on( 'init.dt', function (){
usersElement.hideLoadingAnimation();
// init table tooltips
@@ -777,7 +715,7 @@ define([
}
}
let userDataTable = userTable.dataTable( {
let userDataTable = userTable.dataTable({
pageLength: 20,
paging: true,
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
@@ -866,7 +804,7 @@ define([
},
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
// open character information window (ingame)
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
$(cell).on('click', { tableApi: this.DataTable() }, function(e){
let rowData = e.data.tableApi.row(this).data();
Util.openIngameWindow(rowData.id);
});
@@ -896,7 +834,7 @@ define([
className: [config.tableCellActionClass, 'min-screen-l'].join(' '),
data: 'corporation',
render: {
_: function (data, type, row, meta) {
_: function (data, type, row, meta){
let value = data.name;
if(type === 'display'){
value += '&nbsp;' + getIconForInformationWindow();
@@ -906,7 +844,7 @@ define([
},
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
// open character information window (ingame)
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
$(cell).on('click', { tableApi: this.DataTable() }, function(e){
let cellData = e.data.tableApi.cell(this).data();
Util.openIngameWindow(cellData.id);
});
@@ -936,7 +874,7 @@ define([
data: 'log',
defaultContent: getLabelForUnknownData(),
render: {
_: function (data, type, row, meta) {
_: function (data, type, row, meta){
let value = data;
if(data){
if(data.station && data.station.id > 0){
@@ -959,7 +897,7 @@ define([
className: ['text-right', 'min-screen-l'].join(' '),
data: 'role',
render: {
_: function (data, type, row, meta) {
_: function (data, type, row, meta){
let value = data.label;
if(type === 'display'){
value = Util.getLabelByRole(data).prop('outerHTML');
@@ -973,6 +911,33 @@ define([
};
/**
* set global dialog observer (all tabs/tables)
* @param mapInfoDialog
* @param mapData
*/
let setDialogObserver = (mapInfoDialog, mapData) => {
// planets popover --------------------------------------------------------------------------------------------
mapInfoDialog.hoverIntent({
over: function(e){
let cellElement = $(this);
let tableApi = Util.getDataTableInstance(config.tableId, mapData.config.id, '', 'systems');
let rowData = tableApi.row(cellElement.parents('tr')).data();
cellElement.addSystemPlanetsTooltip(rowData.planets, {
trigger: 'manual',
placement: 'left',
show: true
});
},
out: function(e){
$(this).destroyPopover();
},
selector: 'td.' + config.systemInfoPlanetsClass
});
};
/**
* loads logs table into an element
* @param mapData
@@ -996,7 +961,7 @@ define([
context: context
}).done(function(data){
this.callback(data, context);
}).fail(function( jqXHR, status, error) {
}).fail(function( jqXHR, status, error){
let reason = status + ' ' + error;
Util.showNotify({title: jqXHR.status + ': loadLogs', text: reason, type: 'warning'});
}).always(function(){
@@ -1092,7 +1057,7 @@ define([
data = Util.convertDateToString(logDate, true);
// check whether log is new (today) ->
if(logDate.setHours(0,0,0,0) === serverHours) {
if(logDate.setHours(0,0,0,0) === serverHours){
// replace dd/mm/YYYY
data = 'today' + data.substring(10);
}
@@ -1161,7 +1126,7 @@ define([
},
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
// open character information window (ingame)
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
$(cell).on('click', { tableApi: this.DataTable() }, function(e){
let rowData = e.data.tableApi.row(this).data();
Util.openIngameWindow(rowData.context.data.character.id);
});
@@ -1263,7 +1228,7 @@ define([
className: 'btn btn-sm btn-default',
text: '<i class="fas fa-fw fa-plus"></i>&nbsp;load more',
enabled: false,
action: function ( e, dt, node, config ) {
action: function ( e, dt, node, config ){
let pageInfo = dt.page.info();
getLogsData({
@@ -1327,14 +1292,15 @@ define([
success: {
label: 'close',
className: 'btn-primary',
callback: function() {
callback: function(){
$(mapInfoDialog).modal('hide');
}
}
}
});
mapInfoDialog.on('shown.bs.modal', function(e) {
mapInfoDialog.on('shown.bs.modal', function(e){
let mapInfoDialog = $(this);
let mapElement = $('#' + config.mapInfoId);
let systemsElement = $('#' + config.mapInfoSystemsId);
let connectionsElement = $('#' + config.mapInfoConnectionsId);
@@ -1370,6 +1336,9 @@ define([
// load users table
usersElement.initUsersInfoTable(mapData);
// set global dialog observer
setDialogObserver(mapInfoDialog, mapData);
});
// events for tab change

View File

@@ -190,7 +190,7 @@ define([
* @param tableType
* @returns {string}
*/
let getTableId = (mapId, systemId, tableType) => config.sigTableId + [mapId, systemId, tableType].join('-');
let getTableId = (mapId, systemId, tableType) => Util.getTableId(config.sigTableId, mapId, systemId, tableType);
/**
* get a dataTableApi instance from global cache
@@ -199,14 +199,7 @@ define([
* @param tableType
* @returns {*}
*/
let getDataTableInstance = (mapId, systemId, tableType) => {
let instance = null;
let table = $.fn.dataTable.tables({ visible: false, api: true }).table('#' + getTableId(mapId, systemId, tableType));
if(table.node()){
instance = table;
}
return instance;
};
let getDataTableInstance = (mapId, systemId, tableType) => Util.getDataTableInstance(config.sigTableId, mapId, systemId, tableType);
/**
* Update/set tooltip for an element
@@ -1791,7 +1784,6 @@ define([
// check if cell index is inside table dimensions
newCellIndex = checkIndex(tableApi, newCellIndex);
//let cell = tableApi.cell(newCellIndex[1], newCellIndex[0]);
let cell = tableApi.cell(':eq(' + newCellIndex[1] + ')', ':eq(' + newCellIndex[0] + ')', {search: 'applied'});
let node = cell.node();

View File

@@ -575,9 +575,7 @@ define([
if(options.show){
element.popover('show');
}
});
});
};
@@ -1704,6 +1702,20 @@ define([
return statusInfo;
};
/**
* get planet info e.g. class by type e.g. "barren"
* @param type
* @param option
* @returns {string}
*/
let getPlanetInfo = (type, option = 'class') => {
let info = '';
if( Init.classes.planets.hasOwnProperty(type) ){
info = Init.classes.planets[type][option];
}
return info;
};
/**
* get a HTML table with system effect information
* e.g. for popover
@@ -1739,14 +1751,26 @@ define([
let getSystemPlanetsTable = planets => {
let table = '';
if(planets.length > 0){
let regex = /\(([^)]+)\)/;
table += '<table>';
for(let planet of planets){
let typeName = planet.type.name;
let typeClass = '';
let matches = regex.exec(typeName.toLowerCase());
if(matches && matches[1]){
typeName = matches[1].charAt(0).toUpperCase() + matches[1].slice(1);
typeClass = getPlanetInfo(matches[1]);
}
table += '<tr>';
table += '<td>';
table += planet.name;
table += '</td>';
table += '<td class="' + typeClass + '">';
table += '<i class="fas fa-circle"></i>';
table += '</td>';
table += '<td class="text-right">';
table += planet.type.name;
table += typeName;
table += '</td>';
table += '</tr>';
}
@@ -2697,6 +2721,33 @@ define([
}
};
/**
* get dataTable id
* @param prefix
* @param mapId
* @param systemId
* @param tableType
* @returns {string}
*/
let getTableId = (prefix, mapId, systemId, tableType) => prefix + [mapId, systemId, tableType].join('-');
/**
* get a dataTableApi instance from global cache
* @param prefix
* @param mapId
* @param systemId
* @param tableType
* @returns {*}
*/
let getDataTableInstance = (prefix, mapId, systemId, tableType) => {
let instance = null;
let table = $.fn.dataTable.tables({ visible: false, api: true }).table('#' + getTableId(prefix, mapId, systemId, tableType));
if(table.node()){
instance = table;
}
return instance;
};
/**
* get deep json object value if exists
* -> e.g. key = 'first.last.third' string
@@ -2892,6 +2943,8 @@ define([
clearSessionStorage: clearSessionStorage,
getBrowserTabId: getBrowserTabId,
singleDoubleClick: singleDoubleClick,
getTableId: getTableId,
getDataTableInstance: getDataTableInstance,
getObjVal: getObjVal,
redirect: redirect,
logout: logout,

View File

@@ -1,9 +1,9 @@
/*!
* hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
* http://cherne.net/brian/resources/jquery.hoverIntent.html
* hoverIntent v1.9.0 // 2017.09.01 // jQuery v1.7.0+
* http://briancherne.github.io/jquery-hoverIntent/
*
* 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
* Copyright 2007-2017 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);
!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery"],factory):jQuery&&!jQuery.fn.hoverIntent&&factory(jQuery)}(function($){"use strict";var cX,cY,_cfg={interval:100,sensitivity:6,timeout:0},INSTANCE_COUNT=0,track=function(ev){cX=ev.pageX,cY=ev.pageY},compare=function(ev,$el,s,cfg){if(Math.sqrt((s.pX-cX)*(s.pX-cX)+(s.pY-cY)*(s.pY-cY))<cfg.sensitivity)return $el.off(s.event,track),delete s.timeoutId,s.isActive=!0,ev.pageX=cX,ev.pageY=cY,delete s.pX,delete s.pY,cfg.over.apply($el[0],[ev]);s.pX=cX,s.pY=cY,s.timeoutId=setTimeout(function(){compare(ev,$el,s,cfg)},cfg.interval)},delay=function(ev,$el,s,out){return delete $el.data("hoverIntent")[s.id],out.apply($el[0],[ev])};$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var instanceId=INSTANCE_COUNT++,cfg=$.extend({},_cfg);$.isPlainObject(handlerIn)?(cfg=$.extend(cfg,handlerIn),$.isFunction(cfg.out)||(cfg.out=cfg.over)):cfg=$.isFunction(handlerOut)?$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector}):$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut});var handleHover=function(e){var ev=$.extend({},e),$el=$(this),hoverIntentData=$el.data("hoverIntent");hoverIntentData||$el.data("hoverIntent",hoverIntentData={});var state=hoverIntentData[instanceId];state||(hoverIntentData[instanceId]=state={id:instanceId}),state.timeoutId&&(state.timeoutId=clearTimeout(state.timeoutId));var mousemove=state.event="mousemove.hoverIntent.hoverIntent"+instanceId;if("mouseenter"===e.type){if(state.isActive)return;state.pX=ev.pageX,state.pY=ev.pageY,$el.off(mousemove,track).on(mousemove,track),state.timeoutId=setTimeout(function(){compare(ev,$el,state,cfg)},cfg.interval)}else{if(!state.isActive)return;$el.off(mousemove,track),state.timeoutId=setTimeout(function(){delay(ev,$el,state,cfg.out)},cfg.timeout)}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -286,6 +286,36 @@ define(['jquery'], ($) => {
label: 'rally point'
}
},
// planets
planets: {
barren: {
class: 'pf-planet-barren'
},
gas: {
class: 'pf-planet-gas'
},
ice: {
class: 'pf-planet-ice'
},
lava: {
class: 'pf-planet-lava'
},
oceanic: {
class: 'pf-planet-oceanic'
},
plasma: {
class: 'pf-planet-plasma'
},
shattered: {
class: 'pf-planet-shattered'
},
storm: {
class: 'pf-planet-storm'
},
temperate: {
class: 'pf-planet-temperate'
}
},
// easy-pie-charts
pieChart: {
class: 'pf-pie-chart', // class for all pie charts

View File

@@ -1424,7 +1424,15 @@ define([
options = $.extend({}, defaultOptions, options);
return this.each(function(){
$(this).popover(options);
if(planets.length){
// Abyss systems don´t have planets -> no tooltip
let element = $(this);
element.popover(options);
if(options.show){
element.popover('show');
}
}
});
};

View File

@@ -10,7 +10,7 @@ define([
'bootbox',
'app/counter',
'app/map/util'
], function($, Init, Util, Render, bootbox, Counter, MapUtil) {
], ($, Init, Util, Render, bootbox, Counter, MapUtil) => {
'use strict';
@@ -32,8 +32,10 @@ define([
mapInfoLogsId: 'pf-map-info-logs', // id for map info logs box
mapInfoLifetimeCounterClass: 'pf-map-info-lifetime-counter', // class for map lifetime counter
systemInfoPlanetsClass: 'pf-system-info-planets', // class for "planets" information element
// dataTable
tableId: 'pf-info-table-', // Table id prefix
tableToolsClass: 'pf-table-tools', // class for table "tools" section (e.g. Buttons)
tableCellImageClass: 'pf-table-image-cell', // class for table "image" cells
tableCellImageSmallClass: 'pf-table-image-small-cell', // class for table "small image" cells
@@ -215,13 +217,14 @@ define([
let systemsElement = $(this).empty();
let systemTable = $('<table>', {
id: Util.getTableId(config.tableId, mapData.config.id, '', 'systems'),
class: ['compact', 'stripe', 'order-column', 'row-border'].join(' ')
});
systemsElement.append(systemTable);
systemsElement.showLoadingAnimation(config.loadingOptions);
systemTable.on( 'init.dt', function () {
systemTable.on( 'init.dt', function (){
systemsElement.hideLoadingAnimation();
// init table tooltips
@@ -229,153 +232,14 @@ define([
tooltipElements.tooltip();
});
// prepare data for dataTables
let systemsData = [];
for(let i = 0; i < mapData.data.systems.length; i++){
let tempSystemData = mapData.data.systems[i];
let tempData = {};
// system id
tempData.id = tempSystemData.id;
// current position
if(tempSystemData.currentUser === true){
tempData.position = {
position: '<i class="fas fa-map-marker-alt fa-fw"></i>',
position_sort: 1
};
}else{
tempData.position = {
position: '',
position_sort: 0
};
}
// active pilots
if(tempSystemData.userCount > 0){
tempData.userCount = tempSystemData.userCount;
}else{
tempData.userCount = '';
}
// type
tempData.type = {
type: MapUtil.getSystemTypeInfo(tempSystemData.type.id, 'name'),
type_sort: tempSystemData.type.id
};
// security
let securityClass = Util.getSecurityClassForSystem(tempSystemData.security);
tempData.security = {
security: '<span class="' + securityClass + '">' + tempSystemData.security + '</span>',
security_sort: tempSystemData.security
};
// name
tempData.name = tempSystemData.name;
// alias
tempData.alias = (tempSystemData.alias === tempSystemData.name) ? '' : tempSystemData.alias;
// region
tempData.region = tempSystemData.region.name;
// static
let statics = [];
for(let wormholeName of tempSystemData.statics){
let wormholeData = Object.assign({}, Init.wormholes[wormholeName]);
let security = wormholeData.security;
let secClass = Util.getSecurityClassForSystem(security);
statics.push('<span class="' + secClass + '">' + security + '</span>');
}
tempData.static = statics.join('&nbsp;&nbsp;');
// status
let systemStatusClass = Util.getStatusInfoForSystem(tempSystemData.status.id, 'class');
if(systemStatusClass !== ''){
tempData.status = {
status: '<i class="far fa-square fa-fw ' + systemStatusClass + '"></i>',
status_sort: tempSystemData.status.id
};
}else{
tempData.status = {
status: '',
status_sort: tempSystemData.status.id
};
}
// effect
let systemEffectClass = MapUtil.getEffectInfoForSystem(tempSystemData.effect, 'class');
if(systemEffectClass !== ''){
tempData.effect = {
effect: '<i class="fas fa-square fa-fw ' + systemEffectClass + '"></i>',
effect_sort: tempSystemData.effect
};
}else{
tempData.effect = {
effect: '',
effect_sort: ''
};
}
// trueSec
let systemTrueSecClass = Util.getTrueSecClassForSystem(tempSystemData.trueSec);
if(systemTrueSecClass !== ''){
tempData.trueSec = {
trueSec: '<span class="' + systemTrueSecClass + '">' + tempSystemData.trueSec.toFixed(1) + '</span>',
trueSec_sort: tempSystemData.trueSec
};
}else{
tempData.trueSec = {
trueSec: '',
trueSec_sort: tempSystemData.trueSec
};
}
// shattered
if(tempSystemData.shattered){
tempData.shattered = {
shattered: '<i class="fas fa-skull fa-fw ' + Util.getSecurityClassForSystem('SH') + '"></i>',
shattered_sort: tempSystemData.shattered
};
}else{
tempData.shattered = {
shattered: '',
shattered_sort: 0
};
}
// locked
if(tempSystemData.locked === 1){
tempData.locked = {
locked: '<i class="fas fa-lock 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="fas fa-times txt-color txt-color-redDarker"></i>';
systemsData.push(tempData);
}
let systemsDataTable = systemTable.DataTable( {
let systemsDataTable = systemTable.DataTable({
pageLength: 20,
paging: true,
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
ordering: true,
order: [[ 9, 'desc' ], [ 3, 'asc' ]],
order: [14, 'desc'],
hover: false,
data: systemsData,
data: mapData.data.systems,
columnDefs: [],
language: {
emptyTable: 'Map is empty',
@@ -387,44 +251,53 @@ define([
{
name: 'type',
title: 'type',
width: '25px',
width: 25,
className: ['min-screen-l'].join(' '),
data: 'type',
render: {
_: 'type',
sort: 'type_sort'
_: (cellData, type, rowData, meta) => {
return MapUtil.getSystemTypeInfo(cellData.id, 'name');
}
}
},{
name: 'security',
title: '',
width: '1px',
searchable: false,
width: 1,
data: 'security',
render: {
_: 'security',
sort: 'security_sort'
display: (cellData, type, rowData, meta) => {
let securityClass = Util.getSecurityClassForSystem(cellData);
return '<span class="' + securityClass + '">' + cellData + '</span>';
}
}
},{
name: 'trueSec',
title: 'sec',
width: '18px',
width: 18,
className: ['text-center', 'min-screen-l'].join(' '),
searchable: false,
data: 'trueSec',
render: {
_: 'trueSec',
sort: 'trueSec_sort'
display: (cellData, type, rowData, meta) => {
let systemTrueSecClass = Util.getTrueSecClassForSystem(cellData);
return '<span class="' + systemTrueSecClass + '">' + cellData.toFixed(1) + '</span>';
}
}
},{
name: 'shattered',
title: '<i class="fas fa-skull" title="shattered" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: ['text-center', 'min-screen-l'].join(' '),
searchable: false,
data: 'shattered',
render: {
_: 'shattered',
sort: 'shattered_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData){
value = '<i class="fas fa-skull fa-fw ' + Util.getSecurityClassForSystem('SH') + '"></i>';
}
return value;
}
}
},{
name: 'name',
@@ -440,83 +313,148 @@ define([
},{
name: 'alias',
title: 'alias',
data: 'alias'
data: 'alias',
render: {
_: (cellData, type, rowData, meta) => {
return (cellData === rowData.name) ? '' : cellData;
}
}
},{
name: 'region',
title: 'region',
data: 'region'
data: 'region.name'
},{
name: 'planets',
title: '<i class="fas fa-circle" title="planets" data-toggle="tooltip"></i>',
width: 10,
className: ['text-right', config.systemInfoPlanetsClass, Util.config.helpDefaultClass, Util.config.popoverTriggerClass].join(' '),
searchable: false,
orderSequence: ['desc', 'asc'],
data: 'planets',
render: {
_: (cellData, type, rowData, meta) => {
return cellData.length;
}
}
},{
name: 'status',
title: '<i class="far fa-square" title="system&nbsp;status" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: 'text-center',
searchable: false,
data: 'status',
data: 'status.id',
render: {
_: 'status',
sort: 'status_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
let systemStatusClass = Util.getStatusInfoForSystem(cellData, 'class');
if(systemStatusClass !== ''){
value = '<i class="far fa-square fa-fw ' + systemStatusClass + '"></i>';
}
return value;
}
}
},{
name: 'effect',
title: '<i class="fas fa-square" title="system&nbsp;effect" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: 'text-center',
searchable: false,
data: 'effect',
render: {
_: 'effect',
sort: 'effect_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
let systemEffectClass = MapUtil.getEffectInfoForSystem(cellData, 'class');
if(systemEffectClass !== ''){
value = '<i class="fas fa-square fa-fw ' + systemEffectClass + '"></i>';
}
return value;
}
}
},{
name: 'static',
title: 'static',
width: '30px',
data: 'static'
name: 'statics',
title: 'statics',
width: 30,
searchable: false,
data: 'statics',
render: {
_: (cellData, type, rowData, meta) => {
let statics = [];
for(let wormholeName of cellData){
let wormholeData = Object.assign({}, Init.wormholes[wormholeName]);
let security = wormholeData.security;
let secClass = Util.getSecurityClassForSystem(security);
statics.push('<span class="' + secClass + '">' + security + '</span>');
}
return statics.join('&nbsp;&nbsp;');
}
}
},{
name: 'position',
title: '<i class="fas fa-map-marker-alt" title="your&nbsp;position" data-toggle="tooltip"></i>',
width: '8px',
width: 8,
className: 'text-center',
searchable: false,
data: 'position',
data: 'currentUser',
defaultContent: false,
render: {
_: 'position',
sort: 'position_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData === true){
value = '<i class="fas fa-map-marker-alt fa-fw"></i>';
}
return value;
}
}
},{
name: 'userCount',
title: '<i class="fas fa-plane" title="active&nbsp;pilots" data-toggle="tooltip"></i>',
width: '12px',
width: 12,
className: 'text-center',
searchable: false,
data: 'userCount'
data: 'userCount',
render: {
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData > 0){
value = cellData;
}
return value;
}
}
},{
name: 'locked',
title: '<i class="fas fa-lock" title="system&nbsp;locked" data-toggle="tooltip"></i>',
width: '10px',
width: 10,
className: 'text-center',
searchable: false,
data: 'locked',
render: {
_: 'locked',
sort: 'locked_sort'
display: (cellData, type, rowData, meta) => {
let value = '';
if(cellData === 1){
value = '<i class="fas fa-lock fa-fw"></i>';
}
return value;
}
}
},{
name: 'updated',
title: 'updated',
width: '80px',
width: 80,
searchable: false,
className: ['text-right', config.tableCellCounterClass, 'min-screen-l'].join(' '),
data: 'updated'
data: 'updated.updated',
defaultContent: '',
},{
name: 'action',
title: '',
orderable: false,
searchable: false,
width: '10px',
width: 10,
className: ['text-center', config.tableCellActionClass].join(' '),
data: 'clear',
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
data: null,
defaultContent: '<i class="fas fa-times txt-color txt-color-redDarker"></i>',
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
let tempTableElement = this;
let tempConfirmationSettings = confirmationSettings;
@@ -582,7 +520,7 @@ define([
connectionsElement.showLoadingAnimation(config.loadingOptions);
// table init complete
connectionTable.on( 'init.dt', function () {
connectionTable.on( 'init.dt', function (){
connectionsElement.hideLoadingAnimation();
});
@@ -624,7 +562,7 @@ define([
connectionData.push(tempConData);
}
let connectionDataTable = connectionTable.dataTable( {
let connectionDataTable = connectionTable.dataTable({
pageLength: 20,
paging: true,
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
@@ -705,7 +643,7 @@ define([
width: '10px',
className: ['text-center', config.tableCellActionClass].join(' '),
data: 'clear',
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
let tempTableElement = this;
let tempConfirmationSettings = confirmationSettings;
@@ -749,7 +687,7 @@ define([
usersElement.showLoadingAnimation(config.loadingOptions);
// table init complete
userTable.on( 'init.dt', function () {
userTable.on( 'init.dt', function (){
usersElement.hideLoadingAnimation();
// init table tooltips
@@ -777,7 +715,7 @@ define([
}
}
let userDataTable = userTable.dataTable( {
let userDataTable = userTable.dataTable({
pageLength: 20,
paging: true,
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
@@ -866,7 +804,7 @@ define([
},
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
// open character information window (ingame)
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
$(cell).on('click', { tableApi: this.DataTable() }, function(e){
let rowData = e.data.tableApi.row(this).data();
Util.openIngameWindow(rowData.id);
});
@@ -896,7 +834,7 @@ define([
className: [config.tableCellActionClass, 'min-screen-l'].join(' '),
data: 'corporation',
render: {
_: function (data, type, row, meta) {
_: function (data, type, row, meta){
let value = data.name;
if(type === 'display'){
value += '&nbsp;' + getIconForInformationWindow();
@@ -906,7 +844,7 @@ define([
},
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
// open character information window (ingame)
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
$(cell).on('click', { tableApi: this.DataTable() }, function(e){
let cellData = e.data.tableApi.cell(this).data();
Util.openIngameWindow(cellData.id);
});
@@ -936,7 +874,7 @@ define([
data: 'log',
defaultContent: getLabelForUnknownData(),
render: {
_: function (data, type, row, meta) {
_: function (data, type, row, meta){
let value = data;
if(data){
if(data.station && data.station.id > 0){
@@ -959,7 +897,7 @@ define([
className: ['text-right', 'min-screen-l'].join(' '),
data: 'role',
render: {
_: function (data, type, row, meta) {
_: function (data, type, row, meta){
let value = data.label;
if(type === 'display'){
value = Util.getLabelByRole(data).prop('outerHTML');
@@ -973,6 +911,33 @@ define([
};
/**
* set global dialog observer (all tabs/tables)
* @param mapInfoDialog
* @param mapData
*/
let setDialogObserver = (mapInfoDialog, mapData) => {
// planets popover --------------------------------------------------------------------------------------------
mapInfoDialog.hoverIntent({
over: function(e){
let cellElement = $(this);
let tableApi = Util.getDataTableInstance(config.tableId, mapData.config.id, '', 'systems');
let rowData = tableApi.row(cellElement.parents('tr')).data();
cellElement.addSystemPlanetsTooltip(rowData.planets, {
trigger: 'manual',
placement: 'left',
show: true
});
},
out: function(e){
$(this).destroyPopover();
},
selector: 'td.' + config.systemInfoPlanetsClass
});
};
/**
* loads logs table into an element
* @param mapData
@@ -996,7 +961,7 @@ define([
context: context
}).done(function(data){
this.callback(data, context);
}).fail(function( jqXHR, status, error) {
}).fail(function( jqXHR, status, error){
let reason = status + ' ' + error;
Util.showNotify({title: jqXHR.status + ': loadLogs', text: reason, type: 'warning'});
}).always(function(){
@@ -1092,7 +1057,7 @@ define([
data = Util.convertDateToString(logDate, true);
// check whether log is new (today) ->
if(logDate.setHours(0,0,0,0) === serverHours) {
if(logDate.setHours(0,0,0,0) === serverHours){
// replace dd/mm/YYYY
data = 'today' + data.substring(10);
}
@@ -1161,7 +1126,7 @@ define([
},
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
// open character information window (ingame)
$(cell).on('click', { tableApi: this.DataTable() }, function(e) {
$(cell).on('click', { tableApi: this.DataTable() }, function(e){
let rowData = e.data.tableApi.row(this).data();
Util.openIngameWindow(rowData.context.data.character.id);
});
@@ -1263,7 +1228,7 @@ define([
className: 'btn btn-sm btn-default',
text: '<i class="fas fa-fw fa-plus"></i>&nbsp;load more',
enabled: false,
action: function ( e, dt, node, config ) {
action: function ( e, dt, node, config ){
let pageInfo = dt.page.info();
getLogsData({
@@ -1327,14 +1292,15 @@ define([
success: {
label: 'close',
className: 'btn-primary',
callback: function() {
callback: function(){
$(mapInfoDialog).modal('hide');
}
}
}
});
mapInfoDialog.on('shown.bs.modal', function(e) {
mapInfoDialog.on('shown.bs.modal', function(e){
let mapInfoDialog = $(this);
let mapElement = $('#' + config.mapInfoId);
let systemsElement = $('#' + config.mapInfoSystemsId);
let connectionsElement = $('#' + config.mapInfoConnectionsId);
@@ -1370,6 +1336,9 @@ define([
// load users table
usersElement.initUsersInfoTable(mapData);
// set global dialog observer
setDialogObserver(mapInfoDialog, mapData);
});
// events for tab change

View File

@@ -190,7 +190,7 @@ define([
* @param tableType
* @returns {string}
*/
let getTableId = (mapId, systemId, tableType) => config.sigTableId + [mapId, systemId, tableType].join('-');
let getTableId = (mapId, systemId, tableType) => Util.getTableId(config.sigTableId, mapId, systemId, tableType);
/**
* get a dataTableApi instance from global cache
@@ -199,14 +199,7 @@ define([
* @param tableType
* @returns {*}
*/
let getDataTableInstance = (mapId, systemId, tableType) => {
let instance = null;
let table = $.fn.dataTable.tables({ visible: false, api: true }).table('#' + getTableId(mapId, systemId, tableType));
if(table.node()){
instance = table;
}
return instance;
};
let getDataTableInstance = (mapId, systemId, tableType) => Util.getDataTableInstance(config.sigTableId, mapId, systemId, tableType);
/**
* Update/set tooltip for an element
@@ -1791,7 +1784,6 @@ define([
// check if cell index is inside table dimensions
newCellIndex = checkIndex(tableApi, newCellIndex);
//let cell = tableApi.cell(newCellIndex[1], newCellIndex[0]);
let cell = tableApi.cell(':eq(' + newCellIndex[1] + ')', ':eq(' + newCellIndex[0] + ')', {search: 'applied'});
let node = cell.node();

View File

@@ -575,9 +575,7 @@ define([
if(options.show){
element.popover('show');
}
});
});
};
@@ -1704,6 +1702,20 @@ define([
return statusInfo;
};
/**
* get planet info e.g. class by type e.g. "barren"
* @param type
* @param option
* @returns {string}
*/
let getPlanetInfo = (type, option = 'class') => {
let info = '';
if( Init.classes.planets.hasOwnProperty(type) ){
info = Init.classes.planets[type][option];
}
return info;
};
/**
* get a HTML table with system effect information
* e.g. for popover
@@ -1739,14 +1751,26 @@ define([
let getSystemPlanetsTable = planets => {
let table = '';
if(planets.length > 0){
let regex = /\(([^)]+)\)/;
table += '<table>';
for(let planet of planets){
let typeName = planet.type.name;
let typeClass = '';
let matches = regex.exec(typeName.toLowerCase());
if(matches && matches[1]){
typeName = matches[1].charAt(0).toUpperCase() + matches[1].slice(1);
typeClass = getPlanetInfo(matches[1]);
}
table += '<tr>';
table += '<td>';
table += planet.name;
table += '</td>';
table += '<td class="' + typeClass + '">';
table += '<i class="fas fa-circle"></i>';
table += '</td>';
table += '<td class="text-right">';
table += planet.type.name;
table += typeName;
table += '</td>';
table += '</tr>';
}
@@ -2697,6 +2721,33 @@ define([
}
};
/**
* get dataTable id
* @param prefix
* @param mapId
* @param systemId
* @param tableType
* @returns {string}
*/
let getTableId = (prefix, mapId, systemId, tableType) => prefix + [mapId, systemId, tableType].join('-');
/**
* get a dataTableApi instance from global cache
* @param prefix
* @param mapId
* @param systemId
* @param tableType
* @returns {*}
*/
let getDataTableInstance = (prefix, mapId, systemId, tableType) => {
let instance = null;
let table = $.fn.dataTable.tables({ visible: false, api: true }).table('#' + getTableId(prefix, mapId, systemId, tableType));
if(table.node()){
instance = table;
}
return instance;
};
/**
* get deep json object value if exists
* -> e.g. key = 'first.last.third' string
@@ -2892,6 +2943,8 @@ define([
clearSessionStorage: clearSessionStorage,
getBrowserTabId: getBrowserTabId,
singleDoubleClick: singleDoubleClick,
getTableId: getTableId,
getDataTableInstance: getDataTableInstance,
getObjVal: getObjVal,
redirect: redirect,
logout: logout,

View File

@@ -1,9 +1,9 @@
/*!
* hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
* http://cherne.net/brian/resources/jquery.hoverIntent.html
* hoverIntent v1.9.0 // 2017.09.01 // jQuery v1.7.0+
* http://briancherne.github.io/jquery-hoverIntent/
*
* 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
* Copyright 2007-2017 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);
!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery"],factory):jQuery&&!jQuery.fn.hoverIntent&&factory(jQuery)}(function($){"use strict";var cX,cY,_cfg={interval:100,sensitivity:6,timeout:0},INSTANCE_COUNT=0,track=function(ev){cX=ev.pageX,cY=ev.pageY},compare=function(ev,$el,s,cfg){if(Math.sqrt((s.pX-cX)*(s.pX-cX)+(s.pY-cY)*(s.pY-cY))<cfg.sensitivity)return $el.off(s.event,track),delete s.timeoutId,s.isActive=!0,ev.pageX=cX,ev.pageY=cY,delete s.pX,delete s.pY,cfg.over.apply($el[0],[ev]);s.pX=cX,s.pY=cY,s.timeoutId=setTimeout(function(){compare(ev,$el,s,cfg)},cfg.interval)},delay=function(ev,$el,s,out){return delete $el.data("hoverIntent")[s.id],out.apply($el[0],[ev])};$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var instanceId=INSTANCE_COUNT++,cfg=$.extend({},_cfg);$.isPlainObject(handlerIn)?(cfg=$.extend(cfg,handlerIn),$.isFunction(cfg.out)||(cfg.out=cfg.over)):cfg=$.isFunction(handlerOut)?$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector}):$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut});var handleHover=function(e){var ev=$.extend({},e),$el=$(this),hoverIntentData=$el.data("hoverIntent");hoverIntentData||$el.data("hoverIntent",hoverIntentData={});var state=hoverIntentData[instanceId];state||(hoverIntentData[instanceId]=state={id:instanceId}),state.timeoutId&&(state.timeoutId=clearTimeout(state.timeoutId));var mousemove=state.event="mousemove.hoverIntent.hoverIntent"+instanceId;if("mouseenter"===e.type){if(state.isActive)return;state.pX=ev.pageX,state.pY=ev.pageY,$el.off(mousemove,track).on(mousemove,track),state.timeoutId=setTimeout(function(){compare(ev,$el,state,cfg)},cfg.interval)}else{if(!state.isActive)return;$el.off(mousemove,track),state.timeoutId=setTimeout(function(){delay(ev,$el,state,cfg.out)},cfg.timeout)}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}});

View File

@@ -88,6 +88,17 @@ $system-color-sec-0-8: #00bf39;
$system-color-sec-0-9: #39bf99;
$system-color-sec-1-0: #28c0bf;
// planet types
$planet-color-barren: #755e48;
$planet-color-gas: #a4b2b2;
$planet-color-ice: #aacada;
$planet-color-lava: #891c08;
$planet-color-oceanic: #4d7999;
$planet-color-plasma: #28576e;
$planet-color-shattered: $indigo;
$planet-color-storm: #38556a;
$planet-color-temperate: #4c593c;
// brand colors
$brand-primary: $teal-dark !default;
$brand-success: $green-dark !default;

View File

@@ -1009,6 +1009,43 @@ table{
}
}
// planet types ===================================================================================
.pf-planet-barren{
color: $planet-color-barren;
}
.pf-planet-gas{
color: $planet-color-gas;
}
.pf-planet-ice{
color: $planet-color-ice;
}
.pf-planet-lava{
color: $planet-color-lava;
}
.pf-planet-oceanic{
color: $planet-color-oceanic;
}
.pf-planet-plasma{
color: $planet-color-plasma;
}
.pf-planet-shattered{
color: $planet-color-shattered;
}
.pf-planet-storm{
color: $planet-color-storm;
}
.pf-planet-temperate{
color: $planet-color-temperate;
}
// "fake connection" classes for the map manual
.pf-fake-connection{
box-sizing: content-box;

View File

@@ -34,7 +34,7 @@
font-size: 11px;
td{
padding: 0 5px;
padding: 0 4px; // 10px popover padding + 4px table cell padding == 14px -> same as popover title
vertical-align: middle !important;
}
}