adds dotlan plugin, fixes zkill system clickout, allows signatures in any column

This commit is contained in:
soneill
2020-08-30 19:58:00 +12:00
parent cab7695f4c
commit c3f0bb2ecc
6 changed files with 88 additions and 34 deletions

View File

@@ -5,11 +5,11 @@ define([ // dependencies for this module
'use strict'; 'use strict';
/** /**
* EmptyModule class * DotlanModule class
* -> skeleton for custom module plugins * -> skeleton for custom module plugins
* @type {EmptyModule} * @type {DotlanModule}
*/ */
let EmptyModule = class EmptyModule extends BaseModule { let DotlanModule = class DotlanModule extends BaseModule {
constructor(config = {}) { constructor(config = {}) {
super(Object.assign({}, new.target.defaultConfig, config)); super(Object.assign({}, new.target.defaultConfig, config));
} }
@@ -30,6 +30,16 @@ define([ // dependencies for this module
className: this._config.bodyClassName className: this._config.bodyClassName
}); });
if (this.isWormhole(systemData.name)) {
var moduleContent = 'Not available for Jspace'
} else {
var moduleContent = Object.assign(document.createElement('iframe'), {
src: this.dotlanPath(this._systemData),
className: 'dotlan-iframe',
style: "width: 100%; height: 650px;"
})
}
bodyEl.append(moduleContent)
this.moduleElement.append(bodyEl); this.moduleElement.append(bodyEl);
return this.moduleElement; return this.moduleElement;
@@ -53,19 +63,36 @@ define([ // dependencies for this module
onSortableEvent(name, e){ onSortableEvent(name, e){
super.onSortableEvent(name, e); super.onSortableEvent(name, e);
} }
dotlanPath(sysData){
let regionName = this.snakeCase(sysData.region.name);
let systemName = this.snakeCase(sysData.name);
return ["https://evemaps.dotlan.net/map/", regionName, "/", systemName, "#npc_delta"].join('');
}
snakeCase(str){
const regex = /\ /g;
return str.replace(regex, "_");
}
isWormhole(systemName){
const jspace = /^[jJ][0-9]{4,6}/;
return systemName.match(jspace) ? true : false;
}
}; };
EmptyModule.isPlugin = true; // module is defined as 'plugin' DotlanModule.isPlugin = true; // module is defined as 'plugin'
EmptyModule.scope = 'system'; // module scope controls how module gets updated and what type of data is injected DotlanModule.scope = 'system'; // module scope controls how module gets updated and what type of data is injected
EmptyModule.sortArea = 'a'; // default sortable area DotlanModule.sortArea = 'a'; // default sortable area
EmptyModule.position = 15; // default sort/order position within sortable area DotlanModule.position = 15; // default sort/order position within sortable area
EmptyModule.label = 'Empty'; // static module label (e.g. description) DotlanModule.label = 'Dotlan'; // static module label (e.g. description)
EmptyModule.defaultConfig = { DotlanModule.defaultConfig = {
className: 'pf-system-empty-module', // class for module className: 'pf-system-dotlan-module', // class for module
sortTargetAreas: ['a', 'b', 'c'], // sortable areas where module can be dragged into sortTargetAreas: ['a'], // sortable areas where module can be dragged into
headline: 'Empty Module', headline: 'Dotlan Module',
}; };
return EmptyModule; return DotlanModule;
}); });

View File

