view jiku-chu-direct-link.js @ 1:f0c125358b24

(none)
author Edho Arief <me@myconan.net>
date Sun, 03 May 2015 04:04:42 +0000
parents
children ce30c81f3f0c
line wrap: on
line source

// ==UserScript==
// @name         Jiku-Chu direct link
// @namespace    https://myconan.net
// @version      1.0
// @description  Make proper link on Jiku-Chu pages
// @author       nanaya
// @match        http://www.jiku-chu.com/products/list.php?*
// @grant        none
// ==/UserScript==

$(".title a").each(function() {
  var
    $el = $(this),
    productId = $el.attr("onclick").replace(/.*product_id=(\d+).*/, "$1"),
    url = "/products/detail.php?product_id=" + productId
  $el.attr("href", url)
  $el.attr("onclick", "")
})