annotate jiku-chu-direct-link.user.js @ 111:055f5d084706

Fix metadata and reset version
author nanaya <me@nanaya.net>
date Sun, 15 Jan 2023 23:37:14 +0900
parents ef21ef445fc6
children d9dc190bccaf
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
109
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
3 // @namespace https://nanaya.net
82
86da34e62d29 Update url
nanaya <me@nanaya.pro>
parents: 77
diff changeset
4 // @version 2.5.6
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
109
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
10 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/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
109
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
13 'use strict';
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
14
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
15 function directLink () {
108
2c4470b73ad9 Switch to semistandard
nanaya <me@nanaya.net>
parents: 82
diff changeset
16 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
17 const removeOnClick = function (el) {
108
2c4470b73ad9 Switch to semistandard
nanaya <me@nanaya.net>
parents: 82
diff changeset
18 const productId = el.getAttribute('onclick').replace(/.*product_id=(\d+).*/, '$1');
2c4470b73ad9 Switch to semistandard
nanaya <me@nanaya.net>
parents: 82
diff changeset
19 const url = `/products/detail.php?product_id=${productId}`;
33
Edho Arief <me@myconan.net>
parents: 19
diff changeset
20
108
2c4470b73ad9 Switch to semistandard
nanaya <me@nanaya.net>
parents: 82
diff changeset
21 el.setAttribute('href', url);
2c4470b73ad9 Switch to semistandard
nanaya <me@nanaya.net>
parents: 82
diff changeset
22 el.setAttribute('onclick', '');
2c4470b73ad9 Switch to semistandard
nanaya <me@nanaya.net>
parents: 82
diff changeset
23 };
33
Edho Arief <me@myconan.net>
parents: 19
diff changeset
24
108
2c4470b73ad9 Switch to semistandard
nanaya <me@nanaya.net>
parents: 82
diff changeset
25 Array.prototype.forEach.call(links, removeOnClick);
109
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
26 }
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
27
ef21ef445fc6 Cleanups
nanaya <me@nanaya.net>
parents: 108
diff changeset
28 directLink();