Create remove_bilibili_video_page_params.js
This commit is contained in:
31
remove_bilibili_video_page_params.js
Normal file
31
remove_bilibili_video_page_params.js
Normal file
@@ -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';
|
||||
})();
|
||||
Reference in New Issue
Block a user