Pop Facebook Hash Tags

Makes hashtag links open in a new window or tab

  1. // ==UserScript==
  2. // @name Pop Facebook Hash Tags
  3. // @namespace http://www.emsquared-inc.com/
  4. // @version 2.1
  5. // @description Makes hashtag links open in a new window or tab
  6. // @author Eric Mintz
  7. // @oujs:author emsquared-inc
  8. // @license GNU GPL v3.0; https://github.com/emsquared-inc/PopFacebookHashTags/blob/gh-pages/LICENSE
  9. // @homepageURL http://www.emsquared-inc.com
  10. // @supportURL https://github.com/emsquared-inc/PopFacebookHashTags
  11. // @match https://www.facebook.com/*
  12. // @match https://www.facebook.com
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. var observer = new MutationObserver(function(mutations) {
  18. document.querySelectorAll('div[id*="topnews"] a[href*="/hashtag/"]').forEach(function(link){
  19. link.setAttribute('target','_blank');
  20. });
  21. });
  22.  
  23. window.addEventListener('load',function(){
  24. var main_stream = document.querySelector('div[id*="topnews_main_stream"]');
  25. if (main_stream) {
  26. observer.observe(main_stream, { childList: true, subtree: true });
  27. }
  28. });
  29. })();