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();
});