您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
When opening a video from a playlist, strip out the parameters that make it open in a playlist UI
// ==UserScript== // @name Suppress YouTube Playlist links // @namespace http://tampermonkey.net/ // @description When opening a video from a playlist, strip out the parameters that make it open in a playlist UI // @license MIT // @author Igor Makarov // @match *://*.youtube.com/playlist* // @match *://*.youtube.com/feed/history* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @version 0.0.1.20241227113632 // ==/UserScript== var hrefsCount = 0; function modifyLinks() { let hrefs = document.querySelectorAll('a'); if (hrefs.length == hrefsCount) { return; } hrefsCount = hrefs.length; hrefs.forEach(link => { let href = link.href if (!href) { return; } // console.log(`href: ${href}`); let url = new URL(href, document.location); if (url.searchParams && url.searchParams.has('list')) { url.searchParams.delete('list'); } if (url.searchParams && url.searchParams.has('index')) { url.searchParams.delete('index'); } if (url.searchParams && url.searchParams.has('pp')) { url.searchParams.delete('pp'); } link.href = url // console.log(`url: ${url}`); }); } document.addEventListener('DOMContentLoaded', modifyLinks) let observer = new MutationObserver(e => { modifyLinks() }) observer.observe(document, { subtree: true, //attributes: true, //characterData: true, childList: true })