Mercurial > ec-userscripts
annotate jiku-chu-direct-link.user.js @ 117:d9dc190bccaf
Undo combining fixes into single script per site
author | nanaya <me@nanaya.net> |
---|---|
date | Sun, 15 Jan 2023 23:49:35 +0900 |
parents | ef21ef445fc6 |
children | 8de2d53a4cb1 |
rev | line source |
---|---|
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 | |
117
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
15 const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]"); |
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
16 const removeOnClick = function (el) { |
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
17 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1'); |
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
18 const url = `/products/detail.php?product_id=${productId}`; |
33 | 19 |
117
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
20 el.setAttribute('href', url); |
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
21 el.setAttribute('onclick', ''); |
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
22 }; |
33 | 23 |
117
d9dc190bccaf
Undo combining fixes into single script per site
nanaya <me@nanaya.net>
parents:
109
diff
changeset
|
24 Array.prototype.forEach.call(links, removeOnClick); |