14
|
1 // ==UserScript==
|
|
2 // @name Jiku-Chu direct link
|
109
|
3 // @namespace https://nanaya.net
|
82
|
4 // @version 2.5.6
|
14
|
5 // @description Make proper link on Jiku-Chu pages
|
|
6 // @author nanaya
|
|
7 // @match http://www.jiku-chu.com/*
|
50
|
8 // @match https://www.jiku-chu.com/*
|
14
|
9 // @grant none
|
109
|
10 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/jiku-chu-direct-link.user.js
|
14
|
11 // ==/UserScript==
|
|
12
|
109
|
13 'use strict';
|
|
14
|
|
15 function directLink () {
|
108
|
16 const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]");
|
50
|
17 const removeOnClick = function (el) {
|
108
|
18 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1');
|
|
19 const url = `/products/detail.php?product_id=${productId}`;
|
33
|
20
|
108
|
21 el.setAttribute('href', url);
|
|
22 el.setAttribute('onclick', '');
|
|
23 };
|
33
|
24
|
108
|
25 Array.prototype.forEach.call(links, removeOnClick);
|
109
|
26 }
|
|
27
|
|
28 directLink();
|