Mercurial > ec-userscripts
comparison jiku-chu-direct-link.user.js @ 66:444b17e657be
Standardize code style
author | nanaya <me@nanaya.pro> |
---|---|
date | Wed, 10 Jul 2019 22:36:31 +0900 |
parents | 960d452dea99 |
children | 521dda0a0b6f |
comparison
equal
deleted
inserted
replaced
65:72ef6fcdff44 | 66:444b17e657be |
---|---|
9 // @grant none | 9 // @grant none |
10 // @downloadURL https://bitbucket.org/nanayapro/ec-userscripts/raw/tip/jiku-chu-direct-link.user.js | 10 // @downloadURL https://bitbucket.org/nanayapro/ec-userscripts/raw/tip/jiku-chu-direct-link.user.js |
11 // ==/UserScript== | 11 // ==/UserScript== |
12 | 12 |
13 ;(function () { | 13 ;(function () { |
14 'use strict'; | 14 'use strict' |
15 const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]"); | 15 const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]") |
16 const removeOnClick = function (el) { | 16 const removeOnClick = function (el) { |
17 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1'); | 17 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1') |
18 const url = `/products/detail.php?product_id=${productId}`; | 18 const url = `/products/detail.php?product_id=${productId}` |
19 | 19 |
20 el.setAttribute('href', url); | 20 el.setAttribute('href', url) |
21 el.setAttribute('onclick', ''); | 21 el.setAttribute('onclick', '') |
22 }; | 22 } |
23 | 23 |
24 Array.prototype.forEach.call(links, removeOnClick); | 24 Array.prototype.forEach.call(links, removeOnClick) |
25 }()); | 25 }()) |