Skip to content

Instantly share code, notes, and snippets.

@LaughDonor
Last active October 20, 2020 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LaughDonor/166c4d7ff51c2c70d23b57f7614ae63d to your computer and use it in GitHub Desktop.
Save LaughDonor/166c4d7ff51c2c70d23b57f7614ae63d to your computer and use it in GitHub Desktop.
YouTube History - One Click Delete
// ==UserScript==
// @name Youtube History - One Click Delete
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Delete selectively from Youtube History without submenu.
// @author Sunny Patel <laughdonor@gmail.com>
// @homepage https://gist.github.com/LaughDonor/166c4d7ff51c2c70d23b57f7614ae63d
// @match https://myactivity.google.com/activitycontrols/youtube*
// @downloadURL https://gist.github.com/LaughDonor/166c4d7ff51c2c70d23b57f7614ae63d/raw/youtubehistory-one-click.user.js
// @updateURL https://gist.github.com/LaughDonor/166c4d7ff51c2c70d23b57f7614ae63d/raw/youtubehistory-one-click.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
for( const card of document.querySelectorAll('div[aria-label="Card showing an activity from YouTube"] [aria-label="Open activity options menu"]')) {
const menu = card.parentElement;
const del = menu.nextSibling.children[0].children[0].children[2];
if(menu.parentElement.children.length === 2) {
menu.parentElement.style.display = 'flex';
menu.insertAdjacentHTML('afterend', '<div><button class="VfPpkd-Bz112c-LgbsSe" aria-label="Remove from history"><i class="material-icons-extended" aria-hidden="true">close</i></button></div>')
menu.nextSibling.addEventListener('click', e => del.click());
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment