Last active
May 23, 2019 09:00
-
-
Save moskytw/3c2854817e3eb0927abeb534fff97f4f to your computer and use it in GitHub Desktop.
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
(function () { | |
const intervalMiliseconds = 10; | |
const waitToLoadMiliseconds = 1000; | |
const getUnsaveA = () => document.querySelector('.uiContextualLayerPositioner:not(.hidden_elem) li:last-child a'); | |
const scrollToBottom = () => window.scrollTo(0, document.body.scrollHeight); | |
const unsaveAndLoad = (recursive) => { | |
const alpha = waitToLoadMiliseconds; | |
const beta = intervalMiliseconds; | |
const buttons = document.querySelectorAll('#saveContentFragment .clearfix [id^="saved-more-button"] button'); | |
var i = 1; | |
Array.from(buttons).forEach(button => { | |
if(button.offsetParent === null) return; | |
setTimeout(() => button.click(), beta*i++); | |
setTimeout(() => getUnsaveA().click(), beta*i++); | |
}); | |
setTimeout(scrollToBottom, beta*i); | |
if(recursive) setTimeout(() => unsaveAndLoad(true), beta*i+alpha); | |
}; | |
if(confirm('Unsave?')) unsaveAndLoad(confirm('Unsave infinitely?')); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment