Mercurial > ec-userscripts
annotate mandarake-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 | 17c94a818088 |
rev | line source |
---|---|
16 | 1 // ==UserScript== |
2 // @name mandarake direct link | |
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 1.3.3 |
16 | 5 // @description Make proper link on mandarake pages |
6 // @author nanaya | |
7 // @match https://order.mandarake.co.jp/* | |
18 | 8 // @match http://order.mandarake.co.jp/* |
16 | 9 // @grant none |
57 | 10 // @downloadURL https://bitbucket.org/nanayapro/ec-userscripts/raw/tip/mandarake-direct-link.user.js |
16 | 11 // ==/UserScript== |
12 | |
66 | 13 /* global $ */ |
14 ;(function () { | |
15 'use strict' | |
51 | 16 |
66 | 17 $('.r18mark').remove() |
18 $(".r18item ~ a[href^='#adult_confirm']").remove() | |
51 | 19 |
66 | 20 var fixR18Link = function (_i, el) { |
21 var url = `/order/detailPage/item?itemCode=${el.id}` | |
16 | 22 |
66 | 23 el.setAttribute('href', url) |
24 el.setAttribute('class', '') | |
25 } | |
16 | 26 |
66 | 27 $("[href^='#adult_confirm']").each(fixR18Link) |
48 | 28 |
66 | 29 var currentQuery = new URLSearchParams(window.location.search) |
30 var fixSearchLink = function (_i, el) { | |
31 var query = new URLSearchParams(el.search) | |
48 | 32 |
33 for (let [key, value] of currentQuery) { | |
34 if (!query.has(key)) { | |
66 | 35 query.set(key, value) |
48 | 36 } |
37 } | |
38 | |
66 | 39 el.setAttribute('href', `/order/listPage/list?${query.toString()}`) |
40 } | |
48 | 41 |
66 | 42 $("[href^='/order/listPage/list?']").each(fixSearchLink) |
43 }).call() |