Torn Advanced Signature

Bypass the torn profile editor for more rich featured profile

// ==UserScript==
// @name         Torn Advanced Signature
// @require      https://code.jquery.com/jquery-3.7.1.min.js
// @namespace    https://torn.com/
// @version      2025-08-40
// @description  Bypass the torn profile editor for more rich featured profile
// @author       Angry God
// @match        https://www.torn.com/profiles.php?XID=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=torn.com
// @grant        GM_xmlhttpRequest
// @connect      raw.githubusercontent.com
// @license      MIT
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    $(document).ready(function() {


        function waitForElm(selector) {
            return new Promise(resolve => {
                if (document.querySelector(selector)) {
                    return resolve(document.querySelector(selector));
                }

                const observer = new MutationObserver(mutations => {
                    if (document.querySelector(selector)) {
                        observer.disconnect();
                        resolve(document.querySelector(selector));
                    }
                });


                observer.observe(document.body, {
                    childList: true,
                    subtree: true
                });
            });
        }
        waitForElm('.profile-container.border-round.unreset.editor-content').then((elm) => {
            console.clear();
            //alert('Element is ready'); //debug
            //check to see if the user is Advanced profile user.
            if (elm.children[2]) {
                var TrueorFalseDiv = elm.children[2];
                var UserTrueorFalse = elm.children[2].textContent;
            } else {
                console.log('Not a Torn Advanced Profile User');
            }

            //console.log(UserTrueorFalse); //debug
            if ( TrueorFalseDiv !== null && UserTrueorFalse === 'True') {
                //console.log(elm.children[0].textContent);// debug
                //setting css file
                const csstextFileURL = elm.children[0].textContent;
                var TornProfile = elm.children[4]; // setting var for main profile
                TornProfile.remove();//hides torn profile
                GM_xmlhttpRequest({
                    method: 'GET',
                    url: csstextFileURL,
                    onload: function(responseDetails) {

                        var cssfile = responseDetails.responseText;
                        var yourClasses = cssfile;
                        $("head").append("<style type='text/css'>"+yourClasses+"</style>");//add styles

                    },
                    onerror: function(responseDetails) {
                        // An error occurred during the request.
                        console.error('Error fetching the text file.');
                        console.error('Status:', responseDetails.status);
                        console.error('Details:', responseDetails);
                    }
                });


                //end setting up css file


                //setting html file
                const HtmltextFileURL = elm.children[1].textContent;

                GM_xmlhttpRequest({
                    method: 'GET',
                    url: HtmltextFileURL,
                    onload: function(responseDetails) {

                        var newhtml = responseDetails.responseText;
                        var appenddiv = elm.children[3]; //selecting forth div in profile
                        $(appenddiv).append(newhtml); //adds html to div
                        $(appenddiv).css("height", "auto");//adjust the height of advanced profie
                    },
                    onerror: function(responseDetails) {
                        // An error occurred during the request.
                        console.error('Error fetching the text file.');
                        console.error('Status:', responseDetails.status);
                        console.error('Details:', responseDetails);
                    }
                });
               //end setting html file

            } else {
                console.log('Not a Torn Advanced Profile User')
            }


        });

    });

    // Your code here...
})();