Skip to content

Instantly share code, notes, and snippets.

@Decicus
Last active February 2, 2023 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Decicus/f80f91d97e98d59b6224692a890bc66d to your computer and use it in GitHub Desktop.
Save Decicus/f80f91d97e98d59b6224692a890bc66d to your computer and use it in GitHub Desktop.
// ==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