Anti-Unblocker

Blocks unblocked game sites

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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
        }
    }
}