diff jiku-chu-direct-link.user.js @ 117:d9dc190bccaf

Undo combining fixes into single script per site
author nanaya <me@nanaya.net>
date Sun, 15 Jan 2023 23:49:35 +0900
parents ef21ef445fc6
children 8de2d53a4cb1
line wrap: on
line diff
--- a/jiku-chu-direct-link.user.js	Sun Jan 15 23:46:56 2023 +0900
+++ b/jiku-chu-direct-link.user.js	Sun Jan 15 23:49:35 2023 +0900
@@ -12,17 +12,13 @@
 
 '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');
-    const url = `/products/detail.php?product_id=${productId}`;
+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');
+  const url = `/products/detail.php?product_id=${productId}`;
 
-    el.setAttribute('href', url);
-    el.setAttribute('onclick', '');
-  };
+  el.setAttribute('href', url);
+  el.setAttribute('onclick', '');
+};
 
-  Array.prototype.forEach.call(links, removeOnClick);
-}
-
-directLink();
+Array.prototype.forEach.call(links, removeOnClick);