Block 1337x's Annoying popups!

Blocks all popups from 1337x.to and redirects suspicious links to the homepage.

  1. // ==UserScript==
  2. // @name Block 1337x's Annoying popups!
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @license GNU GPLv3
  6. // @description Blocks all popups from 1337x.to and redirects suspicious links to the homepage.
  7. // @author TheApkDownloader
  8. // @match https://1337x.to/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. const originalOpen = window.open;
  16. window.open = function(url, target, features) {
  17. console.warn(`Blocked popup attempt to open URL: ${url}`);
  18. if (url) {
  19. window.location.href = "https://1337x.to";
  20. }
  21. return null;
  22. };
  23.  
  24. document.addEventListener('click', function(e) {
  25. const target = e.target.closest('a[target="_blank"]');
  26. if (target) {
  27. e.preventDefault();
  28. console.warn(`Blocked target="_blank" link to: ${target.href}`);
  29. window.location.href = "https://1337x.to";
  30. }
  31. });
  32.  
  33. console.info("1337x.to popup blocker is active.");
  34. })();