Greasemonkey Manual:Monkey Menu: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
// GreaseMonkey Script: Google Dark v1.0b
// GreaseMonkey Script: Google Dark v1.0b
// Author: Jarques "Retro_X" Pretorius
// Author: Jarques "Retro_X" Pretorius

Revision as of 19:07, 8 April 2010

// GreaseMonkey Script: Google Dark v1.0b // Author: Jarques "Retro_X" Pretorius // // ---*GNU*--- // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // http://www.gnu.org/copyleft/gpl.html // ---*--- // // ---*About this Script*--- // This script was downloaded from http://www.07designs.com/gdark/ // Please send your questions, suggestions and support to // fetalsage@gmail.com or post a comment on my blog (07Designs.com) // // Feel free to modify this script to your liking, but please contact // me and tell me so I can have a look at it and if it's good enough // I'll post a link to it on my blog. // ---*--- // // ==UserScript== // @name Google Dark // @namespace fetalsage AT gmail DOT com // @description Makes Google Dark // @include http://google.tld/ // @include http://google.tld/#* // @include http://www.google.tld/ // @include http://www.google.tld/#* // @include http://google.tld/webhp // @include http://google.tld/webhp#* // @include http://www.google.tld/webhp // @include http://www.google.tld/webhp#* // @date 2006-04-09 // @version 1.0b // @GM_version 0.6.4 // ==/UserScript==

