Mercurial > ec-userscripts
diff jiku-chu-direct-link.user.js @ 33:28505554a8b9
(none)
author | Edho Arief <me@myconan.net> |
---|---|
date | Sun, 25 Dec 2016 07:41:17 +0000 |
parents | 4b13157ae3a1 |
children | 32a213717e6a |
line wrap: on
line diff
--- a/jiku-chu-direct-link.user.js Sat Dec 24 04:41:13 2016 +0000 +++ b/jiku-chu-direct-link.user.js Sun Dec 25 07:41:17 2016 +0000 @@ -1,7 +1,7 @@ // ==UserScript== // @name Jiku-Chu direct link // @namespace https://myconan.net -// @version 2.5.0 +// @version 2.5.1 // @description Make proper link on Jiku-Chu pages // @author nanaya // @match http://www.jiku-chu.com/* @@ -10,14 +10,15 @@ // ==/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", ""); - } - ) + "use strict"; + var links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]") + var removeOnClick = function(el) { + var productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1") + var url = "/products/detail.php?product_id=" + productId + + el.setAttribute("href", url) + el.setAttribute("onclick", "") + } + + Array.prototype.forEach.call(links, removeOnClick) }).call(); \ No newline at end of file