annotate jiku-chu-direct-link.user.js @ 78:9dc1be1a6c7a

Bye image lazy loading on pixiv fanbox
author nanaya <me@nanaya.pro>
date Thu, 06 Aug 2020 19:39:49 +0900
parents 5a3a269c5e6f
children 86da34e62d29
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
77
5a3a269c5e6f Update downloadurl
nanaya <me@nanaya.pro>
parents: 73
diff changeset
4 // @version 2.5.5
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
77
5a3a269c5e6f Update downloadurl
nanaya <me@nanaya.pro>
parents: 73
diff changeset
10 // @downloadURL https://hg.sr.ht/~nanaya/ec-userscripts/raw/jiku-chu-direct-link.user.js?rev=tip
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 }())