Custom Google Navigation Bar

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

As of 29.09.2014. See ბოლო ვერსია.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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       GM_addStyle
// @grant       GM_getValue
// @grant       GM_setValue
// @include     http://*.google.com/*
// @include     https://*.google.com/*
// @version     1.2.0.0
// ==/UserScript==

GM_addStyle ( "\
	#customNav {\
		padding: 24px;\
		padding-top: 18px;\
		font-size: 14px;\
	}\
	#customNav_checkboxes {\
		font-size: 14px;\
		margin-left: 10px;\
	}\
	#customNav_checkboxes input {\
		margin-bottom: 12px;\
		margin-right: 8px;\
		padding-top: 2px;\
	}\
	#customNav_head {\
		text-align: center;\
		margin-top: 0px;\
		margin-bottom: 20px;\
		font-size: 18px;\
	}\
	#customNav_sites {\
		width: 100%;\
	}\
	#customNav_sites td {\
		width: 70%;\
		padding: 5px 10px;\
	}\
	#customNav_sites td:first-child {\
		width: 30%;\
	}\
	#customNav_sites td input {\
		height: 20px;\
		width: 100%;\
	}\
	#customNav p {\
		margin-left: 10px;\
	}\
	#customNav_small {\
		color: #c0c0c0;\
		font-size: 12px;\
		text-align: center;\
	}\
	#customNav a {\
		color: #c0c0c0;\
	}\
	#customNav_btns {\
		text-align: right;\
	}\
	#customNav_btns input {\
		padding: 6px 10px;\
		cursor: pointer;\
		-moz-border-radius: 2px;\
		border-radius: 2px;\
	}\
	#customNav_apply {\
		background: -moz-linear-gradient(top, #58f 0%, #3866ff 100%);\
		border: 1px solid #04f;\
		color: #fff;\
	}\
	#customNav_cancel {\
		background: -moz-linear-gradient(top, #eee 0%, #ddd 100%);\
		border: 1px solid #888;\
		margin-right: 4px;\
	}\
");

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
if(getParameterByName("customNav_update") == "true") {
	if(getParameterByName("customNav_showApps") == "true") GM_setValue("showApps", true);
	else GM_setValue("showApps", false);
	if(getParameterByName("customNav_showNotifications") == "true") GM_setValue("showNotifications", true);
	else GM_setValue("showNotifications", false);
	if(getParameterByName("customNav_showShare") == "true") GM_setValue("showShare", true);
	else GM_setValue("showShare", false);
	
	GM_setValue("link1N", decodeURIComponent(getParameterByName("customNav_link1N")));
	GM_setValue("link1U", decodeURIComponent(getParameterByName("customNav_link1U")));
	GM_setValue("link2N", decodeURIComponent(getParameterByName("customNav_link2N")));
	GM_setValue("link2U", decodeURIComponent(getParameterByName("customNav_link2U")));
	GM_setValue("link3N", decodeURIComponent(getParameterByName("customNav_link3N")));
	GM_setValue("link3U", decodeURIComponent(getParameterByName("customNav_link3U")));
	GM_setValue("link4N", decodeURIComponent(getParameterByName("customNav_link4N")));
	GM_setValue("link4U", decodeURIComponent(getParameterByName("customNav_link4U")));
	GM_setValue("link5N", decodeURIComponent(getParameterByName("customNav_link5N")));
	GM_setValue("link5U", decodeURIComponent(getParameterByName("customNav_link5U")));
	GM_setValue("link6N", decodeURIComponent(getParameterByName("customNav_link6N")));
	GM_setValue("link6U", decodeURIComponent(getParameterByName("customNav_link6U")));
	GM_setValue("link7N", decodeURIComponent(getParameterByName("customNav_link7N")));
	GM_setValue("link7U", decodeURIComponent(getParameterByName("customNav_link7U")));
	GM_setValue("link8N", decodeURIComponent(getParameterByName("customNav_link8N")));
	GM_setValue("link8U", decodeURIComponent(getParameterByName("customNav_link8U")));
	
	location.href = location.href.split("?")[0];
}

