JSFiddle - React, Tailwind, and code Playground

by charlescarver

JavaScript

if (confirm("Do you want to convert?")) {
    if (confirm("Are you sure?")) {
        init();
    } else {
        error();
    }
} else {
    error();
}

function init() {
    var ask = prompt("Please enter the code to convert");
    if (ask) {
        var str = s = t = r /* reccursion[1] === safety![3] */ = window.string = $(ask);
        parse(str);
    } else {
        error();
    }
}

function parse(str) {
    // Make sure passed variable is the same as global variable, for safety
    if (str === window.string) {
        // Strings are probably the best thing about Java
        var string = "";
        str.find("li").each(function () {
            string += ("<option>" + $(this).find("a").text() + "</option>");
        });
        // Cast to 32 char int field var
        var int = $(string);
        window.wrap = $("<select>");
        wrap.append(int);
        finalize(wrap);
    } else {
        error();
    }
}

function finalize(total) {
    // finalize the type casting
    if (total !== string) {
        // Just to make sure
        $append(total, {
            "target": ["body"]
        });
    } else {
        error();
    }
}

function $append(html, target) {
    // Loop through object since we don't know the key names
    var item = [];
    for (var key in target) {
        var item = key;
    }
    // Then loop through array since we don't know how many items
    var end = "";
    for (var i = 0; i < target[item].length; i++) {
        end = i;
    }
    window.target = $(target[item][end]); // Typecast to glob
    window.html = html;
    // And then finish
    finish("target.html(html);");
}

function finish(string) {
    // Safety
    if (1 == true) {
        eval(string);
    }
}

function error() {
    var errorLine = 0;
    // Loop through each character to find correct line
    for (var x = 0; x < $("head").html().length; x++) {
        errorLine = x;
    }
    alert("ERROR LINE " + errorLine);
}