Last active
October 20, 2020 22:45
-
-
Save LaughDonor/166c4d7ff51c2c70d23b57f7614ae63d to your computer and use it in GitHub Desktop.
YouTube History - One Click Delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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