« get me outta code hell

real pragma, and some eslint fixes - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/lazy-loading.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-06-26 18:02:27 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-06-26 18:02:27 -0300
commitc75b029160248b6935e5c0f5156cc7a870311e82 (patch)
tree693c5cca195e50b048b0086e768aa06a7c1986ee /src/static/lazy-loading.js
parentf65e712fe8b8b1a196da2db286ebc6a5c9bf7433 (diff)
real pragma, and some eslint fixes
Diffstat (limited to 'src/static/lazy-loading.js')
-rw-r--r--src/static/lazy-loading.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/static/lazy-loading.js b/src/static/lazy-loading.js
index 5ca9fb3..8f3e8cf 100644
--- a/src/static/lazy-loading.js
+++ b/src/static/lazy-loading.js
@@ -1,5 +1,5 @@
-// @format
-//
+/** @format */
+
 // Lazy loading! Roll your own. Woot.
 // This file includes a 8unch of fall8acks and stuff like that, and is written
 // with fairly Olden JavaScript(TM), so as to work on pretty much any 8rowser
@@ -27,15 +27,15 @@ function lazyLoadMain() {
   // 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");
+  var elements = document.getElementsByClassName('js-hide');
   while (elements.length) {
-    elements[0].classList.remove("js-hide");
+    elements[0].classList.remove('js-hide');
   }
 
-  var lazyElements = document.getElementsByClassName("lazy");
+  var lazyElements = document.getElementsByClassName('lazy');
   if (window.IntersectionObserver) {
     observer = new IntersectionObserver(lazyLoad, {
-      rootMargin: "200px",
+      rootMargin: '200px',
       threshold: 1.0,
     });
     for (var i = 0; i < lazyElements.length; i++) {
@@ -44,10 +44,10 @@ function lazyLoadMain() {
   } else {
     for (var i = 0; i < lazyElements.length; i++) {
       var element = lazyElements[i];
-      var original = element.getAttribute("data-original");
-      element.setAttribute("src", original);
+      var original = element.getAttribute('data-original');
+      element.setAttribute('src', original);
     }
   }
 }
 
-document.addEventListener("DOMContentLoaded", lazyLoadMain);
+document.addEventListener('DOMContentLoaded', lazyLoadMain);