-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathjs.html
More file actions
75 lines (74 loc) · 3.2 KB
/
js.html
File metadata and controls
75 lines (74 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<title>JavaScript Demo for JQuery Terminal Emulator</title>
<meta name="author" content="Jakub Jankiewicz - jcubic@onet.pl"/>
<meta name="Description" content="Demonstration for JQuery Terminal Emulator using call automaticly JSON-RPC service (in php) with authentication."/>
<link rel="shortcut icon" href="favicon.ico"/>
<script src="https://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="https://cdn.jsdelivr.net/combine/npm/jquery,npm/jquery.terminal/js/jquery.terminal.min.js,npm/jquery.terminal/js/xml_formatting.js,npm/js-polyfills/keyboard.js,npm/prismjs/prism.min.js,npm/jquery.terminal/js/prism.js,npm/jquery.splitter/js/jquery.splitter.min.js"></script>
<link href="https://cdn.jsdelivr.net/combine/npm/terminal-prism/css/prism-coy.css,npm/jquery.terminal/css/jquery.terminal.min.css,npm/jquery.splitter/css/jquery.splitter.css" rel="stylesheet"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
</head>
<body>
<script>
// ref: https://stackoverflow.com/q/67322922/387194
var __EVAL = (s) => eval(`void (__EVAL = ${__EVAL}); ${s}`);
function repr(object) {
if (object) {
if (object instanceof $.fn.init) {
return '#<jQuery>';
} else if (typeof object === 'object') {
var name = object.constructor.name;
if (name) {
return `#<${name}>`;
} else {
return object.toString();
}
} else {
return new String(object);
}
} else if (object === null) {
return 'null';
}
}
function repl(fn) {
return function(code) {
if (code !== '') {
try {
var result = fn(code);
if (result) {
this.echo(repr(result));
}
} catch(e) {
this.error(new String(e));
}
}
};
}
var term = $('body').terminal(repl((code) => __EVAL(code)), {
greetings: 'JavaScript Console using <a href="https://terminal.jcubic.pl/">jQuery Terminal</a>\n',
prompt: 'js> '
});
$.terminal.syntax('javascript');
</script>
<!-- Start Open Web Analytics Tracker -->
<script type="text/javascript">
//<![CDATA[
var owa_baseUrl = 'https://stats.jcubic.pl/';
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', '9b6210e220f27093109ddf895e626f1a']);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);
(function() {
var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
}());
//]]>
</script>
<!-- End Open Web Analytics Code -->
</body>
</html>