Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Add links to Google
- // @namespace addlinkstogoogle
- // @description Adds links to Google
- // @include http://www.google.com/*
- // @copyright JoeSimmons
- // ==/UserScript==
- function id(ID) {
- if(ID) { return document.getElementById(ID); }
- else { return false; }
- }
- // Syntax: addLink('link text', 'link href', 'class', 'target', 'id of node');
- function addLink(arg1, arg2, arg3, arg4, arg5) {
- if(arg1 && arg2) {
- var n, a;
- n=(arg5)?id(arg5):id('gbar');
- a = document.createElement('a');
- // Make the 1st argument the link text
- if(arg1) {a.appendChild(document.createTextNode(arg1));}
- // Make the 2nd argument the link href
- if(arg2) {a.href = arg2;}
- // Make the 3rd argument the link's class
- if(arg3) {a.setAttribute('class', arg3);}
- // Make the 4th argument the link's target
- if(arg4) {a.setAttribute('target', arg4);}
- // Add it to the variable gbar
- n.appendChild(document.createTextNode(' '));
- n.appendChild(a);
- }
- }
- // ADD THE LINKS HERE
- addLink('Scholar', 'http://scholar.google.com/schhp?hl=en&tab=ws', 'gb1', '', 'gbar');
- addLink('Documents', 'http://docs.google.com/?hl=en&tab=wo', 'gb1', '', 'gbar');
- addLink('Calendar', 'http://www.google.com/calendar/render?hl=en&tab=wc', 'gb1', '', 'gbar');
- addLink('PicasaWeb', 'http://picasaweb.google.com/home?hl=en&tab=wq', 'gb1', '', 'gbar');
- addLink('Reader', 'http://www.google.com/reader/view/?hl=en&tab=wy', 'gb1', '', 'gbar');
- // ADD THE LINKS HERE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement