annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
Edho Arief <me@myconan.net>
parents:
diff changeset
1 // ==UserScript==
Edho Arief <me@myconan.net>
parents:
diff changeset
2 // @name Jiku-Chu direct link
Edho Arief <me@myconan.net>
parents:
diff changeset
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
Edho Arief <me@myconan.net>
parents:
diff changeset
5 // @description Make proper link on Jiku-Chu pages
Edho Arief <me@myconan.net>
parents:
diff changeset
6 // @author nanaya
Edho Arief <me@myconan.net>
parents:
diff changeset
7 // @match http://www.jiku-chu.com/*
50
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
8 // @match https://www.jiku-chu.com/*
14
Edho Arief <me@myconan.net>
parents:
diff changeset
9 // @grant none
57
09f735548b2c No more snippets
nanaya <me@nanaya.pro>
parents: 50
diff changeset
10 // @downloadURL https://bitbucket.org/nanayapro/ec-userscripts/raw/tip/jiku-chu-direct-link.user.js
14
Edho Arief <me@myconan.net>
parents:
diff changeset
11 // ==/UserScript==
Edho Arief <me@myconan.net>
parents:
diff changeset
12
50
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
13 ;(function () {
66
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
14 'use strict'
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
15 const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]")
50
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
16 const removeOnClick = function (el) {
66
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
17 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1')
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
18 const url = `/products/detail.php?product_id=${productId}`
33
Edho Arief <me@myconan.net>
parents: 19
diff changeset
19
66
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
20 el.setAttribute('href', url)
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
21 el.setAttribute('onclick', '')
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
22 }
33
Edho Arief <me@myconan.net>
parents: 19
diff changeset
23
66
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
24 Array.prototype.forEach.call(links, removeOnClick)
444b17e657be Standardize code style
nanaya <me@nanaya.pro>
parents: 58
diff changeset
25 }())