sett_showApps = GM_getValue("showApps") == true;
sett_showNotifications = GM_getValue("showNotifications") == true;
sett_showShare = GM_getValue("showShare") == true;
sett_link1N = GM_getValue("link1N") || "";
sett_link1U = GM_getValue("link1U") || "";
sett_link2N = GM_getValue("link2N") || "";
sett_link2U = GM_getValue("link2U") || "";
sett_link3N = GM_getValue("link3N") || "";
sett_link3U = GM_getValue("link3U") || "";
sett_link4N = GM_getValue("link4N") || "";
sett_link4U = GM_getValue("link4U") || "";
sett_link5N = GM_getValue("link5N") || "";
sett_link5U = GM_getValue("link5U") || "";
sett_link6N = GM_getValue("link6N") || "";
sett_link6U = GM_getValue("link6U") || "";
sett_link7N = GM_getValue("link7N") || "";
sett_link7U = GM_getValue("link7U") || "";
sett_link8N = GM_getValue("link8N") || "";
sett_link8U = GM_getValue("link8U") || "";

function testChecked(icon_shown) {
	if(icon_shown) return " checked";
	return "";
}

document.getElementById("fsett").innerHTML += '<a href="javascript:(function(){document.getElementById(\'settingsBackdrop\').style.display = \'block\';document.getElementById(\'settingsPopup\').style.display = \'block\';})();">  Customize Navigation Bar </a>';

settingsBackdrop = document.createElement("div");
settingsBackdrop.style.background = "rgba(128,128,128,0.5)";
settingsBackdrop.style.position = "fixed";
settingsBackdrop.style.top = "0px";
settingsBackdrop.style.bottom = "0px";
settingsBackdrop.style.left = "0px";
settingsBackdrop.style.right = "0px";
settingsBackdrop.style.zIndex = "10000000000000" // To get above the search bar
settingsBackdrop.style.display = "none";
settingsBackdrop.setAttribute("id", "settingsBackdrop");
document.body.appendChild(settingsBackdrop);

settingsPopup = document.createElement("div");
settingsPopup.style.position = "absolute";
settingsPopup.style.width = "960px";
settingsPopup.style.height = "640px";
settingsPopup.style.background = "#fff";
settingsPopup.style.top = "50%";
settingsPopup.style.left = "50%";
settingsPopup.style.marginTop = "-320px";
settingsPopup.style.marginLeft = "-480px";
settingsPopup.style.zIndex = "10000000000009"; // To get above the search bar
settingsPopup.style.border = "1px solid #777";
settingsPopup.style.boxShadow = "0px 0px 4px #777"
settingsPopup.style.display = "none";
settingsPopup.setAttribute("id", "settingsPopup");
settingsPopup.innerHTML = '<div id="customNav"><h3 id="customNav_head">Google Navigation Bar Settings (v1.2.0)</h3><p>Choose which icons to display on the navigation bar.</p><div id="customNav_checkboxes"><div><input type="checkbox" autocomplete="off" id="customNav_inputApps"'+testChecked(sett_showApps)+'>Display Apps List</div><div><input type="checkbox" autocomplete="off" id="customNav_inputNotifications"'+testChecked(sett_showNotifications)+'>Display Notifications</div><div><input type="checkbox" autocomplete="off" id="customNav_inputShare"'+testChecked(sett_showShare)+'>Display Google+ Share</div></div>\
<p>Choose the links to be displayed on the navigation bar.</p><table id="customNav_sites"><tr><th>Name</th><th>URL</th></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN1"></td><td><input autocomplete="off" id="customNav_inputLinkU1"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN2"></td><td><input autocomplete="off" id="customNav_inputLinkU2"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN3"></td><td><input autocomplete="off" id="customNav_inputLinkU3"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN4"></td><td><input autocomplete="off" id="customNav_inputLinkU4"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN5"></td><td><input autocomplete="off" id="customNav_inputLinkU5"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN6"></td><td><input autocomplete="off" id="customNav_inputLinkU6"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN7"></td><td><input autocomplete="off" id="customNav_inputLinkU7"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN8"></td><td><input autocomplete="off" id="customNav_inputLinkU8"></td></tr></table>\
<p id="customNav_small">Custom Google Navigation Bar is a GreaseMonkey script developed by <a href="https://greasyfork.org/users/5353">Qvcool</a>. Download it at <a href="https://greasyfork.org/scripts/5332">https://greasyfork.org/scripts/5332</a>.</p><div id="customNav_btns"><input id="customNav_cancel" type="button" value="Cancel" onclick="document.getElementById(\'settingsBackdrop\').style.display=\'none\';document.getElementById(\'settingsPopup\').style.display=\'none\';location.reload();"><input id="customNav_apply" type="button" value="Apply" onclick="document.getElementById(\'settingsBackdrop\').style.display=\'none\';document.getElementById(\'settingsPopup\').style.display=\'none\';\
location.href = location.href.split(\'?\')[0]+\'?\'+\'customNav_update=true&&customNav_showApps=\'+document.getElementById(\'customNav_inputApps\').checked+\'&&customNav_showNotifications=\'+document.getElementById(\'customNav_inputNotifications\').checked+\'&&customNav_showShare=\'+document.getElementById(\'customNav_inputShare\').checked+\'&&customNav_link1N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN1\').value)+\'&&customNav_link1U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU1\').value)+\'&&customNav_link2N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN2\').value)+\'&&customNav_link2U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU2\').value)+\'&&customNav_link3N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN3\').value)+\'&&customNav_link3U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU3\').value)+\'&&customNav_link4N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN4\').value)+\'&&customNav_link4U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU4\').value)+\'&&customNav_link5N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN5\').value)+\'&&customNav_link5U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU5\').value)+\'&&customNav_link6N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN6\').value)+\'&&customNav_link6U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU6\').value)+\'&&customNav_link7N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN7\').value)+\'&&customNav_link7U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU7\').value)+\'&&customNav_link8N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN8\').value)+\'&&customNav_link8U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU8\').value);\
"></div></div>';
document.body.appendChild(settingsPopup);

