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