Created
July 17, 2020 22:48
-
-
Save 23maverick23/9e9d1b4c412123a291ba5c8b42095194 to your computer and use it in GitHub Desktop.
OA: Fix timesheet exception bug (Tampermonkey)
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 DEMO: Hide OpenAir schedule exception icons (bug workaround; 17 Jul 2020) | |
// @namespace http://rymo.io/ | |
// @version 0.1 | |
// @description DEMO: Hides all schedule exception icons on the timesheet. | |
// @author @rymoio | |
// @match https://demo.openair.com/timesheet.pl?* | |
// @run-at document-idle | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.addEventListener('load', function() { | |
console.log("DEBUG >>> Greasemonkey script start..."); | |
// callback executed when canvas was found | |
function handleElem(elem) { | |
var klassName = "scheduleException"; | |
var elems = document.getElementsByClassName(klassName); | |
for (var i=0, len=elems.length|0; i<len; i=i+1|0) { | |
elems[i].style.display = "none"; | |
console.log(`Hiding ${i+1} icon${i ? "s" : ""}`); | |
} | |
} | |
// set up the mutation observer | |
var observer = new MutationObserver(function (mutations, me) { | |
// `mutations` is an array of mutations that occurred | |
// `me` is the MutationObserver instance | |
var elem = document.getElementById('timesheet_header_lower'); | |
if (elem) { | |
handleElem(elem); | |
me.disconnect(); // stop observing | |
console.log("DEBUG >>> Greasemonkey script end."); | |
return; | |
} | |
}); | |
// start observing | |
observer.observe(document, { | |
childList: true, | |
subtree: true | |
}); | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment