您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Choose what you want to see on the Google navigation bar.
当前为
// ==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.3.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: 5px;\ 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: 8px 20px;\ -moz-border-radius: 2px;\ border-radius: 2px;\ font-size: 11px;\ font-weight: bold;\ font-family: 'Arial', sans-serif;\ }\ #customNav_apply {\ background: #4889f0;\ border: 1px solid #3079ed;\ color: #fff;\ }\ #customNav_apply:hover {\ background: -moz-linear-gradient(top, #4d90fe 0%, #357ae8 100%);\ border: 1px solid #2f5bb7;\ }\ #customNav_cancel {\ background: -moz-linear-gradient(top, #f5f5f5 0%, #f1f1f1 100%);\ border: 1px solid #dadada;\ margin-right: 4px;\ }\ #customNav_cancel:hover {\ background: -moz-linear-gradient(top, #f8f8f8 0%, #f1f1f1 100%);\ border: 1px solid #c6c6c6;\ box-shadow: 0px 1px 0px #d9d9d9;\ }\ "); function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]") + "=([^&#]*)"), 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); if(getParameterByName("customNav_newTab") == "true") GM_setValue("newTab", true); else GM_setValue("newTab", 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"))); GM_setValue("link9N", decodeURIComponent(getParameterByName("customNav_link9N"))); GM_setValue("link9U", decodeURIComponent(getParameterByName("customNav_link9U"))); GM_setValue("link10N", decodeURIComponent(getParameterByName("customNav_link10N"))); GM_setValue("link10U", decodeURIComponent(getParameterByName("customNav_link10U"))); location.href = location.href.split("?")[0]; } sett_showApps = GM_getValue("showApps"); sett_showNotifications = GM_getValue("showNotifications"); sett_showShare = GM_getValue("showShare"); sett_newTab = GM_getValue("newTab"); 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") || ""; sett_link9N = GM_getValue("link9N") || ""; sett_link9U = GM_getValue("link9U") || ""; sett_link10N = GM_getValue("link10N") || ""; sett_link10U = GM_getValue("link10U") || ""; 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 = "720px"; settingsPopup.style.background = "#fff"; settingsPopup.style.top = "50%"; settingsPopup.style.left = "50%"; settingsPopup.style.marginTop = "-360px"; 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">Custom Google Navigation Bar v1.3.0</h3><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><input type="checkbox" autocomplete="off" id="customNav_inputTabs"'+testChecked(sett_newTab)+'>Open links in a new tab</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><tr><td><input autocomplete="off" id="customNav_inputLinkN9"></td><td><input autocomplete="off" id="customNav_inputLinkU9"></td></tr><tr><td><input autocomplete="off" id="customNav_inputLinkN10"></td><td><input autocomplete="off" id="customNav_inputLinkU10"></td></tr></table>\ <p id="customNav_small">Custom Google Navigation Bar is a Greasemonkey script developed by <a href="https://gf.zukizuki.org/users/5353">Qvcool</a>. Download it at <a href="https://gf.zukizuki.org/scripts/5332">https://gf.zukizuki.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_newTab=\'+document.getElementById(\'customNav_inputTabs\').checked+\'&&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)+\'&&customNav_link9N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN9\').value)+\'&&customNav_link9U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU9\').value)+\'&&customNav_link10N=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkN10\').value)+\'&&customNav_link10U=\'+encodeURIComponent(document.getElementById(\'customNav_inputLinkU10\').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; document.getElementById("customNav_inputLinkN9").value = sett_link9N; document.getElementById("customNav_inputLinkU9").value = sett_link9U; document.getElementById("customNav_inputLinkN10").value = sett_link10N; document.getElementById("customNav_inputLinkU10").value = sett_link10U; function esc(v) { return v.replace(new RegExp("&", "g"), "&").replace(new RegExp("<", "g"), ">").replace(new RegExp(">", "g"), ">"); } function esc2(v) { return v.replace(new RegExp("'", "g"), ""); } links = [ [esc(sett_link1N), esc2(sett_link1U)], [esc(sett_link2N), esc2(sett_link2U)], [esc(sett_link3N), esc2(sett_link3U)], [esc(sett_link4N), esc2(sett_link4U)], [esc(sett_link5N), esc2(sett_link5U)], [esc(sett_link6N), esc2(sett_link6U)], [esc(sett_link7N), esc2(sett_link7U)], [esc(sett_link8N), esc2(sett_link8U)], [esc(sett_link9N), esc2(sett_link9U)], [esc(sett_link10N), esc2(sett_link10U)] ] links = links.filter(function(e) { if(e[0] != "" && e[1] != "") return true; return false; }); var content = ""; for(x in links) { content += " <a style='color: #333;text-decoration: none;' onmouseover='this.style.textDecoration = \"underline\";' onmouseout='this.style.textDecoration = \"none\"' href='" + links[x][1] + "'" + function(t){if(t) return " target='_blank'"; return ""}(sett_newTab) + ">" + links[x][0] + "</a>"; } // Combines 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 }