Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gbarkhatov/6b05ff0c41fad3101b1f2e5d913a2ea8 to your computer and use it in GitHub Desktop.
Save gbarkhatov/6b05ff0c41fad3101b1f2e5d913a2ea8 to your computer and use it in GitHub Desktop.
adds a "Bulk delete" button to instapaper to delete all 40 articles on current page. Requires confirmation before deleting.
// ==UserScript==
// @name Instapaper Bulk Delete
// @namespace https://www.instapaper.com/u
// @version 0.1
// @description Provides an option to bulk delete all articles on current page of instapaper
// @author Sean Laidlaw
// @match https://www.instapaper.com/u
// @grant none
// ==/UserScript==
(function() {
// Create the button object
var button = document.createElement("button");
button.innerHTML = "Bulk Delete";
// add the button to the top button bar
var body = document.getElementsByClassName("top_buttons")[0];
body.appendChild(button);
// set all checkboxes and menu buttons as var
var chkbox = document.getElementsByClassName('article_selected_indicator');
var menu_buttons = document.getElementsByClassName('js_batch');
// Add event handler to button
button.addEventListener ("click", function() {
//click on the checkbox next to every article
for(var i = 0; i < chkbox.length; i++) {
chkbox[i].click();
}
//loop through the menu buttons and click when found the delete button
for(var i = 0; i < menu_buttons.length; i++) {
if (menu_buttons[i].getAttribute('data-action') == "delete") {
menu_buttons[i].click();
break;
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment