diff surugaya-fixes.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 4bc5a633437c
children ef21ef445fc6
line wrap: on
line diff
--- a/surugaya-fixes.user.js	Sun Jan 15 23:15:45 2023 +0900
+++ b/surugaya-fixes.user.js	Sun Jan 15 23:24:03 2023 +0900
@@ -9,55 +9,55 @@
 // @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/surugaya-fixes.user.js
 // ==/UserScript==
 
-'use strict'
+'use strict';
 
 // always inject adult consent cookie
-;(function () {
-  const hasAdultCookie = document.cookie.split('; ').includes('adult=1')
+(function () {
+  const hasAdultCookie = document.cookie.split('; ').includes('adult=1');
   if (!hasAdultCookie) {
-    const d = new Date()
-    d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000))
-    document.cookie = `adult=1; expires=${d.toGMTString()}; path=/`
-    window.location.reload()
+    const d = new Date();
+    d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000));
+    document.cookie = `adult=1; expires=${d.toGMTString()}; path=/`;
+    window.location.reload();
   }
-})()
+})();
 
 // skip loading image through php which seems to take forever
-;(function () {
-  const itemImageRegexp = /photo\.php\?shinaban=([0-9A-Z]+)/
+(function () {
+  const itemImageRegexp = /photo\.php\?shinaban=([0-9A-Z]+)/;
   function fix (image) {
-    const origSrc = image.getAttribute('src')
-    if (origSrc == null) return
-    const found = origSrc.match(itemImageRegexp)
-    if (found == null) return
+    const origSrc = image.getAttribute('src');
+    if (origSrc == null) return;
+    const found = origSrc.match(itemImageRegexp);
+    if (found == null) return;
 
-    const src = `https://www.suruga-ya.jp/database/pics_light/game/${found[1].toLowerCase()}.jpg`
+    const src = `https://www.suruga-ya.jp/database/pics_light/game/${found[1].toLowerCase()}.jpg`;
     const setNotFound = () => {
-      image.removeEventListener('error', setNotFound)
-      image.setAttribute('src', 'https://www.suruga-ya.jp/database/images/no_photo.jpg')
-    }
-    image.addEventListener('error', setNotFound)
-    image.setAttribute('src', src)
+      image.removeEventListener('error', setNotFound);
+      image.setAttribute('src', 'https://www.suruga-ya.jp/database/images/no_photo.jpg');
+    };
+    image.addEventListener('error', setNotFound);
+    image.setAttribute('src', src);
   }
 
   function run (node) {
-    if (!(node instanceof window.HTMLElement)) return
+    if (!(node instanceof window.HTMLElement)) return;
 
-    fix(node)
+    fix(node);
     for (const image of node.querySelectorAll('img')) {
-      fix(image)
+      fix(image);
     }
   }
 
   function onMutate (mutations) {
     for (const mutation of mutations) {
       for (const node of mutation.addedNodes) {
-        run(node)
+        run(node);
       }
     }
   }
 
-  const observer = new window.MutationObserver(onMutate)
-  observer.observe(document, { childList: true, subtree: true })
-  run(document.body)
-})()
+  const observer = new window.MutationObserver(onMutate);
+  observer.observe(document, { childList: true, subtree: true });
+  run(document.body);
+})();