document.getElementById("customNav_inputLinkN1").value = sett_link1N;
document.getElementById("customNav_inputLinkU1").value = sett_link1U;
document.getElementById("customNav_inputLinkN2").value = sett_link2N;
document.getElementById("customNav_inputLinkU2").value = sett_link2U;
document.getElementById("customNav_inputLinkN3").value = sett_link3N;
document.getElementById("customNav_inputLinkU3").value = sett_link3U;
document.getElementById("customNav_inputLinkN4").value = sett_link4N;
document.getElementById("customNav_inputLinkU4").value = sett_link4U;
document.getElementById("customNav_inputLinkN5").value = sett_link5N;
document.getElementById("customNav_inputLinkU5").value = sett_link5U;
document.getElementById("customNav_inputLinkN6").value = sett_link6N;
document.getElementById("customNav_inputLinkU6").value = sett_link6U;
document.getElementById("customNav_inputLinkN7").value = sett_link7N;
document.getElementById("customNav_inputLinkU7").value = sett_link7U;
document.getElementById("customNav_inputLinkN8").value = sett_link8N;
document.getElementById("customNav_inputLinkU8").value = sett_link8U;

links = [
	[sett_link1N, sett_link1U],
	[sett_link2N, sett_link2U],
	[sett_link3N, sett_link3U],
	[sett_link4N, sett_link4U],
	[sett_link5N, sett_link5U],
	[sett_link6N, sett_link6U],
	[sett_link7N, sett_link7U],
	[sett_link8N, sett_link8U],
]

var content = "";
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][1] + "'>" + links[x][0] + "</a>";
} // Meshes all links into a single string

var elems = document.getElementsByTagName("div"), i;
for (i in elems) {
    if((" " + elems[i].className + " ").indexOf(" gb_zc ") > -1) {
        elems[i].innerHTML = content;
    } // Adds custom links
    else if((" " + elems[i].className + " ").indexOf(" gb_yc ") > -1) {
        if(!sett_showApps) elems[i].children[1].style.display = "none";
        if(!sett_showNotifications) elems[i].children[2].style.display = "none";
        if(!sett_showShare) elems[i].children[3].style.display = "none";
		elems[i].style.textAlign = "right";
    } // Hides icons
}