Mercurial > ec-userscripts
view 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 |
line wrap: on
line source
// ==UserScript== // @name Jiku-Chu direct link // @namespace https://myconan.net // @version 2.1 // @description Make proper link on Jiku-Chu pages // @author nanaya // @match http://www.jiku-chu.com/products/list.php?* // @grant none // ==/UserScript== ;(function() { Array.prototype.forEach.call( document.querySelectorAll(".title a, .photo a"), 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();