Skip to content

Instantly share code, notes, and snippets.

@azz
Last active July 16, 2019 07:57
Show Gist options
  • Save azz/9ce50b3596b6f7f062523040ebbb5708 to your computer and use it in GitHub Desktop.
Save azz/9ce50b3596b6f7f062523040ebbb5708 to your computer and use it in GitHub Desktop.
UserScript: GitHub Notifications -> octobox.io
// ==UserScript==
// @name GitHub Notifications -> octobox.io
// @namespace https://gist.github.com/azz/9ce50b3596b6f7f062523040ebbb5708/edit
// @version 1.1.1
// @description Redirect the GitHub Notification icon to octobox.io
// @author Lucas Azzola <@azz>
// @match https://github.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var element = document.querySelector('.js-notification-indicator');
if (element) {
element.href = "https://octobox.io/?unread=true";
var icon = element.querySelector('.octicon');
if (icon) {
icon.innerHTML = '<path d="M11,22 C4.92486775,22 0,17.0751322 0,11 C0,4.92486775 4.92486775,0 11,0 C17.0751322,0 22,4.92486775 22,11 C22,17.0751322 17.0751322,22 11,22 Z M17.58,7.71 L16.908,7.229 C16.766,6.566 16.461,5.994 16.025,5.522 C16.122,5.281 16.438,4.322 15.928,3.022 C15.928,3.022 15.14,2.773 13.348,4.004 C12.949,3.892 12.536,3.833 12.118,3.8 L11,3 L9.882,3.8 C9.463,3.833 9.05,3.892 8.652,4.004 C6.86,2.766 6.072,3.022 6.072,3.022 C5.562,4.322 5.877,5.281 5.975,5.522 C5.539,5.994 5.234,6.566 5.092,7.229 L4.42,7.71 C4.16,7.89 4,8.19 4,8.52 L4,17 C4,17.55 4.45,18 5,18 L17,18 C17.55,18 18,17.55 18,17 L18,8.52 C18,8.19 17.85,7.9 17.58,7.71 Z M17,16.5 L12.5,13.5 L17,10.5 L17,16.5 Z M6,17 L11,14 L16,17 L6,17 Z M5,10.5 L9.5,13.5 L5,16.5 L5,10.5 Z M11,13 L6.58,10.227 C6.541,10.011 6.515,9.787 6.515,9.548 C6.515,8.974 6.8,8.43 7.28,7.984 C8.083,7.245 9.455,7.637 11,7.637 C12.553,7.637 13.91,7.245 14.72,7.984 C15.207,8.43 15.485,8.966 15.485,9.548 C15.485,9.78 15.459,9.998 15.421,10.209 L11,13 Z M12.8828,8.2944 C12.3878,8.2944 11.9828,8.8904 11.9828,9.6384 C11.9828,10.3864 12.3878,10.9904 12.8828,10.9904 C13.3778,10.9904 13.7818,10.3864 13.7818,9.6384 C13.7818,8.8904 13.3848,8.2944 12.8828,8.2944 Z M9.1177,8.2944 C8.6227,8.2944 8.2177,8.8984 8.2177,9.6384 C8.2177,10.3784 8.6227,10.9904 9.1177,10.9904 C9.6127,10.9904 10.0177,10.3864 10.0177,9.6384 C10.0177,8.8904 9.6127,8.2944 9.1177,8.2944 Z"></path>';
icon.setAttribute("viewBox", "0 0 22 22");
icon.setAttribute("width", 22);
icon.setAttribute("height", 22);
icon.style.marginTop = "6px";
icon.style.width = "22px";
}
var status = element.querySelector('.mail-status');
if (status) {
status.style.left = "13px";
}
} else {
console.warn("Couldn't find notification element");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment