changeset 109:ef21ef445fc6

Cleanups - wrap everything in function and call them last - fix namespace and update url
author nanaya <me@nanaya.net>
date Sun, 15 Jan 2023 23:33:41 +0900
parents 2c4470b73ad9
children b9b84779a672
files cuffs-hulotte-popup.user.js dlsite-select-title.user.js japan-times-account-wall-remover.user.js jiku-chu-direct-link.user.js mandarake-direct-link.user.js medium-popup-disable.user.js melonbooks-unlazy.user.js nebula-subtitle-style.user.js pixiv-direct-external-link.user.js pixiv-fanbox-unlazy.user.js rakuten-books-direct-search.user.js soranews-image.user.js surugaya-fixes.user.js tweetdeck-column-fix.user.js tweetdeck-large-image.user.js youtube-no-shorts.user.js
diffstat 16 files changed, 199 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- a/cuffs-hulotte-popup.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/cuffs-hulotte-popup.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,6 +1,6 @@
 // ==UserScript==
 // @name         Cuffs/Hulotte tuning
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      1.1.6
 // @description  Strip out Cuffs/Hulotte age confirmation popup, disables lightbox
 // @author       nanaya
@@ -8,13 +8,13 @@
 // @match        http://www.cuffs-cube.jp/*
 // @match        http://hulotte.jp/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/cuffs-hulotte-popup.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/cuffs-hulotte-popup.user.js
 // ==/UserScript==
 
+'use strict';
+
 /* global jQuery, stopload */
-(function () {
-  'use strict';
-
+function alwaysConsent () {
   const $ = jQuery;
   const rules = [];
   let i;
@@ -43,4 +43,6 @@
   if (typeof stopload === 'function') {
     stopload();
   }
-}).call();
+}
+
+alwaysConsent();
--- a/dlsite-select-title.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/dlsite-select-title.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,14 +1,16 @@
 // ==UserScript==
 // @name        dlsite select title
-// @namespace   https://myconan.net
+// @namespace   https://nanaya.net
 // @match       https://www.dlsite.com/*
 // @grant       GM_addStyle
 // @version     1.0.0
 // @author      nanaya
 // @description Allow selecting work title
-// @downloadURL https://hg.myconan.net/ec-userscripts/raw-file/tip/dlsite-select-title.user.js
+// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/dlsite-select-title.user.js
 // ==/UserScript==
 
