GOTA_Container

Modifies the container in which the game is hosted (optionally).

Você precisará instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Você precisará instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Você precisará instalar uma extensão como o Tampermonkey para instalar este script.

Você precisará instalar um gerenciador de scripts de usuário para instalar este script.

(Eu já tenho um gerenciador de scripts de usuário, me deixe instalá-lo!)

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar uma extensão como o Stylus para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

Você precisará instalar um gerenciador de estilos de usuário para instalar este estilo.

(Eu já possuo um gerenciador de estilos de usuário, me deixar fazer a instalação!)

// ==UserScript==
// @name        GOTA_Container
// @namespace   gota_container
// @description Modifies the container in which the game is hosted (optionally).
// @include     https://games.disruptorbeam.com/gamethrones*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @version     1.2
// @grant       GM_getValue
// @grant       GM_setValue
// @grant       unsafeWindow
// ==/UserScript==

// Resolve jQuery conflicts
this.$ = this.jQuery = jQuery.noConflict(true);

// Button HTML definition
var hideHeaderLink = '<a href="#" id="hideHeader">Hide header</a>';
var showGameOnly = '<a href="http://gota-www.disruptorbeam.com/" id="showGameOnly">Show game only</a>&nbsp;';

$(function() {
    try {

        // Append button        
        var $header = $("header.site-header");
        if ($header && $header.length > 0) {
            $header.before(showGameOnly);
            $header.before(hideHeaderLink);
        }

        var $hideLnk = $("#hideHeader");
        if (!$hideLnk && $hideLnk.length == 0) {
            warn("Could not append link button.");
        }

        (function() {
            // Fix iframe visual bugs in FF
            var $iframe = $("#iframe_content iframe");
            if (!$iframe || $iframe.length == 0) {
                return;
            }

            $iframe.css("display", "inline");
            $iframe.css("height", "1000px");
            $iframe.attr("id", "gota_iframe");

            GM_getValue("hideHeader", false)
                ? ($header.show(), $hideLnk.text("Hide header"))
                : ($header.hide(), $hideLnk.text("Show header"));
        })();

        // Attach handler on the buttons
        $("#hideHeader").on('click', function(e) {
            e.preventDefault();

            if (!$header || $header.length == 0) {
                error("Could not locate header.");
                return;
            }

            $header.is(":hidden")
                ? ($header.show(), $hideLnk.text("Hide header"))
                : ($header.hide(), $hideLnk.text("Show header"));

            GM_setValue("hideHeader", $header.is(":hidden"));
        });

        inject(scope.toString());

    } catch (err) {
        error("Error encountered: " + err);
    }
});

function inject(code) {

    var script = document.createElement('script');
    script.type = "text/javascript";
    script.innerHTML = code;
    document.head.appendChild(script);

}

// --> Message handling
function log(message, type) {
    if (console && console.log && typeof (console.log) == "function") {
        if (!type)
            type = "ex-container";

        var prefix = type.toString().toUpperCase() + " <" + new Date().toLocaleTimeString() + "> ";
        console.log(prefix + message);
    }
}

function error(message, type) {
    if (console && console.error && typeof (console.error) == "function") {
        if (!type)
            type = "ex-container";

        var prefix = type.toString().toUpperCase() + " - ERROR <" + new Date().toLocaleTimeString() + "> ";
        console.error(prefix + message);
    }
}

function warn(message, type) {
    if (console && console.warn && typeof (console.warn) == "function") {
        if (!type)
            type = "ex-container";

        var prefix = type.toString().toUpperCase() + " - WARNING <" + new Date().toLocaleTimeString() + "> ";
        console.warn(prefix + message);
    }
}

function scope(data) {
    //console.debug("Attempting to post data to the frame, data: " + data);
    window.frames[0].postMessage(data, "https://gota-www.disruptorbeam.com");
    return data;
}