No Pop-Ups, only new tabs

Turns off the ability to open new windows, opens tabs instead

  1. // ==UserScript==
  2. // @name No Pop-Ups, only new tabs
  3. // @namespace nopopups
  4. // @author Owyn
  5. // @version 1.2
  6. // @description Turns off the ability to open new windows, opens tabs instead
  7. // @run-at document-start
  8. // @grant unsafeWindow
  9. // @match http://*/*
  10. // @match https://*/*
  11. // @match file://*/*
  12. // @noframes
  13. // ==/UserScript==
  14.  
  15. if (typeof unsafeWindow === "undefined"){unsafeWindow = window;}
  16. delete unsafeWindow.window.open;
  17. unsafeWindow.window.Ropen = unsafeWindow.window.open; // FireFox may suck here
  18.  
  19. if (typeof exportFunction === "undefined")
  20. {
  21. unsafeWindow.window.__proto__.open= function (a,b,c)
  22. {
  23. unsafeWindow.window.Ropen(a,b);
  24. }
  25. }
  26. else // FF 31
  27. {
  28. function Opn(a,b,c)
  29. {
  30. unsafeWindow.window.Ropen(a,b);
  31. }
  32. exportFunction(Opn, unsafeWindow.__proto__, {defineAs: "open"});
  33. }