-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrelert.html
More file actions
117 lines (105 loc) · 4.48 KB
/
relert.html
File metadata and controls
117 lines (105 loc) · 4.48 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html lang="zh-cn" charset="UTF-8">
<head>
<title>relert.js-browser</title>
<link rel="shortcut icon" href="./relert.ico">
<link rel="stylesheet" type="text/css" href="./css/relert.css">
</head>
<body>
<div class="container">
<div id="sidebar">
<button id="sidebar-btn-open">打开地图</button>
<input type="file" accept=".map" id="openMap" style="display: none;"/>
<div>
<ul id="timeline"></ul>
</div>
</div>
<div id="main">
<div id="topbar">
<button id="topbar-btn-open" class="card">打开</button>
<button id="topbar-btn-save" class="card">保存</button>
<label>文件名</label>
<input id="topbar-input-filename" placeholder="" />
<button id="topbar-btn-run" class="card">运行</button>
<input type="file" accept=".js" id="openJs" style="display: none;"/>
<button id="topbar-btn-help" class="card right">帮助</button>
<button id="topbar-btn-github" class="card right">Github</button>
</div>
<div id="content">
<div id="tabs"></div>
<div id="editor"></div>
<div id="log-area">
<div id="log-box">
<div id="log"></div>
</div>
<div id="log-toolbar">
<button id="log-btn-clear" class="card right">清空</button>
<button class="card">错误</button>
<button class="card">警告</button>
</div>
</div>
</div>
</div>
</div>
<!-- 引入zepto -->
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
<!-- Editor 相关 -->
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/ace/test/ace.min.js"></script>
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/ace/test/mode-javascript.min.js"></script>
<!-- 编码相关 -->
<script type="text/javascript" src="./script/wwcompression.js"></script>
<!-- 其他第三方库 -->
<script type="text/javascript" src="./script/iconv-lite.min.js"></script>
<script type="text/javascript" src="./script/error-stack-parser.min.js"></script>
<!-- relert.js -->
<script type="text/javascript" src="./script/relert.js"></script>
<!-- 交互 -->
<script>
// 文件关联
const $openJs = document.getElementById('openJs');
$openJs.onchange = () => {
editor.openFile($openJs.files[0]);
}
const $openMap = document.getElementById('openMap');
$openMap.onchange = () => {
timeline.openFile($openMap.files[0]);
}
// 按钮事件
// 左侧边栏
$('#sidebar-btn-open').on('click', () => {
$openMap.click();
});
// 顶栏
$('#topbar-btn-open').on('click', () => {
$openJs.click();
});
$('#topbar-btn-save').on('click', () => {
editor.saveTab();
});
$('#topbar-btn-run').on('click', () => {
timeline.runScript(editor.getText(), editor.getFileName());
});
$('#topbar-btn-help').on('click', () => {
window.open('./readme.html','_blank');
});
$('#topbar-btn-github').on('click', () => {
window.open('https://github.com/Heli-Lab/relert.js-browser','_blank');
});
$('#topbar-input-filename').on('input', () => {
let filename = $('#topbar-input-filename').val();
if (!filename.endsWith('.js')) {
filename += '.js';
}
editor.setFileName(filename);
});
// log栏
$('#log-btn-clear').on('click', () => {
relert.cls();
});
// 退出
window.onbeforeunload = function() {
return '是否确认退出?';
}
</script>
</body>
</html>