Last active
April 4, 2022 10:16
-
-
Save nunogoncalves/e75294ea5a2762befdbf to your computer and use it in GitHub Desktop.
More or less automatic way to delete all links in dropbox. Since they don't provide a way of doing so and it's very boring to delete one by one when you have hundreds of links...
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
$ = jQuery; | |
var indexToDelete = 0; | |
var numOfLinksToDelete = 200; | |
var waitUntilNextLinkInMs = 1000; | |
var waitForModalInMs = 50; | |
var confirmDelete = function() { | |
setTimeout(function() { | |
var $confirmationButtonInModal = $(".button-primary"); | |
$confirmationButtonInModal.click(); | |
}, waitForModalInMs); | |
}; | |
removeLink = function(linkIndex) { | |
if (linkIndex >= indexToDelete + numOfLinksToDelete) { | |
return; | |
} | |
setTimeout(function() { | |
var link = links[linkIndex]; | |
console.log("Removing index: " + linkIndex); | |
links[linkIndex].click(confirmDelete()); | |
removeLink(linkIndex + 1); | |
}, waitUntilNextLinkInMs); | |
} | |
removeAllLinks = function() { | |
links = $(".remove-link"); | |
linksCount = links.length; | |
removeLink(indexToDelete); | |
}; | |
removeAllLinks(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, but how the heck do we use it? 😜
EDIT: Throwing it in GreasMonkey didn't do anything as expected. Pasting it into the browser console seems like it tried, but failed. Tips?