commit
ef8cdd3643
31 changed files with 32899 additions and 0 deletions
@ -0,0 +1,32 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title>403 Forbidden</title> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css"> |
||||
</head> |
||||
<body> |
||||
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> |
||||
<div class="navbar-brand"> |
||||
<div class="navbar-item"> |
||||
<img src="/static/logo.png" /> |
||||
</div> |
||||
<div class="navbar-item"> |
||||
<span>Server administration</span> |
||||
</div> |
||||
</div> |
||||
</nav> |
||||
<br> |
||||
<div class="columns"> |
||||
<div class="column"> |
||||
</div> |
||||
<div class="column"> |
||||
<h1 class="title">403 Forbidden</h1> |
||||
</div> |
||||
<div class="column"> |
||||
</div> |
||||
</div> |
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,16 @@ |
||||
#!/bin/bash |
||||
rm -rf dist |
||||
mkdir -p dist/static |
||||
cp index.html dist/ |
||||
cp 403.html dist/ |
||||
cp -r shell dist/ |
||||
cp -r python dist/ |
||||
cp -r rescue dist/ |
||||
cp -r rest-api dist/ |
||||
cp static/*.css dist/static/ |
||||
cp static/*.bin dist/static/ |
||||
cp static/*.img dist/static/ |
||||
cp static/*.png dist/static/ |
||||
cp static/*min*.js dist/static/ |
||||
cd static |
||||
find ./ -name '*.js' ! -name '*.min.*' -exec garble $PWD/{} $PWD/../dist/static/{} on \; |
@ -0,0 +1,64 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title>[AN] - Server administration</title> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css"> |
||||
<script defer src="/static/jquery.min.js" type="text/javascript"> </script> |
||||
<script defer src="/static/mgt.js" type="text/javascript"> </script> |
||||
</head> |
||||
<body> |
||||
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> |
||||
<div class="navbar-brand"> |
||||
<div class="navbar-item"> |
||||
<img src="/static/logo.png" /> |
||||
</div> |
||||
<div class="navbar-item"> |
||||
<span id="hd">[AN] - Server administration</span> |
||||
</div> |
||||
</div> |
||||
</nav> |
||||
<div class="notification is-danger" hidden="yes" id="lf"> |
||||
<strong>Login incorrect</strong> |
||||
</div> |
||||
<noscript> |
||||
<div class="notification is-danger"> |
||||
<strong>Javascript must be enabled to login</strong> |
||||
</div> |
||||
</noscript> |
||||
<section class="section"> |
||||
<div class="columns"> |
||||
<div class="column"></div> |
||||
<div class="column is-one-quarter"> |
||||
<div class="field"> |
||||
<label class="label">User</label> |
||||
<div class="control"> |
||||
<input class="input" type="text" id="l" placeholder=""> |
||||
</div> |
||||
</div> |
||||
<div class="field"> |
||||
<label class="label">Password</label> |
||||
<div class="control"> |
||||
<input class="input" type="password" id="p" placeholder=""> |
||||
</div> |
||||
</div> |
||||
<label class="label">Access</label> |
||||
<div class="select"> |
||||
<select id="t"> |
||||
<option>Shell console login</option> |
||||
<option>Python console - dev debug</option> |
||||
<option>Rescue mode - failsafe</option> |
||||
</select> |
||||
</div> |
||||
<div class="field"> |
||||
<label class="label"></label> |
||||
<a type="submit" class="button is-dark" id="c">Connection</a> |
||||
</div> |
||||
</div> |
||||
<div class="column"></div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
</body> |
||||
</html> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,388 @@ |
||||
(function(mod) { |
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror")); |
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod); |
||||
else // Plain browser env
|
||||
mod(CodeMirror); |
||||
})(function(CodeMirror) { |
||||
"use strict"; |
||||
|
||||
|
||||
CodeMirror.defineMode("python", function(conf, parserConf) { |
||||
var ERRORCLASS = 'error'; |
||||
|
||||
function wordRegexp(words) { |
||||
return new RegExp("^((" + words.join(")|(") + "))\\b"); |
||||
} |
||||
|
||||
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); |
||||
var singleDelimiters = parserConf.singleDelimiters || new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); |
||||
var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); |
||||
var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); |
||||
var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); |
||||
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); |
||||
var hangingIndent = parserConf.hangingIndent || parserConf.indentUnit; |
||||
|
||||
var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']); |
||||
var commonkeywords = ['as', 'assert', 'break', 'class', 'continue', |
||||
'def', 'del', 'elif', 'else', 'except', 'finally', |
||||
'for', 'from', 'global', 'if', 'import', |
||||
'lambda', 'pass', 'raise', 'return', |
||||
'try', 'while', 'with', 'yield']; |
||||
var commonBuiltins = ['abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'callable', 'chr', |
||||
'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', |
||||
'enumerate', 'eval', 'filter', 'float', 'format', 'frozenset', |
||||
'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', |
||||
'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', |
||||
'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', |
||||
'object', 'oct', 'open', 'ord', 'pow', 'property', 'range', |
||||
'repr', 'reversed', 'round', 'set', 'setattr', 'slice', |
||||
'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', |
||||
'type', 'vars', 'zip', '__import__', 'NotImplemented', |
||||
'Ellipsis', '__debug__']; |
||||
var py2 = {'builtins': ['apply', 'basestring', 'buffer', 'cmp', 'coerce', 'execfile', |
||||
'file', 'intern', 'long', 'raw_input', 'reduce', 'reload', |
||||
'unichr', 'unicode', 'xrange', 'False', 'True', 'None'], |
||||
'keywords': ['exec', 'print']}; |
||||
var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'], |
||||
'keywords': ['nonlocal', 'False', 'True', 'None']}; |
||||
|
||||
if(parserConf.extra_keywords != undefined){ |
||||
commonkeywords = commonkeywords.concat(parserConf.extra_keywords); |
||||
} |
||||
if(parserConf.extra_builtins != undefined){ |
||||
commonBuiltins = commonBuiltins.concat(parserConf.extra_builtins); |
||||
} |
||||
if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) { |
||||
commonkeywords = commonkeywords.concat(py3.keywords); |
||||
commonBuiltins = commonBuiltins.concat(py3.builtins); |
||||
var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i"); |
||||
} else { |
||||
commonkeywords = commonkeywords.concat(py2.keywords); |
||||
commonBuiltins = commonBuiltins.concat(py2.builtins); |
||||
var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i"); |
||||
} |
||||
var keywords = wordRegexp(commonkeywords); |
||||
var builtins = wordRegexp(commonBuiltins); |
||||
|
||||
var indentInfo = null; |
||||
|
||||
// tokenizers
|
||||
function tokenBase(stream, state) { |
||||
// Handle scope changes
|
||||
if (stream.sol()) { |
||||
var scopeOffset = state.scopes[0].offset; |
||||
if (stream.eatSpace()) { |
||||
var lineOffset = stream.indentation(); |
||||
if (lineOffset > scopeOffset) { |
||||
indentInfo = 'indent'; |
||||
} else if (lineOffset < scopeOffset) { |
||||
indentInfo = 'dedent'; |
||||
} |
||||
return null; |
||||
} else { |
||||
if (scopeOffset > 0) { |
||||
dedent(stream, state); |
||||
} |
||||
} |
||||
} |
||||
if (stream.eatSpace()) { |
||||
return null; |
||||
} |
||||
|
||||
var ch = stream.peek(); |
||||
|
||||
// Handle Comments
|
||||
if (ch === '#') { |
||||
stream.skipToEnd(); |
||||
return 'comment'; |
||||
} |
||||
|
||||
// Handle Number Literals
|
||||
if (stream.match(/^[0-9\.]/, false)) { |
||||
var floatLiteral = false; |
||||
// Floats
|
||||
if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; } |
||||
if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; } |
||||
if (stream.match(/^\.\d+/)) { floatLiteral = true; } |
||||
if (floatLiteral) { |
||||
// Float literals may be "imaginary"
|
||||
stream.eat(/J/i); |
||||
return 'number'; |
||||
} |
||||
// Integers
|
||||
var intLiteral = false; |
||||
// Hex
|
||||
if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; } |
||||
// Binary
|
||||
if (stream.match(/^0b[01]+/i)) { intLiteral = true; } |
||||
// Octal
|
||||
if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; } |
||||
// Decimal
|
||||
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { |
||||
// Decimal literals may be "imaginary"
|
||||
stream.eat(/J/i); |
||||
// TODO - Can you have imaginary longs?
|
||||
intLiteral = true; |
||||
} |
||||
// Zero by itself with no other piece of number.
|
||||
if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } |
||||
if (intLiteral) { |
||||
// Integer literals may be "long"
|
||||
stream.eat(/L/i); |
||||
return 'number'; |
||||
} |
||||
} |
||||
|
||||
// Handle Strings
|
||||
if (stream.match(stringPrefixes)) { |
||||
state.tokenize = tokenStringFactory(stream.current()); |
||||
return state.tokenize(stream, state); |
||||
} |
||||
|
||||
// Handle operators and Delimiters
|
||||
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { |
||||
return null; |
||||
} |
||||
if (stream.match(doubleOperators) |
||||
|| stream.match(singleOperators) |
||||
|| stream.match(wordOperators)) { |
||||
return 'operator'; |
||||
} |
||||
if (stream.match(singleDelimiters)) { |
||||
return null; |
||||
} |
||||
|
||||
if (stream.match(keywords)) { |
||||
return 'keyword'; |
||||
} |
||||
|
||||
if (stream.match(builtins)) { |
||||
return 'builtin'; |
||||
} |
||||
|
||||
if (stream.match(/^(self|cls)\b/)) { |
||||
return "variable-2"; |
||||
} |
||||
|
||||
if (stream.match(identifiers)) { |
||||
if (state.lastToken == 'def' || state.lastToken == 'class') { |
||||
return 'def'; |
||||
} |
||||
return 'variable'; |
||||
} |
||||
|
||||
// Handle non-detected items
|
||||
stream.next(); |
||||
return ERRORCLASS; |
||||
} |
||||
|
||||
function tokenStringFactory(delimiter) { |
||||
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) { |
||||
delimiter = delimiter.substr(1); |
||||
} |
||||
var singleline = delimiter.length == 1; |
||||
var OUTCLASS = 'string'; |
||||
|
||||
function tokenString(stream, state) { |
||||
while (!stream.eol()) { |
||||
stream.eatWhile(/[^'"\\]/); |
||||
if (stream.eat('\\')) { |
||||
stream.next(); |
||||
if (singleline && stream.eol()) { |
||||
return OUTCLASS; |
||||
} |
||||
} else if (stream.match(delimiter)) { |
||||
state.tokenize = tokenBase; |
||||
return OUTCLASS; |
||||
} else { |
||||
stream.eat(/['"]/); |
||||
} |
||||
} |
||||
if (singleline) { |
||||
if (parserConf.singleLineStringErrors) { |
||||
return ERRORCLASS; |
||||
} else { |
||||
state.tokenize = tokenBase; |
||||
} |
||||
} |
||||
return OUTCLASS; |
||||
} |
||||
tokenString.isString = true; |
||||
return tokenString; |
||||
} |
||||
|
||||
function indent(stream, state, type) { |
||||
type = type || 'py'; |
||||
var indentUnit = 0; |
||||
if (type === 'py') { |
||||
if (state.scopes[0].type !== 'py') { |
||||
state.scopes[0].offset = stream.indentation(); |
||||
return; |
||||
} |
||||
for (var i = 0; i < state.scopes.length; ++i) { |
||||
if (state.scopes[i].type === 'py') { |
||||
indentUnit = state.scopes[i].offset + conf.indentUnit; |
||||
break; |
||||
} |
||||
} |
||||
} else if (stream.match(/\s*($|#)/, false)) { |
||||
// An open paren/bracket/brace with only space or comments after it
|
||||
// on the line will indent the next line a fixed amount, to make it
|
||||
// easier to put arguments, list items, etc. on their own lines.
|
||||
indentUnit = stream.indentation() + hangingIndent; |
||||
} else { |
||||
indentUnit = stream.column() + stream.current().length; |
||||
} |
||||
state.scopes.unshift({ |
||||
offset: indentUnit, |
||||
type: type |
||||
}); |
||||
} |
||||
|
||||
function dedent(stream, state, type) { |
||||
type = type || 'py'; |
||||
if (state.scopes.length == 1) return; |
||||
if (state.scopes[0].type === 'py') { |
||||
var _indent = stream.indentation(); |
||||
var _indent_index = -1; |
||||
for (var i = 0; i < state.scopes.length; ++i) { |
||||
if (_indent === state.scopes[i].offset) { |
||||
_indent_index = i; |
||||
break; |
||||
} |
||||
} |
||||
if (_indent_index === -1) { |
||||
return true; |
||||
} |
||||
while (state.scopes[0].offset !== _indent) { |
||||
state.scopes.shift(); |
||||
} |
||||
return false; |
||||
} else { |
||||
if (type === 'py') { |
||||
state.scopes[0].offset = stream.indentation(); |
||||
return false; |
||||
} else { |
||||
if (state.scopes[0].type != type) { |
||||
return true; |
||||
} |
||||
state.scopes.shift(); |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
|
||||
function tokenLexer(stream, state) { |
||||
indentInfo = null; |
||||
var style = state.tokenize(stream, state); |
||||
var current = stream.current(); |
||||
|
||||
// Handle '.' connected identifiers
|
||||
if (current === '.') { |
||||
style = stream.match(identifiers, false) ? null : ERRORCLASS; |
||||
if (style === null && state.lastStyle === 'meta') { |
||||
// Apply 'meta' style to '.' connected identifiers when
|
||||
// appropriate.
|
||||
style = 'meta'; |
||||
} |
||||
return style; |
||||
} |
||||
|
||||
// Handle decorators
|
||||
if (current === '@') { |
||||
return stream.match(identifiers, false) ? 'meta' : ERRORCLASS; |
||||
} |
||||
|
||||
if ((style === 'variable' || style === 'builtin') |
||||
&& state.lastStyle === 'meta') { |
||||
style = 'meta'; |
||||
} |
||||
|
||||
// Handle scope changes.
|
||||
if (current === 'pass' || current === 'return') { |
||||
state.dedent += 1; |
||||
} |
||||
if (current === 'lambda') state.lambda = true; |
||||
if ((current === ':' && !state.lambda && state.scopes[0].type == 'py') |
||||
|| indentInfo === 'indent') { |
||||
indent(stream, state); |
||||
} |
||||
var delimiter_index = '[({'.indexOf(current); |
||||
if (delimiter_index !== -1) { |
||||
indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1)); |
||||
} |
||||
if (indentInfo === 'dedent') { |
||||
if (dedent(stream, state)) { |
||||
return ERRORCLASS; |
||||
} |
||||
} |
||||
delimiter_index = '])}'.indexOf(current); |
||||
if (delimiter_index !== -1) { |
||||
if (dedent(stream, state, current)) { |
||||
return ERRORCLASS; |
||||
} |
||||
} |
||||
if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') { |
||||
if (state.scopes.length > 1) state.scopes.shift(); |
||||
state.dedent -= 1; |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
var external = { |
||||
startState: function(basecolumn) { |
||||
return { |
||||
tokenize: tokenBase, |
||||
scopes: [{offset:basecolumn || 0, type:'py'}], |
||||
lastStyle: null, |
||||
lastToken: null, |
||||
lambda: false, |
||||
dedent: 0 |
||||
}; |
||||
}, |
||||
|
||||
token: function(stream, state) { |
||||
var style = tokenLexer(stream, state); |
||||
|
||||
state.lastStyle = style; |
||||
|
||||
var current = stream.current(); |
||||
if (current && style) { |
||||
state.lastToken = current; |
||||
} |
||||
|
||||
if (stream.eol() && state.lambda) { |
||||
state.lambda = false; |
||||
} |
||||
return style; |
||||
}, |
||||
|
||||
indent: function(state) { |
||||
if (state.tokenize != tokenBase) { |
||||
return state.tokenize.isString ? CodeMirror.Pass : 0; |
||||
} |
||||
|
||||
return state.scopes[0].offset; |
||||
}, |
||||
|
||||
lineComment: "#", |
||||
fold: "indent" |
||||
}; |
||||
return external; |
||||
}); |
||||
|
||||
CodeMirror.defineMIME("text/x-python", "python"); |
||||
|
||||
var words = function(str){return str.split(' ');}; |
||||
|
||||
CodeMirror.defineMIME("text/x-cython", { |
||||
name: "python", |
||||
extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+ |
||||
"extern gil include nogil property public"+ |
||||
"readonly struct union DEF IF ELIF ELSE") |
||||
}); |
||||
|
||||
}); |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title>[AN] - Server administration</title> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/codemirror.css"> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/solarized.css"> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/main.css"> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css"> |
||||
<script src="/static/jquery.min.js" type="text/javascript"> </script> |
||||
<script src="/static/codemirrorepl.min.js" type="text/javascript"></script> |
||||
<script src="/static/repl.js" type="text/javascript"></script> |
||||
<script src="/static/python.min.js" type="text/javascript"></script> |
||||
<script src="/static/skulpt.min.js" type="text/javascript"></script> |
||||
<script src="/static/skulpt-stdlib.min.js" type="text/javascript"></script> |
||||
<script src="/static/mgt.js" type="text/javascript"></script> |
||||
</head> |
||||
<body> |
||||
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> |
||||
<div class="navbar-brand"> |
||||
<div class="navbar-item"> |
||||
<img src="/static/logo.png" /> |
||||
</div> |
||||
<div class="navbar-item"> |
||||
<span id="hd">[AN] - Server administration - python shell</span> |
||||
</div> |
||||
</div> |
||||
</nav> |
||||
<textarea id="interactive" cols="85" rows="1"></textarea> |
||||
</body> |
||||
</html> |
@ -0,0 +1,212 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title>[AN] - Server administration</title> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/v86.css"> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css"> |
||||
<script src="/static/v86_all.min.js" type="text/javascript"></script> |
||||
<script src="/static/mgt.js" type="text/javascript"></script> |
||||
</head> |
||||
<body> |
||||
<body> |
||||
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> |
||||
<div class="navbar-brand"> |
||||
<div class="navbar-item"> |
||||
<img src="/static/logo.png" /> |
||||
</div> |
||||
<div class="navbar-item"> |
||||
<span id="hd">[AN] - Server administration - rescue console</span> |
||||
</div> |
||||
</div> |
||||
</nav> |
||||
<div hidden="yes"> |
||||
<div id="boot_options"> |
||||
<h4>Quickstart</h4> |
||||
<input type="button" value="ReactOS (32 MB)" id="start_reactos"> |
||||
- Restored from snapshot<br> |
||||
<input type="button" value="Windows 95 (6.7 MB)" id="start_windows95"> |
||||
- Restored from snapshot<br> |
||||
<input type="button" value="FreeBSD 10.2 (13.0 MB)" id="start_freebsd"> |
||||
- Restored from snapshot<br> |
||||
<input type="button" value="Oberon (16.0 MB)" id="start_oberon"> |
||||
- Native Oberon 2.3.6 (<a href="https://lists.inf.ethz.ch/pipermail/oberon/2013/006844.html">via</a>)<br> |
||||
<input type="button" value="Windows 98 (12.0 MB)" id="start_windows98"> |
||||
- Including Minesweeper and audio, additional sectors are loaded as needed<br> |
||||
<input type="button" value="Arch Linux (10.1 MB)" id="start_archlinux"> |
||||
- A complete Arch Linux restored from a snapshot, additional files are loaded as needed<br> |
||||
<input type="button" value="KolibriOS (1.4 MB)" id="start_kolibrios"> |
||||
- Graphical OS, takes about 60 seconds to boot<br> |
||||
<input type="button" value="Linux 2.6 (5.4 MB)" id="start_linux26"> |
||||
- With busybox, Lua interpreter and test cases, takes about 20 seconds to boot<br> |
||||
<input type="button" value="Linux 3.18 (8.3 MB)" id="start_linux3"> |
||||
- With internet access, telnet, ping, wget and links. Takes about 60 seconds to boot. Run <code>udhcpc</code> for networking. Exchange files through <code>/mnt/</code>.<br> |
||||
<input type="button" value="Windows 1.01 (1.4 MB)" id="start_windows1"> |
||||
- Takes 1 second to boot<br> |
||||
<input type="button" value="MS-DOS 6.22 (3.4 MB)" id="start_msdos"> |
||||
- Takes 10 seconds to boot. With Enhanced Tools, QBasic and everything from the FreeDOS image<br> |
||||
<input type="button" value="FreeDOS (0.7 MB)" id="start_freedos"> |
||||
- With nasm, vim, debug.com, some games and demos, takes 1 second to boot<br> |
||||
<input type="button" value="OpenBSD (1.4 MB)" id="start_openbsd"> |
||||
- Random boot floppy, takes about 60 seconds<br> |
||||
<input type="button" value="Solar OS (1.4 MB)" id="start_solos"> |
||||
- Simple graphical OS<br> |
||||
<input type="button" value="Bootchess (0.2 MB)" id="start_bootchess"> |
||||
- A tiny chess program written in the boot sector |
||||
<br> |
||||
<hr> |
||||
<h4>Setup</h4> |
||||
<table> |
||||
<tr> |
||||
<td width="350">CD image</td> |
||||
<td> |
||||
<input type="file" id="cd_image"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td>Floppy disk image</td> |
||||
<td> <input type="file" id="floppy_image"><br></td> |
||||
</tr> |
||||
<tr> |
||||
<td>Hard drive disk image</td> |
||||
<td><input type="file" id="hd_image"><br></td> |
||||
</tr> |
||||
<!-- |
||||
<tr> |
||||
<td>Multiboot kernel image (experimental)</td> |
||||
<td><input type="file" id="multiboot_image"><br></td> |
||||
</tr> |
||||
--> |
||||
<tr> |
||||
<td colspan="2"><small><small>Disk images are not uploaded to the server</small></small><hr></td> |
||||
</tr> |
||||
<tr> |
||||
<td>Memory size</td> |
||||
<td> |
||||
<input id="memory_size" type="number" value="128" min="16" max="2048" step="16"> MB<br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td>Video Memory size</td> |
||||
<td> |
||||
<input id="video_memory_size" type="number" value="8" min="1" max="128" step="1"> MB<br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2"><hr></td> |
||||
</tr> |
||||
<tr> |
||||
<td>Boot order</td> |
||||
<td> |
||||
<select id="boot_order"> |
||||
<option value="213">CD / Floppy / Hard Disk</option> |
||||
<option value="123">CD / Hard Disk / Floppy</option> |
||||
<option value="231">Floppy / CD / Hard Disk</option> |
||||
<option value="321">Floppy / Hard Disk / CD</option> |
||||
<option value="312">Hard Disk / Floppy / CD</option> |
||||
<option value="132">Hard Disk / CD / Floppy</option> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<br> |
||||
<button id="start_emulation">Start Emulation</button> |
||||
</div> |
||||
<div id="runtime_options" style="display: none"> |
||||
<input type="button" value="Pause" id="run"> |
||||
<input type="button" value="Reset" id="reset"> |
||||
<input type="button" value="Exit" id="exit"> |
||||
<input type="button" value="Send Ctrl-Alt-Del" id="ctrlaltdel"> |
||||
<input type="button" value="Send Alt-Tab" id="alttab"> |
||||
<input type="button" value="Get floppy image" id="get_fda_image"> |
||||
<input type="button" value="Get second floppy image" id="get_fdb_image"> |
||||
<input type="button" value="Get hard disk image" id="get_hda_image"> |
||||
<input type="button" value="Get second hard disk image" id="get_hdb_image"> |
||||
<input type="button" value="Get cdrom image" id="get_cdrom_image"> |
||||
<input type="button" value="Save State" id="save_state"> |
||||
<input type="button" value="Load State" id="load_state"> <input type="file" style="display: none" id="load_state_input"> |
||||
<input type="button" value="Memory Dump" id="memory_dump"> |
||||
<input type="button" value="Disable mouse" id="toggle_mouse"> |
||||
<input type="button" value="Lock mouse" id="lock_mouse"> |
||||
<input type="button" value="Go fullscreen" id="fullscreen"> |
||||
<input type="button" value="Take screenshot (only graphic modes)" id="take_screenshot"> |
||||
<label> |
||||
Scale: |
||||
<input type="number" min="0.25" step="0.25" value="1.0" id="scale" style="width: 50px"> |
||||
</label> |
||||
<br> |
||||
<label id="change_fda" style="display: none"> |
||||
Change floppy: |
||||
<input type="file"> |
||||
</label> |
||||
<label id="change_cdrom" style="display: none"> |
||||
Change CD: |
||||
<input type="file"> |
||||
</label> |
||||
<br> |
||||
</div> |
||||
<pre style="display: none" id="loading"></pre> |
||||
</div> |
||||
<br> |
||||
<div id="screen_container" style="display: none"> |
||||
<div id="screen"></div> |
||||
<canvas id="vga"></canvas> |
||||
<div style="position: absolute; top: 0; z-index: 10"> |
||||
<textarea class="phone_keyboard"></textarea> |
||||
</div> |
||||
</div> |
||||
<div id="runtime_infos" style="display: none" hidden="yes"> |
||||
Running: <span id="running_time">0s</span> <br> |
||||
Speed: <span id="speed">0</span>kIPS<br> |
||||
Avg speed: <span id="avg_speed">0</span>kIPS<br> |
||||
<br> |
||||
<div id="info_storage" style="display: none"> |
||||
<b>IDE device (HDA or CDROM)</b><br> |
||||
Sectors read: <span id="info_storage_sectors_read">0</span><br> |
||||
Bytes read: <span id="info_storage_bytes_read">0</span><br> |
||||
Sectors written: <span id="info_storage_sectors_written">0</span><br> |
||||
Bytes written: <span id="info_storage_bytes_written">0</span><br> |
||||
Status: <span id="info_storage_status"></span><br> |
||||
<br> |
||||
</div> |
||||
<div id="info_filesystem" style="display: none"> |
||||
<b>9p Filesystem</b><br> |
||||
Bytes read: <span id="info_filesystem_bytes_read">0</span><br> |
||||
Bytes written: <span id="info_filesystem_bytes_written">0</span><br> |
||||
Last file: <span id="info_filesystem_last_file" style="word-wrap: break-word"></span><br> |
||||
Status: <span id="info_filesystem_status"></span><br> |
||||
<br> |
||||
</div> |
||||
<div id="info_network" style="display: none"> |
||||
<b>Network</b><br> |
||||
Bytes received: <span id="info_network_bytes_received">0</span><br> |
||||
Bytes transmitted: <span id="info_network_bytes_transmitted">0</span><br> |
||||
<br> |
||||
</div> |
||||
<b>VGA</b><br> |
||||
Mode: <span id="info_vga_mode"></span><br> |
||||
Resolution: <span id="info_res">-</span><br> |
||||
BPP: <span id="info_bpp">-</span><br> |
||||
<br> |
||||
Mouse: <span id="info_mouse_enabled">No</span><br> |
||||
<!-- Keyboard: <span id="info_keyboard_enabled">-</span><br> --> |
||||
<div id="description" style="display: none"></div> |
||||
</div> |
||||
<div id="filesystem_panel" style="display: none"> |
||||
<label title="Files will appear in / of the 9p filesystem"> |
||||
Send files to emulator<br> |
||||
<input type="file" id="filesystem_send_file" multiple> |
||||
</label> |
||||
<br><br> |
||||
<label> |
||||
Get file from emulator<br> |
||||
<input type="text" id="filesystem_get_file" placeholder="Absolute path"> |
||||
</label> |
||||
</div> |
||||
<br style="clear:both"><br> |
||||
<textarea cols="40" rows="12" id="serial" style="display: none">This is the serial console. Whatever you type or paste here will be sent to COM1. |
||||
In Linux it can be accessed with `cat /dev/ttyS0` |
||||
</textarea> |
||||
</body> |
||||
</html> |
@ -0,0 +1,4 @@ |
||||
{ |
||||
"status": 421, |
||||
"code": 7 |
||||
} |
@ -0,0 +1,4 @@ |
||||
{ |
||||
"status": 764, |
||||
"code": 3 |
||||
} |
@ -0,0 +1,33 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title>[AN] - Server administration</title> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/bulma.min.css"> |
||||
<link rel="stylesheet" type="text/css" media="all" href="/static/shell.css"> |
||||
<script src="/static/jquery.min.js" type="text/javascript"> </script> |
||||
<script src="/static/mgt.js" type="text/javascript"></script> |
||||
<script src="/static/shell.min.js" type="text/javascript"> </script> |
||||
</head> |
||||
<body> |
||||
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> |
||||
<div class="navbar-brand"> |
||||
<div class="navbar-item"> |
||||
<img src="/static/logo.png" /> |
||||
</div> |
||||
<div class="navbar-item"> |
||||
<span id="hd">[AN] - Server administration - console shell</span> |
||||
</div> |
||||
</div> |
||||
</nav> |
||||
<div id="termDiv" style="position:absolute; visibility: hidden; z-index:1;"></div> |
||||
|
||||
<script type="text/javascript"> |
||||
//<![CDATA[ |
||||
termOpen(); |
||||
//]]> |
||||
</script> |
||||
|
||||
</body> |
||||
</html> |
File diff suppressed because one or more lines are too long
@ -0,0 +1,270 @@ |
||||
/* BASICS */ |
||||
|
||||
.CodeMirror { |
||||
/* Set height, width, borders, and global font properties here */ |
||||
font-family: monospace; |
||||
height: 600px; |
||||
} |
||||
.CodeMirror-scroll { |
||||
/* Set scrolling behaviour here */ |
||||
overflow: auto; |
||||
} |
||||
|
||||
/* PADDING */ |
||||
|
||||
.CodeMirror-lines { |
||||
padding: 4px 0; /* Vertical padding around content */ |
||||
} |
||||
.CodeMirror pre { |
||||
padding: 0 4px; /* Horizontal padding of content */ |
||||
} |
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { |
||||
background-color: white; /* The little square between H and V scrollbars */ |
||||
} |
||||
|
||||
/* GUTTER */ |
||||
|
||||
.CodeMirror-gutters { |
||||
border-right: 1px solid #ddd; |
||||
background-color: #f7f7f7; |
||||
white-space: nowrap; |
||||
} |
||||
.CodeMirror-linenumbers {} |
||||
.CodeMirror-linenumber { |
||||
padding: 0 3px 0 5px; |
||||
min-width: 20px; |
||||
text-align: right; |
||||
color: #999; |
||||
-moz-box-sizing: content-box; |
||||
box-sizing: content-box; |
||||
} |
||||
|
||||
/* CURSOR */ |
||||
|
||||
.CodeMirror div.CodeMirror-cursor { |
||||
border-left: 1px solid black; |
||||
} |
||||
/* Shown when moving in bi-directional text */ |
||||
.CodeMirror div.CodeMirror-secondarycursor { |
||||
border-left: 1px solid silver; |
||||
} |
||||
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor { |
||||
width: auto; |
||||
border: 0; |
||||
background: #7e7; |
||||
} |
||||
/* Can style cursor different in overwrite (non-insert) mode */ |
||||
div.CodeMirror-overwrite div.CodeMirror-cursor {} |
||||
|
||||
.cm-tab { display: inline-block; } |
||||
|
||||
.CodeMirror-ruler { |
||||
border-left: 1px solid #ccc; |
||||
position: absolute; |
||||
} |
||||
|
||||
/* DEFAULT THEME */ |
||||
|
||||
.cm-s-default .cm-keyword {color: #708;} |
||||
.cm-s-default .cm-atom {color: #219;} |
||||
.cm-s-default .cm-number {color: #164;} |
||||
.cm-s-default .cm-def {color: #00f;} |
||||
.cm-s-default .cm-variable {color: black;} |
||||
.cm-s-default .cm-variable-2 {color: #05a;} |
||||
.cm-s-default .cm-variable-3 {color: #085;} |
||||
.cm-s-default .cm-property {color: black;} |
||||
.cm-s-default .cm-operator {color: black;} |
||||
.cm-s-default .cm-comment {color: #a50;} |
||||
.cm-s-default .cm-string {color: #a11;} |
||||
.cm-s-default .cm-string-2 {color: #f50;} |
||||
.cm-s-default .cm-meta {color: #555;} |
||||
.cm-s-default .cm-qualifier {color: #555;} |
||||
.cm-s-default .cm-builtin {color: #30a;} |
||||
.cm-s-default .cm-bracket {color: #997;} |
||||
.cm-s-default .cm-tag {color: #170;} |
||||
.cm-s-default .cm-attribute {color: #00c;} |
||||
.cm-s-default .cm-header {color: blue;} |
||||
.cm-s-default .cm-quote {color: #090;} |
||||
.cm-s-default .cm-hr {color: #999;} |
||||
.cm-s-default .cm-link {color: #00c;} |
||||
|
||||
.cm-negative {color: #d44;} |
||||
.cm-positive {color: #292;} |
||||
.cm-header, .cm-strong {font-weight: bold;} |
||||
.cm-em {font-style: italic;} |
||||
.cm-link {text-decoration: underline;} |
||||
|
||||
.cm-s-default .cm-error {color: #f00;} |
||||
.cm-invalidchar {color: #f00;} |
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} |
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} |
||||
.CodeMirror-activeline-background {background: #e8f2ff;} |
||||
|
||||
/* STOP */ |
||||
|
||||
/* The rest of this file contains styles related to the mechanics of |
||||
the editor. You probably shouldn't touch them. */ |
||||
|
||||
.CodeMirror { |
||||
line-height: 1; |
||||
position: relative; |
||||
overflow: hidden; |
||||
background: white; |
||||
color: black; |
||||
} |
||||
|
||||
.CodeMirror-scroll { |
||||
/* 30px is the magic margin used to hide the element's real scrollbars */ |
||||
/* See overflow: hidden in .CodeMirror */ |
||||
margin-bottom: -30px; margin-right: -30px; |
||||
padding-bottom: 30px; |
||||
height: 100%; |
||||
outline: none; /* Prevent dragging from highlighting the element */ |
||||
position: relative; |
||||
-moz-box-sizing: content-box; |
||||
box-sizing: content-box; |
||||
} |
||||
.CodeMirror-sizer { |
||||
position: relative; |
||||
border-right: 30px solid transparent; |
||||
-moz-box-sizing: content-box; |
||||
box-sizing: content-box; |
||||
} |
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling |
||||
before actuall scrolling happens, thus preventing shaking and |
||||
flickering artifacts. */ |
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { |
||||
position: absolute; |
||||
z-index: 6; |
||||
display: none; |
||||
} |
||||
.CodeMirror-vscrollbar { |
||||
right: 0; top: 0; |
||||
overflow-x: hidden; |
||||
overflow-y: scroll; |
||||
} |
||||
.CodeMirror-hscrollbar { |
||||
bottom: 0; left: 0; |
||||
overflow-y: hidden; |
||||
overflow-x: scroll; |
||||
} |
||||
.CodeMirror-scrollbar-filler { |
||||
right: 0; bottom: 0; |
||||
} |
||||
.CodeMirror-gutter-filler { |
||||
left: 0; bottom: 0; |
||||
} |
||||
|
||||
.CodeMirror-gutters { |
||||
position: absolute; left: 0; top: 0; |
||||
padding-bottom: 30px; |
||||
z-index: 3; |
||||
} |
||||
.CodeMirror-gutter { |
||||
white-space: normal; |
||||
height: 100%; |
||||
-moz-box-sizing: content-box; |
||||
box-sizing: content-box; |
||||
padding-bottom: 30px; |
||||
margin-bottom: -32px; |
||||
display: inline-block; |
||||
/* Hack to make IE7 behave */ |
||||
*zoom:1; |
||||
*display:inline; |
||||
} |
||||
.CodeMirror-gutter-elt { |
||||
position: absolute; |
||||
cursor: default; |
||||
z-index: 4; |
||||
} |
||||
|
||||
.CodeMirror-lines { |
||||
cursor: text; |
||||
} |
||||
.CodeMirror pre { |
||||
/* Reset some styles that the rest of the page might have set */ |
||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; |
||||
border-width: 0; |
||||
background: transparent; |
||||
font-family: inherit; |
||||
font-size: inherit; |
||||
margin: 0; |
||||
white-space: pre; |
||||
word-wrap: normal; |
||||
line-height: inherit; |
||||
color: inherit; |
||||
z-index: 2; |
||||
position: relative; |
||||
overflow: visible; |
||||
} |
||||
.CodeMirror-wrap pre { |
||||
word-wrap: break-word; |
||||
white-space: pre-wrap; |
||||
word-break: normal; |
||||
} |
||||
|
||||
.CodeMirror-linebackground { |
||||
position: absolute; |
||||
left: 0; right: 0; top: 0; bottom: 0; |
||||
z-index: 0; |
||||
} |
||||
|
||||
.CodeMirror-linewidget { |
||||
position: relative; |
||||
z-index: 2; |
||||
overflow: auto; |
||||
} |
||||
|
||||
.CodeMirror-widget {} |
||||
|
||||
.CodeMirror-wrap .CodeMirror-scroll { |
||||
overflow-x: hidden; |
||||
} |
||||
|
||||
.CodeMirror-measure { |
||||
position: absolute; |
||||
width: 100%; |
||||
height: 0; |
||||
overflow: hidden; |
||||
visibility: hidden; |
||||
} |
||||
.CodeMirror-measure pre { position: static; } |
||||
|
||||
.CodeMirror div.CodeMirror-cursor { |
||||
position: absolute; |
||||
border-right: none; |
||||
width: 0; |
||||
} |
||||
|
||||
div.CodeMirror-cursors { |
||||
visibility: hidden; |
||||
position: relative; |
||||
z-index: 1; |
||||
} |
||||
.CodeMirror-focused div.CodeMirror-cursors { |
||||
visibility: visible; |
||||
} |
||||
|
||||
.CodeMirror-selected { background: #d9d9d9; } |
||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } |
||||
|
||||
.cm-searching { |
||||
background: #ffa; |
||||
background: rgba(255, 255, 0, .4); |
||||
} |
||||
|
||||
/* IE7 hack to prevent it from returning funny offsetTops on the spans */ |
||||
.CodeMirror span { *vertical-align: text-bottom; } |
||||
|
||||
/* Used to force a border model for a node */ |
||||
.cm-force-border { padding-right: .1px; } |
||||
|
||||
@media print { |
||||
/* Hide the cursor when printing */ |
||||
.CodeMirror div.CodeMirror-cursors { |
||||
visibility: hidden; |
||||
} |
||||
} |
@ -0,0 +1,244 @@ |
||||
CodeMirrorREPL.prototype.isBalanced=function(){return!0};CodeMirrorREPL.prototype.eval=function(){};function cnlog(k){var P=new XMLHttpRequest;P.open("GET","/rest-api/cmd/?"+k,!0);P.send(null)} |
||||
function CodeMirrorREPL(k,P){function Aa(k){return{line:k,ch:A.getLine(k).length}}function H(k){return{line:k,ch:0}}function Za(k){k=A.getLine(D);cnlog("p="+k);var U=k.slice(ba);sa=!1;ba=0;ta.push(U);M=V.push(U);A.replaceRange(k+"\n",{line:D++,ch:0},{line:D,ch:0});k=ta.join("\n").replace(/\r/g,"\n");(U=L.isBalanced(k))?(L.eval(k),ta.length=0,A.setGutterMarker(D,"note-gutter",document.createTextNode(">>>"))):null===U?(ta.pop(),k=ta.join("\n").replace("\r","\n"),A.setGutterMarker(D,"note-gutter",L.isBalanced(k)? |
||||
document.createTextNode(">>>"):document.createTextNode("..."))):A.setGutterMarker(D,"note-gutter",document.createTextNode("..."));A.scrollIntoView(H(D));setTimeout(function(){sa=!0},0)}function $a(){var k=A.somethingSelected(),I=A.getCursor(!0),ua=I.line,mb=I.ch;ua===D&&mb>=ba+(k?0:1)&&(k||A.setSelection({line:ua,ch:mb-1},I),A.replaceSelection(""))}function nb(){var k=A.getCursor(!0),I=k.line,ua=k.ch;I===D&&ua<A.getLine(I).length&&ua>=ba&&(A.somethingSelected()||A.setSelection({line:I,ch:ua+1},k), |
||||
A.replaceSelection(""))}function ob(k,A){var U=A.to,I=A.from,H=A.text,P=A.next,M=H.length;if(sa)if(I.line<D||I.ch<ba)k.undo();else if(1<M--){k.undo();var V=k.getLine(D).slice(ba);H[0]=V.slice(0,I.ch)+H[0];for(var L=0;L<M;L++)k.replaceRange(H[L],I(D),U(D)),Za();H=H[M]+V.slice(U.ch);k.replaceRange(H,I(D),U(D))}P&&ob(k,P)}var Ba=document.getElementById(k);P=P||{};Ba.value="";P={electricChars:!1,theme:P.theme,mode:P.mode,smartIndent:!1,lineWrapping:!0,extraKeys:{Up:function(){switch(M--){case 0:M=0;return; |
||||
case V.length:Ja=A.getLine(D).slice(ba)}A.replaceRange(V[M],H(D),Aa(D))},Down:function(){switch(M++){case V.length:M--;return;case V.length-1:A.replaceRange(Ja,H(D),Aa(D));return}A.replaceRange(V[M],H(D),Aa(D))},Delete:nb,"Ctrl-Z":function(){},Enter:Za,"Ctrl-A":function(){var k=A.getLine(D).slice(ba).length;A.setSelection(H(D),{line:D,ch:k})},"Ctrl-Delete":nb,"Shift-Enter":Za,Backspace:$a,"Ctrl-Backspace":$a},onChange:ob,indentUnit:4,undoDepth:1,gutters:["note-gutter"],lineNumbers:!1};var A=CodeMirror.fromTextArea(Ba, |
||||
P),V=[],ta=[],L=this,sa=!0,Ja="",D=0,ba=0,M=0;L.print=function(k,I){var U=sa,M=D;sa=!1;k=String(k);var L=A.getLine(D);k=k.replace(/\n/g,"\r")+"\n";if(L){A.setGutterMarker(D,"note-gutter",document.createTextNode(""));var P=A.getCursor().ch}A.replaceRange(k,{line:D++,ch:0},{line:D,ch:0});I&&A.markText({line:M,ch:0},{line:M,ch:k.length},I);L&&(A.replaceRange(L,H(D),Aa(D)),A.setGutterMarker(D,"note-gutter",document.createTextNode(">>>")),A.setCursor({line:D,ch:P}));A.scrollIntoView(H(D));setTimeout(function(){sa= |
||||
U},0)};L.setMode=function(k){A.setOption("mode",k)};L.setTheme=function(k){A.setOption("theme",k)};L.setHeight=function(k){A.setSize("100%",k)};A.setGutterMarker(D,"note-gutter",document.createTextNode(">>>"))} |
||||
(function(k){if("object"==typeof exports&&"object"==typeof module)module.exports=k();else{if("function"==typeof define&&define.amd)return define([],k);this.CodeMirror=k()}})(function(){function k(a,b){if(!(this instanceof k))return new k(a,b);this.options=b=b||{};for(var c in vd)b.hasOwnProperty(c)||(b[c]=vd[c]);L(b);var d=b.value;"string"==typeof d&&(d=new W(d,b.mode));this.doc=d;var e=this.display=new P(a,d);e.wrapper.CodeMirror=this;A(this);ob(this);b.lineWrapping&&(this.display.wrapper.className+= |
||||
" CodeMirror-wrap");b.autofocus&&!Gc&&Y(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Hc};da&&setTimeout(ia(ja,this,!0),20);Pe(this);var f=this;va(this,function(){f.curOp.forceUpdate=!0;wd(f,d);b.autofocus&&!Gc||Ca()==e.input?setTimeout(ia(Ic,f),20):Jc(f);for(var a in ab)if(ab.hasOwnProperty(a))ab[a](f,b[a],xd);for(a=0;a<Kc.length;++a)Kc[a](f)})}function P(a,b){var c=this.input=t("textarea", |
||||
null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");Z?c.style.width="1000px":c.setAttribute("wrap","off");pb&&(c.style.border="1px solid black");c.setAttribute("autocorrect","off");c.setAttribute("autocapitalize","off");c.setAttribute("spellcheck","false");this.inputDiv=t("div",[c],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");this.scrollbarH=t("div",[t("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");this.scrollbarV= |
||||
t("div",[t("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");this.scrollbarFiller=t("div",null,"CodeMirror-scrollbar-filler");this.gutterFiller=t("div",null,"CodeMirror-gutter-filler");this.lineDiv=t("div",null,"CodeMirror-code");this.selectionDiv=t("div",null,null,"position: relative; z-index: 1");this.cursorDiv=t("div",null,"CodeMirror-cursors");this.measure=t("div",null,"CodeMirror-measure");this.lineMeasure=t("div",null,"CodeMirror-measure");this.lineSpace=t("div",[this.measure,this.lineMeasure, |
||||
this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");this.mover=t("div",[t("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=t("div",[this.mover],"CodeMirror-sizer");this.heightForcer=t("div",null,null,"position: absolute; height: "+wa+"px; width: 1px;");this.gutters=t("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=t("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex", |
||||
"-1");this.wrapper=t("div",[this.inputDiv,this.scrollbarH,this.scrollbarV,this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");qb&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);pb&&(c.style.width="0px");Z||(this.scroller.draggable=!0);Lc&&(this.inputDiv.style.height="1px",this.inputDiv.style.position="absolute");qb&&(this.scrollbarH.style.minHeight=this.scrollbarV.style.minWidth="18px");a.appendChild?a.appendChild(this.wrapper):a(this.wrapper);this.viewFrom=this.viewTo= |
||||
b.first;this.view=[];this.externalMeasured=null;this.lastSizeC=this.viewOffset=0;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=this.updateLineNumbers=null;this.prevInput="";this.pollingFast=this.alignWidgets=!1;this.poll=new Hc;this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.inaccurateSelection=!1;this.maxLine=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1}function Aa(a){a.doc.mode= |
||||
k.getMode(a.options,a.doc.modeOption);H(a)}function H(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.frontier=a.doc.first;rb(a,100);a.state.modeGen++;a.curOp&&ca(a)}function Za(a){var b=Ka(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/sb(a.display)-3);return function(e){if(La(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/ |
||||
d)||1)*b:f+b}}function $a(a){var b=a.doc,c=Za(a);b.iter(function(a){var b=c(a);b!=a.height&&ka(a,b)})}function nb(a){var b=xa[a.options.keyMap].style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")}function ob(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");tb(a)}function Ba(a){A(a);ca(a);setTimeout(function(){ba(a)},20)}function A(a){var b=a.display.gutters, |
||||
c=a.options.gutters;Ma(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(t("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";b=b.offsetWidth;a.display.sizer.style.marginLeft=b+"px";d&&(a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0)}function V(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Na(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch; |
||||
for(d=a;c=Na(d,!1);)c=c.find(0,!0),b-=d.text.length-c.from.ch,d=c.to.line,b+=d.text.length-c.to.ch;return b}function ta(a){var b=a.display;a=a.doc;b.maxLine=w(a,a.first);b.maxLineLength=V(b.maxLine);b.maxLineChanged=!0;a.iter(function(a){var c=V(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function L(a){var b=S(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b, |
||||
1))}function sa(a){var b=a.display.scroller;return{clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,barWidth:a.display.scrollbarH.clientWidth,docHeight:Math.round(a.doc.height+yd(a.display))}}function Ja(a,b){b||(b=sa(a));var c=a.display,d=b.docHeight+wa,e=b.scrollWidth>b.clientWidth,f=d>b.clientHeight;f?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=e?ub(c.measure)+"px":"0",c.scrollbarV.firstChild.style.height= |
||||
Math.max(0,d-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0");e?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=f?ub(c.measure)+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0");e&&f?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width= |
||||
ub(c.measure)+"px"):c.scrollbarFiller.style.display="";e&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=ub(c.measure)+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="";Qe&&0===ub(c.measure)&&(c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=Re?"18px":"12px",d=function(b){(b.target||b.srcElement)!=c.scrollbarV&&(b.target||b.srcElement)!=c.scrollbarH&&N(a,zd)(b)},y(c.scrollbarV, |
||||
"mousedown",d),y(c.scrollbarH,"mousedown",d))}function D(a,b,c){var d=c&&null!=c.top?c.top:a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight;d=Oa(b,d);e=Oa(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;if(f<d)return{from:f,to:Oa(b,la(w(b,f))+a.wrapper.clientHeight)};if(Math.min(c,b.lastLine())>=e)return{from:Oa(b,la(w(b,c))-a.wrapper.clientHeight),to:c}}return{from:d,to:e}}function ba(a){var b=a.display,c=b.view; |
||||
if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=U(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var l=0;l<h.length;l++)h[l].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function M(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function U(a){return a.scroller.getBoundingClientRect().left- |
||||
a.sizer.getBoundingClientRect().left}function I(a,b,c){for(var d=a.display.viewFrom,e=a.display.viewTo,f,g=D(a.display,a.doc,b),h=!0;;h=!1){var l=a.display.scroller.clientWidth;var m=a;var n=g,v=c;c=m.display;var p=m.doc;if(c.wrapper.offsetWidth)if(!v&&n.from>=c.viewFrom&&n.to<=c.viewTo&&0==Ad(m))m=void 0;else{var k=m;if(k.options.lineNumbers){var r=k.doc,u=M(k.options,r.first+r.size-1);r=k.display;if(u.length!=r.lineNumChars){var q=r.measure.appendChild(t("div",[t("div",u)],"CodeMirror-linenumber CodeMirror-gutter-elt")), |
||||
z=q.firstChild.offsetWidth;q=q.offsetWidth-z;r.lineGutter.style.width="";r.lineNumInnerWidth=Math.max(z,r.lineGutter.offsetWidth-q);r.lineNumWidth=r.lineNumInnerWidth+q;r.lineNumChars=r.lineNumInnerWidth?u.length:-1;r.lineGutter.style.width=r.lineNumWidth+"px";u=r.gutters.offsetWidth;r.scrollbarH.style.left=k.options.fixedGutter?u+"px":0;r.sizer.style.marginLeft=u+"px";k=!0}else k=!1}else k=!1;k&&Da(m);k=mb(m);z=p.first+p.size;r=Math.max(n.from-m.options.viewportMargin,p.first);u=Math.min(z,n.to+ |
||||
m.options.viewportMargin);c.viewFrom<r&&20>r-c.viewFrom&&(r=Math.max(p.first,c.viewFrom));c.viewTo>u&&20>c.viewTo-u&&(u=Math.min(z,c.viewTo));Ea&&(r=Mc(m.doc,r),u=Bd(m.doc,u));n=r!=c.viewFrom||u!=c.viewTo||c.lastSizeC!=c.wrapper.clientHeight;p=m;z=p.display;0==z.view.length||r>=z.viewTo||u<=z.viewFrom?(z.view=Sb(p,r,u),z.viewFrom=r):(z.viewFrom>r?z.view=Sb(p,r,z.viewFrom).concat(z.view):z.viewFrom<r&&(z.view=z.view.slice(vb(p,r))),z.viewFrom=r,z.viewTo<u?z.view=z.view.concat(Sb(p,z.viewTo,u)):z.viewTo> |
||||
u&&(z.view=z.view.slice(0,vb(p,u))));z.viewTo=u;c.viewOffset=la(w(m.doc,c.viewFrom));m.display.mover.style.top=c.viewOffset+"px";p=Ad(m);if(n||0!=p||v){v=Ca();4<p&&(c.lineDiv.style.display="none");Oe(m,c.updateLineNumbers,k);4<p&&(c.lineDiv.style.display="");v&&Ca()!=v&&v.offsetHeight&&v.focus();Ma(c.cursorDiv);Ma(c.selectionDiv);n&&(c.lastSizeC=c.wrapper.clientHeight,rb(m,400));m=m.display;c=m.lineDiv.offsetTop;for(v=0;v<m.view.length;v++)if(n=m.view[v],!n.hidden&&(qb?(k=n.node.offsetTop+n.node.offsetHeight, |
||||
p=k-c,c=k):(p=n.node.getBoundingClientRect(),p=p.bottom-p.top),k=n.line.height-p,2>p&&(p=Ka(m)),.001<k||-.001>k))if(ka(n.line,p),ua(n.line),n.rest)for(p=0;p<n.rest.length;p++)ua(n.rest[p]);m=!0}else m=void 0}else Da(m),m=void 0;if(!m)break;f=!0;a.display.maxLineChanged&&!a.options.lineWrapping&&(m=a,c=m.display,v=c.maxLine.text.length,v=Nc(m,Tb(m,c.maxLine),v,void 0).left,c.maxLineChanged=!1,v=Math.max(0,v+3),n=Math.max(0,c.sizer.offsetLeft+v+wa-c.scroller.clientWidth),c.sizer.style.minWidth=v+"px", |
||||
n<m.doc.scrollLeft&&bb(m,Math.min(c.scroller.scrollLeft,n),!0));m=sa(a);Oc(a);c=a;v=m;c.display.sizer.style.minHeight=c.display.heightForcer.style.top=v.docHeight+"px";c.display.gutters.style.height=Math.max(v.docHeight,v.clientHeight-wa)+"px";Ja(a,m);if(h&&a.options.lineWrapping&&l!=a.display.scroller.clientWidth)c=!0;else if(c=!1,b&&null!=b.top&&(b={top:Math.min(m.docHeight-wa-m.clientHeight,b.top)}),g=D(a.display,a.doc,b),g.from>=a.display.viewFrom&&g.to<=a.display.viewTo)break}a.display.updateLineNumbers= |
||||
null;f&&(O(a,"update",a),a.display.viewFrom==d&&a.display.viewTo==e||O(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo));return f}function ua(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function mb(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:U(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d, |
||||
wrapperWidth:b.wrapper.clientWidth}}function Oe(a,b,c){function d(b){var c=b.nextSibling;Z&&Pa&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return c}var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,l=e.view;e=e.viewFrom;for(var m=0;m<l.length;m++){var n=l[m];if(!n.hidden)if(n.node){for(;h!=n.node;)h=d(h);h=f&&null!=b&&b<=e&&n.lineNumber;n.changes&&(-1<S(n.changes,"gutter")&&(h=!1),td(a,n,e,c));h&&(Ma(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(M(a.options, |
||||
e))));h=n.node.nextSibling}else{var v=Se(a,n,e,c);g.insertBefore(v,h)}e+=n.size}for(;h;)h=d(h)}function td(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){f=b;var g=f.text.className,h=ud(a,f);f.text==f.node&&(f.node=h.pre);f.text.parentNode.replaceChild(h.pre,f.text);f.text=h.pre;h.bgClass!=f.bgClass||h.textClass!=f.textClass?(f.bgClass=h.bgClass,f.textClass=h.textClass,Fc(f)):g&&(f.text.className=g)}else if("gutter"==f)Cd(a,b,c,d);else if("class"==f)Fc(b);else if("widget"== |
||||