window.addEventListener("load", function(e) { document.getElementsByTagName('head')[0].removeChild(document.getElementsByTagName('style')[0]);

var logo = (document.getElementsByTagName('img')[1].src.indexOf('images/hp0.gif') != -1 || document.getElementsByTagName('img')[1].src.indexOf('images/hp1.gif') != -1 ? 'http://www.google.com/intl/en/images/logo.gif' : document.getElementsByTagName('img')[1].src);

var logo_html = '

Google

';

if (document.body.innerHTML.indexOf('images/hp0.gif') != -1) {

logo_html = '

' + document.getElementsByTagName('table')[0].innerHTML + '

';

}

var in_or_account = '<a href="https://www.google.com/accounts/Login">Sign in</a>'; var out = ; if (document.body.innerHTML.indexOf('Sign out') != -1) { in_or_account = '<a href="https://www.google.com/accounts/ManageAccount" title="' + document.getElementsByTagName('b')[0].innerHTML.replace(/<(.|\n)*?>/g, ) + '">' + (0 == 1 ? document.getElementsByTagName('b')[0].innerHTML.replace(/<(.|\n)*?>/g, ) : 'My Account') + '</a>'; out = '<a href="http://www.google.com/accounts/Logout?continue=http://www.google.com/">Sign out</a>'; }

var checkbox = ; if (document.getElementById('cty')) { checkbox = '<input type="checkbox" name="meta" id="meta" value="' + document.getElementById('cty').value + '" /><label for="meta">' + document.getElementsByTagName('label')[1].innerHTML + '</label>'; }

document.body.innerHTML = '

<img src="http://07designs.com/GDark/img/logo.jpg"/>
<a href="/options/">More Services</a><a href="/advanced_search">Advanced Search</a><a href="/preferences">Preferences</a><a href="/language_tools">Language Tools</a>
<a href="http://www.google.com/ads/">Advertising Programs</a>
<a href="/ig">Personalized Home</a>
<a href="http://www.google.com/services/">Business Solutions</a>
!in_or_account!
<a href="http://www.google.com/about.html">About Google</a>
!out!

';

document.body.innerHTML = document.body.innerHTML.replace(/\!in_or_account\!/, in_or_account); document.body.innerHTML = document.body.innerHTML.replace(/\!out\!/, out); document.body.innerHTML = document.body.innerHTML.replace(/\!checkbox\!/, checkbox); document.body.innerHTML = document.body.innerHTML.replace(/\!logo_html\!/, logo_html); if (document.getElementsByTagName('h1')[0]) { document.getElementsByTagName('h1')[0].style.backgroundImage ='url(' + logo + ')'; }

var css = document.createTextNode('*, html {margin: 0;padding: 0;}body{background: #000 url(http://uploadverse.com/uploads/image/shxEdr5sHq.jpg) repeat-x top;color: #000;width: 600px;margin: 0 auto;padding: 60px 0 0 0;}h1 {background-color: #000;width: 276px;height: 110px;margin: 0 auto;text-indent: -99999px;}#search {background-color: #0E1116;color: #000;width: 438px;margin: 20px auto 0 auto;padding-bottom: 5px;}#search a {background-color: #0E1116;color: #494E52;padding: 6px 8px;font-family: Tahoma, Verdana, Arial, Sans-serif;font-size: 14px;text-decoration: none;display: block;}#search a.active {background-color: #22252A;color: #1D9ADA;}#search div.query {background: #24292F url(http://img422.imageshack.us/img422/1047/bg4rx.gif) no-repeat left bottom;color: #7A8187;width: 308px;padding: 20px 65px 55px 65px;}#search div.submit {text-align: right; margin-right:70px; margin-top:-48px;}#search div.checkbox {font-family: Verdana, Arial, Sans-serif;font-size: 11px;text-align: center;}#search div.checkbox {padding: 10px 0 0 0;}#search div.checkbox label {padding: 0 0 0 4px;}#q {width: 300px;padding: 5px;border: 1px solid #000;font-family: Verdana, Arial, Sans-serif;font-size: 24px;color:#7B828A;}input.button {background-color: #101A26;margin: 6px 0 0 4px;padding: 2px 10px;border: 1px solid #000;font-family: Verdana, Arial, Sans-serif;font-size: 16px;color:#fff;font-weight:bold;}#misc {width: 375px;margin: 32px auto 50px auto;list-style: none;}#misc a {color: #FF00CC;font-family: Helvetica, Arial, Sans-serif;font-size: 12px;text-decoration: none;}#misc a:hover {border-bottom: 1px solid #FF00CC;}#misc td {text-align: center;}#bottom {color: #2399E3;width: 418px;margin: 0 auto;padding: 0 20px;font-family: Helvetica, Arial, Sans-serif;}#bottom td {width: 180px;}#bottom td.second {background-color: transparent !important;padding: 0 0 0 40px;}#bottom a {color: #2399E3;width: 180px;padding: 5px;font-size: 12px;text-decoration: none !important;display: block;}#bottom a:hover {color: #036;}') var style = document.createElement("style"); style.type = "text/css"; style.appendChild(css); document.getElementsByTagName('head')[0].appendChild(style);

if (checkbox != ) { document.getElementById('misc').style.margin = '24px auto 45px auto;'; }

var current = 'web'; if (current != 'web') { document.getElementById('lucky').style.display = 'none'; } document.getElementById(current).className = 'active'; addEvent(document.getElementById('froogle'), 'click', activate); addEvent(document.getElementById('groups'), 'click', activate); addEvent(document.getElementById('images'), 'click', activate); addEvent(document.getElementById('local'), 'click', activate); addEvent(document.getElementById('news'), 'click', activate); addEvent(document.getElementById('web'), 'click', activate);

document.getElementById('q').focus();

function activate(e) { document.getElementById(current).className = ; current = this.id; document.getElementsByTagName('form')[0].action = this.href; document.getElementById(current).className = 'active'; document.getElementById('q').focus(); if (current != 'web') { document.getElementById('lucky').style.display = 'none'; } else { document.getElementById('lucky').style.display = 'inline'; } e.preventDefault(); return false; }

function addEvent(obj,type,fn){if(obj.attachEvent){obj['e'+type+fn]=fn;obj[type+fn]=function(){obj['e'+type+fn](window.event);};obj.attachEvent('on'+type,obj[type+fn]);}else obj.addEventListener(type,fn,false);} }, false);