Created
October 17, 2019 02:59
-
-
Save AstroCB/5b34b657a55c16234bf5d9c9435d053d to your computer and use it in GitHub Desktop.
Small script that adds a button to the Piazza toolbar to mark all posts in the currently selected class as read.
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
// Button to mark all posts as read | |
function makeButton() { | |
let button = document.createElement("button"); | |
button.setAttribute("id", "new_post_button"); | |
button.setAttribute("class", "btn-primary left btn-small"); | |
button.addEventListener("click", _ => { | |
// Clear unread posts and reload page | |
document.querySelectorAll(".unread").forEach(b => b.click()); | |
window.location.reload(); | |
}); | |
let text = document.createElement("i"); | |
text.setAttribute("class", "icon-check icon-white"); | |
button.appendChild(text); | |
return button; | |
} | |
let toolbar = document.querySelector("#feed_search"); | |
toolbar.insertBefore(makeButton(), toolbar.children[0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I recommend adding this as a userscript that runs on page load for ease of use.