diff soranews-image.user.js @ 108:2c4470b73ad9

Switch to semistandard No more `;` at the start of line.
author nanaya <me@nanaya.net>
date Sun, 15 Jan 2023 23:24:03 +0900
parents 9c8cde985caf
children ef21ef445fc6
line wrap: on
line diff
--- a/soranews-image.user.js	Sun Jan 15 23:15:45 2023 +0900
+++ b/soranews-image.user.js	Sun Jan 15 23:24:03 2023 +0900
@@ -9,47 +9,47 @@
 // @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/soranews-image.user.js
 // ==/UserScript==
 
-;(function () {
-  'use strict'
+(function () {
+  'use strict';
 
   const fix = function (image) {
     // basic sanity check
     if (!image.classList.contains('lazy')) {
-      return
+      return;
     }
 
-    image.classList.remove('lazy')
-    image.removeAttribute('src')
-    image.setAttribute('srcset', image.dataset.scoSrcset)
-  }
+    image.classList.remove('lazy');
+    image.removeAttribute('src');
+    image.setAttribute('srcset', image.dataset.scoSrcset);
+  };
 
   // loop through passed nodes (or body if called without arguments)
   const run = function (nodes) {
     if (nodes == null) {
-      nodes = [document.body]
+      nodes = [document.body];
     }
 
     for (let i = 0; i < nodes.length; i++) {
       // find all the images inside (and self)
-      const images = [nodes[i], ...nodes[i].querySelectorAll('.lazy')]
+      const images = [nodes[i], ...nodes[i].querySelectorAll('.lazy')];
 
       for (let j = 0; j < images.length; j++) {
-        fix(images[j])
+        fix(images[j]);
       }
     }
-  }
+  };
 
   const onMutate = function (mutations) {
     for (const mutation in mutations) {
-      run(mutation.addedNodes)
+      run(mutation.addedNodes);
     }
-  }
+  };
 
   // the observer
-  const observer = new window.MutationObserver(onMutate)
+  const observer = new window.MutationObserver(onMutate);
 
   // start the observer
-  observer.observe(document, { childList: true, subtree: true })
+  observer.observe(document, { childList: true, subtree: true });
   // initial run on existing document
-  run()
-}).call()
+  run();
+}).call();