view jiku-chu-direct-link.user.js @ 46:c20e3e6b0a3f

Even more rulesss
author nanaya <me@nanaya.pro>
date Thu, 24 Aug 2017 20:51:06 +0900
parents 32a213717e6a
children 2e1cae72a63e
line wrap: on
line source

// ==UserScript==
// @name         Jiku-Chu direct link
// @namespace    https://myconan.net
// @version      2.5.1
// @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/nanayapro/TK64/tip/files/jiku-chu-direct-link.user.js
// ==/UserScript==

;(function() {
  "use strict";
  var links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]")
  var removeOnClick = function(el) {
    var productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1")
    var url = "/products/detail.php?product_id=" + productId

    el.setAttribute("href", url)
    el.setAttribute("onclick", "")
  }

  Array.prototype.forEach.call(links, removeOnClick)
}).call();