aa-sov-timer 2.5.1__tar.gz → 2.6.0__tar.gz

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.
Files changed (85) hide show
  1. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/PKG-INFO +6 -7
  2. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/README.md +4 -4
  3. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/pyproject.toml +1 -2
  4. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/__init__.py +1 -1
  5. aa_sov_timer-2.6.0/sovtimer/static/sovtimer/js/aa-sov-timer.js +308 -0
  6. aa_sov_timer-2.6.0/sovtimer/static/sovtimer/js/aa-sov-timer.min.js +2 -0
  7. aa_sov_timer-2.6.0/sovtimer/static/sovtimer/js/aa-sov-timer.min.js.map +1 -0
  8. aa_sov_timer-2.5.1/sovtimer/static/sovtimer/js/aa-sov-timer.js +0 -353
  9. aa_sov_timer-2.5.1/sovtimer/static/sovtimer/js/aa-sov-timer.min.js +0 -2
  10. aa_sov_timer-2.5.1/sovtimer/static/sovtimer/js/aa-sov-timer.min.js.map +0 -1
  11. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/.gitignore +0 -0
  12. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/LICENSE +0 -0
  13. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/app_settings.py +0 -0
  14. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/apps.py +0 -0
  15. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/auth_hooks.py +0 -0
  16. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/constants.py +0 -0
  17. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/.gitkeep +0 -0
  18. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  19. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/cs_CZ/LC_MESSAGES/django.po +0 -0
  20. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/de/LC_MESSAGES/django.mo +0 -0
  21. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/de/LC_MESSAGES/django.po +0 -0
  22. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/django.pot +0 -0
  23. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/es/LC_MESSAGES/django.mo +0 -0
  24. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/es/LC_MESSAGES/django.po +0 -0
  25. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
  26. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/fr_FR/LC_MESSAGES/django.po +0 -0
  27. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/it_IT/LC_MESSAGES/django.mo +0 -0
  28. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/it_IT/LC_MESSAGES/django.po +0 -0
  29. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/ja/LC_MESSAGES/django.mo +0 -0
  30. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/ja/LC_MESSAGES/django.po +0 -0
  31. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
  32. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/ko_KR/LC_MESSAGES/django.po +0 -0
  33. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
  34. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/nl_NL/LC_MESSAGES/django.po +0 -0
  35. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
  36. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/pl_PL/LC_MESSAGES/django.po +0 -0
  37. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/ru/LC_MESSAGES/django.mo +0 -0
  38. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/ru/LC_MESSAGES/django.po +0 -0
  39. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/sk/LC_MESSAGES/django.mo +0 -0
  40. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/sk/LC_MESSAGES/django.po +0 -0
  41. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/uk/LC_MESSAGES/django.mo +0 -0
  42. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/uk/LC_MESSAGES/django.po +0 -0
  43. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  44. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/locale/zh_Hans/LC_MESSAGES/django.po +0 -0
  45. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/management/commands/__init__.py +0 -0
  46. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/management/commands/sovtimer_load_initial_data.py +0 -0
  47. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0001_initial.py +0 -0
  48. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0002_aasovtimercampaigns_aasovtimerstructures.py +0 -0
  49. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0003_auto_20201113_1033.py +0 -0
  50. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0004_auto_20201113_1856.py +0 -0
  51. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0005_auto_20201114_0720.py +0 -0
  52. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0006_rename_models.py +0 -0
  53. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0007_cleanup_models.py +0 -0
  54. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0008_fix_campaign_attackers_score.py +0 -0
  55. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0009_alter_campaign_options_and_more.py +0 -0
  56. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/0010_alter_campaign_event_type.py +0 -0
  57. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/migrations/__init__.py +0 -0
  58. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/models.py +0 -0
  59. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/providers.py +0 -0
  60. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/static/sovtimer/css/aa-sov-timer.css +0 -0
  61. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/static/sovtimer/css/aa-sov-timer.min.css +0 -0
  62. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/static/sovtimer/css/aa-sov-timer.min.css.map +0 -0
  63. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/static/sovtimer/font/materialicons/v143/MaterialIcons-Regular.woff2 +0 -0
  64. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/static/sovtimer/font/materialicons/v143/README.md +0 -0
  65. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/static/sovtimer/images/zkillboard.png +0 -0
  66. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tasks.py +0 -0
  67. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/templates/sovtimer/base.html +0 -0
  68. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/templates/sovtimer/bundles/aa-sov-timer-css.html +0 -0
  69. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/templates/sovtimer/bundles/aa-sov-timer-js.html +0 -0
  70. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/templates/sovtimer/dashboard.html +0 -0
  71. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/templates/sovtimer/partials/dashboard/table.html +0 -0
  72. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/templates/sovtimer/partials/footer/app-translation-footer.html +0 -0
  73. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/__init__.py +0 -0
  74. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/fixtures/allianceauth.json +0 -0
  75. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/fixtures/load_allianceauth.py +0 -0
  76. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/fixtures/load_sovtimer.py +0 -0
  77. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/fixtures/sovtimer.json +0 -0
  78. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/fixtures/utils.py +0 -0
  79. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/test_ajax_calls.py +0 -0
  80. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/test_app_settings.py +0 -0
  81. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/test_integration.py +0 -0
  82. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/test_user_agent.py +0 -0
  83. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/tests/utils.py +0 -0
  84. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/urls.py +0 -0
  85. {aa_sov_timer-2.5.1 → aa_sov_timer-2.6.0}/sovtimer/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aa-sov-timer
3
- Version: 2.5.1
3
+ Version: 2.6.0
4
4
  Summary: Sov Campaign Timer for Alliance Auth
