Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions github-title-notification.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name GitHub Title Notification
// @version 1.0.7
// @version 1.0.8
// @description A userscript that changes the document title if there are unread messages
// @license MIT
// @author Rob Garrison
Expand All @@ -27,7 +27,10 @@
function check() {
let title = document.title,
mail = document.querySelector(".mail-status"),
hasUnread = mail ? !mail.hidden : false;
notificationButton = document.querySelector("#AppHeader-notifications-button"), //for new layout
hasUnreadMail = mail ? !mail.hidden : false,
hasIndicator = notificationButton ? notificationButton.classList.contains("AppHeader-button--hasIndicator") : false,
hasUnread = hasUnreadMail || hasIndicator;
//
if (!/^\(\d+\)/.test(title)) {
title = title.replace(/^(\([^)]+\)\s)*/g, "");
Expand Down