@@ -554,7 +554,7 @@ define([
*/ */
openKillboardUrl(e){ openKillboardUrl(e){
e.stopPropagation(); e.stopPropagation();
window.open(`//zkillboard.com/system/${this._systemData.systemId}`, '_blank'); window.open(`//zkillboard.com/system/${this._systemData.systemId}/`, '_blank');
} }
/** /**

View File

@@ -3181,7 +3181,7 @@ define([
SystemSignatureModule.defaultConfig = { SystemSignatureModule.defaultConfig = {
className: 'pf-system-signature-module', // class for module className: 'pf-system-signature-module', // class for module
sortTargetAreas: ['a'], // sortable areas where module can be dragged into sortTargetAreas: ['a', 'b', 'c'], // sortable areas where module can be dragged into
headline: 'Signatures', headline: 'Signatures',
// headline toolbar // headline toolbar

View File

@@ -5,11 +5,11 @@ define([ // dependencies for this module
'use strict'; 'use strict';
/** /**
* EmptyModule class * DotlanModule class
* -> skeleton for custom module plugins * -> skeleton for custom module plugins
* @type {EmptyModule} * @type {DotlanModule}
*/ */
let EmptyModule = class EmptyModule extends BaseModule { let DotlanModule = class DotlanModule extends BaseModule {
constructor(config = {}) { constructor(config = {}) {
super(Object.assign({}, new.target.defaultConfig, config)); super(Object.assign({}, new.target.defaultConfig, config));
} }
@@ -30,6 +30,16 @@ define([ // dependencies for this module
className: this._config.bodyClassName className: this._config.bodyClassName
}); });
if (this.isWormhole(systemData.name)) {
var moduleContent = 'Not available for Jspace'
} else {
var moduleContent = Object.assign(document.createElement('iframe'), {
src: this.dotlanPath(this._systemData),
className: 'dotlan-iframe',
style: "width: 100%; height: 650px;"
})
}
bodyEl.append(moduleContent)
this.moduleElement.append(bodyEl); this.moduleElement.append(bodyEl);
return this.moduleElement; return this.moduleElement;
@@ -53,19 +63,36 @@ define([ // dependencies for this module
onSortableEvent(name, e){ onSortableEvent(name, e){
super.onSortableEvent(name, e); super.onSortableEvent(name, e);
} }
dotlanPath(sysData){
let regionName = this.snakeCase(sysData.region.name);
let systemName = this.snakeCase(sysData.name);
return ["https://evemaps.dotlan.net/map/", regionName, "/", systemName, "#npc_delta"].join('');
}
snakeCase(str){
const regex = /\ /g;
return str.replace(regex, "_");
}
isWormhole(systemName){
const jspace = /^[jJ][0-9]{4,6}/;
return systemName.match(jspace) ? true : false;
}
}; };
EmptyModule.isPlugin = true; // module is defined as 'plugin' DotlanModule.isPlugin = true; // module is defined as 'plugin'
EmptyModule.scope = 'system'; // module scope controls how module gets updated and what type of data is injected DotlanModule.scope = 'system'; // module scope controls how module gets updated and what type of data is injected
EmptyModule.sortArea = 'a'; // default sortable area DotlanModule.sortArea = 'a'; // default sortable area
EmptyModule.position = 15; // default sort/order position within sortable area DotlanModule.position = 15; // default sort/order position within sortable area
EmptyModule.label = 'Empty'; // static module label (e.g. description) DotlanModule.label = 'Dotlan'; // static module label (e.g. description)
EmptyModule.defaultConfig = { DotlanModule.defaultConfig = {
className: 'pf-system-empty-module', // class for module className: 'pf-system-dotlan-module', // class for module
sortTargetAreas: ['a', 'b', 'c'], // sortable areas where module can be dragged into sortTargetAreas: ['a'], // sortable areas where module can be dragged into
headline: 'Empty Module', headline: 'Dotlan Module',
}; };
return EmptyModule; return DotlanModule;
}); });

View File

@@ -554,7 +554,7 @@ define([
*/ */
openKillboardUrl(e){ openKillboardUrl(e){
e.stopPropagation(); e.stopPropagation();
window.open(`//zkillboard.com/system/${this._systemData.systemId}`, '_blank'); window.open(`//zkillboard.com/system/${this._systemData.systemId}/`, '_blank');
} }
/** /**

View File

@@ -3181,7 +3181,7 @@ define([
SystemSignatureModule.defaultConfig = { SystemSignatureModule.defaultConfig = {
className: 'pf-system-signature-module', // class for module className: 'pf-system-signature-module', // class for module
sortTargetAreas: ['a'], // sortable areas where module can be dragged into sortTargetAreas: ['a', 'b', 'c'], // sortable areas where module can be dragged into
headline: 'Signatures', headline: 'Signatures',
// headline toolbar // headline toolbar