- Refined GitHub
- GitHub Dark with
Stylus
- Install user style
- PR File Tree
-
Inject Desktop Notifications with Scripty
Notification.requestPermission().then((permission) => { console.log("Notifications", permission, "!"); }); setTimeout(() => location.reload(), 30 * 1000); document.addEventListener("visibilitychange", function () { if (!document.hidden) { saveNotificationCount(); checkIfNotifications(); } }); checkIfNotifications(); function saveNotificationCount() { console.log("Save", getNotificationCount()); window.localStorage.setItem("notificationCount", getNotificationCount()); } function getNotificationCount() { return document.querySelectorAll("li.notification-unread").length; } function getUnreadActions() { var unreadActionElements = document.querySelectorAll( "li.notification-unread .flex-md-row-reverse > span" ); console.log(unreadActionElements); var actions = []; unreadActionElements.forEach((element) => actions.push(element.innerText)); console.log(actions); } function getLastNotificationCount() { return window.localStorage.getItem("notificationCount"); } function checkIfNotifications() { if (getNotificationCount() > getLastNotificationCount()) { changeFavicon("pending-dark"); showNotification(); } else { changeFavicon("dark"); } } function changeFavicon(iconName) { removeFavicons(); var link = document.querySelector("link[rel='icon']"); link.href = `https://github.githubassets.com/favicons/favicon-${iconName}.svg`; } function showNotification() { var faviconDark = "https://github.githubassets.com/favicons/favicon-dark.png"; var notification = new Notification("New unread notification", { icon: faviconDark, }); } function removeFavicons() { removeFavicon("mask-icon"); removeFavicon("alternate icon"); } function removeFavicon(name) { var elem = document.querySelector(`link[rel='${name}']`); elem && elem.parentNode.removeChild(elem); }