index.html
13.8 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>互动编程</title>
<link rel="stylesheet" href="css/responsive/css/bootstrap.min.css">
<link href="css/validationEngine.jquery.css" rel="stylesheet">
<link href="css/codemirror.css" rel="stylesheet">
<link href="css/cm-theme/gbtags.css" rel="stylesheet">
<link href="css/cm-theme/gbtags-dark.css" rel="stylesheet">
<link href="css/font/iconfont.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<script>
// var gxb_api = "http://192.168.80.144:8080"
var gxb_api = "https://restful.gaoxiaobang.cn"
</script>
<script src="js/jquery-1.7.1.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/util/util.js"></script>
<script src="js/spin.js"></script>
<script src="js/ladda.js"></script>
<script src="js/bootstrapslider.js"></script>
<script src="js/jquery-ui-1.8.20.custom.js"></script>
<script src="js/codemirror.js"></script>
<!-- <script src="js/handlebars-1.3.js"></script> -->
<script src="js/emmet.js"></script>
<script src="js/jshint-2.6.min.js"></script>
<script src="js/jstorage.js"></script>
<script src="js/05-util.js"></script>
<script src="js/03-http.js"></script>
<script src="js/jquery.iframe-transport.js"></script>
<script src="js/jquery.ui.widget.js"></script>
<script src="js/jquery.fileupload.js"></script>
<script src="js/jquery.validationEngine.js"></script>
<script src="js/jquery.validationEngine-zh.js"></script>
<script src="js/jquery.isotope.js"></script>
<script src="js/identityService.js"></script>
<script src="js/engine.js"></script>
<script src="js/gbreplayer.js"></script>
<script src="js/gbdebug/mode/xml/xml.js"></script>
<script src="js/gbdebug/mode/javascript/javascript.js"></script>
<script src="js/gbdebug/mode/css/css.js"></script>
<script src="js/gbdebug/mode/htmlmixed/htmlmixed.js"></script>
</head>
<body>
<div class="real-program-title">
<div class="back">
<i class="gxbrecording record-back" style="color: #1FB6FF">返回课程</i>
<span>| 我的课程</span>
</div>
<div class="save-wrap">
<a id="savecorde">保存</a>
<a id="cancel">关闭</a>
</div>
</div>
<div class="real-program-content">
<div class="row">
<div class="col-md-8" id="editorpanel">
<!-- <div id="recordpanel" class="recording-wrap">
<div class="recording-header">
</div>
<div class="recording-content">
</div>
<div class="recording-audio">
</div>
</div> -->
<div id="recordpanel" class="panel panel-default">
<!-- 头部语言 -->
<div class="panel-heading">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group btn-group-lg" id="editorwrapper">
<!-- <button type="button" class="btn btn-default" id="allbutton" title="全部代码" data-editorname="all">全部</button> -->
<button type="button" class="btn btn-default btn-primary" id="htmlbutton" title="HTML代码" data-editorname="html">HTML/CSS/JS</button>
<!-- <button type="button" class="btn btn-default" id="cssbutton" title="CSS代码" data-editorname="css">CSS</button> -->
<!-- <button type="button" class="btn btn-default" id="jsbutton" title="Javascript代码" data-editorname="js">JS</button> -->
</div>
</div>
</div>
<!-- 录音播放区域 -->
<div class="recording">
<div class="play">
<span class="glyphicon glyphicon-stop"></span>
</div>
<audio id="audio" controls autoplay></audio>
<input type="button" id="startRec" value="录音" />
<input type="button" id="stopRec" value="录制完成" />
<!-- <input type="button" id="playRec" value="播放" disabled="disabled" /> -->
<input onclick="uploadAudio(this)" type="button" id="submitRec" value="上传音频" disabled="disabled" />
<a id="save" onclick="downloadAudio()" href="#">下载</a>
</div>
<!-- 编辑播放代码区域 -->
<div class="panel-body">
<ul class="nav nav-tabs" id="recordertab">
<li class="active" style="margin-left: 28PX;">
<a href="#recordzone" data-toggle="tab"><span class="glyphicon glyphicon-record"></span><p class="hidden-xs hidden-sm pull-right"> 录制区</p></a>
</li>
<li>
<a href="#replayzone" data-toggle="tab"><span class="glyphicon glyphicon-play"></span><p class="hidden-xs hidden-sm pull-right"> 录制预览区</p></a>
</li>
<li class="clearfix"></li>
</ul>
<input type="hidden" class="audio-url" value="value">
<div class="tab-content" style="position:relative;">
<div class="tab-pane active" id="recordzone">
<textarea id="HTMLeditor" title="HTML"></textarea>
<textarea id="CSSeditor" title="CSS"></textarea>
<textarea id="JSeditor" title="Javascript"></textarea>
</div>
<div class="tab-pane" id="replayzone">
<textarea id="HTMLplayer"></textarea>
<textarea id="CSSplayer"></textarea>
<textarea id="JSplayer"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4" id="previewpanel">
<div id="resultpanel" class="panel panel-default">
<div class="panel-heading">
<div class="btn-group">
<button type="button" class="btn btn-success" id="play" data-status="0" title="代码播放或者暂停" style="display: none;"><span class="glyphicon glyphicon-play"></span></button>
<!-- <button type="button" class="btn btn-success" id="replay" title="重新回放"><span class="glyphicon glyphicon-repeat"></span></button> -->
<p id="replay" onclick="playRecording(this)" title="重新回放"><span class="play-text">预览录制</span><span class="glyphicon glyphicon-repeat play-icon"></span></p>
</div>
<!-- 修改播放速度 -->
<div class="btn-group dropdown" id="playspeed" style="display: none;">
<button type="button" class="btn btn-default" title="播放速度">
<span class="glyphicon glyphicon-forward"></span><span id="selectedspeed" data-speed="1">x1</span>
</button>
<button type="button" id="preparespeed" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu" id="speedlist">
<li><a href="#" data-speed="1" title="缺省速度"><span class="glyphicon glyphicon-forward"></span>x1</a></li>
<li><a href="#" data-speed="2" title="速度x2"><span class="glyphicon glyphicon-forward"></span>x2</a></li>
<li><a href="#" data-speed="4" title="速度x4"><span class="glyphicon glyphicon-forward"></span>x4</a></li>
</ul>
</div>
<div class="btn-group pull-right" id="comprunbtngrp"></div>
<div class="btn-group pull-right">
<button id="resizepreview" type="button" class="btn btn-default" title="缩放预览窗口"><span class="glyphicon glyphicon-resize-full"></span></button>
</div>
<div class="clearfix"></div>
</div>
<div class="panel-body hidden" id="cmprun-output">
<div id="resultoutput" style="overflow:auto;">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist" id="cmprun-tabs">
<li class="active"><a href="#stdin" role="tab" data-toggle="tab" class="text-warning">标准输入</a></li>
<li><a href="#cmpinfo" role="tab" data-toggle="tab" class="text-warning">编译信息</a></li>
<li><a href="#stderr" role="tab" data-toggle="tab" class="text-danger">错误输出</a></li>
<li><a href="#output" role="tab" data-toggle="tab" class="text-success">运行结果</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active padall15" id="stdin">
<input type="text" class="form-control" id="input" placeholder="标准输入">
</div>
<div class="tab-pane padall15" id="cmpinfo">...</div>
<div class="tab-pane padall15" id="stderr">...</div>
<div class="tab-pane padall15" id="output">...</div>
</div>
</div>
</div>
<div class="panel-body" id="ifrcontainer">
<iframe id="resultiframe" frameBorder="0" width="100%"></iframe>
</div>
</div>
</div>
</div>
</div>
<div id="editor-popover" class="popover gbinline-popover top fade" style="display: block;z-index:10000;position:absolute;">
<div class="arrow gbinline-arrow" style="left:20%;"></div>
<h3 class="popover-title" style="display: none;"></h3>
<div class="popover-content">test</div>
</div>
<!-- 覆盖层 -->
<div class="modal-backdrop fade in hidden" id="gbloading" style="opacity:.9;height:100%;width:100%;">
<div class="text-center" style="margin:50px auto;opacity:1;color:#EEE;">
<h3 class="text-default"><span class="glyphicon glyphicon-flag"></span> 正在同步已录制的代码...</h3>
<p class="loading"></p>
</div>
</div>
<!-- 倒计时 -->
<div id="countdown" style="display: none;"></div>
<script src="js/recorder/Myna.js"></script>
<!-- <script src="js/recording/recording.js"></script> -->
<script>
var global_trigger_record = 1;
var recorder;
var startRec = $('#startRec');
var stopRec = $('#stopRec');
var playRec = $('#playRec');
var submitRec = $('#submitRec');
var audio = document.querySelector('audio');
var saveAudio = document.getElementById("save");
// var audio = document.getElementById('audio');
// 播放录音
$("#startRec").click(function(){
startRecording();
})
function startRecording(obj) {
HZRecorder.get(function(rec) {
var seconds = 0;
var countdown = setInterval(function(){
seconds += 1;
document.getElementById('countdown').innerHTML = 4-seconds;
if(seconds == 4){
clearInterval(countdown);
$("#countdown").css("display", "none");
recorder = rec;
recorder.start();
}
},1000);
startRec.val('录音中...').attr('disabled', 'disabled').prop("disabled", true);
playRec.attr('disabled', 'disabled').prop("disabled", true);
submitRec.attr('disabled', 'disabled').prop("disabled", true);
});
$("#countdown").css("display", "block")
}
// 停止录音
$("#stopRec").click(function(){
stopRecording()
})
function stopRecording() {
recorder.stop();
console.log(recorder)
startRec.val('重新录音').removeAttr('disabled').prop("disabled", false);
stopRec.val('录制完成').attr('disabled', 'disabled').prop("disabled", true);
playRec.removeAttr('disabled').prop("disabled", false);
submitRec.removeAttr('disabled').prop("disabled", false);
}
// 播放录音
$("#playRec").click(function(){
playRecording()
})
function playRecording() {
recorder.play(audio);
playRec.val('正在播放...').attr('disabled', 'disabled').prop("disabled", true);
setTimeout(function(){
alert
playRec.val('播放').removeAttr('disabled').prop("disabled", false);
}, 2000);
}
// 下载录音文件
function downloadAudio(saveAudio){
recorder.download(saveAudio);
}
function uploadAudio(ob) {
recorder.upload();
}
</script>
</body>
</html>