Skip to content

Instantly share code, notes, and snippets.

@rsslldnphy
Last active October 3, 2020 09:40
Show Gist options
  • Save rsslldnphy/4642c5adf5bd7dda81553ea3215547d1 to your computer and use it in GitHub Desktop.
Save rsslldnphy/4642c5adf5bd7dda81553ea3215547d1 to your computer and use it in GitHub Desktop.
Select All articles in Pocket
1. Open pocket in your browser
2. Open the javascript console
3. Paste the above code
4. Call the function `selectAll()`
var simulateClick = function (elem) {
const evt = new MouseEvent("click", {
bubbles: true,
cancelable: true,
view: window,
});
elem.dispatchEvent(evt);
};
var selectAllInner = () => {
const elements = $("body").querySelectorAll("use");
var count = 0;
elements.forEach((u) => {
console.log(u);
if (u.getAttribute("xlink:href").indexOf("#CheckOpen") !== -1) {
count += 1;
simulateClick(u);
}
});
if (count > 0) {
elements[elements.length - 1].scrollIntoView();
setTimeout(selectAllInner, 3000);
}
};
var selectAll = () => {
$('[aria-label="Bulk Edit"]').click();
selectAllInner();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment