您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically expand all YouTube video comments. No more clicking "View all replies" or "Read more".
当前为
- // ==UserScript==
- // @name YouTube (New Design) | Expand All Video Comments
- // @namespace de.sidneys.userscripts
- // @homepage https://gist.githubusercontent.com/sidneys/6756166a781bd76b97eeeda9fb0bc0c1/raw/
- // @version 1.0.0
- // @description Automatically expand all YouTube video comments. No more clicking "View all replies" or "Read more".
- // @author sidneys
- // @icon https://www.youtube.com/favicon.ico
- // @include http*://www.youtube.com/*
- // @require https://greasyfork.org/scripts/38888-greasemonkey-color-log/code/Greasemonkey%20%7C%20Color%20Log.js
- // @require https://greasyfork.org/scripts/38889-greasemonkey-waitforkeyelements-2018/code/Greasemonkey%20%7C%20waitForKeyElements%202018.js
- // @run-at document-end
- // ==/UserScript==
- /**
- * @default
- * @constant
- * @global
- */
- DEBUG = false;
- /**
- * @default
- * @constant
- */
- const urlPath = '/watch';
- /**
- * Init
- */
- let init = () => {
- console.info('init');
- // Check URL
- if (!location.pathname.startsWith(urlPath)) { return; }
- // Wait for "View all reples"
- waitForKeyElements('.more-button.ytd-comment-replies-renderer', (element) => {
- element.click();
- console.info('Expanded:', '"View all replies"');
- });
- // Wait for "Read More"
- waitForKeyElements('.more-button.ytd-comment-renderer', (element) => {
- element.click();
- console.info('Expanded:', '"Read More"');
- });
- };
- /**
- * @listens window:Event#load
- */
- window.addEventListener('load', () => {
- console.debug('window#load');
- init();
- });
- /**
- * @listens window:Event#spfdone
- */
- window.addEventListener('spfdone', () => {
- console.debug('window#spfdone');
- init();
- });