comparison 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
comparison
equal deleted inserted replaced
32:41953e59d06f 33:28505554a8b9
1 // ==UserScript== 1 // ==UserScript==
2 // @name Jiku-Chu direct link 2 // @name Jiku-Chu direct link
3 // @namespace https://myconan.net 3 // @namespace https://myconan.net
4 // @version 2.5.0 4 // @version 2.5.1
5 // @description Make proper link on Jiku-Chu pages 5 // @description Make proper link on Jiku-Chu pages
6 // @author nanaya 6 // @author nanaya
7 // @match http://www.jiku-chu.com/* 7 // @match http://www.jiku-chu.com/*
8 // @grant none 8 // @grant none
9 // @downloadURL https://bitbucket.org/!api/2.0/snippets/nanaya1/TK64/tip/files/jiku-chu-direct-link.user.js 9 // @downloadURL https://bitbucket.org/!api/2.0/snippets/nanaya1/TK64/tip/files/jiku-chu-direct-link.user.js
10 // ==/UserScript== 10 // ==/UserScript==
11 11
12 ;(function() { 12 ;(function() {
13 Array.prototype.forEach.call( 13 "use strict";
14 document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]"), 14 var links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]")
15 function(el) { 15 var removeOnClick = function(el) {
16 var 16 var productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1")
17 productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1"), 17 var url = "/products/detail.php?product_id=" + productId
18 url = "/products/detail.php?product_id=" + productId; 18
19 el.setAttribute("href", url); 19 el.setAttribute("href", url)
20 el.setAttribute("onclick", ""); 20 el.setAttribute("onclick", "")
21 } 21 }
22 ) 22
23 Array.prototype.forEach.call(links, removeOnClick)
23 }).call(); 24 }).call();