Advertisement
Guest User

Untitled

a guest
Jan 21st, 2011
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           Add links to Google
  3. // @namespace      addlinkstogoogle
  4. // @description    Adds links to Google
  5. // @include        http://www.google.com/*
  6. // @copyright      JoeSimmons
  7. // ==/UserScript==
  8.  
  9. function id(ID) {
  10. if(ID) { return document.getElementById(ID); }
  11. else { return false; }
  12. }
  13.  
  14. // Syntax: addLink('link text', 'link href', 'class', 'target', 'id of node');
  15. function addLink(arg1, arg2, arg3, arg4, arg5) {
  16. if(arg1 && arg2) {
  17. var n, a;
  18. n=(arg5)?id(arg5):id('gbar');
  19. a = document.createElement('a');
  20. // Make the 1st argument the link text
  21. if(arg1) {a.appendChild(document.createTextNode(arg1));}
  22. // Make the 2nd argument the link href
  23. if(arg2) {a.href = arg2;}
  24. // Make the 3rd argument the link's class
  25. if(arg3) {a.setAttribute('class', arg3);}
  26. // Make the 4th argument the link's target
  27. if(arg4) {a.setAttribute('target', arg4);}
  28. // Add it to the variable gbar
  29. n.appendChild(document.createTextNode(' '));
  30. n.appendChild(a);
  31. }
  32. }
  33.  
  34.  
  35.  
  36. // ADD THE LINKS HERE
  37. addLink('Scholar', 'http://scholar.google.com/schhp?hl=en&tab=ws', 'gb1', '', 'gbar');
  38. addLink('Documents', 'http://docs.google.com/?hl=en&tab=wo', 'gb1', '', 'gbar');
  39. addLink('Calendar', 'http://www.google.com/calendar/render?hl=en&tab=wc', 'gb1', '', 'gbar');
  40. addLink('PicasaWeb', 'http://picasaweb.google.com/home?hl=en&tab=wq', 'gb1', '', 'gbar');
  41. addLink('Reader', 'http://www.google.com/reader/view/?hl=en&tab=wy', 'gb1', '', 'gbar');
  42. // ADD THE LINKS HERE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement