Greasy Fork is available in English.

Anti-Unblocker

Blocks unblocked game sites

  1. // ==UserScript==
  2. // @name Anti-Unblocker
  3. // @description Blocks unblocked game sites
  4. // @author You
  5. // @include *
  6. // @run-at document-body
  7. // @grant none
  8. // @version 0.0.1.20160228092418
  9. // @namespace https://greasyfork.org/users/12417
  10. // ==/UserScript==
  11. /* jshint -W097 */
  12. 'use strict';
  13. var title = document.title.toLowerCase().replace(/ /g, "");
  14. var unblocked =
  15. [
  16. "unblock",
  17. "unblocked",
  18. "unblocks",
  19. "ublock",
  20. "ublocked",
  21. "ublocks"
  22. ]; // Initializes list of all variations of the word "unblocked"
  23.  
  24. var games =
  25. [
  26. "game",
  27. "gaming",
  28. ]; // Initializes list of all variations of the beginnings of the word "games" (the end doesn't matter)
  29.  
  30. function block() // Function will block the website.
  31. {
  32. var current = window.location.href;
  33. window.history.back(); // Attempt to go back (if it's opened in a tab with no tab history)
  34. if (window.location.href == current) // If it's still there
  35. {
  36. window.close(); // Attempt to close page
  37. if (window.location.href == current) // If it's still there (if it's the only tab)
  38. {
  39. window.location.href = "about://newtab"; // Go to a new tab; always works!
  40. }
  41. }
  42. }
  43.  
  44. for (var i in unblocked) // Iterate through list of all variations of the word "unblocked"
  45. {
  46. for (var x in games) // Iterate through list of all variations of the beginnings of the word "games" (the end doesn't matter)
  47. {
  48. var search_result = title.search(unblocked[i] + games[x]); // This variable will equal -1 if it is not found
  49. if (search_result !== -1) // If the search exists
  50. {
  51. block(); // Block
  52. }
  53. }
  54. }