-
Notifications
You must be signed in to change notification settings - Fork 0
/
JavaScriptTester.html
48 lines (42 loc) · 2.95 KB
/
JavaScriptTester.html
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
<!DOCTYPE html><html lang="ja"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="height=device-height,width=device-width,initial-scale=1.0,maximum-scale=1.0">
<meta name="author" content="RuiluAdora">
<title>JavaScript Tester</title>
<!-- <link rel="stylesheet" href="./JavaScript Tester online_files/all.css"> -->
<script type="text/javascript" src="./JavaScript Tester online_files/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="./JavaScript Tester online_files/all.js"></script>
<script type="text/javascript" src="./JavaScript Tester online_files/clipboard.js"></script>
<script src="./JavaScript Tester online_files/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">$(function () {$("#test").click(function () {var screen = document.getElementById("screen");screen.innerHTML = "";try {var value = `function log(logs) {let log = logs.replace(/\\n/g,"<br>");var screen = document.getElementById( "screen" );var div = document.createElement( "div");div.innerHTML =log;screen.appendChild( div );}` + getValue();var myObject = eval(value);if (typeof myObject != "undefined") {if (typeof myObject == "object") {if (value.indexOf("screen") == -1) {alert("Result is an object, look at the console");console && console.log(myObject);}} else {alert("Result=" + myObject);}}} catch (error) {alert("Invalid JavaScript");}});$("#clear").click(function () {setValue("");});});</script>
</head>
<body>
<div id="all">
<div id="body">
<div id="content" class="box"><h1>JavaScript Tester</h1>
<div class="body">
<form>
<fieldset>
<label for="json">JavaScript code</label>
<div id="editor" style="width:100%;height:400px;" class=" ace_editor ace-eclipse"><textarea
class="ace_text-input" wrap="off" autocapitalize="off" spellcheck="false"
style="bottom: 336px; height: 12px; width: 6px; right: 1365px;"></textarea></div>
</fieldset>
<fieldset>
<input type="button" id="test" value="Execute">
<input type="button" id="copy" value="Copy">
<input type="button" id="clear" value="Clear">
</fieldset>
</form>
<div style="padding-left:10px;margin-top:40px">log(<strong>Object</strong>)<input type="button" id="copy-screen" value="Copy"></div>
<div
style="background-color:white;margin:10px;border-radius:5px;padding:10px;border:1px solid #999">
<div id="screen">
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>