NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @namespace https://openuserjs.org/users/fardjad // @name No Thanks, YouTube! // @description Automatically dismisses the sign-in to YouTube popover // @copyright 2021, Fardjad Davari (https://openuserjs.org/users/fardjad) // @author Fardjad Davari // @license MIT // @version 1.0.0 // @include https://www.youtube.com/* // @grant none // ==/UserScript== // ==OpenUserJS== // @author fardjad // ==/OpenUserJS== (async function () { 'use strict'; const waitForDom = () => { return new Promise((resolve, reject) => { if (document.readyState === "loading") { document.addEventListener('DOMContentLoaded', resolve); } else { resolve(); } }); }; const findDismissButton = () => { return document.querySelector('#dismiss-button #text'); } const clickDismissButton = () => { const dismissButton = findDismissButton(); if (dismissButton == null) { return false; } dismissButton.click(); return true; }; const noThanksYouTube = () => { let retries = 30; setTimeout(() => { if (retries === 0) return; retries -= 1; const done = clickDismissButton(); if (!done) { noThanksYouTube(); } }, 1000); } await waitForDom(); noThanksYouTube(); }());