search
HomeWeb Front-endJS TutorialCrazy, there is an operating system written in js_javascript skills

http://www.masswerk.at/jsuix/

// JS/UIX v0.44
// (c) mass:werk (N.Landsteiner ) 2003
// all rights reserved

// term gui

var conf_term_x=102;
var conf_term_y=34;
var conf_kbd_offset=34;
var termImgPath='jsuix_support/';
var termDiv='termDiv';
var termBgColor='#181818';
var termFrameColor='#555555';
var termPageColor='#222222';
var conf_repeat_delay1=320;
var conf_repeat_delay2=170;

var termKbdDiv='termKbdDiv';
var termKbdBgColor='#222222';
var keycapspath='jsuix_support/keycaps/';

var termSubDivs=false;
var termLayers=false;
var termDocNS4=null;
var termStringStart='';
var termStringEnd='';

var termKbdDocNS4=null;
var termKbdOn=false;
var keycapsShift=false;
var keycapsCpslk=false;
var keycapsShiftRef=new Array();
var keycapsCpslkRef=new Array();

var termSpecials=new Array();
termSpecials[0]=' ';
termSpecials[1]='$';
termSpecials[2]=' ';
termSpecials[3]='?';
termSpecials[4]='#';
termSpecials[32]=' ';
termSpecials[34]='"';
termSpecials[38]='&';
termSpecials[60]='termSpecials[62]='>';
termSpecials[127];

var termStyles=new Array(1,2,4,8);
var termStyleOpen=new Array(); ();
termStyle[1]='
'; termStyle[2]='
termStyle[ 2]='
';
termStyle[4]='';
termStyleOpen[8]='
' ;
termStyleClose[8]='';

