Kill popup window

Close all popup window automatic

  1. // ==UserScript==
  2. // @name Kill popup window
  3. // @namespace https://greasyfork.org/en/scripts/408032-close-all-popup-window/
  4. // @version 0.5
  5. // @description Close all popup window automatic
  6. // @author TechComet
  7. // @include http://*/*
  8. // @include https://*/*
  9. // @supportURL https://greasyfork.org/en/scripts/408032-close-all-popup-window/feedback
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // replace all `no_close` to custom any string
  14.  
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. var element_url = document.getElementsByTagName("a"), index_url;
  20.  
  21. for (index_url = element_url.length - 1; index_url >= 0; index_url--) {
  22. var cur_url = element_url[index_url]
  23. var prefix = function (url) { return cur_url.href.indexOf(url) != -1 };
  24.  
  25. cur_url.href = cur_url.href + "#no_close"
  26.  
  27. }
  28.  
  29.  
  30.  
  31. var except = [
  32. 'google.com', 'facebook.com' //example except WebSites
  33. ]
  34.  
  35. var hostname = window.location.hostname.replace("www.", "")
  36.  
  37. if (window.location.href.indexOf("#no_close") == -1) {
  38. if (except.indexOf(hostname) == -1) {
  39. window.close();
  40. }
  41. }
  42. })();