summaryrefslogtreecommitdiff
path: root/elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-11-05 10:34:58 +0100
committerYorhel <git@yorhel.nl>2019-11-10 12:44:55 +0100
commit24f03ae521a6b35def38788e0446201aa6095314 (patch)
tree8162ef1a151d35731dfcf099703c401af5b9b058 /elm
parent3af0103b6bcc791142f78664bc449263c99571fb (diff)
JS: Add LibreJS compatibility + use embedded comment tag to sort v2rw.js files
I found myself forgetting to add a file to $JS_FILES in the Makefile several times now, and with Perl and Elm modules being detected and loaded automatically, it feels weird not to do the same for .js files. This embedded order trick is ugly, but it's pretty simple and gets the job done.
Diffstat (limited to 'elm')
-rw-r--r--elm/checkall.js2
-rw-r--r--elm/checkhidden.js2
-rw-r--r--elm/elm-init.js2
-rw-r--r--elm/pagevars.js2
-rw-r--r--elm/polyfills.js2
5 files changed, 10 insertions, 0 deletions
diff --git a/elm/checkall.js b/elm/checkall.js
index 5b7dc44e..bc87bad4 100644
--- a/elm/checkall.js
+++ b/elm/checkall.js
@@ -1,3 +1,5 @@
+//order:9 - After Elm initialization
+
/* "checkall" checkbox, usage:
*
* <input type="checkbox" class="checkall" name="$somename">
diff --git a/elm/checkhidden.js b/elm/checkhidden.js
index cfe2f8a2..486b3c1d 100644
--- a/elm/checkhidden.js
+++ b/elm/checkhidden.js
@@ -1,3 +1,5 @@
+//order:9 - After Elm initialization
+
/* "checkhidden" checkbox, usage:
*
* <input type="checkbox" class="checkhidden" value="$somename">
diff --git a/elm/elm-init.js b/elm/elm-init.js
index 1aefbb09..1388b0cd 100644
--- a/elm/elm-init.js
+++ b/elm/elm-init.js
@@ -1,3 +1,5 @@
+//order:8 - After all regular JS, as other files may modify pageVars or modules in the Elm.* namespace.
+
/* Add the X-CSRF-Token header to every POST request. Based on:
* https://stackoverflow.com/questions/24196140/adding-x-csrf-token-header-globally-to-all-instances-of-xmlhttprequest/24196317#24196317
*/
diff --git a/elm/pagevars.js b/elm/pagevars.js
index 8fc92d88..e36ed7da 100644
--- a/elm/pagevars.js
+++ b/elm/pagevars.js
@@ -1,3 +1,5 @@
+//order:0 - Before anything else that may use window.pageVars
+
/* Load global page-wide variables from <script id="pagevars">...</script> and store them into window.pageVars */
var e = document.getElementById('pagevars');
window.pageVars = e ? JSON.parse(e.innerHTML) : {};
diff --git a/elm/polyfills.js b/elm/polyfills.js
index 02179ee3..4bb85105 100644
--- a/elm/polyfills.js
+++ b/elm/polyfills.js
@@ -1,3 +1,5 @@
+//order:0 - Must be loaded before anything else.
+
/* classList.toggle() */
(function() {
var historic = DOMTokenList.prototype.toggle;