Custom Google Navigation Bar

Choose what you want to see on the Google navigation bar.

目前為 2014-09-27 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Custom Google Navigation Bar
// @description Choose what you want to see on the Google navigation bar.
// @namespace   407d4100-4661-11e4-916c-0800200c9a66
// @grant       none
// @include     https://*.google.com/*
// @version     1.1.0.0
// ==/UserScript==

links = [
    ["http://www.greasyfork.org", "Greasy Fork"],
    ["http://mail.google.com", "Gmail"],
];
// List of links to display on the navigation bar.
hideApps = false;
// Hide the apps icon
hideNotifications = false;
// Hide notifications
hideShare = true;
// Hide the Google+ Share button
    
content = "";
var elems = document.getElementsByTagName("div"), i;

for(x in links) {
    content += "&emsp;<a style='color: #333;text-decoration: none;' onmouseover='this.style.textDecoration = \"underline\";' onmouseout='this.style.textDecoration = \"none\"' href='" + links[x][0] + "'>" + links[x][1] + "</a>";
}
for (i in elems) {
    if((" " + elems[i].className + " ").indexOf(" gb_zc ") > -1) {
        if(hideApps) elems[i].style.paddingRight = "5px";
        elems[i].innerHTML = content;
    }
    else if((" " + elems[i].className + " ").indexOf(" gb_yc ") > -1) {
        if(hideApps) elems[i].children[1].style.display = "none";
        if(hideNotifications) elems[i].children[2].style.display = "none";
        if(hideShare) elems[i].children[3].style.display = "none";
    }
}