Created
June 24, 2023 15:21
-
-
Save rmnmjw/afea5e71540cb197c9b8c7232fdeea7d to your computer and use it in GitHub Desktop.
Clockify Web App Add Badge
This file contains 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 clockify - badge | |
// @namespace t89sjuvq8x | |
// @match https://app.clockify.me/* | |
// @grant none | |
// @version 1.0 | |
// @author rmnmjw | |
// @description 2023-06-24, 17:20:00 | |
// ==/UserScript== | |
(async () => { | |
const observer = new MutationObserver((mutations) => { | |
const m = /(?<time>[0-9\:]+)/g.exec(mutations[0].target.innerHTML)?.groups.time; | |
if (!m) { | |
navigator.setAppBadge(0); | |
return; | |
} | |
navigator.setAppBadge(m.split(':')[0]); | |
}); | |
observer.observe(document.querySelector('title'), { | |
childList: true | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment