Last active
October 3, 2020 09:40
-
-
Save rsslldnphy/4642c5adf5bd7dda81553ea3215547d1 to your computer and use it in GitHub Desktop.
Select All articles in Pocket
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 characters
1. Open pocket in your browser | |
2. Open the javascript console | |
3. Paste the above code | |
4. Call the function `selectAll()` |
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 characters
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