Mercurial > ec-userscripts
annotate jiku-chu-direct-link.user.js @ 58:960d452dea99
Bump version to force updating to new repository
| author | nanaya <me@nanaya.pro> |
|---|---|
| date | Thu, 23 Aug 2018 22:58:16 +0900 |
| parents | 09f735548b2c |
| children | 444b17e657be |
| rev | line source |
|---|---|
| 14 | 1 // ==UserScript== |
| 2 // @name Jiku-Chu direct link | |
| 3 // @namespace https://myconan.net | |
|
58
960d452dea99
Bump version to force updating to new repository
nanaya <me@nanaya.pro>
parents:
57
diff
changeset
|
4 // @version 2.5.3 |
| 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 |
| 57 | 10 // @downloadURL https://bitbucket.org/nanayapro/ec-userscripts/raw/tip/jiku-chu-direct-link.user.js |
| 14 | 11 // ==/UserScript== |
| 12 | |
| 50 | 13 ;(function () { |
| 14 'use strict'; | |
| 15 const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]"); | |
| 16 const removeOnClick = function (el) { | |
| 17 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1'); | |
| 18 const url = `/products/detail.php?product_id=${productId}`; | |
| 33 | 19 |
| 50 | 20 el.setAttribute('href', url); |
| 21 el.setAttribute('onclick', ''); | |
| 49 | 22 }; |
| 33 | 23 |
| 49 | 24 Array.prototype.forEach.call(links, removeOnClick); |
| 50 | 25 }()); |
