Mercurial > ec-userscripts
comparison jiku-chu-direct-link.user.js @ 50:e8517cc75a74
Add https, update coding style
author | nanaya <me@nanaya.pro> |
---|---|
date | Fri, 13 Oct 2017 02:40:23 +0900 |
parents | 2e1cae72a63e |
children | 09f735548b2c |
comparison
equal
deleted
inserted
replaced
49:2e1cae72a63e | 50:e8517cc75a74 |
---|---|
1 // ==UserScript== | 1 // ==UserScript== |
2 // @name Jiku-Chu direct link | 2 // @name Jiku-Chu direct link |
3 // @namespace https://myconan.net | 3 // @namespace https://myconan.net |
4 // @version 2.5.1 | 4 // @version 2.5.2 |
5 // @description Make proper link on Jiku-Chu pages | 5 // @description Make proper link on Jiku-Chu pages |
6 // @author nanaya | 6 // @author nanaya |
7 // @match http://www.jiku-chu.com/* | 7 // @match http://www.jiku-chu.com/* |
8 // @match https://www.jiku-chu.com/* | |
8 // @grant none | 9 // @grant none |
9 // @downloadURL https://bitbucket.org/!api/2.0/snippets/nanayapro/TK64/tip/files/jiku-chu-direct-link.user.js | 10 // @downloadURL https://bitbucket.org/!api/2.0/snippets/nanayapro/TK64/tip/files/jiku-chu-direct-link.user.js |
10 // ==/UserScript== | 11 // ==/UserScript== |
11 | 12 |
12 ;(function() { | 13 ;(function () { |
13 "use strict"; | 14 'use strict'; |
14 var 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=\"]"); |
15 var removeOnClick = function(el) { | 16 const removeOnClick = function (el) { |
16 var productId = el.getAttribute("onclick").replace(/.*product_id=(\d+).*/, "$1"); | 17 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1'); |
17 var url = "/products/detail.php?product_id=" + productId; | 18 const url = `/products/detail.php?product_id=${productId}`; |
18 | 19 |
19 el.setAttribute("href", url); | 20 el.setAttribute('href', url); |
20 el.setAttribute("onclick", ""); | 21 el.setAttribute('onclick', ''); |
21 }; | 22 }; |
22 | 23 |
23 Array.prototype.forEach.call(links, removeOnClick); | 24 Array.prototype.forEach.call(links, removeOnClick); |
24 }).call(); | 25 }()); |