NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Mark all annotations as completed // @namespace http://tampermonkey.net/ // @version 0.2 // @description Mark all annotations as completed // @author fmm // @match https://metcash.retailpath.com.au/* // @license MIT // @updateURL https://openuserjs.org/meta/fmm/Mark_all_annotations_as_completed.meta.js // ==/UserScript== (function() { 'use strict'; let annotationsHeading = document.querySelector(".sidebar .toolbar h1"); let allAnnotations = document.querySelectorAll("li.annotations a"); let btn = document.createElement("button"); btn.innerHTML = "Mark all done"; btn.onclick = function (e) { e.preventDefault(); markAllDone(); return false; }; if (allAnnotations.length > 0) { annotationsHeading.appendChild(btn); } function markAllDone() { // re-query any pending annotations allAnnotations = document.querySelectorAll("li.annotations a"); for (var i = 0; i < allAnnotations.length; i++) { let self = allAnnotations[i]; let result = fetch(allAnnotations[i].href) .then(function() { self.hidden = true; }) .catch(function() {}); } } })();