Put left-aligned links to Private Messages and Subscriptions on the navbar (red bubbles)

Red notification bubbles. See "Author's Description" to see what else this gives you!

  1. // ==UserScript==
  2. // @name Put left-aligned links to Private Messages and Subscriptions on the navbar (red bubbles)
  3. // @description Red notification bubbles. See "Author's Description" to see what else this gives you!
  4. // @namespace none
  5. // @include http://www.overclock.net/*
  6. // @version Version 1.0
  7. // @grant none
  8. // @require http://code.jquery.com/jquery-1.6.4.js
  9. // ==/UserScript==
  10. (function () {
  11. /*----PUT "View All Drafts" ON YOUR PROFILE MENU-----*/
  12. $('<li/>') .append($('<a/>', {
  13. text: 'View All Drafts',
  14. href: 'http://www.overclock.net/draft'
  15. })) .insertBefore($('.profile .menu .prefs'));
  16. /*-----PUT "Edit Signature" ON YOUR PROFILE MENU-----*/
  17. var userData = $('.profile .user-avatar a') .attr('href') .split('/');
  18. var userId = userData[2];
  19. var userName = userData[3];
  20. var plText = '';
  21. var plUrl = '';
  22. plText = 'Edit Signature'.replace('{{username}}', userName) .replace('{{userid}}', userId);
  23. plUrl = 'http://www.overclock.net/users/signature/edit_signature/user_id/{{userid}}'.replace('{{username}}', userName) .replace('{{userid}}', userId);
  24. $('<li/>') .append($('<a/>', {
  25. text: plText,
  26. href: plUrl,
  27. target: '_self'
  28. })) .insertAfter($('.profile .menu .threads-started'));
  29. /*-----HIGH-RESOLUTION AVATAR ON THE NAVBAR-----*/
  30. var highres = $('.ui-header-fixed li.profile .user-avatar img') .attr('src') .replace('32x32px-LL', '120x120px-LS');
  31. $('.ui-header-fixed li.profile .user-avatar img') .attr('src', highres);
  32.  
  33. /*-----CORRECT THE CAPITALIZATION OF YOUR USERNAME ON YOUR PROFILE MENU-----*/
  34. $('.profile .menu .username a') .text($('#loggedin-username') .text());
  35. /*-----CHANGE "Logout" ON PROFILE MENU TO "Log Out"-----*/
  36. $('.profile .menu .logout a') .text('Log Out');
  37.  
  38. /*-----PUT "Private Messages" AND "Subscriptions" ON THE NAVBAR-----*/
  39. $("<style type='text/css'>.jlink { font-size: 12px; display: block !important; height: 18px !important; color: #FFFFFF !important; text-align: left !important; } .jncontainer { position: absolute; right: 48px; display: inline-block; top: 27px; width: 124px; } .jcounter { background-color: #B84300; color: #FFFFFF; font-weight: bold; display: inline-block; height: 15px; min-width: 18px; text-align: center; font-size: 10px; line-height: 14px; border-radius: 2px; margin-right: 5px; font-family: Verdana; .jpadder { display: inline-block; height: 15px; min-width: 18px; text-align: center; font-size: 10px; line-height: 14px; border-radius: 2px; margin-right: 5px; background-color: transparent; font-family: Verdana; } .jpadder, .jcounter { float: right !important; margin-top: 0px; margin-left: 3px; text-indent: -1px; } .fixed-scroll-breakpoint .jncontainer { top: 8px; } .ui-header-fixed li.profile .user-avatar .notification-counter, .ui-header-fixed ul#main-nav li.messages, .ui-header-fixed ul#main-nav li.subscriptions { display:none; } .search-bar-outer, .ui-header-fixed ul#main-nav .search > a { right:165px !important; } </style>").appendTo("head");
  40. var privateMessagesCount = $('.messages .notification-counter') .first() .text() .replace(/s+/, '');
  41. var subscriptionsCount = $('.subscriptions .notification-counter') .first() .text() .replace(/s+/, '');
  42. var notificationModule = $('<li/>', {
  43. class: 'jncontainer',
  44. });
  45. var msgText = privateMessagesCount == 1 ? 'New Message ' : privateMessagesCount < 1 ? 'Private Messages ' : 'New Messages ';
  46. var messagesContainer = $('<a/>', {
  47. href: 'http://www.overclock.net/messages',
  48. text: msgText,
  49. class: 'jlink',
  50. });
  51. var messagesCounter = $('<span/>', {
  52. text: privateMessagesCount,
  53. class: 'jcounter'
  54. });
  55. var subsContainer = $('<a/>', {
  56. href: 'http://www.overclock.net/users/subscriptions/',
  57. text: 'Subscriptions',
  58. class: 'jlink',
  59. });
  60. var subsCounter = $('<span/>', {
  61. text: subscriptionsCount,
  62. class: 'jcounter'
  63. });
  64. if (privateMessagesCount > 0) messagesContainer.append(messagesCounter);
  65. else messagesContainer.append($('<span/>', {
  66. class: 'jpadder',
  67. text: ''
  68. }));
  69. if (subscriptionsCount > 0) subsContainer.append(subsCounter);
  70. else subsContainer.append($('<span/>', {
  71. class: 'jpadder',
  72. text: ''
  73. }));
  74. notificationModule.append(messagesContainer);
  75. notificationModule.append(subsContainer);
  76. notificationModule.insertBefore($('#main-nav .profile'));
  77. }) ();