Mercurial > ec-userscripts
comparison jiku-chu-direct-link.js @ 3:7687bbda0bb4
(none)
author | Edho Arief <me@myconan.net> |
---|---|
date | Sun, 03 May 2015 04:23:06 +0000 |
parents | ce30c81f3f0c |
children | 59084566b064 |
comparison
equal
deleted
inserted
replaced
2:ce30c81f3f0c | 3:7687bbda0bb4 |
---|---|
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.0 | 4 // @version 2.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/products/list.php?* | 7 // @match http://www.jiku-chu.com/products/list.php?* |
8 // @grant none | 8 // @grant none |
9 // ==/UserScript== | 9 // ==/UserScript== |
10 | 10 |
11 ;(function() { | 11 ;(function() { |
12 console.log("hi") | 12 Array.prototype.forEach.call( |
13 var | 13 document.querySelectorAll(".title a, .photo a"), |
14 links = document.querySelectorAll(".title a, .photo a") | 14 function(el) { |
15 Array.prototype.forEach.call(links, function(el) { | 15 var |
16 var | 16 productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1"), |
17 productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1"), | 17 url = "/products/detail.php?product_id=" + productId |
18 url = "/products/detail.php?product_id=" + productId | 18 el.setAttribute("href", url) |
19 el.setAttribute("href", url) | 19 el.setAttribute("onclick", "") |
20 el.setAttribute("onclick", "") | 20 } |
21 }) | 21 ) |
22 }).call(); | 22 }).call(); |