5
5
  Project-URL: Changelog, https://github.com/ppfeufer/aa-sov-timer/blob/master/CHANGELOG.md
6
6
  Project-URL: Documentation, https://github.com/ppfeufer/aa-sov-timer/blob/master/README.md
@@ -701,8 +701,7 @@ Classifier: Topic :: Internet :: WWW/HTTP
701
701
  Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
702
702
  Requires-Python: >=3.10
703
703
  Requires-Dist: allianceauth-app-utils>=1.25
704
- Requires-Dist: allianceauth<5,>=4.6
705
- Requires-Dist: django-esi>=7.0.1
704
+ Requires-Dist: allianceauth<5,>=4.9
706
705
  Requires-Dist: django-eveuniverse>=1.5.4
707
706
  Provides-Extra: tests-allianceauth-latest
708
707
  Requires-Dist: coverage; extra == 'tests-allianceauth-latest'
@@ -785,7 +784,7 @@ Make sure you're in the virtual environment (venv) of your Alliance Auth install
785
784
  Then install the latest version:
786
785
 
787
786
  ```shell
788
- pip install aa-sov-timer==2.5.1
787
+ pip install aa-sov-timer==2.6.0
789
788
  ```
790
789
 
791
790
  #### Step 2: Update Your AA Settings<a name="step-2-update-your-aa-settings"></a>
@@ -846,7 +845,7 @@ Now your system is updating the sovereignty campaigns every 30 seconds.
846
845
  Add the app to your `conf/requirements.txt`:
847
846
 
848
847
  ```text
849
- aa-sov-timer==2.5.1
848
+ aa-sov-timer==2.6.0
850
849
  ```
851
850
 
852
851
  #### Step 2: Update Your AA Settings<a name="step-2-update-your-aa-settings-1"></a>
@@ -897,7 +896,7 @@ Then run the following commands from your AA project directory (the one that
897
896
  contains `manage.py`).
898
897
 
899
898
  ```shell
900
- pip install aa-sov-timer==2.5.1
899
+ pip install aa-sov-timer==2.6.0
901
900
 
902
901
  python manage.py collectstatic
903
902
  python manage.py migrate
@@ -910,7 +909,7 @@ Finally, restart your AA supervisor service.
910
909
  To update your existing installation of AA Sovereignty Timer, all you need to do is to update the respective line in your `conf/requirements.txt` file to the latest version.
911
910
 
912
911
  ```text
913
- aa-sov-timer==2.5.1
912
+ aa-sov-timer==2.6.0
914
913
  ```
915
914
 
916
915
  Now rebuild your containers and restart them:
@@ -74,7 +74,7 @@ Make sure you're in the virtual environment (venv) of your Alliance Auth install
74
74
  Then install the latest version:
75
75
 
76
76
  ```shell
77
- pip install aa-sov-timer==2.5.1
77
+ pip install aa-sov-timer==2.6.0
78
78
  ```
79
79
 
80
80
  #### Step 2: Update Your AA Settings<a name="step-2-update-your-aa-settings"></a>
@@ -135,7 +135,7 @@ Now your system is updating the sovereignty campaigns every 30 seconds.
135
135
  Add the app to your `conf/requirements.txt`:
136
136
 
137
137
  ```text
138
- aa-sov-timer==2.5.1
138
+ aa-sov-timer==2.6.0
139
139
  ```
140
140
 
141
141
  #### Step 2: Update Your AA Settings<a name="step-2-update-your-aa-settings-1"></a>
@@ -186,7 +186,7 @@ Then run the following commands from your AA project directory (the one that
186
186
  contains `manage.py`).
187
187
 
188
188
  ```shell
189
- pip install aa-sov-timer==2.5.1
189
+ pip install aa-sov-timer==2.6.0
190
190
 
191
191
  python manage.py collectstatic
192
192
  python manage.py migrate
@@ -199,7 +199,7 @@ Finally, restart your AA supervisor service.
199
199
  To update your existing installation of AA Sovereignty Timer, all you need to do is to update the respective line in your `conf/requirements.txt` file to the latest version.
200
200
 
201
201
  ```text
202
- aa-sov-timer==2.5.1
202
+ aa-sov-timer==2.6.0
203
203
  ```
204
204
 
205
205
  Now rebuild your containers and restart them:
@@ -39,9 +39,8 @@ dynamic = [
39
39
  "version",
40
40
  ]
41
41
  dependencies = [
42
- "allianceauth>=4.6,<5",
42
+ "allianceauth>=4.9,<5",
43
43
  "allianceauth-app-utils>=1.25",
44
- "django-esi>=7.0.1",
45
44
  "django-eveuniverse>=1.5.4",
46
45
  ]
