- Upgraded "[_pathfinder_esi_](https://github.com/exodus4d/pathfinder_esi)" Web API client`v1.3.2` → `v2.0.0` - Fixed a js bug where current active(selected) system becomes deselected after system was dragged on map - Fixed a js bug where new auto mapped systems (e.g. after jump) were positioned outside current map scroll viewport - Fixed a js bug where map sync failed after map tabs switch - Fixed blurry map when map zoom was changed - Fixed multiple minor JS bugs where map render/update failed
108 lines
2.9 KiB
JavaScript
108 lines
2.9 KiB
JavaScript
define([
|
|
'PNotify',
|
|
'PNotifyButtons',
|
|
'PNotifyCallbacks',
|
|
'PNotifyDesktop',
|
|
'NonBlock'
|
|
], (PNotify) => {
|
|
'use strict';
|
|
|
|
let stackConfig = {
|
|
bottomRight: {
|
|
stack: {
|
|
dir1: 'up',
|
|
dir2: 'left',
|
|
firstpos1: 32,
|
|
firstpos2: 10,
|
|
spacing1: 5,
|
|
spacing2: 5,
|
|
push: 'bottom',
|
|
context: document.body
|
|
}
|
|
},
|
|
barBottom: {
|
|
stack: {
|
|
dir1: 'up',
|
|
firstpos1: 32,
|
|
spacing1: 0,
|
|
context: document.querySelector(`.pf-site`)
|
|
},
|
|
addclass: 'stack-bar-bottom'
|
|
}
|
|
};
|
|
|
|
/**
|
|
* default PNotify config
|
|
*/
|
|
let initDefaultPNotifyConfig = () => {
|
|
PNotify.defaults.styling = 'bootstrap3';
|
|
PNotify.defaults.icons = 'fontawesome5';
|
|
PNotify.defaults.addClass = 'nonblock';
|
|
PNotify.defaults.delay = 5000;
|
|
PNotify.defaults.width = '250px';
|
|
PNotify.defaults.animateSpeed = 'fast';
|
|
|
|
PNotify.defaults.stack = stackConfig.bottomRight.stack;
|
|
|
|
PNotify.modules.Desktop.defaults.icon = '/public/img/notifications/logo.png';
|
|
};
|
|
|
|
/**
|
|
* show browser/desktop notification
|
|
* @param config
|
|
* @param options
|
|
*/
|
|
let showNotify = (config = {}, options = {}) => {
|
|
|
|
if(options.desktop){
|
|
config.modules = {
|
|
Desktop: Object.assign({}, {desktop: true}, options.desktop)
|
|
};
|
|
}
|
|
|
|
switch(config.type){
|
|
case 'info':
|
|
config.icon = 'fas fa-info fa-fw fa-lg';
|
|
break;
|
|
case 'success':
|
|
config.icon = 'fas fa-check fa-fw fa-lg';
|
|
break;
|
|
case 'notice':
|
|
case 'warning':
|
|
config.icon = 'fas fa-exclamation-triangle fa-fw fa-lg';
|
|
config.type = 'notice';
|
|
break;
|
|
case 'error':
|
|
config.icon = 'fas fa-times fa-fw fa-lg';
|
|
break;
|
|
case 'lock':
|
|
config.icon = 'fas fa-lock fa-fw fa-lg';
|
|
config.type = 'success';
|
|
break;
|
|
case 'unlock':
|
|
config.icon = 'fas fa-unlock fa-fw fa-lg';
|
|
config.type = 'info';
|
|
break;
|
|
default:
|
|
config.icon = false;
|
|
}
|
|
|
|
if(options.stack){
|
|
config.stack = stackConfig[options.stack].stack;
|
|
config.addClass = stackConfig[options.stack].addclass;
|
|
}
|
|
|
|
let notice = PNotify.alert(config);
|
|
|
|
if(typeof options.click === 'function'){
|
|
notice.refs.elem.style.cursor = 'pointer';
|
|
notice.on('click', options.click);
|
|
}
|
|
};
|
|
|
|
initDefaultPNotifyConfig();
|
|
|
|
return {
|
|
showNotify: showNotify
|
|
};
|
|
}); |