annotate jiku-chu-direct-link.user.js @ 53:28fde586a234

Add twitter anti-crap (part 1)
author nanaya <me@nanaya.pro>
date Sat, 30 Jun 2018 21:50:51 +0900
parents e8517cc75a74
children 09f735548b2c
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
50
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
4 // @version 2.5.2
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
35
32a213717e6a Update update url
nanaya <me@nanaya.pro>
parents: 33
diff changeset
10 // @downloadURL https://bitbucket.org/!api/2.0/snippets/nanayapro/TK64/tip/files/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 () {
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
14 'use strict';
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
15 const links = document.querySelectorAll("a[onclick^=\"age_verification_submit('/products/detail.php?product_id=\"]");
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
16 const removeOnClick = function (el) {
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
17 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1');
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
18 const url = `/products/detail.php?product_id=${productId}`;
33
Edho Arief <me@myconan.net>
parents: 19
diff changeset
19
50
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
20 el.setAttribute('href', url);
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
21 el.setAttribute('onclick', '');
49
2e1cae72a63e Semicolons
nanaya <me@nanaya.pro>
parents: 35
diff changeset
22 };
33
Edho Arief <me@myconan.net>
parents: 19
diff changeset
23
49
2e1cae72a63e Semicolons
nanaya <me@nanaya.pro>
parents: 35
diff changeset
24 Array.prototype.forEach.call(links, removeOnClick);
50
e8517cc75a74 Add https, update coding style
nanaya <me@nanaya.pro>
parents: 49
diff changeset
25 }());