Last active
February 12, 2020 16:12
-
-
Save jayotterbein/9bc44309c15c48cbd4ac5147445ae1fa to your computer and use it in GitHub Desktop.
Ring Central Google Calendar add dashes to ID (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 Ring Central ID dashes | |
// @namespace http://tampermonkey.net/ | |
// @version 0.6 | |
// @description Add dashes to Ring Central meeting IDs in the "ID:" display | |
// @author Jay Otterbein | |
// @match https://calendar.google.com/calendar* | |
// @grant none | |
// @updateURL https://gist.githubusercontent.com/jayotterbein/9bc44309c15c48cbd4ac5147445ae1fa/raw/userscript_gcal_rc_dashes.js | |
// @homepageURL https://gist.github.com/jayotterbein/9bc44309c15c48cbd4ac5147445ae1fa/userscript_gcal_rc_dashes.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const observer = new MutationObserver(mutationsList => { | |
mutationsList.forEach(mutation => { | |
mutation.addedNodes && | |
mutation.addedNodes.forEach(n => { | |
n.querySelectorAll && | |
n.querySelectorAll('div').forEach(el => { | |
const m = el.firstChild && el.firstChild.data && el.firstChild.data.match(/(ID|PIN|Passcode):\s+([0-9]{3})([0-9]{3})([0-9]{4})\s*/); | |
if (m) { | |
const u = `${m[1]}: ${m[2]}-${m[3]}-${m[4]}`; | |
el.innerText = u; | |
} | |
}); | |
}); | |
}); | |
}); | |
observer.observe(document.body, { childList: true, subtree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment