Last active
February 2, 2023 21:58
-
-
Save Decicus/f80f91d97e98d59b6224692a890bc66d to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name LowEndSpirit.com - "Mark All Viewed" Confirmation | |
// @namespace github.com/Decicus | |
// @match https://lowendspirit.com/* | |
// @grant none | |
// @version 1.0.1 | |
// @author Decicus | |
// @description Confirm whether you wanna mark all LES discussions as viewed. | |
// ==/UserScript== | |
function init() { | |
const viewedButton = document.querySelector('.MarkAllViewed'); | |
// Can't find button - e.g. not logged in | |
if (!viewedButton) { | |
return; | |
} | |
let markAsViewed = false; | |
viewedButton.addEventListener('click', function(ev) { | |
if (markAsViewed) { | |
return; | |
} | |
ev.preventDefault(); | |
ev.stopPropagation(); | |
if (!confirm('Confirm: Mark all viewed?')) { | |
return; | |
} | |
markAsViewed = true; | |
ev.target.click(); | |
markAsViewed = false; | |
}); | |
} | |
init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment