« get me outta code hell

this commit is very large because i am doing work - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/lazy-show.js
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2020-10-28 17:33:03 -0300
committer(quasar) nebula <towerofnix@gmail.com>2020-10-28 17:33:03 -0300
commit25798012d6a0ab3ba0c439f372bbedc5943ac47e (patch)
tree71dabc10f3283027d54c1d514ef1bf5e6d243800 /lazy-show.js
parentf017dfe9c87bdf29430a26aa2b441d56e62c9195 (diff)
this commit is very large because i am doing work
and i would like to not lose progress in case i really screw those git
moves up bad

also it puts everything new into tracking which is kinda nice
Diffstat (limited to 'lazy-show.js')
-rw-r--r--lazy-show.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/lazy-show.js b/lazy-show.js
new file mode 100644
index 00000000..c6a1bf25
--- /dev/null
+++ b/lazy-show.js
@@ -0,0 +1,16 @@
+// Kinda like lazy-fallback.js in that this should work on any 8rowser, period.
+// Shows the lazy loading images iff JS is enabled (so that you don't have a
+// duplicate image if JS is disabled).
+
+lazyLoadingShowHiddenImages();
+
+function lazyLoadingShowHiddenImages() {
+    // This is a live HTMLCollection! We can't iter8te over it normally 'cuz
+    // we'd 8e mutating its value just 8y interacting with the DOM elements it
+    // contains. A while loop works just fine, even though you'd think reading
+    // over this code that this would 8e an infinitely hanging loop. It isn't!
+    var elements = document.getElementsByClassName('js-hide');
+    while (elements.length) {
+        elements[0].classList.remove('js-hide');
+    }
+}