您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
移除url中冗余的查询参数
// ==UserScript== // @name 清洗url // @namespace http://tampermonkey.net/ // @version 0.9 // @description 移除url中冗余的查询参数 // @author 微笑 // @run-at document-idle // @match https://mp.weixin.qq.com/* // @match https://www.zhihu.com/* // @match https://*.bilibili.com/* // @match https://github.com/* // @match https://*.aliyun.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=qq.com // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; const domainConfig = { 'mp.weixin.qq.com': { removeKeys: ['chksm', 'source'], removeHash: true, }, 'www.zhihu.com': { removeKeys: ['utm_medium', 'utm_oi', 'utm_source'], removeHash: false, }, 'search.bilibili.com': { removeKeys: ['spm_id_from', 'from_source', 'search_source', 'vt'], removeHash: false, }, 'space.bilibili.com': { removeKeys: ['spm_id_from', 'from_source', 'search_source'], removeHash: false, }, 'www.bilibili.com': { removeKeys: [ 'buvid', 'is_story_h5', 'mid', 'p', 'plat_id', 'share_from', 'share_medium', 'share_plat', 'share_session_id', 'share_source', 'share_tag', 'timestamp', 'unique_k', 'up_id', 'vd_source', 'spm_id_from', ], }, 'github.com': { removeKeys: ['ref'], }, }; const defaultRemoveKeys = ['spm']; const { href, host } = location; const newUrl = new URL(href); const removeParams = (keys) => { keys.forEach((key) => { newUrl.searchParams.delete(key); }); }; const configForCurrentDomain = domainConfig[host]; removeParams(configForCurrentDomain?.removeKeys || defaultRemoveKeys); if (configForCurrentDomain) { if (configForCurrentDomain.removeHash) { newUrl.hash = ''; } } const newHref = newUrl.toString(); if (newHref !== href) { setTimeout(() => { history.replaceState(null, '', newHref); }, 3000); } if (host === 'www.bilibili.com') { const adDom = document.querySelector('.adblock-tips'); if (adDom) { adDom.remove(); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址