Hack Space4Online

hack space4.online~

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Advertisement:

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Advertisement:

// ==UserScript==
// @name         Hack Space4Online
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  hack space4.online~
// @author       You
// @match        http://space4.online/problems/*
// @icon         https://www.google.com/s2/favicons?domain=space4.online
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setTimeout(() => {
        // move the toolbar at the bottom
        let content = document.getElementById("blah2");
        let header = content.previousElementSibling;
        header.parentElement.insertBefore(content, header);

        // remove footer
        document.getElementsByTagName('footer')[0].remove();

        // get the height of header;
        let header_height = document.getElementsByTagName('header')[0].offsetHeight;

        // let the main part's display is flex.
        let main_part = header.parentElement.parentElement.parentElement.parentElement;
        main_part.style.display = "flex";
        main_part.style.height = "calc(100vh - " + header_height + "px)";
        console.log("calc(100vh - " + header_height + "px)");
        let left = main_part.children[0];
        let right = main_part.children[1];

        // change left's outlook
        left.style.overflow="scroll";
        left.style.width = "40%";
        left.children[2].style["max-width"] = "100%";
        left.children[2].style.display = "block";
        let tags = left.children[2].children[1];
        let text = left.children[2].children[0];
        text.parentElement.insertBefore(tags, text);

        // change right's outlook
        right.style["min-height"] = "0";
        right.style.width = "60%";
        right.children[0].style.height = "75%";
        right.children[1].style.height = "25%";
        right.children[1].children[0].style["min-height"] = "0";
        right.children[1].children[1].style["min-height"] = "0";

        // refrash
        let evt = document.createEvent("HTMLEvents");
        evt.initEvent("resize", true, true);
        window.dispatchEvent(evt);
    }, 3000);
})();