forked from jason53415/blockly-app
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcode.html
323 lines (322 loc) · 16.7 KB
/
code.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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PAIA Desktop</title>
<link rel="stylesheet" href="node_modules/vex-js/dist/css/vex.css">
<link rel="stylesheet" href="node_modules/vex-js/dist/css/vex-theme-os.css">
<link rel="stylesheet" href="node_modules/bootstrap-icons/font/bootstrap-icons.css">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="node_modules/codemirror/addon/fold/foldgutter.css">
<link rel="stylesheet" href="node_modules/codemirror/addon/hint/show-hint.css">
<link rel="stylesheet" href="node_modules/codemirror/addon/lint/lint.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="node_modules/github-markdown-css/github-markdown.css">
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/mode/python/python.js"></script>
<script src="node_modules/codemirror/addon/selection/active-line.js"></script>
<script src="node_modules/codemirror/addon/hint/show-hint.js"></script>
<script src="node_modules/codemirror/addon/fold/foldcode.js"></script>
<script src="node_modules/codemirror/addon/fold/foldgutter.js"></script>
<script src="node_modules/codemirror/addon/fold/brace-fold.js"></script>
<script src="node_modules/codemirror/addon/fold/indent-fold.js"></script>
<script src="node_modules/codemirror/addon/fold/comment-fold.js"></script>
<script src="node_modules/codemirror/addon/edit/closebrackets.js"></script>
<script src="node_modules/codemirror/addon/edit/matchbrackets.js"></script>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.js"></script>
<script src="node_modules/vex-js/dist/js/vex.combined.min.js"></script>
<script>vex.defaultOptions.className = 'vex-theme-os'</script>
<script src="node_modules/blockly/blockly_compressed.js"></script>
<script src="node_modules/blockly/blocks_compressed.js"></script>
<script src="node_modules/blockly/python_compressed.js"></script>
<script src="js/code.js"></script>
</head>
<body>
<!-- Login dialog -->
<div class="modal fade" id="login-dialog" tabindex="-1" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content p-3">
<h5 class="text-center mt-3">登入 PAIA</h5>
<form name="play" action="javascript:Code.login()">
<div class="modal-body my-2">
<div class="container">
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" aria-describedby="emailHelp" placeholder="[email protected]" required>
</div>
<div class="form-group mb-4">
<label for="password">密碼</label>
<input type="password" class="form-control" id="password" placeholder="Password" required>
</div>
<button type="submit" class="btn btn-primary">登入</button>
<span class="text-danger ml-3" id="state-content"></span>
</div>
</div>
</form>
<button type="button" onclick="location.href=window.paia.redirect();">
從 PAIA 網站登入
</button>
</div>
</div>
</div>
<!-- Project dialog -->
<div class="modal fade" id="project-dialog" tabindex="-1" data-backdrop="static" data-keyboard="false" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="game-play-title">新建 / 載入專案</h5>
</div>
<form name="project" action="javascript:Code.newProject()">
<div class="modal-body my-2">
<div class="form-group">
<label for="">專案位置</label>
<input type="text" class="form-control" id="project-path" onclick="Code.selectProjectPath()" readonly required>
</div>
<div class="form-group">
<label for="">專案名稱</label>
<input type="text" class="form-control" id="project-name" placeholder="My awesome project"
pattern="[\w\- ]{1,64}" title="長度限制為 64,只能包含英文、數字、空格、「_」或「-」。" required>
</div>
</div>
<div class="modal-footer">
<button type="button" onclick="location.href='index.html';" class="btn btn-outline-primary mr-auto">返回遊戲選單</button>
<button type="submit" class="btn btn-outline-primary">新建</button>
<button type="button" onclick="Code.openProject()" class="btn btn-outline-secondary">載入</button>
</div>
</form>
</div>
</div>
</div>
<!-- Game play dialog -->
<div class="modal fade" id="run-mlgame-dialog" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="game-play-title">開始玩</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form name="play" action="javascript:Code.play()">
<div class="modal-body" id="game-args"></div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-outline-primary">確定</button>
</div>
</form>
</div>
</div>
</div>
<!-- Custom Python dialog -->
<div class="modal fade" id="custom-python-dialog" tabindex="-1" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="custom-python-title">執行環境設定</h5>
</div>
<form name="save" action="javascript:Code.saveCustomPython()">
<div class="modal-body m-2" id="game-args">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="custom-python-check">
<label class="form-check-label" for="custom-python-check">使用自訂 Python 環境</label>
</div>
<div class="form-group">
<label for="">Python 直譯器位置:<span id='custom-python-path'></span></label>
<button type="button" id="custom_python_button">選擇</button>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-outline-primary">確定</button>
</div>
</form>
</div>
</div>
</div>
<!-- Console dialog -->
<div class="modal fade" id="console-dialog" tabindex="-1" aria-labelledby="exampleModalLabel" data-backdrop="static" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="console-title">Console</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id='console-body'>
<pre id="content_console" class="prettyprint lang-sh" style="border: 0"></pre>
</div>
</div>
</div>
</div>
<!-- Readme dialog -->
<div class="modal fade" id="readme-dialog" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" style="max-width: 1200px;">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="readme-title">Readme</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body markdown-body" id='readme-body'></div>
</div>
</div>
</div>
<!-- Fileset list dialog -->
<div class="modal fade" id="filset-dialog" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">線上檔案集</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body my-2">
<div class="accordion" id="fileset-list"></div>
</div>
<div class="modal-footer">
<button type="button" onclick="Code.updateFileset(-1);" class="btn btn-outline-primary">新增檔案集</button>
</div>
</div>
</div>
</div>
<!-- Fileset upload dialog -->
<div class="modal fade" id="upload-filset-dialog" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">新增 / 更新範例程式集</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form name="upload-filset" action="javascript:Code.uploadFileset()">
<div class="modal-body my-2">
<div class="form-group">
<label for="">名稱</label>
<input type="text" class="form-control" id="filset-name" required>
</div>
<div class="form-group">
<label for="">描述</label>
<input type="text" class="form-control" id="filset-description">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-outline-primary">新增 / 更新</button>
</div>
</form>
</div>
</div>
</div>
<div class="wrapper">
<nav class="pt-3 px-3" id="sidebar">
<div class="sidebar-header">
<h4 id='game_name'></h4>
</div>
<div class="dropdown-divider"></div>
<ul class="list-unstyled my-3">
<div class="row mx-0 justify-content-between">
<h6 class="mb-0" id="saved_filesets">程式庫</h6>
<div class="dropdown position-static">
<a href="#" data-toggle="dropdown" data-boundary="viewport" id="fileset-options"><i class="bi bi-three-dots"></i></a>
<div class="dropdown-menu" aria-labelledby="fileset-options">
<button class="dropdown-item" type="button" id="open_example_dir"><i class="bi bi-folder2-open"></i> 開啟程式庫路徑</button>
</div>
</div>
</div>
<li id="library"></li>
</ul>
<div class="dropdown-divider"></div>
<ul class="list-unstyled my-3">
<div class="row mx-0 justify-content-between">
<h6 class="mb-0">目前專案</h6>
<div class="dropdown position-static">
<a href="#" data-toggle="dropdown" data-boundary="viewport" id="project-options"><i class="bi bi-three-dots"></i></a>
<div class="dropdown-menu" aria-labelledby="project-options">
<button class="dropdown-item" type="button" id="load_project"><i class="bi bi-box-arrow-in-left"></i> 新建 / 載入專案</button>
<button class="dropdown-item" type="button" id="export_project"><i class="bi bi-box-arrow-right"></i> 匯出專案</button>
<button class="dropdown-item" type="button" id="reveal_project"><i class="bi bi-folder2-open"></i> 開啟專案資料夾位置</button>
</div>
</div>
</div>
<li>
<a href="#project-files" data-toggle="collapse" aria-expanded="false" class="group mt-2" id="project-link">
<i class="bi bi-caret-right-fill pointer mr-1"></i>
<span id="project_name"></span>
</a>
<ul class="collapse list-unstyled" id="project-files">
</ul>
</li>
</ul>
<div class="dropdown-divider"></div>
<ul class="list-unstyled my-3" id="fileset_download_div">
<h6>下載特定專案</h6>
<form name="download-filset" action="javascript:Code.findFileset()">
<div class="form-group py-1">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<button type="submit" class="btn btn-outline-light"><i class="bi bi-search"></i></button>
</div>
<input type="text" class="form-control" id="fileset-download-token" placeholder="輸入專案代碼"
pattern="[\w]{1,10}" required>
</div>
</div>
</form>
<ul class="collapse list-unstyled" id="fileset-data">
<p>分享者:<span id="fileset-author"></span></p>
<p>專案名稱:<span id="fileset-name"></span></p>
<p>最後更新時間:<span id="fileset-updated-at"></span></p>
<button class="btn btn-sm btn-outline-light" onclick="Code.downloadFileset()">下載</button>
</ul>
</ul>
<webview id="paia-ads" src="" style="display:none; width:100%; height:80px"></webview>
</nav>
<div class="container-fluid" id="blockly-container">
<ul class="nav nav-tabs" role="tablist" id="tab_list">
<div class="row mx-0" id="opened_xml"></div>
<button class="btn btn-primary h-75 mr-1 ml-auto" id="toggle_python">Python</button>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="tab_user" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">尚未登入</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#" id="logout">登出</a>
<!-- <div class="dropdown-divider"></div> -->
<a class="dropdown-item" href="#" id="show_filesets">線上檔案集</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="tab_lang" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">語言</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#" id="zh-hant">中文</a>
<a class="dropdown-item" href="#" id="en">英文</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="tab_option" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">選項</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#" id="show_readme">遊戲說明</a>
<a class="dropdown-item" href="#" id="run">執行程式</a>
<a class="dropdown-item" href="#" id="custom_python">執行環境設定</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" id='open_xml'>開啟 XML 檔</a>
<a class="dropdown-item" href="#" id='save_xml'>儲存 XML 檔</a>
<a class="dropdown-item" href="#" id='save_python'>另存 Python 檔</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" id="discard">移除所有積木</a>
<a class="dropdown-item" href="#" id="clean_trashcan">清空垃圾桶</a>
<a class="dropdown-item" href="#" id="custom_blocks">開啟自訂積木位置</a>
<a class="dropdown-item" href="index.html" id="game_menu">選擇遊戲</a>
</div>
</li>
</ul>
<div class="tab-content" id="tab_content">
<div id="content_blocks" class="content active" role="tabpanel" aria-labelledby="tab_blocks"></div>
<div id="content_python" class="content" role="tabpanel" aria-labelledby="tab_python"><textarea id="python_code"></textarea></div>
</div>
</div>
</div>
</body>
</html>