+'use strict';
+
 /* global GM_addStyle */
 GM_addStyle(`
   .topicpath_item, #work_name {
--- a/japan-times-account-wall-remover.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/japan-times-account-wall-remover.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,14 +1,16 @@
 // ==UserScript==
 // @name        Japan Times "account wall" remover
-// @namespace   https://myconan.net
+// @namespace   https://nanaya.net
 // @match       https://www.japantimes.co.jp/*
 // @grant       GM_addStyle
 // @version     1.0.1
 // @author      nanaya
 // @description Removes account wall
-// @downloadURL https://hg.myconan.net/ec-userscripts/raw-file/tip/japan-times-account-wall-remover.user.js
+// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/japan-times-account-wall-remover.user.js
 // ==/UserScript==
 
+'use strict';
+
 /* global GM_addStyle */
 GM_addStyle(`
   .tp-modal-open.tp-modal-open {
--- a/jiku-chu-direct-link.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/jiku-chu-direct-link.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,17 +1,18 @@
 // ==UserScript==
 // @name         Jiku-Chu direct link
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      2.5.6
 // @description  Make proper link on Jiku-Chu pages
 // @author       nanaya
 // @match        http://www.jiku-chu.com/*
 // @match        https://www.jiku-chu.com/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/jiku-chu-direct-link.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/jiku-chu-direct-link.user.js
 // ==/UserScript==
 
-(function () {
-  'use strict';
+'use strict';
+
+function directLink () {
   const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]");
   const removeOnClick = function (el) {
     const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1');
@@ -22,4 +23,6 @@
   };
 
   Array.prototype.forEach.call(links, removeOnClick);
-}());
+}
+
+directLink();
--- a/mandarake-direct-link.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/mandarake-direct-link.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,6 +1,6 @@
 // ==UserScript==
 // @name         mandarake direct link
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      2.0.1
 // @description  Make proper link on mandarake pages
 // @author       nanaya
@@ -13,43 +13,47 @@
 
 'use strict';
 
-const r18ConfirmLink = '#adult_confirm';
-function fixR18Link (link) {
-  if (!(link instanceof window.HTMLAnchorElement) || link.getAttribute('href') !== r18ConfirmLink) return;
+function directLink () {
+  const r18ConfirmLink = '#adult_confirm';
+  function fixR18Link (link) {
+    if (!(link instanceof window.HTMLAnchorElement) || link.getAttribute('href') !== r18ConfirmLink) return;
+
+    link.setAttribute('href', `/order/detailPage/item?itemCode=${link.id}`);
+    link.removeAttribute('class');
+  }
 
-  link.setAttribute('href', `/order/detailPage/item?itemCode=${link.id}`);
-  link.removeAttribute('class');
-}
+  function removeR18Mark (node) {
+    if (node.classList.contains('r18mark')) {
+      node.remove();
+      return true;
+    }
 
-function removeR18Mark (node) {
-  if (node.classList.contains('r18mark')) {
-    node.remove();
-    return true;
+    for (const mark of node.querySelectorAll('.r18mark')) {
+      mark.remove();
+    }
   }
 
-  for (const mark of node.querySelectorAll('.r18mark')) {
-    mark.remove();
+  function run (node) {
+    if (!(node instanceof window.HTMLElement)) return;
+    if (removeR18Mark(node)) return;
+
+    fixR18Link(node);
+    for (const link of node.querySelectorAll(`a[href='${r18ConfirmLink}']`)) {
+      fixR18Link(link);
+    }
   }
+
+  function onMutate (mutations) {
+    for (const mutation of mutations) {
+      for (const node of mutation.addedNodes) {
+        run(node);
+      }
+    }
+  }
+
+  const observer = new window.MutationObserver(onMutate);
+  observer.observe(document, { childList: true, subtree: true });
+  run(document.body);
 }
 
-function run (node) {
-  if (!(node instanceof window.HTMLElement)) return;
-  if (removeR18Mark(node)) return;
-
-  fixR18Link(node);
-  for (const link of node.querySelectorAll(`a[href='${r18ConfirmLink}']`)) {
-    fixR18Link(link);
-  }
-}
-
-function onMutate (mutations) {
-  for (const mutation of mutations) {
-    for (const node of mutation.addedNodes) {
-      run(node);
-    }
-  }
-}
-
-const observer = new window.MutationObserver(onMutate);
-observer.observe(document, { childList: true, subtree: true });
-run(document.body);
+directLink();
--- a/medium-popup-disable.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/medium-popup-disable.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,6 +1,6 @@
 // ==UserScript==
 // @name         Medium popup disable
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      1.0.7
 // @description  Strip out Medium's highlighting popup "feature"
 // @author       nanaya
@@ -9,11 +9,12 @@
 // @match        https://m.signalvnoise.com/*
 // @match        https://hackernoon.com/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/medium-popup-disable.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/medium-popup-disable.user.js
 // ==/UserScript==
 
-(function () {
-  'use strict';
+'use strict';
+
+function removeHighlightPopup () {
   const popups = document.getElementsByClassName('highlightMenu');
   const killPopup = function (popup) {
     popup.style.display = 'none';
@@ -22,4 +23,6 @@
     Array.prototype.forEach.call(popups, killPopup);
   };
   document.addEventListener('click', killPopups);
-}).call();
+}
+
+removeHighlightPopup();
--- a/melonbooks-unlazy.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/melonbooks-unlazy.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -12,35 +12,39 @@
 
 'use strict';
 
-function fix (image) {
-  if (!image.classList.contains('lazyload')) return;
+function unlazy () {
+  function fix (image) {
+    if (!image.classList.contains('lazyload')) return;
+
+    const src = image.dataset.src;
+
+    if (src == null || src === '') return;
 
-  const src = image.dataset.src;
+    image.classList.remove('lazyload');
+    image.src = image.dataset.src;
+    delete image.dataset.src;
+  }
+
+  function run (node) {
+    if (!(node instanceof window.HTMLElement)) return;
 
-  if (src == null || src === '') return;
+    fix(node);
+    for (const image of node.querySelectorAll('.lazyload')) {
+      fix(image);
+    }
+  }
 
-  image.classList.remove('lazyload');
-  image.src = image.dataset.src;
-  delete image.dataset.src;
+  function onMutate (mutations) {
+    for (const mutation of mutations) {
+      for (const node of mutation.addedNodes) {
+        run(node);
+      }
+    }
+  }
+
+  const observer = new window.MutationObserver(onMutate);
+  observer.observe(document, { childList: true, subtree: true });
+  run(document.body);
 }
 
-function run (node) {
-  if (!(node instanceof window.HTMLElement)) return;
-
-  fix(node);
-  for (const image of node.querySelectorAll('.lazyload')) {
-    fix(image);
-  }
-}
-
-function onMutate (mutations) {
-  for (const mutation of mutations) {
-    for (const node of mutation.addedNodes) {
-      run(node);
-    }
-  }
-}
-
-const observer = new window.MutationObserver(onMutate);
-observer.observe(document, { childList: true, subtree: true });
-run(document.body);
+unlazy();
--- a/nebula-subtitle-style.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/nebula-subtitle-style.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,14 +1,16 @@
 // ==UserScript==
 // @name        nebula subtitle style
-// @namespace   https://myconan.net
+// @namespace   https://nanaya.net
 // @match       https://nebula.app/*
 // @grant       GM_addStyle
 // @version     1.0.1
 // @author      nanaya
 // @description Better subtitle styling
-// @downloadURL https://hg.myconan.net/ec-userscripts/raw-file/tip/nebula-subtitle-style.user.js
+// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/nebula-subtitle-style.user.js
 // ==/UserScript==
 
+'use strict';
+
 /* global GM_addStyle */
 GM_addStyle(`
   .vjs-text-track-cue * {
--- a/pixiv-direct-external-link.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/pixiv-direct-external-link.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,18 +1,18 @@
 // ==UserScript==
 // @name         pixiv direct external link
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      1.1.5
 // @description  Make proper link on pixiv pages
 // @author       nanaya
 // @match        http://www.pixiv.net/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/pixiv-direct-external-link.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/pixiv-direct-external-link.user.js
 // ==/UserScript==
 
+'use strict';
+
 /* global $ */
-(function () {
-  'use strict';
-
+function directLink () {
   const fixLink = function (_i, el) {
     const $el = $(el);
     const url = decodeURIComponent($el.attr('href').replace(/^\/?jump.php\?/, ''));
@@ -22,4 +22,6 @@
 
   $("[href^='jump.php?']").each(fixLink);
   $("[href^='/jump.php?']").each(fixLink);
-}).call();
+}
+
+directLink();
--- a/pixiv-fanbox-unlazy.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/pixiv-fanbox-unlazy.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,6 +1,6 @@
 // ==UserScript==
 // @name         pixiv fanbox no lazy loading image
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      2.1.2
 // @description  Lazy loading is bad for environment. Disable it.
 // @author       nanaya
@@ -12,50 +12,54 @@
 
 'use strict';
 
-const imageUrlPrefix = 'https://downloads.fanbox.cc/images/post/';
-
-function disableEventLink (event) {
-  event.stopPropagation();
-}
+function unlazy () {
+  const imageUrlPrefix = 'https://downloads.fanbox.cc/images/post/';
 
-function fix (link) {
-  const href = link.href;
-
-  // basic sanity check
-  if (typeof href !== 'string' || !href.startsWith(imageUrlPrefix)) {
-    return;
+  function disableEventLink (event) {
+    event.stopPropagation();
   }
 
-  // don't run again if already run on passed link
-  if (link._ecUserscript) {
-    return;
+  function fix (link) {
+    const href = link.href;
+
+    // basic sanity check
+    if (typeof href !== 'string' || !href.startsWith(imageUrlPrefix)) {
+      return;
+    }
+
+    // don't run again if already run on passed link
+    if (link._ecUserscript) {
+      return;
+    }
+    link._ecUserscript = true;
+
+    link.addEventListener('click', disableEventLink);
+    const image = document.createElement('img');
+    image.style.width = '100%';
+    image.src = href;
+    link.replaceChildren(image);
   }
-  link._ecUserscript = true;
 
-  link.addEventListener('click', disableEventLink);
-  const image = document.createElement('img');
-  image.style.width = '100%';
-  image.src = href;
-  link.replaceChildren(image);
+  function run (node) {
+    if (!(node instanceof window.HTMLElement)) return;
+
+    fix(node);
+    for (const link of node.querySelectorAll(`[href^="${imageUrlPrefix}"]`)) {
+      fix(link);
+    }
+  }
+
+  function onMutate (mutations) {
+    for (const mutation of mutations) {
+      for (const node of mutation.addedNodes) {
+        run(node);
+      }
+    }
+  }
+
+  const observer = new window.MutationObserver(onMutate);
+  observer.observe(document, { childList: true, subtree: true });
+  run(document.body);
 }
 
-function run (node) {
-  if (!(node instanceof window.HTMLElement)) return;
-
-  fix(node);
-  for (const link of node.querySelectorAll(`[href^="${imageUrlPrefix}"]`)) {
-    fix(link);
-  }
-}
-
-function onMutate (mutations) {
-  for (const mutation of mutations) {
-    for (const node of mutation.addedNodes) {
-      run(node);
-    }
-  }
-}
-
-const observer = new window.MutationObserver(onMutate);
-observer.observe(document, { childList: true, subtree: true });
-run(document.body);
+unlazy();
--- a/rakuten-books-direct-search.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/rakuten-books-direct-search.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,6 +1,6 @@
 // ==UserScript==
 // @name         rakuten books direct search
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      1.0.6
 // @description  Search on rakuten without tracking proxy
 // @author       nanaya
@@ -9,13 +9,13 @@
 // @match        https://*.books.rakuten.co.jp/*
 // @match        http://*.books.rakuten.co.jp/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/rakuten-books-direct-search.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/rakuten-books-direct-search.user.js
 // ==/UserScript==
 
+'use strict';
+
 /* global jQuery */
-(function () {
-  'use strict';
-
+function noTrackSearch () {
   const $ = jQuery;
   const $form = $("form[name='srchFrm']");
 
@@ -23,4 +23,6 @@
 
   const searchUrl = $form.find("input[name='R2']").attr('value');
   $form.attr('action', searchUrl);
-}).call();
+}
+
+noTrackSearch();
--- a/soranews-image.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/soranews-image.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,17 +1,17 @@
 // ==UserScript==
 // @name         Soranews image fix
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      1.0.3
 // @description  Soranews lazy load image fix
 // @author       nanaya
 // @match        https://soranews24.com/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/soranews-image.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/soranews-image.user.js
 // ==/UserScript==
 
-(function () {
-  'use strict';
+'use strict';
 
+function unlazy () {
   const fix = function (image) {
     // basic sanity check
     if (!image.classList.contains('lazy')) {
@@ -52,4 +52,6 @@
   observer.observe(document, { childList: true, subtree: true });
   // initial run on existing document
   run();
-}).call();
+}
+
+unlazy();
--- a/surugaya-fixes.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/surugaya-fixes.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,18 +1,18 @@
 // ==UserScript==
 // @name         suruga-ya fixes
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      2.0.2
 // @description  Show all products with fast image
 // @author       nanaya
 // @match        https://www.suruga-ya.jp/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/surugaya-fixes.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/surugaya-fixes.user.js
 // ==/UserScript==
 
 'use strict';
 
 // always inject adult consent cookie
-(function () {
+function alwaysConsent () {
   const hasAdultCookie = document.cookie.split('; ').includes('adult=1');
   if (!hasAdultCookie) {
     const d = new Date();
@@ -20,10 +20,10 @@
     document.cookie = `adult=1; expires=${d.toGMTString()}; path=/`;
     window.location.reload();
   }
-})();
+}
 
 // skip loading image through php which seems to take forever
-(function () {
+function directImage () {
   const itemImageRegexp = /photo\.php\?shinaban=([0-9A-Z]+)/;
   function fix (image) {
     const origSrc = image.getAttribute('src');
@@ -60,4 +60,7 @@
   const observer = new window.MutationObserver(onMutate);
   observer.observe(document, { childList: true, subtree: true });
   run(document.body);
-})();
+}
+
+alwaysConsent();
+directImage();
--- a/tweetdeck-column-fix.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/tweetdeck-column-fix.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,14 +1,16 @@
 // ==UserScript==
 // @name         Tweetdeck column fix
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      1.1.0
 // @description  No weird column alignment and color for scrollbar
 // @author       nanaya
 // @match        https://tweetdeck.twitter.com/*
 // @grant        GM_addStyle
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/tweetdeck-column-fix.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/tweetdeck-column-fix.user.js
 // ==/UserScript==
 
+'use strict';
+
 /* global GM_addStyle */
 GM_addStyle(`
   .app-columns {
--- a/tweetdeck-large-image.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/tweetdeck-large-image.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -1,17 +1,17 @@
 // ==UserScript==
 // @name         Tweetdeck large image
-// @namespace    https://myconan.net
+// @namespace    https://nanaya.net
 // @version      2.0.9
 // @description  No more stupid link for images in tweetdeck
 // @author       nanaya
 // @match        https://tweetdeck.twitter.com/*
 // @grant        none
-// @downloadURL  https://hg.myconan.net/ec-userscripts/raw-file/tip/tweetdeck-large-image.user.js
+// @downloadURL  https://hg.nanaya.net/ec-userscripts/raw-file/tip/tweetdeck-large-image.user.js
 // ==/UserScript==
 
-(function () {
-  'use strict';
+'use strict';
 
+function origLink () {
   const fix = function (link) {
     // basic sanity check
     if (!link.classList.contains('js-media-image-link')) {
@@ -82,4 +82,6 @@
   observer.observe(document, { childList: true, subtree: true });
   // initial run on existing document
   run();
-}).call();
+}
+
+origLink();
--- a/youtube-no-shorts.user.js	Sun Jan 15 23:24:03 2023 +0900
+++ b/youtube-no-shorts.user.js	Sun Jan 15 23:33:41 2023 +0900
@@ -9,10 +9,12 @@
 // @run-at       document-start
 // ==/UserScript==
 
+'use strict';
+
 // Source: https://gist.github.com/Ultrawipf/7af006d1b8f75eddd3222d1053c3a243
-(function () {
-  'use strict';
+function shortDirect () {
   // From https://www.youtube.com/shorts/xxxx to https://www.youtube.com/watch?v=xxxx
+  window.location = window.location.href.replace('youtube.com/shorts/', 'youtube.com/watch?v=');
+}
 
-  window.location = window.location.href.replace('youtube.com/shorts/', 'youtube.com/watch?v=');
-})();
+shortDirect();