// buttons UI
var termImgNames=new Array('left_lo', 'right_lo' ', 'right_hi', 'delete_lo', 'delete_hi', 'Crazy, there is an operating system written in js_javascript skills_lo', 'Crazy, there is an operating system written in js_javascript skills_hi', 'kbd_show_lo', 'kbd_hide_lo', 'kbd_hide_hi');
var termImages=new Array();

function termImgPreload(path,imgnames) {
    for (var i=0; iCrazy, there is an operating system written in js_javascript skills        var n=imgnames[i];
       termImages[n ]=new Image();
        termImages[n].src=path n '.gif'
    }
}
Crazy, there is an operating system written in js_javascript skillsif (document.images) termImgPreload(termImgPath,termImgNames);

function termSetImg(n,v) {
    if (document.images) {
        var img=(termLayers)? termDocNS4.images['term_' n]: document.images['term_' n];
        var stat=(v)? '_hi' : '_lo';
        img.src=termImages[n stat].src
    }
}


// UI keyboard
// key maps (200=left shift, 202=right shift, 204=CpsLock)

var termKeyMap= [
    [96,49,50,51,52,53,54,55,56,57,48,45,61,8],
    [27,113,119,101,114,116,121,117,105,111,112,91,93,13],
    [204,97,115,100,102,103,104,106,107,108,59,39,35],
    [200,92,122,120,99,118,98,110,109,44,46,47,30,202],
    [32,28,31,29]
];
var termKeyMapShift=[
    [126,33,34,35,36,37,94,38,42,40,41,95,43,8],
    [27,81,87,69,82,84,89,85,73,79,80,123,125,13],
    [204,65,83,68,70,71,72,74,75,76,58,34,64],
    [200,124,90,88,67,86,66,78,77,60,62,63,30,202],
    [32,28,31,29]
];
var termKeyMapCpslk=[
    [96,49,50,51,52,53,54,55,56,57,48,45,61,8],
    [27,81,87,69,82,84,89,85,73,79,80,91,93,13],
    [204,65,83,68,70,71,72,74,75,76,59,39,35],
    [200,92,90,88,67,86,66,78,77,44,46,47,30,202],
    [32,28,31,29]
];
var termKeyWdth=[
    [35,35,35,35,35,35,35,35,35,35,35,35,35,69],
    [55,35,35,35,35,35,35,35,35,35,35,35,35,0],
    [65,35,35,35,35,35,35,35,35,35,35,35,35],
    [49,35,35,35,35,35,35,35,35,35,35,35,35,54],
    [252,35,35,35]
];

var keycapsImgNames=new Array(200,201,202,203,204,205);

function termKeyCaps(k) {
    if ((k=32) && (repeatTimer)) clearTimeout(repeatTimer);
    if (k==204) {
        keycapsCpslk=(!keycapsCpslk);
        var cnr=(keycapsCpslk)? 205:204;
        termKbdSetImg(204,cnr)
    }
    else if ((k==200) || (k==202)) {
        keycapsShift=(!keycapsShift);
        var m=(keycapsShift)? 1:0;
        termKbdSetImg(200,200 m);
        termKbdSetImg(202,202 m)
    }
    else {
        var ch=0;
        if (keycapsShift) {
            ch=keycapsShiftRef[k]
            keycapsShift=false;
            termKbdSetImg(200,200);
            termKbdSetImg(202,202)
        }
        else if (keycapsCpslk) ch=keycapsCpslkRef[k]
        else ch=k;
        keyHandler({which:ch,jsuix_remapped:true})
    }
}

function termKbdSetImg(n,v) {
    if (document.images) {
        var img=(termLayers)? termKbdDocNS4.images['key' n] : document.images['key' n];
        img.src=termImages[v].src
    }
}


function termSetKbdButton(v) {
    if (document.images) {
        var img=(termLayers)? termDocNS4.images.term_kbd_show : document.images.term_kbd_show;
        var n=(termKbdOn)? 'kbd_hide' : 'kbd_show';
        var stat=(v)? '_hi' : '_lo';
        img.src=termImages[n stat].src
    }
}

function termKbdShow() {
    if (termKbdOn) {
        setDivVisibility(termKbdDiv,0);
        termKbdOn=false;
        termSetKbdButton(0)
    }
    else {
        termImgPreload(keycapspath,keycapsImgNames);
        keycapsShift=false;
        keycapsCpslk=false;
        var s='n';
        s ='n';
        s ='n';
        s 'n';
        s ='n';
        s ='
Crazy, there is an operating system written in js_javascript skills' termMakeKbd() 'Crazy, there is an operating system written in js_javascript skills
Crazy, there is an operating system written in js_javascript skills
n';
        s ='
Crazy, there is an operating system written in js_javascript skillsn';
        s ='' termMakeKbd() 'n';
        s 'Crazy, there is an operating system written in js_javascript skills
n';
        s ='
Crazy, there is an operating system written in js_javascript skillsn';
        s ='';
        writeElement(termKbdDiv,s);
        setDivXY(termKbdDiv,conf_term_x,conf_term_y conf_kbd_offset conf_rows*conf_rowheigt);
        if (termLayers) termKbdDocNS4=document.layers[termKbdDiv].document;         termKbdOn=true;
        setDivVisibility(termKbdDiv,1);         termSetKbdButton(0)     } n';
    };
    s ='
}
function termMakeKbd() {
    var s='
n';
    for (var i=0; i        s ='Crazy, there is an operating system written in js_javascript skills';         for (var k=0; k            var kc=termKeyMap[i][k];
            keycapsShiftRef[kc]=termKeyMapShift[i][k];
            keycapsCpslkRef[kc]=termKeyMapCpslk[i][k]; Crazy, there is an operating system written in js_javascript skills            if (kc==13) {
                s ='
Crazy, there is an operating system written in js_javascript skills
';                 continue Crazy, there is an operating system written in js_javascript skills            };             if (kc==32) s ='
'
            else if (kc==28) {                 s ='';                 s ='';                 continue             }
            else if (kc==29) {
                s ='Crazy, there is an operating system written in js_javascript skills';
                continue
            }
            else if (kc==8) {
                s ='Crazy, there is an operating system written in js_javascript skills';
                continue
            }
            s ='Crazy, there is an operating system written in js_javascript skills';
            if (kc==35) s ='Crazy, there is an operating system written in js_javascript skills';
        };
        s ='
';
    return s
}


// term UI

function termHide() {
    if (repeatTimer) clearTimeout(repeatTimer);
    if (termKbdOn) termKbdShow();
    setDivVisibility(termDiv,0)
}

function makeTerm() {
    window.status='Building terminal ...';
    termLayers=(document.layers)? true:false;
    termSubDivs=(navigator.userAgent.indexOf('Gecko')    var s='';
    s ='n';
    s ='n';

    s ='n    s ='
n';
    s ='
n';
    var rstr='';
    for (var c=0; c    for (var r=0; r        var id=((termLayers) || (termSubDivs))? '' : ' ID="term_' r '"';
        s ='
n';
    };
    s ='
' rstr '
n';
    s ='
Crazy, there is an operating system written in js_javascript skills
n';     s ='
Crazy, there is an operating system written in js_javascript skills

n';
    s ='n';
    s ='n';
    s ='n';
    s ='n';
    s ='
Crazy, there is an operating system written in js_javascript skillsCrazy, there is an operating system written in js_javascript skillsCrazy, there is an operating system written in js_javascript skillsCrazy, there is an operating system written in js_javascript skills
n';
n';
    s =' Crazy, there is an operating system written in js_javascript skills
n';     s =' Crazy, there is an operating system written in js_javascript skillsn';     s =' Crazy, there is an operating system written in js_javascript skills
n';
    s =' Crazy, there is an operating system written in js_javascript skills
n';
';
        termStringEnd='
    s ='


n';
    s ='
n';
    if (termLayers) {
        for (var r=0; r';
        termStringEnd='
            s ='
n'         };         termDocNS4=document.layers[termDiv].document;         termStringStart='
';         termStringEnd='';     }     else if (termSubDivs) {         for (var r=0; r            s ='n'         };         termStringStart='
';         termStringEnd='';     };
    writeElement(termDiv,s);
    setDivXY(termDiv,conf_term_x,conf_term_y);
    setDivVisibility(termDiv,1);
    window.status=''
}

function termDisplay(r) {
    var s=termStringStart;
    var curStyle=0;
    for (var i=0; i        var c=term[r][i];
        var cs=termStyle[r][i];
        if (cs!=curStyle) {
            if (curStyle) {
                for (var k=termStyles.length-1; k>=0; k--) {
                    var st=termStyles[k];
                    if (curStyle&st) s =termStyleClose[st];
                }
            };
            curStyle=cs;
            for (var k=0; k                var st=termStyles[k];
                if (curStyle&st) s =termStyleOpen[st];
            }
        };
        s = (termSpecials[c])? termSpecials[c] : String.fromCharCode(c);
    };
    if (curStyle>0) {
        for (var k=termStyles.length-1; k>=0; k--) {
            var st=termStyles[k];
            if (curStyle&st) s =termStyleClose[st];
        }
    };
    s =termStringEnd;
    writeElement('term_' r,s,termDocNS4)
}

function termGuiReady() {
    ready=true;
    if (termGuiElementReady(termDiv, self.document)) {
        for (var r=0; r            if (termGuiElementReady('term_' r,termDocNS4)==false) {
                ready=false;
                break
            }
        }
    }
    else ready=false;
    return ready
}


function cursorKbdLeft() {
    keyHandler({which:28})
}

function cursorKbdRight() {
    keyHandler({which:29})
}

function termKbdBackspace() {
    keyHandler({which:8})
}

function termKbdEsc() {
    keyHandler({which:27})
}

function termKbdClear() {
    if ((!cnslLock) && (!cnslRawMode)) cnslReset();
}

// UI-button repeat

function repeatSet(cmd,on) {
    if (repeatTimer) clearTimeout(repeatTimer);
    repeatTimer=setTimeout('repeatDo("' cmd '")',conf_repeat_delay1);
}

function repeatClear() {
    if (repeatTimer) clearTimeout(repeatTimer);
}

function repeatDo(cmd) {
    if (repeatTimer) clearTimeout(repeatTimer);
    if (cmd=='left') cursorKbdLeft()
    else if (cmd=='right') cursorKbdRight()
    else if (cmd=='Crazy, there is an operating system written in js_javascript skills') termKbdBackspace();
    repeatTimer=setTimeout('repeatDo("' cmd '")',conf_repeat_delay2);
}


// basic dynamics

function writeElement(e,t,d) {
    if (document.layers) {
        var doc=(d)? d : self.document;
        doc.layers[e].document.open();
        doc.layers[e].document.write(t);
        doc.layers[e].document.close()
    }
    else if (document.getElementById) {
        var obj=document.getElementById(e);
        obj.innerHTML=t
    }
    else if (document.all) {
        document.all[e].innerHTML=t
    }
}

function setDivXY(d,x,y) {
    if (document.layers) {
        document.layers[d].moveTo(x,y)
    }
    else if (document.getElementById) {
        var obj=document.getElementById(d);
        obj.style.left=x 'px';
        obj.style.top=y 'px'
    }
    else if (document.all) {
        document.all[d].style.left=x 'px';
        document.all[d].style.top=y 'px'
    }
}

function setDivVisibility(d,v) {
    if (document.layers) {
        document.layers[d].visibility= (v)? 'show':'hide';
    }
    else if (document.getElementById) {
        var obj=document.getElementById(d);
        obj.style.visibility= (v)? 'visible':'hidden';
    }
    else if (document.all) {
        document.all[d].style.visibility= (v)? 'visible':'hidden';
    }
}

function termGuiElementReady(e,d) {
    if (document.layers) {
        var doc=(d)? d : self.document;
        return ((doc) && (doc.layers[e]))? true:false
    }
    else if (document.getElementById) {
        return (document.getElementById(e))? true:false
    }
    else if (document.all) {
        return (document.all[e])? true:false
    }
    else return false
}

//eof
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
JavaScript in Action: Real-World Examples and ProjectsJavaScript in Action: Real-World Examples and ProjectsApr 19, 2025 am 12:13 AM

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

JavaScript and the Web: Core Functionality and Use CasesJavaScript and the Web: Core Functionality and Use CasesApr 18, 2025 am 12:19 AM

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

Understanding the JavaScript Engine: Implementation DetailsUnderstanding the JavaScript Engine: Implementation DetailsApr 17, 2025 am 12:05 AM

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)