From 7c35ea0f5e15da59a3e275806920843ca2502f81 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Thu, 22 Sep 2022 18:25:45 +0800 Subject: [PATCH] Create remove_bilibili_video_page_params.js --- remove_bilibili_video_page_params.js | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 remove_bilibili_video_page_params.js diff --git a/remove_bilibili_video_page_params.js b/remove_bilibili_video_page_params.js new file mode 100644 index 0000000..cd34137 --- /dev/null +++ b/remove_bilibili_video_page_params.js @@ -0,0 +1,31 @@ +// ==UserScript== +// @name 移除 BiliBili 播放页的死🐴参数 +// @namespace http://tampermonkey.net/ +// @version 0.1 +// @description 仅保留t和p的参数 +// @author lifegpc +// @match https://www.bilibili.com/video/* +// @icon https://www.bilibili.com/favicon.ico +// @grant none +// ==/UserScript== + +(function() { + function check_get_param() { + let ori = new URL(document.location.href); + let need_replease = false; + let params = new URLSearchParams(); + for (const [key, value] of ori.searchParams.entries()) { + if (key != "t" && key != "p") { + need_replease = true; + } else { + params.append(key, value); + } + } + if (need_replease) { + history.replaceState(null, null, '?' + params.toString()) + } + setTimeout(check_get_param, 1000); + } + check_get_param(); + 'use strict'; +})();