Forked from seanlaidlaw/instapaper_bulk_delete_userscript.js
Created
November 16, 2024 14:04
-
-
Save gbarkhatov/6b05ff0c41fad3101b1f2e5d913a2ea8 to your computer and use it in GitHub Desktop.
Revisions
-
seanlaidlaw created this gist
Aug 18, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ // ==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; } } }); })();