Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Light Navbar for Screenshot
// ==UserScript==
// @name Google Light Navbar for Screenshot
// @namespace http://d.hatena.ne.jp/thinkAmi/
// @description Fork Google Light Navbar, main color is black and without cookie
// @author thinkAami
// @version 1.0
// @license MIT License
// @source https://gist.github.com/1697132
// @include http://*.google.*
// @include https://*.google.*
// ==/UserScript==
// Fork of Google Light Navbar (http://userscripts.org/scripts/review/105735)
// original author is akira@Taiwan (http://userscripts.org/users/336234)
// スクリーンショットを撮りやすくするために、デフォルトの色を黒に統一
// Cookieの状態に依存しないよう、デフォルトの色をハードコーディングし、不要な部分を削除
(function(){
// Helper Functions
function $(q, root, single, context) {
root = root || document;
context = context || root;
if (q[0] == '#') return root.getElementById(q.substr(1));
if (q.match(/^[\/*]|^\.[\/\.]/)) {
if (single) return root.evaluate(q, context, null, 9, null).singleNodeValue;
var arr = [], xpr = root.evaluate(q, context, null, 7, null);
for (var i = 0, length = xpr.snapshotLength; i < length; i++) arr.push(xpr.snapshotItem(i));
return arr;
}
if (q[0] == '.') {
if (single) return root.getElementsByClassName(q.substr(1))[0];
return root.getElementsByClassName(q.substr(1));
}
if (single) return root.getElementsByTagName(q)[0];
return root.getElementsByTagName(q);
}
function $create(tag, attributes) {
var element = document.createElement(tag);
if (attributes && typeof attributes == 'object') {
for (attribute in attributes) {
if (attribute) element[attribute] = attributes[attribute];
}
}
return element;
}
var backgroundColor = '#000000',
foregroundColor = '#000000',
borderColor = '#DAE2F2';
// Insert CSS rules.
var style = $create('style', {type: 'text/css'});
style.innerHTML = '\
#gbx3, #gbx4 { border-bottom: 1px solid ' + borderColor + ' !important; background: ' + backgroundColor + ' url("//ssl.gstatic.com/gb/images/b_8d5afc09.png") 0 -138px repeat-x; opacity: 1; }\
.gbts { color: ' + foregroundColor + '; }\
.gbz0l .gbtb2 { border-top-color: ' + borderColor + ' !important; }\
.gbz0l .gbts { color: ' + foregroundColor + '; font-weight: bold; }\
.gbzt:hover, .gbgt:hover { background-color: ' + borderColor + '; }\
#gbi5 { background-position: -6px -22px; }\
.msel, .tbos, #leftnav h2 { color: ' + foregroundColor + ' !important; font-weight: bold; }\
.mitem:hover { background: ' + borderColor + '; }\
.micon { background: transparent url("//www.google.com/images/srpr/nav_logo73.png"); }\
';
$('head')[0].appendChild(style);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment