Facebook Notifications in sidebar

Move the notifications to sidebar so you never have to click the shit out of the button again

  1. // ==UserScript==
  2. // @name Facebook Notifications in sidebar
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Move the notifications to sidebar so you never have to click the shit out of the button again
  6. // @author Damien <damien@dam.io>
  7. // @match https://www.facebook.com/
  8. // @grant MIT
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // add notifs to sidebar
  15. var sidebar = document.getElementById('u_0_q');
  16. var notifDiv = document.getElementById('fbNotificationsFlyout');
  17. notifDiv.className = '_4-u2 _4-u8 _5v6e cardRightCol';
  18. notifDiv.style.padding = '4px 6px';
  19. sidebar.insertBefore(notifDiv, sidebar.firstChild);
  20. setInterval(() => {
  21. // fix width overflowing
  22. var scrollbody = sidebar.getElementsByClassName('uiScrollableAreaBody')[0];
  23. if (scrollbody) scrollbody.style['width'] = 'auto';
  24. }, 500);
  25.  
  26. setTimeout(() => {
  27. // trigger the notification
  28. document.getElementById('fbNotificationsJewel').firstChild.click();
  29. }, 1000);
  30. })();