diff jiku-chu-direct-link.user.js @ 14:6415f831aa5a

(none)
author Edho Arief <me@myconan.net>
date Mon, 21 Sep 2015 06:34:01 +0000
parents
children aa43130ad87f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jiku-chu-direct-link.user.js	Mon Sep 21 06:34:01 2015 +0000
@@ -0,0 +1,22 @@
+// ==UserScript==
+// @name         Jiku-Chu direct link
+// @namespace    https://myconan.net
+// @version      2.3
+// @description  Make proper link on Jiku-Chu pages
+// @author       nanaya
+// @match        http://www.jiku-chu.com/*
+// @grant        none
+// ==/UserScript==
+
+;(function() {
+  Array.prototype.forEach.call(
+    document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]"),
+    function(el) {
+      var
+        productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1"),
+        url = "/products/detail.php?product_id=" + productId;
+      el.setAttribute("href", url);
+      el.setAttribute("onclick", "");
+    }
+  )
+}).call();
\ No newline at end of file