您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically click the "Show More" subscriptions button in the side bar
当前为
// ==UserScript== // @name YouTube - automatically expand subscription list // @description Automatically click the "Show More" subscriptions button in the side bar // @namespace https://greasyfork.org/en/scripts/367774-youtube-automatically-expand-subscription-list // @version 0.1.4 // @author Valacar // @include https://www.youtube.com/* // @noframes // @grant none // ==/UserScript== (function() { 'use strict'; const DEBUGGING = 0; const debugLog = DEBUGGING ? console.debug : function() {}; const debugAssert = DEBUGGING ? console.assert : function() {}; window.addEventListener("loadstart", expandSubscriptions, true); function expandSubscriptions() { const expanders = document.querySelectorAll("ytd-guide-collapsible-entry-renderer"); debugLog("----------"); debugLog("::: Found %d expanders", expanders.length); if (expanders.length == 0) { window.removeEventListener("loadstart", expandSubscriptions, true); } for (let expander of expanders) { debugLog("\t", expander); debugAssert(expander.previousSibling); const itemAbove = expander.previousSibling; const subscriptionChannel = itemAbove.querySelectorAll( 'a[href^="/c/"],a[href^="/user/"],a[href^="/feed/subscriptions/"],a[href^="/channel/"]' ); if (subscriptionChannel.length) { debugLog("\t\tFound a subscription channel", subscriptionChannel[0]); const isExpanded = expander.hasAttribute("expanded"); if (!isExpanded) { const expanderItem = expander.querySelector("#expander-item"); if (expanderItem) { debugLog("::: Found #expander-item", expanderItem); debugLog("::: %cClicking #expander-item", "background: green; color: white; font-weight: bold;" ); expanderItem.click(); window.removeEventListener("loadstart", expandSubscriptions, true); } else { debugLog("::: Can't find #expander-item to click."); } return; } else { debugLog("::: Expander is already expanded. Not clicking."); } } else { debugLog("\t\tNo subscription channel link above expander."); } } } })();