47
46
  optional-dependencies.tests-allianceauth-latest = [
@@ -5,7 +5,7 @@ App init
5
5
  # Django
6
6
  from django.utils.translation import gettext_lazy as _
7
7
 
8
- __version__ = "2.5.1"
8
+ __version__ = "2.6.0"
9
9
  __title__ = _("Sovereignty Timers")
10
10
 
11
11
  __package_name__ = "aa-sov-timer"
@@ -0,0 +1,308 @@
1
+ /* global sovtimerJsSettingsDefaults, sovtimerJsSettingsOverride, moment, objectDeepMerge, fetchGet */
2
+
3
+ $(document).ready(() => {
4
+ 'use strict';
5
+
6
+ // Build the settings object
7
+ let sovtimerSettings = sovtimerJsSettingsDefaults;
8
+
9
+ if (typeof sovtimerJsSettingsOverride !== 'undefined') {
10
+ sovtimerSettings = objectDeepMerge(
11
+ sovtimerJsSettingsDefaults,
12
+ sovtimerJsSettingsOverride
13
+ );
14
+ }
15
+
16
+ const elementTimerTotal = $('.aa-sovtimer-campaigns-total');
17
+ const elementTimerUpcoming = $('.aa-sovtimer-campaigns-upcoming');
18
+ const elementTimerActive = $('.aa-sovtimer-campaigns-active');
19
+
20
+ /**
21
+ * Convert seconds into a time string
22
+ *
23
+ * @param {string|int} secondsRemaining
24
+ * @returns {{countdown: string, remainingTimeInSeconds: string|int}}
25
+ */
26
+ const secondsToRemainingTime = (secondsRemaining) => {
27
+ let prefix = '';
28
+ let spanClasses = 'aa-sovtimer-remaining';
29
+
30
+ if (secondsRemaining < 0) {
31
+ spanClasses += ' aa-sovtimer-timer-elapsed';
32
+ prefix = '-';
33
+
34
+ secondsRemaining = Math.abs(secondsRemaining); // Remove negative prefix
35
+
36
+ secondsRemaining++; // Increment with one second each second
37
+ } else {
38
+ secondsRemaining--; // Decrement with one second each second
39
+ }
40
+
41
+ const days = Math.floor(secondsRemaining / (24 * 60 * 60)); // Calculate days
42
+ let hours = Math.floor(secondsRemaining / (60 * 60)) % 24; // Hours
43
+ let minutes = Math.floor(secondsRemaining / 60) % 60; // Minutes
44
+ let seconds = Math.floor(secondsRemaining) % 60; // Seconds
45
+
46
+ // leading zero ...
47
+ if (hours < 10) {
48
+ hours = '0' + hours;
49
+ }
50
+
51
+ if (minutes < 10) {
52
+ minutes = '0' + minutes;
53
+ }
54
+
55
+ if (seconds < 10) {
56
+ seconds = '0' + seconds;
57
+ }
58
+
59
+ return {
60
+ countdown: `<span class="${spanClasses}">${prefix}${days}d ${hours}h ${minutes}m ${seconds}s</span>`,
61
+ remainingTimeInSeconds: prefix + secondsRemaining
62
+ };
63
+ };
64
+
65
+ /**
66
+ * Build the datatable
67
+ *
68
+ * @type {jQuery}
69
+ */
70
+ const sovCampaignTable = $('.aa-sovtimer-campaigns');
71
+
72
+ fetchGet({url: sovtimerSettings.url.ajaxUpdate})
73
+ .then((tableData) => {
74
+ if (tableData) {
75
+ sovCampaignTable.DataTable({
76
+ language: sovtimerSettings.dataTables.language,
77
+ data: tableData,
78
+ columns: [
79
+ // Column: 0
80
+ {
81
+ data: 'event_type'
82
+ },
83
+
84
+ // Column: 1
85
+ {
86
+ data: 'solar_system_name_html'
87
+ },
88
+
89
+ // Column: 2
90
+ {
91
+ data: 'constellation_name_html'
92
+ },
93
+
94
+ // Column: 3
95
+ {
96
+ data: 'region_name_html'
97
+ },
98
+
99
+ // Column: 4
100
+ {
101
+ data: 'defender_name_html'
102
+ },
103
+
104
+ // Column: 5
105
+ {
106
+ data: 'adm'
107
+ },
108
+
109
+ // Column: 6
110
+ {
111
+ data: 'start_time',
112
+ render: {
113
+ _: (data) => {
114
+ return data === null ? '' : moment(data).utc().format(
115
+ sovtimerSettings.datetimeFormat.datetimeLong
116
+ );
117
+ },
118
+ sort: (data) => {
119
+ return data === null ? '' : data;
120
+ }
121
+ }
122
+ },
123
+
124
+ // Column: 7
125
+ {
126
+ data: 'remaining_time'
127
+ },
128
+
129
+ // Column: 8
130
+ {
131
+ data: 'campaign_progress'
132
+ },
133
+
134
+ // Hidden columns
135
+ // Column: 9
136
+ {
137
+ data: 'remaining_time_in_seconds'
138
+ },
139
+
140
+ // Column: 10
141
+ {
142
+ data: 'solar_system_name'
143
+ },
144
+
145
+ // Column: 11
146
+ {
147
+ data: 'constellation_name'
148
+ },
149
+
150
+ // Column: 12
151
+ {
152
+ data: 'region_name'
153
+ },
154
+
155
+ // Column: 13
156
+ {
157
+ data: 'defender_name'
158
+ },
159
+
160
+ // Column: 14
161
+ {
162
+ data: 'active_campaign'
163
+ }
164
+ ],
165
+ columnDefs: [
166
+ {
167
+ visible: false,
168
+ targets: [0, 9, 10, 11, 12, 13, 14]
169
+ },
170
+ // {
171
+ // width: '115px',
172
+ // targets: [7]
173
+ // },
174
+ {
175
+ width: '150px',
176
+ targets: [8]
177
+ }
178
+ ],
179
+ order: [[6, 'asc']],
180
+ filterDropDown: {
181
+ columns: [
182
+ // Filter: Type
183
+ // {
184
+ // idx: 0,
185
+ // title: sovtimerSettings.translation.dtFilter.type
186
+ // },
187
+
188
+ // Filter: System
189
+ {
190
+ idx: 10,
191
+ title: sovtimerSettings.translation.dtFilter.system
192
+ },
193
+
194
+ // Filter: Constellation
195
+ {
196
+ idx: 11,
197
+ title: sovtimerSettings.translation.dtFilter.constellation
198
+ },
199
+
200
+ // Filter: Region
201
+ {
202
+ idx: 12,
203
+ title: sovtimerSettings.translation.dtFilter.region
204
+ },
205
+
206
+ // Filter: Owner/Defender
207
+ {
208
+ idx: 13,
209
+ title: sovtimerSettings.translation.dtFilter.owner
210
+ },
211
+
212
+ // Filter: Active Campaign
213
+ {
214
+ idx: 14,
215
+ title: sovtimerSettings.translation.dtFilter.activeCampaign
216
+ }
217
+ ],
218
+ autoSize: false,
219
+ bootstrap: true,
220
+ bootstrap_version: 5
221
+ },
222
+ createdRow: (row, data) => {
223
+ // Total timer
224
+ const currentTotal = elementTimerTotal.html();
225
+ const newTotal = parseInt(currentTotal) + 1;
226
+
227
+ elementTimerTotal.html(newTotal);
228
+
229
+ // Upcoming timer (< 4 hrs)
230
+ if (data.active_campaign === sovtimerSettings.translation.no && data.remaining_time_in_seconds <= sovtimerSettings.upcomingTimerThreshold) {
231
+ $(row).addClass('aa-sovtimer-upcoming-campaign');
232
+
233
+ const currentUpcoming = elementTimerUpcoming.html();
234
+ const newUpcoming = parseInt(currentUpcoming) + 1;
235
+
236
+ elementTimerUpcoming.html(newUpcoming);
237
+ }
238
+
239
+ // Active timer
240
+ if (data.active_campaign === sovtimerSettings.translation.yes) {
241
+ $(row).addClass('aa-sovtimer-active-campaign');
242
+
243
+ const currentActive = elementTimerActive.html();
244
+ const newActive = parseInt(currentActive) + 1;
245
+
246
+ elementTimerActive.html(newActive);
247
+ }
248
+ },
249
+ paging: false
250
+ });
251
+ }
252
+ })
253
+ .catch((error) => {
254
+ console.error('Error fetching campaign data:', error);
255
+ });
256
+
257
+ /**
258
+ * Update the datatable information every 30 seconds
259
+ */
260
+ setInterval(() => {
261
+ fetchGet({url: sovtimerSettings.url.ajaxUpdate})
262
+ .then((newData) => {
263
+ const dataTable = sovCampaignTable.DataTable();
264
+ dataTable.clear().rows.add(newData).draw();
265
+
266
+ let totalCount = 0;
267
+ let upcomingCount = 0;
268
+ let activeCount = 0;
269
+
270
+ newData.forEach((item) => {
271
+ totalCount++;
272
+
273
+ if (item.active_campaign === sovtimerSettings.translation.no && item.remaining_time_in_seconds <= sovtimerSettings.upcomingTimerThreshold) {
274
+ upcomingCount++;
275
+ }
276
+
277
+ if (item.active_campaign === sovtimerSettings.translation.yes) {
278
+ activeCount++;
279
+ }
280
+ });
281
+
282
+ elementTimerTotal.html(totalCount);
283
+ elementTimerUpcoming.html(upcomingCount);
284
+ elementTimerActive.html(activeCount);
285
+ })
286
+ .catch((error) => {
287
+ console.error('Error updating campaign data:', error);
288
+ });
289
+ }, 30000);
290
+
291
+ /**
292
+ * Update the remaining time every second
293
+ */
294
+ setInterval(() => {
295
+ sovCampaignTable.DataTable().rows().every((element) => {
296
+ const data = sovCampaignTable.DataTable().row(element).data();
297
+
298
+ const remaining = secondsToRemainingTime(
299
+ data.remaining_time_in_seconds
300
+ );
301
+
302
+ data.remaining_time_in_seconds = remaining.remainingTimeInSeconds;
303
+ data.remaining_time = remaining.countdown;
304
+
305
+ sovCampaignTable.DataTable().row(element).data(data);
306
+ });
307
+ }, 1000);
308
+ });
@@ -0,0 +1,2 @@
1
+ $(document).ready(()=>{let m=sovtimerJsSettingsDefaults;"undefined"!=typeof sovtimerJsSettingsOverride&&(m=objectDeepMerge(sovtimerJsSettingsDefaults,sovtimerJsSettingsOverride));const l=$(".aa-sovtimer-campaigns-total"),d=$(".aa-sovtimer-campaigns-upcoming"),c=$(".aa-sovtimer-campaigns-active"),n=a=>{let t="",e="aa-sovtimer-remaining";a<0?(e+=" aa-sovtimer-timer-elapsed",t="-",a=Math.abs(a),a++):a--;const n=Math.floor(a/86400);let i=Math.floor(a/3600)%24,r=Math.floor(a/60)%60,s=Math.floor(a)%60;return i<10&&(i="0"+i),r<10&&(r="0"+r),s<10&&(s="0"+s),{countdown:`<span class="${e}">${t}${n}d ${i}h ${r}m ${s}s</span>`,remainingTimeInSeconds:t+a}},r=$(".aa-sovtimer-campaigns");fetchGet({url:m.url.ajaxUpdate}).then(a=>{a&&r.DataTable({language:m.dataTables.language,data:a,columns:[{data:"event_type"},{data:"solar_system_name_html"},{data:"constellation_name_html"},{data:"region_name_html"},{data:"defender_name_html"},{data:"adm"},{data:"start_time",render:{_:a=>null===a?"":moment(a).utc().format(m.datetimeFormat.datetimeLong),sort:a=>null===a?"":a}},{data:"remaining_time"},{data:"campaign_progress"},{data:"remaining_time_in_seconds"},{data:"solar_system_name"},{data:"constellation_name"},{data:"region_name"},{data:"defender_name"},{data:"active_campaign"}],columnDefs:[{visible:!1,targets:[0,9,10,11,12,13,14]},{width:"150px",targets:[8]}],order:[[6,"asc"]],filterDropDown:{columns:[{idx:10,title:m.translation.dtFilter.system},{idx:11,title:m.translation.dtFilter.constellation},{idx:12,title:m.translation.dtFilter.region},{idx:13,title:m.translation.dtFilter.owner},{idx:14,title:m.translation.dtFilter.activeCampaign}],autoSize:!1,bootstrap:!0,bootstrap_version:5},createdRow:(a,t)=>{const e=l.html(),n=parseInt(e)+1;if(l.html(n),t.active_campaign===m.translation.no&&t.remaining_time_in_seconds<=m.upcomingTimerThreshold){$(a).addClass("aa-sovtimer-upcoming-campaign");const i=d.html(),r=parseInt(i)+1;d.html(r)}if(t.active_campaign===m.translation.yes){$(a).addClass("aa-sovtimer-active-campaign");const s=c.html(),o=parseInt(s)+1;c.html(o)}},paging:!1})}).catch(a=>{console.error("Error fetching campaign data:",a)}),setInterval(()=>{fetchGet({url:m.url.ajaxUpdate}).then(a=>{const t=r.DataTable();t.clear().rows.add(a).draw();let e=0,n=0,i=0;a.forEach(a=>{e++,a.active_campaign===m.translation.no&&a.remaining_time_in_seconds<=m.upcomingTimerThreshold&&n++,a.active_campaign===m.translation.yes&&i++}),l.html(e),d.html(n),c.html(i)}).catch(a=>{console.error("Error updating campaign data:",a)})},3e4),setInterval(()=>{r.DataTable().rows().every(a=>{const t=r.DataTable().row(a).data(),e=n(t.remaining_time_in_seconds);t.remaining_time_in_seconds=e.remainingTimeInSeconds,t.remaining_time=e.countdown,r.DataTable().row(a).data(t)})},1e3)});
2
+ //# sourceMappingURL=aa-sov-timer.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["aa-sov-timer.js"],"names":["$","document","ready","let","sovtimerSettings","sovtimerJsSettingsDefaults","sovtimerJsSettingsOverride","objectDeepMerge","elementTimerTotal","elementTimerUpcoming","elementTimerActive","secondsToRemainingTime","prefix","spanClasses","secondsRemaining","Math","abs","days","floor","hours","minutes","seconds","countdown","remainingTimeInSeconds","sovCampaignTable","fetchGet","url","ajaxUpdate","then","tableData","DataTable","language","dataTables","data","columns","render","_","moment","utc","format","datetimeFormat","datetimeLong","sort","columnDefs","visible","targets","width","order","filterDropDown","idx","title","translation","dtFilter","system","constellation","region","owner","activeCampaign","autoSize","bootstrap","bootstrap_version","createdRow","row","currentTotal","html","newTotal","parseInt","active_campaign","no","remaining_time_in_seconds","upcomingTimerThreshold","addClass","currentUpcoming","newUpcoming","yes","currentActive","newActive","paging","catch","console","error","setInterval","dataTable","clear","rows","add","newData","draw","totalCount","upcomingCount","activeCount","forEach","item","every","element","remaining","remaining_time"],"mappings":"AAEAA,EAAEC,QAAQ,EAAEC,MAAM,KAIdC,IAAIC,EAAmBC,2BAEmB,aAAtC,OAAOC,6BACPF,EAAmBG,gBACfF,2BACAC,0BACJ,GAGJ,MAAME,EAAoBR,EAAE,8BAA8B,EACpDS,EAAuBT,EAAE,iCAAiC,EAC1DU,EAAqBV,EAAE,+BAA+B,EAQtDW,EAAyB,IAC3BR,IAAIS,EAAS,GACTC,EAAc,wBAEdC,EAAmB,GACnBD,GAAe,6BACfD,EAAS,IAETE,EAAmBC,KAAKC,IAAIF,CAAgB,EAE5CA,CAAgB,IAEhBA,CAAgB,GAGpB,MAAMG,EAAOF,KAAKG,MAAMJ,EAAmB,KAAc,EACzDX,IAAIgB,EAAQJ,KAAKG,MAAMJ,EAAmB,IAAS,EAAI,GACnDM,EAAUL,KAAKG,MAAMJ,EAAmB,EAAE,EAAI,GAC9CO,EAAUN,KAAKG,MAAMJ,CAAgB,EAAI,GAe7C,OAZIK,EAAQ,KACRA,EAAQ,IAAMA,GAGdC,EAAU,KACVA,EAAU,IAAMA,GAGhBC,EAAU,KACVA,EAAU,IAAMA,GAGb,CACHC,0BAA2BT,MAAgBD,IAASK,MAASE,MAAUC,MAAYC,YACnFE,uBAAwBX,EAASE,CACrC,CACJ,EAOM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B,CAAa,EACvC/E,EAAmBsD,KAAK0B,CAAW,CACvC,CAAC,EACAZ,MAAM,IACHC,QAAQC,MAAM,gCAAiCA,CAAK,CACxD,CAAC,CACT,EAAG,GAAK,EAKRC,YAAY,KACRzD,EAAiBM,UAAU,EAAEsD,KAAK,EAAES,MAAM,IACtC,MAAM5D,EAAOT,EAAiBM,UAAU,EAAEgC,IAAIgC,CAAO,EAAE7D,KAAK,EAEtD8D,EAAYpF,EACdsB,EAAKoC,yBACT,EAEApC,EAAKoC,0BAA4B0B,EAAUxE,uBAC3CU,EAAK+D,eAAiBD,EAAUzE,UAEhCE,EAAiBM,UAAU,EAAEgC,IAAIgC,CAAO,EAAE7D,KAAKA,CAAI,CACvD,CAAC,CACL,EAAG,GAAI,CACX,CAAC"}
@@ -1,353 +0,0 @@
1
- /* global sovtimerJsSettingsDefaults, sovtimerJsSettingsOverride, moment */
2
-
3
- $(document).ready(() => {
4
- 'use strict';
5
-
6
- /**
7
- * Checks if the given item is a plain object, excluding arrays and dates.
8
- *
9
- * @param {*} item - The item to check.
10
- * @returns {boolean} True if the item is a plain object, false otherwise.
11
- */
12
- function isObject (item) {
13
- return (
14
- item && typeof item === 'object' && !Array.isArray(item) && !(item instanceof Date)
15
- );
16
- }
17
-
18
- /**
19
- * Recursively merges properties from source objects into a target object. If a property at the current level is an object,
20
- * and both target and source have it, the property is merged. Otherwise, the source property overwrites the target property.
21
- * This function does not modify the source objects and prevents prototype pollution by not allowing __proto__, constructor,
22
- * and prototype property names.
23
- *
24
- * @param {Object} target - The target object to merge properties into.
25
- * @param {...Object} sources - One or more source objects from which to merge properties.
26
- * @returns {Object} The target object after merging properties from sources.
27
- */
28
- function deepMerge (target, ...sources) {
29
- if (!sources.length) {
30
- return target;
31
- }
32
-
33
- // Iterate through each source object without modifying the `sources` array.
34
- sources.forEach(source => {
35
- if (isObject(target) && isObject(source)) {
36
- for (const key in source) {
37
- if (isObject(source[key])) {
38
- if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
39
- continue; // Skip potentially dangerous keys to prevent prototype pollution.
40
- }
41
-
42
- if (!target[key] || !isObject(target[key])) {
43
- target[key] = {};
44
- }
45
-
46
- deepMerge(target[key], source[key]);
47
- } else {
48
- target[key] = source[key];
49
- }
50
- }
51
- }
52
- });
53
-
54
- return target;
55
- }
56
-
57
- // Build the settings object
58
- let sovtimerSettings = sovtimerJsSettingsDefaults;
59
- if (typeof sovtimerJsSettingsOverride !== 'undefined') {
60
- sovtimerSettings = deepMerge(
61
- sovtimerJsSettingsDefaults,
62
- sovtimerJsSettingsOverride
63
- );
64
- }
65
-
66
- const elementTimerTotal = $('.aa-sovtimer-campaigns-total');
67
- const elementTimerUpcoming = $('.aa-sovtimer-campaigns-upcoming');
68
- const elementTimerActive = $('.aa-sovtimer-campaigns-active');
69
-
70
- /**
71
- * Convert seconds into a time string
72
- *
73
- * @param {string|int} secondsRemaining
74
- * @returns {{countdown: string, remainingTimeInSeconds: string|int}}
75
- */
76
- const secondsToRemainingTime = (secondsRemaining) => {
77
- let prefix = '';
78
- let spanClasses = 'aa-sovtimer-remaining';
79
-
80
- if (secondsRemaining < 0) {
81
- spanClasses += ' aa-sovtimer-timer-elapsed';
82
- prefix = '-';
83
-
84
- secondsRemaining = Math.abs(secondsRemaining); // Remove negative prefix
85
-
86
- secondsRemaining++; // Increment with one second each second
87
- } else {
88
- secondsRemaining--; // Decrement with one second each second
89
- }
90
-
91
- const days = Math.floor(secondsRemaining / (24 * 60 * 60)); // Calculate days
92
- let hours = Math.floor(secondsRemaining / (60 * 60)) % 24; // Hours
93
- let minutes = Math.floor(secondsRemaining / 60) % 60; // Minutes
94
- let seconds = Math.floor(secondsRemaining) % 60; // Seconds
95
-
96
- // leading zero ...
97
- if (hours < 10) {
98
- hours = '0' + hours;
99
- }
100
-
101
- if (minutes < 10) {
102
- minutes = '0' + minutes;
103
- }
104
-
105
- if (seconds < 10) {
106
- seconds = '0' + seconds;
107
- }
108
-
109
- return {
110
- countdown: `<span class="${spanClasses}">${prefix}${days}d ${hours}h ${minutes}m ${seconds}s</span>`,
111
- remainingTimeInSeconds: prefix + secondsRemaining
112
- };
113
- };
114
-
115
- /**
116
- * Build the datatable
117
- *
118
- * @type {jQuery}
119
- */
120
- const sovCampaignTable = $('.aa-sovtimer-campaigns').DataTable({
121
- language: sovtimerSettings.dataTables.language,
122
- ajax: {
123
- url: sovtimerSettings.url.ajaxUpdate,
124
- dataSrc: '',
125
- cache: false
126
- },
127
- columns: [
128
- // Column: 0
129
- {
130
- data: 'event_type'
131
- },
132
-
133
- // Column: 1
134
- {
135
- data: 'solar_system_name_html'
136
- },
137
-
138
- // Column: 2
139
- {
140
- data: 'constellation_name_html'
141
- },
142
-
143
- // Column: 3
144
- {
145
- data: 'region_name_html'
146
- },
147
-
148
- // Column: 4
149
- {
150
- data: 'defender_name_html'
151
- },
152
-
153
- // Column: 5
154
- {
155
- data: 'adm'
156
- },
157
-
158
- // Column: 6
159
- {
160
- data: 'start_time',
161
- render: {
162
- _: (data) => {
163
- return data === null ? '' : moment(data).utc().format(
164
- sovtimerSettings.datetimeFormat.datetimeLong
165
- );
166
- },
167
- sort: (data) => {
168
- return data === null ? '' : data;
169
- }
170
- }
171
- },
172
-
173
- // Column: 7
174
- {
175
- data: 'remaining_time'
176
- },
177
-
178
- // Column: 8
179
- {
180
- data: 'campaign_progress'
181
- },
182
-
183
- // Hidden columns
184
- // Column: 9
185
- {
186
- data: 'remaining_time_in_seconds'
187
- },
188
-
189
- // Column: 10
190
- {
191
- data: 'solar_system_name'
192
- },
193
-
194
- // Column: 11
195
- {
196
- data: 'constellation_name'
197
- },
198
-
199
- // Column: 12
200
- {
201
- data: 'region_name'
202
- },
203
-
204
- // Column: 13
205
- {
206
- data: 'defender_name'
207
- },
208
-
209
- // Column: 14
210
- {
211
- data: 'active_campaign'
212
- }
213
- ],
214
- columnDefs: [
215
- {
216
- visible: false,
217
- targets: [0, 9, 10, 11, 12, 13, 14]
218
- },
219
- // {
220
- // width: '115px',
221
- // targets: [7]
222
- // },
223
- {
224
- width: '150px',
225
- targets: [8]
226
- }
227
- ],
228
- order: [[6, 'asc']],
229
- filterDropDown: {
230
- columns: [
231
- // Filter: Type
232
- // {
233
- // idx: 0,
234
- // title: sovtimerSettings.translation.dtFilter.type
235
- // },
236
-
237
- // Filter: System
238
- {
239
- idx: 10,
240
- title: sovtimerSettings.translation.dtFilter.system
241
- },
242
-
243
- // Filter: Constellation
244
- {
245
- idx: 11,
246
- title: sovtimerSettings.translation.dtFilter.constellation
247
- },
248
-
249
- // Filter: Region
250
- {
251
- idx: 12,
252
- title: sovtimerSettings.translation.dtFilter.region
253
- },
254
-
255
- // Filter: Owner/Defender
256
- {
257
- idx: 13,
258
- title: sovtimerSettings.translation.dtFilter.owner
259
- },
260
-
261
- // Filter: Active Campaign
262
- {
263
- idx: 14,
264
- title: sovtimerSettings.translation.dtFilter.activeCampaign
265
- }
266
- ],
267
- autoSize: false,
268
- bootstrap: true,
269
- bootstrap_version: 5
270
- },
271
- createdRow: (row, data) => {
272
- // Total timer
273
- const currentTotal = elementTimerTotal.html();
274
- const newTotal = parseInt(currentTotal) + 1;
275
-
276
- elementTimerTotal.html(newTotal);
277
-
278
- // Upcoming timer (< 4 hrs)
279
- if (data.active_campaign === sovtimerSettings.translation.no && data.remaining_time_in_seconds <= sovtimerSettings.upcomingTimerThreshold) {
280
- $(row).addClass('aa-sovtimer-upcoming-campaign');
281
-
282
- const currentUpcoming = elementTimerUpcoming.html();
283
- const newUpcoming = parseInt(currentUpcoming) + 1;
284
-
285
- elementTimerUpcoming.html(newUpcoming);
286
- }
287
-
288
- // Active timer
289
- if (data.active_campaign === sovtimerSettings.translation.yes) {
290
- $(row).addClass('aa-sovtimer-active-campaign');
291
-
292
- const currentActive = elementTimerActive.html();
293
- const newActive = parseInt(currentActive) + 1;
294
-
295
- elementTimerActive.html(newActive);
296
- }
297
- },
298
- paging: false
299
- });
300
-
301
- /**
302
- * Update the datatable information every 30 seconds
303
- */
304
- setInterval(() => {
305
- sovCampaignTable.ajax.reload((tableData) => {
306
- elementTimerTotal.html('0');
307
- elementTimerUpcoming.html('0');
308
- elementTimerActive.html('0');
309
-
310
- $.each(tableData, (i, item) => {
311
- // Total timer
312
- const currentTotal = elementTimerTotal.html();
313
- const newTotal = parseInt(currentTotal) + 1;
314
-
315
- elementTimerTotal.html(newTotal);
316
-
317
- // Upcoming timer (< 4 hrs)
318
- if (item.active_campaign === sovtimerSettings.translation.no && item.remaining_time_in_seconds <= sovtimerSettings.upcomingTimerThreshold) {
319
- const currentUpcoming = elementTimerUpcoming.html();
320
- const newUpcoming = parseInt(currentUpcoming) + 1;
321
-
322
- elementTimerUpcoming.html(newUpcoming);
323
- }
324
-
325
- // Active timer
326
- if (item.active_campaign === sovtimerSettings.translation.yes) {
327
- const currentActive = elementTimerActive.html();
328
- const newActive = parseInt(currentActive) + 1;
329
-
330
- elementTimerActive.html(newActive);
331
- }
332
- });
333
- });
334
- }, 30000);
335
-
336
- /**
337
- * Update the remaining time every second
338
- */
339
- setInterval(() => {
340
- sovCampaignTable.rows().every((element) => {
341
- const data = sovCampaignTable.row(element).data();
342
-
343
- const remaining = secondsToRemainingTime(
344
- data.remaining_time_in_seconds
345
- );
346
-
347
- data.remaining_time_in_seconds = remaining.remainingTimeInSeconds;
348
- data.remaining_time = remaining.countdown;
349
-
350
- sovCampaignTable.row(element).data(data);
351
- });
352
- }, 1000);
353
- });
@@ -1,2 +0,0 @@
1
- $(document).ready(()=>{function n(t){return t&&"object"==typeof t&&!Array.isArray(t)&&!(t instanceof Date)}function i(e,...t){return t.length&&t.forEach(t=>{if(n(e)&&n(t))for(var a in t)n(t[a])?"__proto__"!==a&&"constructor"!==a&&"prototype"!==a&&(e[a]&&n(e[a])||(e[a]={}),i(e[a],t[a])):e[a]=t[a]}),e}let m=sovtimerJsSettingsDefaults;"undefined"!=typeof sovtimerJsSettingsOverride&&(m=i(sovtimerJsSettingsDefaults,sovtimerJsSettingsOverride));const l=$(".aa-sovtimer-campaigns-total"),d=$(".aa-sovtimer-campaigns-upcoming"),c=$(".aa-sovtimer-campaigns-active"),r=t=>{let a="",e="aa-sovtimer-remaining";t<0?(e+=" aa-sovtimer-timer-elapsed",a="-",t=Math.abs(t),t++):t--;const n=Math.floor(t/86400);let i=Math.floor(t/3600)%24,r=Math.floor(t/60)%60,s=Math.floor(t)%60;return i<10&&(i="0"+i),r<10&&(r="0"+r),s<10&&(s="0"+s),{countdown:`<span class="${e}">${a}${n}d ${i}h ${r}m ${s}s</span>`,remainingTimeInSeconds:a+t}},s=$(".aa-sovtimer-campaigns").DataTable({language:m.dataTables.language,ajax:{url:m.url.ajaxUpdate,dataSrc:"",cache:!1},columns:[{data:"event_type"},{data:"solar_system_name_html"},{data:"constellation_name_html"},{data:"region_name_html"},{data:"defender_name_html"},{data:"adm"},{data:"start_time",render:{_:t=>null===t?"":moment(t).utc().format(m.datetimeFormat.datetimeLong),sort:t=>null===t?"":t}},{data:"remaining_time"},{data:"campaign_progress"},{data:"remaining_time_in_seconds"},{data:"solar_system_name"},{data:"constellation_name"},{data:"region_name"},{data:"defender_name"},{data:"active_campaign"}],columnDefs:[{visible:!1,targets:[0,9,10,11,12,13,14]},{width:"150px",targets:[8]}],order:[[6,"asc"]],filterDropDown:{columns:[{idx:10,title:m.translation.dtFilter.system},{idx:11,title:m.translation.dtFilter.constellation},{idx:12,title:m.translation.dtFilter.region},{idx:13,title:m.translation.dtFilter.owner},{idx:14,title:m.translation.dtFilter.activeCampaign}],autoSize:!1,bootstrap:!0,bootstrap_version:5},createdRow:(t,a)=>{const e=l.html(),n=parseInt(e)+1;if(l.html(n),a.active_campaign===m.translation.no&&a.remaining_time_in_seconds<=m.upcomingTimerThreshold){$(t).addClass("aa-sovtimer-upcoming-campaign");const i=d.html(),r=parseInt(i)+1;d.html(r)}if(a.active_campaign===m.translation.yes){$(t).addClass("aa-sovtimer-active-campaign");const s=c.html(),o=parseInt(s)+1;c.html(o)}},paging:!1});setInterval(()=>{s.ajax.reload(t=>{l.html("0"),d.html("0"),c.html("0"),$.each(t,(t,a)=>{const e=l.html(),n=parseInt(e)+1;if(l.html(n),a.active_campaign===m.translation.no&&a.remaining_time_in_seconds<=m.upcomingTimerThreshold){const i=d.html(),r=parseInt(i)+1;d.html(r)}if(a.active_campaign===m.translation.yes){const s=c.html(),o=parseInt(s)+1;c.html(o)}})})},3e4),setInterval(()=>{s.rows().every(t=>{const a=s.row(t).data(),e=r(a.remaining_time_in_seconds);a.remaining_time_in_seconds=e.remainingTimeInSeconds,a.remaining_time=e.countdown,s.row(t).data(a)})},1e3)});
2
- //# sourceMappingURL=aa-sov-timer.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["aa-sov-timer.js"],"names":["$","document","ready","isObject","item","Array","isArray","Date","deepMerge","target","sources","length","forEach","source","key","let","sovtimerSettings","sovtimerJsSettingsDefaults","sovtimerJsSettingsOverride","elementTimerTotal","elementTimerUpcoming","elementTimerActive","secondsToRemainingTime","prefix","spanClasses","secondsRemaining","Math","abs","days","floor","hours","minutes","seconds","countdown","remainingTimeInSeconds","sovCampaignTable","DataTable","language","dataTables","ajax","url","ajaxUpdate","dataSrc","cache","columns","data","render","_","moment","utc","format","datetimeFormat","datetimeLong","sort","columnDefs","visible","targets","width","order","filterDropDown","idx","title","translation","dtFilter","system","constellation","region","owner","activeCampaign","autoSize","bootstrap","bootstrap_version","createdRow","row","currentTotal","html","newTotal","parseInt","active_campaign","no","remaining_time_in_seconds","upcomingTimerThreshold","addClass","currentUpcoming","newUpcoming","yes","currentActive","newActive","paging","setInterval","reload","each","tableData","i","rows","every","element","remaining","remaining_time"],"mappings":"AAEAA,EAAEC,QAAQ,EAAEC,MAAM,KASd,SAASC,EAAUC,GACf,OACIA,GAAwB,UAAhB,OAAOA,GAAqB,CAACC,MAAMC,QAAQF,CAAI,GAAK,EAAEA,aAAgBG,KAEtF,CAYA,SAASC,EAAWC,KAAWC,GA0B3B,OAzBKA,EAAQC,QAKbD,EAAQE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