view jiku-chu-direct-link.js @ 11:888cdeba7a16

(none)
author Edho Arief <me@myconan.net>
date Thu, 06 Aug 2015 05:50:51 +0000
parents bd7febc9889b
children 06e6dbdedd47
line wrap: on
line source

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

;(function() {
  Array.prototype.forEach.call(
    document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]"),
    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();