Torn Better UI

Make Torn Beautiful

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 or Violentmonkey 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         Torn Better UI
// @namespace    http://tampermonkey.net/
// @version      alpha-1.1
// @description  Make Torn Beautiful
// @author       Jayam Patel
// @match        https://www.torn.com/*
// @icon         https://raw.githubusercontent.com/jayam04/torn-scripts/master/tornBetterUI/icon.png
// @license      Apache License 2.0
// @grant        none
// @require      https://update.greasyfork.org/scripts/501645/1416051/Torn%20UI%20Elements%20%28for%20Developers%29.js
// @require      https://update.greasyfork.org/scripts/501648/1416074/Constants%20for%20Torn%20Scripts%20%28for%20Developers%29.js
// ==/UserScript==

function realignTornUI() {
    const mainContainer = document.getElementById("mainContainer");
    mainContainer.style.marginLeft = "20px";

    // TODO: make this more robust.
    // TODO: make this more efficient, currently, it takes time and shift is visible on every page reload.
    const mainContentContainer =
        document.getElementsByClassName("content-wrapper")[0];
    const topHeaderContainer =
        document.getElementsByClassName("header-wrapper-top")[0];
    const topHeaderContainerChild = topHeaderContainer.children[0];
    topHeaderContainerChild.style.marginLeft = "20px";

    const bottomHeaderContainer = document.getElementsByClassName(
        "header-wrapper-bottom"
    )[0];
    const bottomHeaderContainerChild = bottomHeaderContainer.children[0];
    bottomHeaderContainerChild.style.marginLeft = "20px";
}

function updateFont() {
    const mainContainer = document.getElementById("mainContainer");
    mainContainer.style.fontFamily = "Pangolin";
}

function main() {
    realignTornUI();
}

main();