Mercurial > ec-userscripts
view mandarake-direct-link.user.js @ 77:5a3a269c5e6f
Update downloadurl
author | nanaya <me@nanaya.pro> |
---|---|
date | Wed, 08 Jul 2020 20:45:05 +0900 |
parents | 521dda0a0b6f |
children | 86da34e62d29 |
line wrap: on
line source
// ==UserScript== // @name mandarake direct link // @namespace https://myconan.net // @version 1.3.5 // @description Make proper link on mandarake pages // @author nanaya // @match https://order.mandarake.co.jp/* // @match http://order.mandarake.co.jp/* // @grant none // @downloadURL https://hg.sr.ht/~nanaya/ec-userscripts/raw/mandarake-direct-link.user.js?rev=tip // ==/UserScript== /* global $ */ ;(function () { 'use strict' $('.r18mark').remove() $(".r18item ~ a[href^='#adult_confirm']").remove() var fixR18Link = function (_i, el) { var url = `/order/detailPage/item?itemCode=${el.id}` el.setAttribute('href', url) el.setAttribute('class', '') } $("[href^='#adult_confirm']").each(fixR18Link) var currentQuery = new URLSearchParams(window.location.search) var fixSearchLink = function (_i, el) { var query = new URLSearchParams(el.search) for (const [key, value] of currentQuery) { if (!query.has(key)) { query.set(key, value) } } el.setAttribute('href', `/order/listPage/list?${query.toString()}`) } $("[href^='/order/listPage/list?']").each(fixSearchLink) }).call()