// ==UserScript== // @name 爱达杂货铺 // @namespace https://github.com/RUInalan/AidaGroceryStore // @version 8.8.88 // @author YouXiaoHou // @description 1 // @license AGPL-3.0-or-later // @match *://adzhp.net/* // ==/UserScript== (function () { function StraightChainP(){ // 获取页面上所有的 标签 const links = document.getElementsByTagName('a'); // 遍历每个链接,匹配与正则表达式相符的链接 for (let i = 0; i < links.length; i++) { const link = links[i]; const pattern = //; if (pattern.test(link.outerHTML)) { //开始修改 link.href = link.dataset.url; } } } StraightChainP(); const pagenumber = document.getElementsByClassName("pagenumber nav-item"); for (let i = 0; i < pagenumber.length; i++) { console.log(pagenumber[i]); pagenumber[i].onclick = StraightChainP; } })();