Skip to content

Instantly share code, notes, and snippets.

@alangrainger
Created June 10, 2020 23:07
Show Gist options
  • Save alangrainger/7ec47756e40a7bcdbeb6ef17b7146f69 to your computer and use it in GitHub Desktop.
Save alangrainger/7ec47756e40a7bcdbeb6ef17b7146f69 to your computer and use it in GitHub Desktop.
Add an unread badge count to ClickUp when using as a custom service in Rambox
/*
Add this into the Custom Code section in your custom service:
https://github.com/ramboxapp/community-edition/wiki/Add-a-Custom-Service
*/
function checkUnread() {
// Check for an unread count by looking for the dot favicon
var unread = document.querySelectorAll("link[href^='favicon-dot-32x32']")
// Get the document title
var match = document.title.match(/^(\(1\) )?(.*)/)
var title = match[3]
// Put a (1) before the title if necessary, so that Rambox adds the badge
document.title = unread.length ? `(1) ${title}` : title
}
setInterval(checkUnread, 3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment