Facebook - Extra Links

Adds extra links at the top of facebook; customizable

当前为 2015-07-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Facebook - Extra Links
  3. // @namespace http://userscripts.org/users/23652
  4. // @description Adds extra links at the top of facebook; customizable
  5. // @include http://*.facebook.com/*
  6. // @include http://facebook.com/*
  7. // @include https://*.facebook.com/*
  8. // @include https://facebook.com/*
  9. // @copyright JoeSimmons
  10. // @version 1.0.26
  11. // @require https://greasyfork.org/scripts/1885-joesimmons-library/code/JoeSimmons'%20Library.js?version=7915
  12. // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
  13. // ==/UserScript==
  14.  
  15. JSL.runAt('interactive', function () {
  16. 'use strict';
  17.  
  18. var menubar, navSearch, rTrim, u;
  19. var links = {
  20.  
  21.  
  22.  
  23. // LINKS SECTION
  24. // FORMAT: 'LINK TEXT' : 'LINK URL',
  25. /////////////////////////////////////////////////////////////////////////////
  26. 'FarmVille' : 'http://apps.facebook.com/onthefarm/',
  27. 'Requests' : 'http://www.facebook.com/reqs.php',
  28. 'Notifications' : 'http://www.facebook.com/notifications.php',
  29. /////////////////////////////////////////////////////////////////////////////
  30.  
  31.  
  32.  
  33. '':'' // don't change
  34. };
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. navSearch = JSL('#blueBarNAXAnchor');
  42. rTrim = /^\s*(\S*(?:\s+\S+)*)\s*$/; // trim regexp by douglas crockford
  43. menubar = JSL.create('div', {id: 'extra_links_holder', style: 'float: left; padding: 11px 0 0 4px;'});
  44.  
  45. if (navSearch.exists) {
  46. for (u in links) {
  47. u = u.replace(rTrim, '$1'); // trim text
  48. if (u !== '') {
  49. menubar.appendChild(
  50. JSL.create('a', {href: links[u], style: 'padding: 6px 8px; color: #FFFFFF; font-family: verdana, tahoma, arial, sans-serif; font-size: 11pt;', target:'_parent'}, [
  51. JSL.create('text', u)
  52. ])
  53. );
  54. }
  55. }
  56.  
  57. navSearch.prepend(menubar);
  58. }
  59.  
  60. });