Skip to content

Instantly share code, notes, and snippets.

@scar45
Created November 23, 2016 05:36
Show Gist options
  • Save scar45/bf2d57a615b000661ca28ea59dc79236 to your computer and use it in GitHub Desktop.
Save scar45/bf2d57a615b000661ca28ea59dc79236 to your computer and use it in GitHub Desktop.
Rambox Custom Badge Code
function checkUnread() {
var e = document.getElementsByClassName("mx_RoomTile_badge");
var t = 0;
for(i = 0; i < e.length; i++) {
if (parseInt(e[i].textContent.trim()) % 1 === 0 ) {
t += parseInt(e[i].textContent.trim());
}
}
updateBadge(t);
}
function updateBadge(e) {
e >= 1 ? document.title = "(" + e + ") " + originalTitle : document.title = originalTitle
}
var originalTitle = document.title;
setInterval(checkUnread, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment