aa-intel-tool 2.8.0__py3-none-any.whl → 2.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aa_intel_tool/__init__.py +1 -1
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.css +5 -0
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css +1 -1
- aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.js +240 -315
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.js +70 -90
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.js +58 -90
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.js +158 -197
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.js +79 -93
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.js +67 -91
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.js +322 -132
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js.map +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool.js +16 -9
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool.min.js +1 -1
- aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool.min.js.map +1 -1
- {aa_intel_tool-2.8.0.dist-info → aa_intel_tool-2.9.0.dist-info}/METADATA +2 -2
- {aa_intel_tool-2.8.0.dist-info → aa_intel_tool-2.9.0.dist-info}/RECORD +32 -32
- {aa_intel_tool-2.8.0.dist-info → aa_intel_tool-2.9.0.dist-info}/WHEEL +0 -0
- {aa_intel_tool-2.8.0.dist-info → aa_intel_tool-2.9.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["$","settings","_getAaIntelToolJsSettings","elements","shipClassesTable","shipClassesMass","shipTypesTable","fleetcompositionTable","pilotsCount","fetchGet","url","getShipClasses","then","tableData","addClass","Object","keys","length","removeClass","DataTable","data","paging","language","dataTables","lengthChange","dom","columns","shipInfoPanel","order","columnDefs","targets","createdCell","td","width","visible","createdRow","row","currentMass","newMass","parseInt","mass","html","numberFormatter","value","locales","django","id","type_id","attr","initComplete","classTableRow","_toggleFleetcompStickyHighlight","element","type","bootstrapTooltip","selector","catch","error","console","getShipTypes","getFleetComposition","pilotInfoPanel","currentTotal","newTotal","ship_id","ship_type_id"],"sources":["aa-intel-tool-fleet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yC,eAAezC,IAG9B,CACIA,KAAM,QAEV,CACIA,KAAM,gBAGdQ,MAAO,CACH,CAAC,EAAG,QAERC,WAAY,CACR,CACIC,QAAS,EACTC,YAAcC,IACVhC,EAAEgC,GAAIlB,SAAS,6BAI3BqB,WAAY,CAACC,EAAKhB,KAEd,MAAM0C,EAAe3D,EAASK,YAAYiC,OACpCsB,EAAWxB,SAASuB,GAAgB,EAE1C3D,EAASK,YAAYiC,KAAKsB,GAE1B/D,EAAEoC,GACGtB,SAAS,iDAAiDM,EAAK4C,gCAAgC5C,EAAK6C,gBACpGjB,KAAK,oBAAqB5B,EAAK4C,SAC/BhB,KAAK,mBAAoB5B,EAAK6C,eAEvChB,aAAc,KACV,MAAMC,EAAgBlD,EAAE,4BAExBmD,gCAAgC,CAC5BC,QAASF,EACTG,KAAM,aAIVC,iBAAiB,CAACC,SAAU,gDAM/CC,MAAOC,IACJC,QAAQD,MAAM,yCAA0CA","ignoreList":[]}
|
|
@@ -1,17 +1,138 @@
|
|
|
1
|
-
/* global
|
|
1
|
+
/* global _getAaIntelToolJsSettings, ClipboardJS, bootstrap, addFleetcompositionHighlight, removeFleetcompositionHighlight, changeFleetcompositionStickyHighlight, addDscanHighlight, removeDscanHighlight, changeDscanStickyHighlight, addChatscanHighlight, removeChatscanHighlight, changeChatscanStickyHighlight */
|
|
2
2
|
|
|
3
3
|
/* jshint -W097 */
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
+
const aaIntelToolJsSettings = _getAaIntelToolJsSettings();
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Toggle sticky highlight for scan results
|
|
10
|
+
*
|
|
11
|
+
* @param {jQuery|Element} element The element to attach the events to
|
|
12
|
+
* @param {string} type The type of the element (shipclass or shiptype)
|
|
13
|
+
* @param {string} scanType The scan type (fleetcomposition, dscan, or chatscan)
|
|
14
|
+
* @param {string} [excludeLinkElement=aa-intel-information-link] The class of the element to exclude from sticky toggle
|
|
15
|
+
* @param {boolean} [highlightOnly=false] Omit sticky toggle, only highlight on hover
|
|
16
|
+
* @returns {void}
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
const _toggleScanStickyHighlight = ({
|
|
20
|
+
element,
|
|
21
|
+
type,
|
|
22
|
+
scanType,
|
|
23
|
+
excludeLinkElement = 'aa-intel-information-link',
|
|
24
|
+
highlightOnly = false
|
|
25
|
+
}) => {
|
|
26
|
+
// Function name mappings for different scan types
|
|
27
|
+
const functionMappings = {
|
|
28
|
+
fleetcomposition: {
|
|
29
|
+
add: typeof addFleetcompositionHighlight === 'function' ? addFleetcompositionHighlight : null,
|
|
30
|
+
remove: typeof removeFleetcompositionHighlight === 'function' ? removeFleetcompositionHighlight : null,
|
|
31
|
+
change: typeof changeFleetcompositionStickyHighlight === 'function' ? changeFleetcompositionStickyHighlight : null
|
|
32
|
+
},
|
|
33
|
+
dscan: {
|
|
34
|
+
add: typeof addDscanHighlight === 'function' ? addDscanHighlight : null,
|
|
35
|
+
remove: typeof removeDscanHighlight === 'function' ? removeDscanHighlight : null,
|
|
36
|
+
change: typeof changeDscanStickyHighlight === 'function' ? changeDscanStickyHighlight : null
|
|
37
|
+
},
|
|
38
|
+
chatscan: {
|
|
39
|
+
add: typeof addChatscanHighlight === 'function' ? addChatscanHighlight : null,
|
|
40
|
+
remove: typeof removeChatscanHighlight === 'function' ? removeChatscanHighlight : null,
|
|
41
|
+
change: typeof changeChatscanStickyHighlight === 'function' ? changeChatscanStickyHighlight : null
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const functions = functionMappings[scanType];
|
|
46
|
+
|
|
47
|
+
// Highlight
|
|
48
|
+
const highlightHandler = highlightOnly
|
|
49
|
+
? (element) => element.addClass('aa-intel-highlight') // jshint ignore:line
|
|
50
|
+
: (element) => functions.add(type, element);
|
|
51
|
+
|
|
52
|
+
const unhighlightHandler = highlightOnly
|
|
53
|
+
? (element) => element.removeClass('aa-intel-highlight') // jshint ignore:line
|
|
54
|
+
: (element) => functions.remove(type, element);
|
|
55
|
+
|
|
56
|
+
element
|
|
57
|
+
.mouseenter((event) => {
|
|
58
|
+
highlightHandler($(event.currentTarget));
|
|
59
|
+
})
|
|
60
|
+
.mouseleave((event) => {
|
|
61
|
+
unhighlightHandler($(event.currentTarget));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Sticky
|
|
65
|
+
if (!highlightOnly) {
|
|
66
|
+
element.click((event) => {
|
|
67
|
+
if (!$(event.target).hasClass(excludeLinkElement)) {
|
|
68
|
+
functions.change(type, $(event.currentTarget));
|
|
69
|
+
} else {
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Toggle sticky highlight for Fleet Composition
|
|
78
|
+
*
|
|
79
|
+
* @param {Object} params Parameters
|
|
80
|
+
* @param {jQuery|Element} params.element The element to attach the events to
|
|
81
|
+
* @param {string} params.type The type of the element (shipclass or shiptype)
|
|
82
|
+
* @param {string} [params.excludeLinkElement=aa-intel-information-link] The class of the element to exclude from sticky toggle
|
|
83
|
+
* @param {boolean} [params.highlightOnly=false] Omit sticky toggle, only highlight on hover
|
|
84
|
+
* @returns {void}
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
const _toggleFleetcompStickyHighlight = (params) => { // eslint-disable-line no-unused-vars
|
|
88
|
+
_toggleScanStickyHighlight({...params, scanType: 'fleetcomposition'});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Toggle sticky highlight for D-Scans
|
|
93
|
+
*
|
|
94
|
+
* @param {Object} params Parameters
|
|
95
|
+
* @param {jQuery|Element} params.element The element to attach the events to
|
|
96
|
+
* @param {string} params.type The type of the element (shipclass or shiptype)
|
|
97
|
+
* @param {string} [params.excludeLinkElement=aa-intel-information-link] The class of the element to exclude from sticky toggle
|
|
98
|
+
* @param {boolean} [params.highlightOnly=false] Omit sticky toggle, only highlight on hover
|
|
99
|
+
* @returns {void}
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
const _toggleDscanStickyHighlight = (params) => { // eslint-disable-line no-unused-vars
|
|
103
|
+
_toggleScanStickyHighlight({...params, scanType: 'dscan'});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Toggle sticky highlight for Chat Scans
|
|
108
|
+
*
|
|
109
|
+
* @param {Object} params Parameters
|
|
110
|
+
* @param {jQuery|Element} params.element The element to attach the events to
|
|
111
|
+
* @param {string} params.type The type of the element (shipclass or shiptype)
|
|
112
|
+
* @param {string} [params.excludeLinkElement=aa-intel-information-link] The class of the element to exclude from sticky toggle
|
|
113
|
+
* @param {boolean} [params.highlightOnly=false] Omit sticky toggle, only highlight on hover
|
|
114
|
+
* @returns {void}
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
const _toggleChatscanStickyHighlight = (params) => { // eslint-disable-line no-unused-vars
|
|
118
|
+
_toggleScanStickyHighlight({...params, scanType: 'chatscan'});
|
|
119
|
+
};
|
|
120
|
+
|
|
6
121
|
/**
|
|
7
122
|
* Bootstrap tooltip
|
|
8
123
|
*
|
|
9
|
-
* @param {string} selector
|
|
124
|
+
* @param {string} [selector=body] Selector for the tooltip elements, defaults to 'body'
|
|
125
|
+
* to apply to all elements with the data-bs-tooltip attribute.
|
|
126
|
+
* Example: 'body', '.my-tooltip-class', '#my-tooltip-id'
|
|
127
|
+
* If you want to apply it to a specific element, use that element's selector.
|
|
128
|
+
* If you want to apply it to all elements with the data-bs-tooltip attribute,
|
|
129
|
+
* use 'body' or leave it empty.
|
|
130
|
+
* @param {string} [namespace=aa-intel-tool] Namespace for the tooltip
|
|
131
|
+
* @returns {void}
|
|
10
132
|
*/
|
|
11
|
-
const bootstrapTooltip = (selector = 'body') => { // eslint-disable-line no-unused-vars
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.map((tooltipTriggerEl) => {
|
|
133
|
+
const bootstrapTooltip = ({selector = 'body', namespace = 'aa-intel-tool'}) => { // eslint-disable-line no-unused-vars
|
|
134
|
+
document.querySelectorAll(`${selector} [data-bs-tooltip="${namespace}"]`)
|
|
135
|
+
.forEach((tooltipTriggerEl) => {
|
|
15
136
|
return new bootstrap.Tooltip(tooltipTriggerEl);
|
|
16
137
|
});
|
|
17
138
|
};
|
|
@@ -19,156 +140,205 @@ const bootstrapTooltip = (selector = 'body') => { // eslint-disable-line no-unus
|
|
|
19
140
|
/**
|
|
20
141
|
* Get the image HTML string for an Eve portrait or logo
|
|
21
142
|
*
|
|
22
|
-
* @param {int} eveId
|
|
23
|
-
* @param {string} eveName
|
|
24
|
-
* @param {string} imageSource
|
|
25
|
-
* @param {int} imageSize
|
|
143
|
+
* @param {int} eveId Eve ID of the entity
|
|
144
|
+
* @param {string} eveName Name of the entity
|
|
145
|
+
* @param {string} imageSource URL of the image
|
|
146
|
+
* @param {int} [imageSize=32] Size of the image (width and height)
|
|
26
147
|
* @returns {`<img class='eve-image rounded' data-eveid='${int}' src='${string}' alt='${string}' title='${string}' data-bs-tooltip='aa-intel-tool' loading='lazy' width='${int}' height='${int}'>`}
|
|
148
|
+
* @private
|
|
27
149
|
*/
|
|
28
|
-
const
|
|
150
|
+
const _eveImageHtml = ({eveId, eveName, imageSource, imageSize = 32}) => {
|
|
29
151
|
return `<img class="eve-image rounded" data-eveid="${eveId}" src="${imageSource}" alt="${eveName}" title="${eveName}" data-bs-tooltip="aa-intel-tool" loading="lazy" width="${imageSize}" height="${imageSize}">`;
|
|
30
152
|
};
|
|
31
153
|
|
|
32
154
|
/**
|
|
33
|
-
* Get the link HTML to EveWho for a pilot
|
|
34
155
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
156
|
+
* Get the link HTML for external services
|
|
157
|
+
*
|
|
158
|
+
* @param {string} serviceName Name of the external service
|
|
159
|
+
* @param {string} href URL of the external service
|
|
160
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>${string}</a>`} HTML string for the external service link
|
|
161
|
+
* @private
|
|
37
162
|
*/
|
|
38
|
-
const
|
|
39
|
-
return `<a class="aa-intel-information-link" href="${href}" target="_blank" rel="noopener noreferer"
|
|
163
|
+
const _externalLinkHtml = ({serviceName, href}) => {
|
|
164
|
+
return `<a class="aa-intel-information-link" href="${href}" target="_blank" rel="noopener noreferer">${serviceName}</a>`;
|
|
40
165
|
};
|
|
41
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Get the link HTML to EveWho for a pilot
|
|
169
|
+
*
|
|
170
|
+
* @param {string} href URL of the external service
|
|
171
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>evewho</a>`} HTML string for the EveWho link
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
const _eveWhoLinkHtml = (href) => _externalLinkHtml({
|
|
175
|
+
serviceName: 'evewho',
|
|
176
|
+
href: href
|
|
177
|
+
});
|
|
178
|
+
|
|
42
179
|
/**
|
|
43
180
|
* Get the link HTML to zKillboard
|
|
44
181
|
*
|
|
45
|
-
* @param {string} href
|
|
46
|
-
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>zkillboard
|
|
182
|
+
* @param {string} href URL of the external service
|
|
183
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>zkillboard</a>`} HTML string for the zKillboard link
|
|
184
|
+
* @private
|
|
47
185
|
*/
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
186
|
+
const _zkillboardLinkHtml = (href) => _externalLinkHtml({
|
|
187
|
+
serviceName: 'zkillboard',
|
|
188
|
+
href: href
|
|
189
|
+
});
|
|
51
190
|
|
|
52
191
|
/**
|
|
53
192
|
* Get the link HTML to dotlan
|
|
54
193
|
*
|
|
55
|
-
* @param {string} href
|
|
56
|
-
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>dotlan
|
|
194
|
+
* @param {string} href URL of the external service
|
|
195
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>dotlan</a>`} HTML string for the dotlan link
|
|
196
|
+
* @private
|
|
57
197
|
*/
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
198
|
+
const _dotlanLinkHtml = (href) => _externalLinkHtml({
|
|
199
|
+
serviceName: 'dotlan',
|
|
200
|
+
href: href
|
|
201
|
+
});
|
|
61
202
|
|
|
62
203
|
/**
|
|
63
204
|
* Info panel for the datatable
|
|
64
205
|
*
|
|
65
|
-
* @param {string} imageData
|
|
66
|
-
* @param {string} eveData
|
|
67
|
-
* @param {string} additionalInfo
|
|
68
|
-
* @param {boolean} logoOnly Returns only the logo
|
|
69
|
-
* @returns {string} HTML construct for the info panel
|
|
206
|
+
* @param {string} imageData HTML for the image
|
|
207
|
+
* @param {string} eveData Name of the entity
|
|
208
|
+
* @param {string} [additionalInfo=''] Additional information (links etc.)
|
|
209
|
+
* @param {boolean} [logoOnly=false] Returns only the logo
|
|
210
|
+
* @returns {`<span class='aa-intel-eve-image-wrapper'>${string}</span>`|`<span class='aa-intel-eve-image-wrapper'>${string}</span><span class='aa-intel-eve-information-wrapper'><span class='aa-intel-eve-name-wrapper'>${string}</span><span class='aa-intel-additional-information-wrapper'><small>${string}</small></span></span>|<span class='aa-intel-eve-image-wrapper'>${string}</span>`} HTML construct for the info panel
|
|
211
|
+
* @private
|
|
70
212
|
*/
|
|
71
|
-
const
|
|
72
|
-
imageData,
|
|
73
|
-
eveData,
|
|
74
|
-
additionalInfo = '',
|
|
75
|
-
logoOnly = false
|
|
76
|
-
) => {
|
|
213
|
+
const _infoPanel = ({imageData, eveData, additionalInfo = '', logoOnly = false}) => {
|
|
77
214
|
const imageDataHtml = `<span class="aa-intel-eve-image-wrapper">${imageData}</span>`;
|
|
78
215
|
|
|
79
216
|
if (logoOnly) {
|
|
80
217
|
return imageDataHtml;
|
|
81
218
|
}
|
|
82
219
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
} else {
|
|
88
|
-
eveDataHtml += `</span>`;
|
|
89
|
-
}
|
|
220
|
+
const nameWrapper = `<span class="aa-intel-eve-name-wrapper">${eveData}</span>`;
|
|
221
|
+
const additionalWrapper = additionalInfo
|
|
222
|
+
? `<span class="aa-intel-additional-information-wrapper"><small>${additionalInfo}</small></span>` // jshint ignore:line
|
|
223
|
+
: '';
|
|
90
224
|
|
|
91
|
-
return imageDataHtml
|
|
225
|
+
return `${imageDataHtml}<span class="aa-intel-eve-information-wrapper">${nameWrapper}${additionalWrapper}</span>`;
|
|
92
226
|
};
|
|
93
227
|
|
|
94
228
|
/**
|
|
95
229
|
* Pilot info element in datatable
|
|
96
230
|
*
|
|
97
|
-
* @param {Object} pilotData
|
|
98
|
-
* @
|
|
231
|
+
* @param {Object} pilotData Pilot data
|
|
232
|
+
* @param {int} pilotData.id Pilot ID
|
|
233
|
+
* @param {string} pilotData.name Pilot name
|
|
234
|
+
* @param {string} pilotData.portrait URL of the pilot portrait
|
|
235
|
+
* @param {string} pilotData.evewho URL to EveWho
|
|
236
|
+
* @param {string} pilotData.zkillboard URL to zKillboard
|
|
237
|
+
* @returns {`<span class='aa-intel-eve-image-wrapper'>${string}</span><span class='aa-intel-eve-information-wrapper'><span class='aa-intel-eve-name-wrapper'>${string}</span><span class='aa-intel-additional-information-wrapper'><small>${string} | ${string}</small></span></span>`} HTML construct for the pilot info
|
|
99
238
|
*/
|
|
100
239
|
const pilotInfoPanel = (pilotData) => { // eslint-disable-line no-unused-vars
|
|
101
|
-
const imageData =
|
|
102
|
-
|
|
103
|
-
|
|
240
|
+
const imageData = _eveImageHtml({
|
|
241
|
+
eveId: pilotData.id,
|
|
242
|
+
eveName: pilotData.name,
|
|
243
|
+
imageSource: pilotData.portrait
|
|
244
|
+
});
|
|
245
|
+
const additionalInfo = `${_eveWhoLinkHtml(pilotData.evewho)} | ${_zkillboardLinkHtml(pilotData.zkillboard)}`;
|
|
104
246
|
|
|
105
|
-
return
|
|
247
|
+
return _infoPanel({
|
|
248
|
+
imageData: imageData,
|
|
249
|
+
eveData: pilotData.name,
|
|
250
|
+
additionalInfo: additionalInfo
|
|
251
|
+
});
|
|
106
252
|
};
|
|
107
253
|
|
|
108
254
|
/**
|
|
109
255
|
* Corporation info element in datatable
|
|
110
256
|
*
|
|
111
|
-
* @param {Object} corporationData
|
|
257
|
+
* @param {Object} corporationData Corporation data
|
|
258
|
+
* @param {int} corporationData.id Corporation ID
|
|
259
|
+
* @param {string} corporationData.name Corporation name
|
|
260
|
+
* @param {string} corporationData.logo URL of the corporation logo
|
|
261
|
+
* @param {string} corporationData.dotlan URL to dotlan
|
|
262
|
+
* @param {string} corporationData.zkillboard URL to zKillboard
|
|
112
263
|
* @param {boolean} logoOnly Returns only the corporation logo
|
|
113
|
-
* @returns {string} HTML construct for the corporation info
|
|
264
|
+
* @returns {`<span class='aa-intel-eve-image-wrapper'>${string}</span><span class='aa-intel-eve-information-wrapper'><span class='aa-intel-eve-name-wrapper'>${string}</span><span class='aa-intel-additional-information-wrapper'><small>${string}</small></span></span>|<span class='aa-intel-eve-image-wrapper'>${string}</span>`} HTML construct for the corporation info
|
|
114
265
|
*/
|
|
115
266
|
const corporationInfoPanel = (corporationData, logoOnly = false) => { // eslint-disable-line no-unused-vars
|
|
116
|
-
const imageData =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
additionalInfo = `(${aaIntelToolJsSettings.translation.scanData.npcCorp})`;
|
|
122
|
-
} else {
|
|
123
|
-
additionalInfo = `${dotlanLinkHtml(corporationData.dotlan)} | ${zkillboardLinkHtml(corporationData.zkillboard)}`;
|
|
124
|
-
}
|
|
267
|
+
const imageData = _eveImageHtml({
|
|
268
|
+
eveId: corporationData.id,
|
|
269
|
+
eveName: corporationData.name,
|
|
270
|
+
imageSource: corporationData.logo
|
|
271
|
+
});
|
|
125
272
|
|
|
126
|
-
|
|
273
|
+
const isNpcCorp = corporationData.id >= 1000000 && corporationData.id <= 2000000;
|
|
274
|
+
const additionalInfo = isNpcCorp
|
|
275
|
+
? `(${aaIntelToolJsSettings.translation.scanData.npcCorp})` // jshint ignore:line
|
|
276
|
+
: `${_dotlanLinkHtml(corporationData.dotlan)} | ${_zkillboardLinkHtml(corporationData.zkillboard)}`;
|
|
277
|
+
|
|
278
|
+
return _infoPanel({
|
|
279
|
+
imageData: imageData,
|
|
280
|
+
eveData: corporationData.name,
|
|
281
|
+
additionalInfo: additionalInfo,
|
|
282
|
+
logoOnly: logoOnly
|
|
283
|
+
});
|
|
127
284
|
};
|
|
128
285
|
|
|
129
286
|
/**
|
|
130
287
|
* Alliance info element in datatable
|
|
131
288
|
*
|
|
132
|
-
* @param {Object} allianceData
|
|
289
|
+
* @param {Object} allianceData Alliance data
|
|
290
|
+
* @param {int} allianceData.id Alliance ID
|
|
291
|
+
* @param {string} allianceData.name Alliance name
|
|
292
|
+
* @param {string} allianceData.logo URL of the alliance logo
|
|
293
|
+
* @param {string} allianceData.dotlan URL to dotlan
|
|
294
|
+
* @param {string} allianceData.zkillboard URL to zKillboard
|
|
133
295
|
* @param {boolean} logoOnly Returns only the alliance logo
|
|
134
|
-
* @returns {string} HTML construct for the alliance info
|
|
296
|
+
* @returns {'' | `<span class='aa-intel-eve-image-wrapper'>${string}</span><span class='aa-intel-eve-information-wrapper'><span class='aa-intel-eve-name-wrapper'>${string}</span><span class='aa-intel-additional-information-wrapper'><small>${string}</small></span></span>|<span class='aa-intel-eve-image-wrapper'>${string}</span>`} HTML construct for the alliance info
|
|
135
297
|
*/
|
|
136
298
|
const allianceInfoPanel = (allianceData, logoOnly = false) => { // eslint-disable-line no-unused-vars
|
|
137
|
-
|
|
138
|
-
allianceData.name = aaIntelToolJsSettings.translation.scanData.unaffiliated;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const imageData = eveImageHtml(allianceData.id, allianceData.name, allianceData.logo);
|
|
142
|
-
const eveData = allianceData.name;
|
|
143
|
-
let additionalInfo = aaIntelToolJsSettings.translation.scanData.noAlliance;
|
|
144
|
-
|
|
145
|
-
if (allianceData.id > 1) {
|
|
146
|
-
additionalInfo = `${dotlanLinkHtml(allianceData.dotlan)} | ${zkillboardLinkHtml(allianceData.zkillboard)}`;
|
|
147
|
-
}
|
|
299
|
+
const name = allianceData.name || aaIntelToolJsSettings.translation.scanData.unaffiliated;
|
|
148
300
|
|
|
149
|
-
if (logoOnly) {
|
|
150
|
-
|
|
151
|
-
return '';
|
|
152
|
-
}
|
|
301
|
+
if (logoOnly && allianceData.id === 1) {
|
|
302
|
+
return '';
|
|
153
303
|
}
|
|
154
304
|
|
|
155
|
-
|
|
305
|
+
const imageData = _eveImageHtml({
|
|
306
|
+
eveId: allianceData.id,
|
|
307
|
+
eveName: name,
|
|
308
|
+
imageSource: allianceData.logo
|
|
309
|
+
});
|
|
310
|
+
const additionalInfo = allianceData.id > 1
|
|
311
|
+
? `${_dotlanLinkHtml(allianceData.dotlan)} | ${_zkillboardLinkHtml(allianceData.zkillboard)}` // jshint ignore:line
|
|
312
|
+
: aaIntelToolJsSettings.translation.scanData.noAlliance;
|
|
313
|
+
|
|
314
|
+
return _infoPanel({
|
|
315
|
+
imageData: imageData,
|
|
316
|
+
eveData: name,
|
|
317
|
+
additionalInfo: additionalInfo,
|
|
318
|
+
logoOnly: logoOnly
|
|
319
|
+
});
|
|
156
320
|
};
|
|
157
321
|
|
|
158
322
|
/**
|
|
159
323
|
* Ship/Item info element in datatable
|
|
160
324
|
*
|
|
161
|
-
* @param {Object} shipData
|
|
162
|
-
* @
|
|
325
|
+
* @param {Object} shipData Ship data
|
|
326
|
+
* @param {int} shipData.id Ship ID
|
|
327
|
+
* @param {string} shipData.name Ship name
|
|
328
|
+
* @param {string} shipData.image URL of the ship image
|
|
329
|
+
* @returns {`<span class='aa-intel-eve-image-wrapper'>${string}</span><span class='aa-intel-eve-information-wrapper'><span class='aa-intel-eve-name-wrapper'>${string}</span></span>`} HTML construct for the ship info
|
|
163
330
|
*/
|
|
164
331
|
const shipInfoPanel = (shipData) => { // eslint-disable-line no-unused-vars
|
|
165
|
-
const imageData =
|
|
166
|
-
|
|
332
|
+
const imageData = _eveImageHtml({
|
|
333
|
+
eveId: shipData.id,
|
|
334
|
+
eveName: shipData.name,
|
|
335
|
+
imageSource: shipData.image
|
|
336
|
+
});
|
|
167
337
|
|
|
168
|
-
return
|
|
338
|
+
return _infoPanel({imageData: imageData, eveData: shipData.name});
|
|
169
339
|
};
|
|
170
340
|
|
|
171
|
-
$(() => {
|
|
341
|
+
$(document).ready(() => {
|
|
172
342
|
const elementCopyToClipboard = $('button#btn-copy-permalink-to-clipboard');
|
|
173
343
|
|
|
174
344
|
|
|
@@ -179,51 +349,73 @@ $(() => {
|
|
|
179
349
|
elementCopyToClipboard.remove();
|
|
180
350
|
}
|
|
181
351
|
|
|
182
|
-
|
|
183
352
|
/**
|
|
184
353
|
* Closing the message
|
|
185
354
|
*
|
|
186
|
-
* @param {
|
|
187
|
-
* @param {int} closeAfter Close Message after given time in seconds
|
|
355
|
+
* @param {jQuery|HTMLElement} element The element to close
|
|
356
|
+
* @param {int} [closeAfter=10] Close Message after given time in seconds
|
|
357
|
+
* @return {void}
|
|
188
358
|
*/
|
|
189
|
-
const closeMessageElement = (element, closeAfter = 10) => {
|
|
190
|
-
|
|
191
|
-
|
|
359
|
+
const closeMessageElement = ({element, closeAfter = 10}) => {
|
|
360
|
+
element.fadeTo(closeAfter * 1000, 500).slideUp(500, () => {
|
|
361
|
+
element.remove();
|
|
192
362
|
});
|
|
193
363
|
};
|
|
194
364
|
|
|
195
365
|
/**
|
|
196
|
-
* Show a message
|
|
366
|
+
* Show a message (success or error)
|
|
197
367
|
*
|
|
198
|
-
* @param {string} message
|
|
199
|
-
* @param {
|
|
368
|
+
* @param {string} message The message to show
|
|
369
|
+
* @param {jQuery|HTMLElement} element The element to show the message in
|
|
370
|
+
* @param {string} type The message type (e.g.: 'success' or 'error')
|
|
371
|
+
* @return {void}
|
|
200
372
|
*/
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
373
|
+
const showMessage = ({message, element, type}) => {
|
|
374
|
+
const alertClass = type === 'success' ? 'alert-success' : 'alert-danger';
|
|
375
|
+
const messageClass = `alert-message-${type}`;
|
|
376
|
+
const closeAfter = type === 'success' ? 10 : 9999;
|
|
377
|
+
|
|
378
|
+
element.html(
|
|
379
|
+
`<div class="alert ${alertClass} alert-dismissible ${messageClass} d-flex align-items-center fade show">${message}<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>`
|
|
204
380
|
);
|
|
205
381
|
|
|
206
|
-
closeMessageElement(
|
|
382
|
+
closeMessageElement({
|
|
383
|
+
element: $(`.${messageClass}`),
|
|
384
|
+
closeAfter: closeAfter
|
|
385
|
+
});
|
|
207
386
|
};
|
|
208
387
|
|
|
209
388
|
/**
|
|
210
|
-
* Show a message
|
|
389
|
+
* Show a success message
|
|
211
390
|
*
|
|
212
|
-
* @param {string} message
|
|
213
|
-
* @param {
|
|
391
|
+
* @param {string} message The message to show
|
|
392
|
+
* @param {jQuery|HTMLElement} element The element to show the message in
|
|
393
|
+
* @return {void}
|
|
214
394
|
*/
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
395
|
+
const showSuccess = ({message, element}) => showMessage({
|
|
396
|
+
message: message,
|
|
397
|
+
element: element,
|
|
398
|
+
type: 'success'
|
|
399
|
+
});
|
|
219
400
|
|
|
220
|
-
|
|
221
|
-
|
|
401
|
+
/**
|
|
402
|
+
* Show an error message
|
|
403
|
+
*
|
|
404
|
+
* @param {string} message The message to show
|
|
405
|
+
* @param {jQuery|HTMLElement} element The element to show the message in
|
|
406
|
+
* @return {void}
|
|
407
|
+
*/
|
|
408
|
+
const showError = ({message, element}) => showMessage({
|
|
409
|
+
message: message,
|
|
410
|
+
element: element,
|
|
411
|
+
type: 'error'
|
|
412
|
+
});
|
|
222
413
|
|
|
223
414
|
/**
|
|
224
415
|
* Copy the scan link to clipboard
|
|
225
416
|
*
|
|
226
417
|
* @param {string} elementId The HTML-element ID
|
|
418
|
+
* @return {void}
|
|
227
419
|
*/
|
|
228
420
|
const copyScanLink = (elementId) => {
|
|
229
421
|
/**
|
|
@@ -234,37 +426,35 @@ $(() => {
|
|
|
234
426
|
const clipboardScanLink = new ClipboardJS(elementId);
|
|
235
427
|
|
|
236
428
|
/**
|
|
237
|
-
*
|
|
429
|
+
* Handle clipboard operation result
|
|
238
430
|
*
|
|
239
|
-
* @param {
|
|
431
|
+
* @param {boolean} success Whether the operation was successful
|
|
432
|
+
* @param {Event} [e] The event object (for success case)
|
|
433
|
+
* @return {void}
|
|
240
434
|
*/
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
'.aa-intel-copy-result'
|
|
245
|
-
);
|
|
435
|
+
const handleClipboardResult = ({success, e}) => {
|
|
436
|
+
const messageType = success ? 'success' : 'error';
|
|
437
|
+
const message = aaIntelToolJsSettings.translation.copyToClipboard.permalink.text[messageType];
|
|
246
438
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
439
|
+
(success ? showSuccess : showError)({
|
|
440
|
+
message: message,
|
|
441
|
+
element: $('.aa-intel-copy-result')
|
|
442
|
+
});
|
|
250
443
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
clipboardScanLink.on('error', () => {
|
|
255
|
-
showError(
|
|
256
|
-
aaIntelToolJsSettings.translation.copyToClipboard.permalink.text.error,
|
|
257
|
-
'.aa-intel-copy-result'
|
|
258
|
-
);
|
|
444
|
+
if (success && e) {
|
|
445
|
+
e.clearSelection();
|
|
446
|
+
}
|
|
259
447
|
|
|
260
448
|
clipboardScanLink.destroy();
|
|
261
|
-
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
clipboardScanLink
|
|
452
|
+
.on('success', (e) => handleClipboardResult({success: true, e: e}))
|
|
453
|
+
.on('error', () => handleClipboardResult({success: false}));
|
|
262
454
|
};
|
|
263
455
|
|
|
264
|
-
|
|
265
|
-
* Copy ping text
|
|
266
|
-
*/
|
|
456
|
+
// Copy ping text
|
|
267
457
|
elementCopyToClipboard.click(() => {
|
|
268
|
-
copyScanLink(
|
|
458
|
+
copyScanLink(`#${elementCopyToClipboard.attr('id')}`);
|
|
269
459
|
});
|
|
270
460
|
});
|