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