Anti-Unblocker

Blocks unblocked game sites

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Anti-Unblocker
// @description  Blocks unblocked game sites
// @author       You
// @include      *
// @run-at       document-body
// @grant        none
// @version 0.0.1.20160228092418
// @namespace https://greasyfork.org/users/12417
// ==/UserScript==
/* jshint -W097 */
'use strict';
var title = document.title.toLowerCase().replace(/ /g, "");
var unblocked =
[
    "unblock",
    "unblocked",
    "unblocks",
    "ublock",
    "ublocked",
    "ublocks"
]; // Initializes list of all variations of the word "unblocked"

var games =
[
    "game",
    "gaming",
]; // Initializes list of all variations of the beginnings of the word "games" (the end doesn't matter)

function block() // Function will block the website.
{
    var current = window.location.href;
    window.history.back(); // Attempt to go back (if it's opened in a tab with no tab history)
    if (window.location.href == current) // If it's still there 
    {
        window.close(); // Attempt to close page
        if (window.location.href == current) // If it's still there (if it's the only tab)
        {
            window.location.href = "about://newtab"; // Go to a new tab; always works!
        }
    }
}

for (var i in unblocked) // Iterate through list of all variations of the word "unblocked"
{
    for (var x in games) // Iterate through list of all variations of the beginnings of the word "games" (the end doesn't matter)
    {
        var search_result = title.search(unblocked[i] + games[x]); // This variable will equal -1 if it is not found
        if (search_result !== -1) // If the search exists
        {
            block(); // Block
        }
    }
}