view jiku-chu-direct-link.user.js @ 31:e18a3d8230c9

(none)
author Edho Arief <me@myconan.net>
date Sat, 24 Dec 2016 04:40:27 +0000
parents 4b13157ae3a1
children 28505554a8b9
line wrap: on
line source

// ==UserScript==
// @name         Jiku-Chu direct link
// @namespace    https://myconan.net
// @version      2.5.0
// @description  Make proper link on Jiku-Chu pages
// @author       nanaya
// @match        http://www.jiku-chu.com/*
// @grant        none
// @downloadURL  https://bitbucket.org/!api/2.0/snippets/nanaya1/TK64/tip/files/jiku-chu-direct-link.user.js
// ==/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();