aa-intel-tool 2.8.0__py3-none-any.whl → 2.8.1__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 +333 -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.8.1.dist-info}/METADATA +1 -1
- {aa_intel_tool-2.8.0.dist-info → aa_intel_tool-2.8.1.dist-info}/RECORD +32 -32
- {aa_intel_tool-2.8.0.dist-info → aa_intel_tool-2.8.1.dist-info}/WHEEL +0 -0
- {aa_intel_tool-2.8.0.dist-info → aa_intel_tool-2.8.1.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","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-fleetcomposition.js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,gBAGdQ,MAAO,CACH,CAAC,EAAG,QAERC,WAAY,CACR,CACIC,QAAS,EACTC,YAAcC,IACVhC,EAAEgC,GAAIlB,SAAS,6BAI3BqB,WAAY,CAACC,EAAKhB,KAEd,MAAMuC,EAAexD,EAASK,YAAYiC,OACpCmB,EAAWrB,SAASoB,GAAgB,EAE1CxD,EAASK,YAAYiC,KAAKmB,GAE1B5D,EAAEoC,GACGtB,SAAS,iDAAiDM,EAAKyC,gCAAgCzC,EAAK0C,gBACpGjB,KAAK,oBAAqBzB,EAAKyC,SAC/BhB,KAAK,mBAAoBzB,EAAK0C,eAEvChB,aAAc,KACV,MAAMC,EAAgB/C,EAAE,4BAExBgD,gCAAgC,CAC5BC,QAASF,EACTG,KAAM,aAIVC,iBAAiB,CAACC,SAAU,gDAM/CC,MAAOC,IACJC,QAAQD,MAAM,yCAA0CA","ignoreList":[]}
|
|
@@ -1,17 +1,149 @@
|
|
|
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
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Number formatter
|
|
123
|
+
*
|
|
124
|
+
* @param {number} value The number to format
|
|
125
|
+
* @return {string} The formatted number
|
|
126
|
+
* @private
|
|
127
|
+
*/
|
|
128
|
+
const _numberFormatter = (value) => { // eslint-disable-line no-unused-vars
|
|
129
|
+
return new Intl.NumberFormat(aaIntelToolJsSettings.language.django).format(value);
|
|
130
|
+
};
|
|
131
|
+
|
|
6
132
|
/**
|
|
7
133
|
* Bootstrap tooltip
|
|
8
134
|
*
|
|
9
|
-
* @param {string} selector
|
|
135
|
+
* @param {string} [selector=body] Selector for the tooltip elements, defaults to 'body'
|
|
136
|
+
* to apply to all elements with the data-bs-tooltip attribute.
|
|
137
|
+
* Example: 'body', '.my-tooltip-class', '#my-tooltip-id'
|
|
138
|
+
* If you want to apply it to a specific element, use that element's selector.
|
|
139
|
+
* If you want to apply it to all elements with the data-bs-tooltip attribute,
|
|
140
|
+
* use 'body' or leave it empty.
|
|
141
|
+
* @param {string} [namespace=aa-intel-tool] Namespace for the tooltip
|
|
142
|
+
* @returns {void}
|
|
10
143
|
*/
|
|
11
|
-
const bootstrapTooltip = (selector = 'body') => { // eslint-disable-line no-unused-vars
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.map((tooltipTriggerEl) => {
|
|
144
|
+
const bootstrapTooltip = ({selector = 'body', namespace = 'aa-intel-tool'}) => { // eslint-disable-line no-unused-vars
|
|
145
|
+
document.querySelectorAll(`${selector} [data-bs-tooltip="${namespace}"]`)
|
|
146
|
+
.forEach((tooltipTriggerEl) => {
|
|
15
147
|
return new bootstrap.Tooltip(tooltipTriggerEl);
|
|
16
148
|
});
|
|
17
149
|
};
|
|
@@ -19,156 +151,205 @@ const bootstrapTooltip = (selector = 'body') => { // eslint-disable-line no-unus
|
|
|
19
151
|
/**
|
|
20
152
|
* Get the image HTML string for an Eve portrait or logo
|
|
21
153
|
*
|
|
22
|
-
* @param {int} eveId
|
|
23
|
-
* @param {string} eveName
|
|
24
|
-
* @param {string} imageSource
|
|
25
|
-
* @param {int} imageSize
|
|
154
|
+
* @param {int} eveId Eve ID of the entity
|
|
155
|
+
* @param {string} eveName Name of the entity
|
|
156
|
+
* @param {string} imageSource URL of the image
|
|
157
|
+
* @param {int} [imageSize=32] Size of the image (width and height)
|
|
26
158
|
* @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}'>`}
|
|
159
|
+
* @private
|
|
27
160
|
*/
|
|
28
|
-
const
|
|
161
|
+
const _eveImageHtml = ({eveId, eveName, imageSource, imageSize = 32}) => {
|
|
29
162
|
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
163
|
};
|
|
31
164
|
|
|
32
165
|
/**
|
|
33
|
-
* Get the link HTML to EveWho for a pilot
|
|
34
166
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
167
|
+
* Get the link HTML for external services
|
|
168
|
+
*
|
|
169
|
+
* @param {string} serviceName Name of the external service
|
|
170
|
+
* @param {string} href URL of the external service
|
|
171
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>${string}</a>`} HTML string for the external service link
|
|
172
|
+
* @private
|
|
37
173
|
*/
|
|
38
|
-
const
|
|
39
|
-
return `<a class="aa-intel-information-link" href="${href}" target="_blank" rel="noopener noreferer"
|
|
174
|
+
const _externalLinkHtml = ({serviceName, href}) => {
|
|
175
|
+
return `<a class="aa-intel-information-link" href="${href}" target="_blank" rel="noopener noreferer">${serviceName}</a>`;
|
|
40
176
|
};
|
|
41
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Get the link HTML to EveWho for a pilot
|
|
180
|
+
*
|
|
181
|
+
* @param {string} href URL of the external service
|
|
182
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>evewho</a>`} HTML string for the EveWho link
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
const _eveWhoLinkHtml = (href) => _externalLinkHtml({
|
|
186
|
+
serviceName: 'evewho',
|
|
187
|
+
href: href
|
|
188
|
+
});
|
|
189
|
+
|
|
42
190
|
/**
|
|
43
191
|
* Get the link HTML to zKillboard
|
|
44
192
|
*
|
|
45
|
-
* @param {string} href
|
|
46
|
-
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>zkillboard
|
|
193
|
+
* @param {string} href URL of the external service
|
|
194
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>zkillboard</a>`} HTML string for the zKillboard link
|
|
195
|
+
* @private
|
|
47
196
|
*/
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
197
|
+
const _zkillboardLinkHtml = (href) => _externalLinkHtml({
|
|
198
|
+
serviceName: 'zkillboard',
|
|
199
|
+
href: href
|
|
200
|
+
});
|
|
51
201
|
|
|
52
202
|
/**
|
|
53
203
|
* Get the link HTML to dotlan
|
|
54
204
|
*
|
|
55
|
-
* @param {string} href
|
|
56
|
-
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>dotlan
|
|
205
|
+
* @param {string} href URL of the external service
|
|
206
|
+
* @returns {`<a class='aa-intel-information-link' href='${string}' target='_blank' rel='noopener noreferer'>dotlan</a>`} HTML string for the dotlan link
|
|
207
|
+
* @private
|
|
57
208
|
*/
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
209
|
+
const _dotlanLinkHtml = (href) => _externalLinkHtml({
|
|
210
|
+
serviceName: 'dotlan',
|
|
211
|
+
href: href
|
|
212
|
+
});
|
|
61
213
|
|
|
62
214
|
/**
|
|
63
215
|
* Info panel for the datatable
|
|
64
216
|
*
|
|
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
|
|
217
|
+
* @param {string} imageData HTML for the image
|
|
218
|
+
* @param {string} eveData Name of the entity
|
|
219
|
+
* @param {string} [additionalInfo=''] Additional information (links etc.)
|
|
220
|
+
* @param {boolean} [logoOnly=false] Returns only the logo
|
|
221
|
+
* @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
|
|
222
|
+
* @private
|
|
70
223
|
*/
|
|
71
|
-
const
|
|
72
|
-
imageData,
|
|
73
|
-
eveData,
|
|
74
|
-
additionalInfo = '',
|
|
75
|
-
logoOnly = false
|
|
76
|
-
) => {
|
|
224
|
+
const _infoPanel = ({imageData, eveData, additionalInfo = '', logoOnly = false}) => {
|
|
77
225
|
const imageDataHtml = `<span class="aa-intel-eve-image-wrapper">${imageData}</span>`;
|
|
78
226
|
|
|
79
227
|
if (logoOnly) {
|
|
80
228
|
return imageDataHtml;
|
|
81
229
|
}
|
|
82
230
|
|
|
83
|
-
|
|
231
|
+
const nameWrapper = `<span class="aa-intel-eve-name-wrapper">${eveData}</span>`;
|
|
232
|
+
const additionalWrapper = additionalInfo
|
|
233
|
+
? `<span class="aa-intel-additional-information-wrapper"><small>${additionalInfo}</small></span>` // jshint ignore:line
|
|
234
|
+
: '';
|
|
84
235
|
|
|
85
|
-
|
|
86
|
-
eveDataHtml += `<span class="aa-intel-additional-information-wrapper"><small>${additionalInfo}</small></span>`;
|
|
87
|
-
} else {
|
|
88
|
-
eveDataHtml += `</span>`;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return imageDataHtml + eveDataHtml;
|
|
236
|
+
return `${imageDataHtml}<span class="aa-intel-eve-information-wrapper">${nameWrapper}${additionalWrapper}</span>`;
|
|
92
237
|
};
|
|
93
238
|
|
|
94
239
|
/**
|
|
95
240
|
* Pilot info element in datatable
|
|
96
241
|
*
|
|
97
|
-
* @param {Object} pilotData
|
|
98
|
-
* @
|
|
242
|
+
* @param {Object} pilotData Pilot data
|
|
243
|
+
* @param {int} pilotData.id Pilot ID
|
|
244
|
+
* @param {string} pilotData.name Pilot name
|
|
245
|
+
* @param {string} pilotData.portrait URL of the pilot portrait
|
|
246
|
+
* @param {string} pilotData.evewho URL to EveWho
|
|
247
|
+
* @param {string} pilotData.zkillboard URL to zKillboard
|
|
248
|
+
* @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
249
|
*/
|
|
100
250
|
const pilotInfoPanel = (pilotData) => { // eslint-disable-line no-unused-vars
|
|
101
|
-
const imageData =
|
|
102
|
-
|
|
103
|
-
|
|
251
|
+
const imageData = _eveImageHtml({
|
|
252
|
+
eveId: pilotData.id,
|
|
253
|
+
eveName: pilotData.name,
|
|
254
|
+
imageSource: pilotData.portrait
|
|
255
|
+
});
|
|
256
|
+
const additionalInfo = `${_eveWhoLinkHtml(pilotData.evewho)} | ${_zkillboardLinkHtml(pilotData.zkillboard)}`;
|
|
104
257
|
|
|
105
|
-
return
|
|
258
|
+
return _infoPanel({
|
|
259
|
+
imageData: imageData,
|
|
260
|
+
eveData: pilotData.name,
|
|
261
|
+
additionalInfo: additionalInfo
|
|
262
|
+
});
|
|
106
263
|
};
|
|
107
264
|
|
|
108
265
|
/**
|
|
109
266
|
* Corporation info element in datatable
|
|
110
267
|
*
|
|
111
|
-
* @param {Object} corporationData
|
|
268
|
+
* @param {Object} corporationData Corporation data
|
|
269
|
+
* @param {int} corporationData.id Corporation ID
|
|
270
|
+
* @param {string} corporationData.name Corporation name
|
|
271
|
+
* @param {string} corporationData.logo URL of the corporation logo
|
|
272
|
+
* @param {string} corporationData.dotlan URL to dotlan
|
|
273
|
+
* @param {string} corporationData.zkillboard URL to zKillboard
|
|
112
274
|
* @param {boolean} logoOnly Returns only the corporation logo
|
|
113
|
-
* @returns {string} HTML construct for the corporation info
|
|
275
|
+
* @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
276
|
*/
|
|
115
277
|
const corporationInfoPanel = (corporationData, logoOnly = false) => { // eslint-disable-line no-unused-vars
|
|
116
|
-
const imageData =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
278
|
+
const imageData = _eveImageHtml({
|
|
279
|
+
eveId: corporationData.id,
|
|
280
|
+
eveName: corporationData.name,
|
|
281
|
+
imageSource: corporationData.logo
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const isNpcCorp = corporationData.id >= 1000000 && corporationData.id <= 2000000;
|
|
285
|
+
const additionalInfo = isNpcCorp
|
|
286
|
+
? `(${aaIntelToolJsSettings.translation.scanData.npcCorp})` // jshint ignore:line
|
|
287
|
+
: `${_dotlanLinkHtml(corporationData.dotlan)} | ${_zkillboardLinkHtml(corporationData.zkillboard)}`;
|
|
125
288
|
|
|
126
|
-
return
|
|
289
|
+
return _infoPanel({
|
|
290
|
+
imageData: imageData,
|
|
291
|
+
eveData: corporationData.name,
|
|
292
|
+
additionalInfo: additionalInfo,
|
|
293
|
+
logoOnly: logoOnly
|
|
294
|
+
});
|
|
127
295
|
};
|
|
128
296
|
|
|
129
297
|
/**
|
|
130
298
|
* Alliance info element in datatable
|
|
131
299
|
*
|
|
132
|
-
* @param {Object} allianceData
|
|
300
|
+
* @param {Object} allianceData Alliance data
|
|
301
|
+
* @param {int} allianceData.id Alliance ID
|
|
302
|
+
* @param {string} allianceData.name Alliance name
|
|
303
|
+
* @param {string} allianceData.logo URL of the alliance logo
|
|
304
|
+
* @param {string} allianceData.dotlan URL to dotlan
|
|
305
|
+
* @param {string} allianceData.zkillboard URL to zKillboard
|
|
133
306
|
* @param {boolean} logoOnly Returns only the alliance logo
|
|
134
|
-
* @returns {string} HTML construct for the alliance info
|
|
307
|
+
* @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
308
|
*/
|
|
136
309
|
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;
|
|
310
|
+
const name = allianceData.name || aaIntelToolJsSettings.translation.scanData.unaffiliated;
|
|
144
311
|
|
|
145
|
-
if (allianceData.id
|
|
146
|
-
|
|
312
|
+
if (logoOnly && allianceData.id === 1) {
|
|
313
|
+
return '';
|
|
147
314
|
}
|
|
148
315
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
316
|
+
const imageData = _eveImageHtml({
|
|
317
|
+
eveId: allianceData.id,
|
|
318
|
+
eveName: name,
|
|
319
|
+
imageSource: allianceData.logo
|
|
320
|
+
});
|
|
321
|
+
const additionalInfo = allianceData.id > 1
|
|
322
|
+
? `${_dotlanLinkHtml(allianceData.dotlan)} | ${_zkillboardLinkHtml(allianceData.zkillboard)}` // jshint ignore:line
|
|
323
|
+
: aaIntelToolJsSettings.translation.scanData.noAlliance;
|
|
324
|
+
|
|
325
|
+
return _infoPanel({
|
|
326
|
+
imageData: imageData,
|
|
327
|
+
eveData: name,
|
|
328
|
+
additionalInfo: additionalInfo,
|
|
329
|
+
logoOnly: logoOnly
|
|
330
|
+
});
|
|
156
331
|
};
|
|
157
332
|
|
|
158
333
|
/**
|
|
159
334
|
* Ship/Item info element in datatable
|
|
160
335
|
*
|
|
161
|
-
* @param {Object} shipData
|
|
162
|
-
* @
|
|
336
|
+
* @param {Object} shipData Ship data
|
|
337
|
+
* @param {int} shipData.id Ship ID
|
|
338
|
+
* @param {string} shipData.name Ship name
|
|
339
|
+
* @param {string} shipData.image URL of the ship image
|
|
340
|
+
* @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
341
|
*/
|
|
164
342
|
const shipInfoPanel = (shipData) => { // eslint-disable-line no-unused-vars
|
|
165
|
-
const imageData =
|
|
166
|
-
|
|
343
|
+
const imageData = _eveImageHtml({
|
|
344
|
+
eveId: shipData.id,
|
|
345
|
+
eveName: shipData.name,
|
|
346
|
+
imageSource: shipData.image
|
|
347
|
+
});
|
|
167
348
|
|
|
168
|
-
return
|
|
349
|
+
return _infoPanel({imageData: imageData, eveData: shipData.name});
|
|
169
350
|
};
|
|
170
351
|
|
|
171
|
-
$(() => {
|
|
352
|
+
$(document).ready(() => {
|
|
172
353
|
const elementCopyToClipboard = $('button#btn-copy-permalink-to-clipboard');
|
|
173
354
|
|
|
174
355
|
|
|
@@ -179,51 +360,73 @@ $(() => {
|
|
|
179
360
|
elementCopyToClipboard.remove();
|
|
180
361
|
}
|
|
181
362
|
|
|
182
|
-
|
|
183
363
|
/**
|
|
184
364
|
* Closing the message
|
|
185
365
|
*
|
|
186
|
-
* @param {
|
|
187
|
-
* @param {int} closeAfter Close Message after given time in seconds
|
|
366
|
+
* @param {jQuery|HTMLElement} element The element to close
|
|
367
|
+
* @param {int} [closeAfter=10] Close Message after given time in seconds
|
|
368
|
+
* @return {void}
|
|
188
369
|
*/
|
|
189
|
-
const closeMessageElement = (element, closeAfter = 10) => {
|
|
190
|
-
|
|
191
|
-
|
|
370
|
+
const closeMessageElement = ({element, closeAfter = 10}) => {
|
|
371
|
+
element.fadeTo(closeAfter * 1000, 500).slideUp(500, () => {
|
|
372
|
+
element.remove();
|
|
192
373
|
});
|
|
193
374
|
};
|
|
194
375
|
|
|
195
376
|
/**
|
|
196
|
-
* Show a message
|
|
377
|
+
* Show a message (success or error)
|
|
197
378
|
*
|
|
198
|
-
* @param {string} message
|
|
199
|
-
* @param {
|
|
379
|
+
* @param {string} message The message to show
|
|
380
|
+
* @param {jQuery|HTMLElement} element The element to show the message in
|
|
381
|
+
* @param {string} type The message type (e.g.: 'success' or 'error')
|
|
382
|
+
* @return {void}
|
|
200
383
|
*/
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
384
|
+
const showMessage = ({message, element, type}) => {
|
|
385
|
+
const alertClass = type === 'success' ? 'alert-success' : 'alert-danger';
|
|
386
|
+
const messageClass = `alert-message-${type}`;
|
|
387
|
+
const closeAfter = type === 'success' ? 10 : 9999;
|
|
388
|
+
|
|
389
|
+
element.html(
|
|
390
|
+
`<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
391
|
);
|
|
205
392
|
|
|
206
|
-
closeMessageElement(
|
|
393
|
+
closeMessageElement({
|
|
394
|
+
element: $(`.${messageClass}`),
|
|
395
|
+
closeAfter: closeAfter
|
|
396
|
+
});
|
|
207
397
|
};
|
|
208
398
|
|
|
209
399
|
/**
|
|
210
|
-
* Show a message
|
|
400
|
+
* Show a success message
|
|
211
401
|
*
|
|
212
|
-
* @param {string} message
|
|
213
|
-
* @param {
|
|
402
|
+
* @param {string} message The message to show
|
|
403
|
+
* @param {jQuery|HTMLElement} element The element to show the message in
|
|
404
|
+
* @return {void}
|
|
214
405
|
*/
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
406
|
+
const showSuccess = ({message, element}) => showMessage({
|
|
407
|
+
message: message,
|
|
408
|
+
element: element,
|
|
409
|
+
type: 'success'
|
|
410
|
+
});
|
|
219
411
|
|
|
220
|
-
|
|
221
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Show an error message
|
|
414
|
+
*
|
|
415
|
+
* @param {string} message The message to show
|
|
416
|
+
* @param {jQuery|HTMLElement} element The element to show the message in
|
|
417
|
+
* @return {void}
|
|
418
|
+
*/
|
|
419
|
+
const showError = ({message, element}) => showMessage({
|
|
420
|
+
message: message,
|
|
421
|
+
element: element,
|
|
422
|
+
type: 'error'
|
|
423
|
+
});
|
|
222
424
|
|
|
223
425
|
/**
|
|
224
426
|
* Copy the scan link to clipboard
|
|
225
427
|
*
|
|
226
428
|
* @param {string} elementId The HTML-element ID
|
|
429
|
+
* @return {void}
|
|
227
430
|
*/
|
|
228
431
|
const copyScanLink = (elementId) => {
|
|
229
432
|
/**
|
|
@@ -234,37 +437,35 @@ $(() => {
|
|
|
234
437
|
const clipboardScanLink = new ClipboardJS(elementId);
|
|
235
438
|
|
|
236
439
|
/**
|
|
237
|
-
*
|
|
440
|
+
* Handle clipboard operation result
|
|
238
441
|
*
|
|
239
|
-
* @param {
|
|
442
|
+
* @param {boolean} success Whether the operation was successful
|
|
443
|
+
* @param {Event} [e] The event object (for success case)
|
|
444
|
+
* @return {void}
|
|
240
445
|
*/
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
'.aa-intel-copy-result'
|
|
245
|
-
);
|
|
446
|
+
const handleClipboardResult = ({success, e}) => {
|
|
447
|
+
const messageType = success ? 'success' : 'error';
|
|
448
|
+
const message = aaIntelToolJsSettings.translation.copyToClipboard.permalink.text[messageType];
|
|
246
449
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
450
|
+
(success ? showSuccess : showError)({
|
|
451
|
+
message: message,
|
|
452
|
+
element: $('.aa-intel-copy-result')
|
|
453
|
+
});
|
|
250
454
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
clipboardScanLink.on('error', () => {
|
|
255
|
-
showError(
|
|
256
|
-
aaIntelToolJsSettings.translation.copyToClipboard.permalink.text.error,
|
|
257
|
-
'.aa-intel-copy-result'
|
|
258
|
-
);
|
|
455
|
+
if (success && e) {
|
|
456
|
+
e.clearSelection();
|
|
457
|
+
}
|
|
259
458
|
|
|
260
459
|
clipboardScanLink.destroy();
|
|
261
|
-
}
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
clipboardScanLink
|
|
463
|
+
.on('success', (e) => handleClipboardResult({success: true, e: e}))
|
|
464
|
+
.on('error', () => handleClipboardResult({success: false}));
|
|
262
465
|
};
|
|
263
466
|
|
|
264
|
-
|
|
265
|
-
* Copy ping text
|
|
266
|
-
*/
|
|
467
|
+
// Copy ping text
|
|
267
468
|
elementCopyToClipboard.click(() => {
|
|
268
|
-
copyScanLink(
|
|
469
|
+
copyScanLink(`#${elementCopyToClipboard.attr('id')}`);
|
|
269
470
|
});
|
|
270
471
|
});
|