Commit 698647f2ce355a354ee280ae35b7b288d2de5188

Authored by ykxie
1 parent 754a8ff8

add dist

dist/gxb-ide/Dir.js
... ... @@ -9,6 +9,8 @@
9 9 fileList, // 有值的文件数据结构
10 10 treeObj; // 获取ztree对象
11 11  
  12 + var playTimes = 0;
  13 +
12 14 var playTreePathData = {"tree": []};
13 15  
14 16 var isReplayPage = false;
... ... @@ -612,8 +614,11 @@
612 614  
613 615 var role = getQuery('role');
614 616 if (role == 0) {
615   - // 请求玩立刻执行
616   - $.AudioPlayer.play()
  617 + if (playTimes === 0) {
  618 + // 请求玩立刻执行
  619 + $.AudioPlayer.play()
  620 + playTimes++
  621 + }
617 622 }else{
618 623 CodingEditer.playCoding();
619 624 }
... ... @@ -647,9 +652,21 @@
647 652 imagePath: '../js/audioPlayer/image',
648 653 debuggers: false,
649 654 allowSeek: false,
  655 + canplayCallback: function(res){
  656 + if (res.status == true) {
  657 + CodingEditer.playCoding();
  658 + }
  659 + },
  660 + onwaitingCallback: function(){
  661 + if (playTimes != 0) {
  662 + CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000);
  663 + CodingEditer.pauseCode();
  664 + }
  665 + },
650 666 playCallback: function() { // 播放
651   - console.log('++++++++');
652   - CodingEditer.playCoding();
  667 + if (playTimes != 0) {
  668 + CodingEditer.playCoding();
  669 + }
653 670 },
654 671 pauseCallback: function() { // 暂停
655 672 CodingEditer.audioTime = parseInt(player.elements.audioDom.currentTime*1000);
... ...
dist/index.html
... ... @@ -16,7 +16,6 @@
16 16 <link href="css/layout.css" rel="stylesheet">
17 17 <!-- <link href="css/main.css" rel="stylesheet"> -->
18 18 <link href="css/recording.css" rel="stylesheet">
19   -
20 19 <style>
21 20 .CodeMirror{
22 21 width: 100%;
... ...
dist/js/audioPlayer/jQuery.AudioPlayer.js 100755 → 100644
... ... @@ -2,8 +2,8 @@
2 2 * jQuery.AudioPlayer.js
3 3 * @Author Keystion
4 4 * @Version 1.0.1
5   - * Created by Keystion on 2016-12-19
6   - * Update on 2017-01-06
  5 + * Created by Keystion on 2016-12-19. Update on 2017-01-06
  6 + * https://github.com/Keystion/jQuery.AudioPlayer.js
7 7 */
8 8 ;(function(jQuery){
9 9 "use strict";
... ... @@ -11,24 +11,31 @@
11 11 options: {
12 12 // open console log / 打开控制台日志
13 13 debuggers: false
14   - // container, default 'body' / 组件要放到什么地方,默认'body'
  14 + // The outer Dom ClassName/id, default 'body'
  15 + // 外部Dom ClassName / id,默认的“body”
15 16 ,container: 'body'
16 17 // audio source / 音频源
17 18 ,source: ''
18   - // 音频源文件 / image resources
  19 + // image resources / 图像资源
19 20 ,imagePath: './image'
20 21 // Determines whether or not the player is playing before dragging/判断拖拽之前是否正在播放
21 22 ,seekNum: 0
22   - // Whether can drag and drop / 是否可以拖拽
  23 + // Whether to support drag and drop, the default open: `true` / 是否支持拖拽,默认开启:`true`
23 24 ,allowSeek: true
24 25 // After can play TODO / 可以播放之后,做某些事情
25 26 ,canplayCallback: null
  27 + // After searching for the audio TODO / 开始查找音频源之后,做某些事情
  28 + ,onloadstartCallback: null
  29 + // 需要缓冲下一帧而停止,做某些事情
  30 + ,onwaitingCallback: null
26 31 // After playback TODO / 播放之后,做某些事情
27 32 ,playCallback: null
28 33 // After the suspension TODO / 暂停之后,做某些事情
29 34 ,pauseCallback: null
30 35 // After the drag TODO / 拖动之后,做某些事情
31 36 ,timeupdateCallback: null
  37 + // After the drag, the callback function (`allowSeek: false`) / 拖动之后,回调函数(`allowSeek: false`)
  38 + ,seekedCallback: null
32 39 // End of the play TODO / 播放结束之后,做某些事情
33 40 ,endedCallback: null
34 41 // After the mute TODO / 静音之后,做某些事情
... ... @@ -258,6 +265,9 @@
258 265 // When the browser begins searching for the audio / 当浏览器开始查找音频时
259 266 _this.elements.audioDom.onloadstart = function() {
260 267 _this.log('onloadstart');
  268 + if(typeof _this.options.onloadstartCallback == 'function'){
  269 + _this.options.onloadstartCallback({'status': true});
  270 + }
261 271 }
262 272  
263 273 // When the audio has begun or is no longer suspended / 当音频已开始或不再暂停时
... ... @@ -300,6 +310,13 @@
300 310 _this.timeupdate();
301 311 }
302 312  
  313 + _this.elements.audioDom.onwaiting = function() {
  314 + _this.log('onwaiting');
  315 + if(typeof _this.options.onwaitingCallback == 'function'){
  316 + _this.options.onwaitingCallback({'status': true});
  317 + }
  318 + }
  319 +
303 320 // When the volume is changed
304 321 // 当音量已更改时
305 322 _this.elements.audioDom.onvolumechange = function() {
... ...
dist/js/gbreplayer.js
... ... @@ -80,6 +80,7 @@ $(function(){
80 80 times: 0, // 播放次数
81 81 isPause: 1, // 是否暂停 1:不暂停,0:暂停
82 82 isRcording: 0, // 是否录制 1:录制中,0:暂停中
  83 + playTimes: 0,
83 84 recordinit: function(codereplaytype, preload) {
84 85 var modeName = getMode(_languageid);
85 86 var modeNameItem = modeName[0];
... ... @@ -428,9 +429,26 @@ $(function(){
428 429 ,imagePath: 'js/audioPlayer/image'
429 430 ,debuggers: false
430 431 ,allowSeek: false
  432 + ,canplayCallback: function(res){
  433 + if (res.status == true) {
  434 + playCode();
  435 + GBCodePlayBack.htmlplayereditor.setOption('readOnly', true);
  436 + }
  437 + }
  438 + ,onwaitingCallback: function(){
  439 + if (GBCodePlayBack.playTimes !== 0) {
  440 + GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000)
  441 + pauseCode();
  442 + GBCodePlayBack.firstPlay = 0;
  443 + GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue();
  444 + GBCodePlayBack.htmlplayereditor.setOption('readOnly', false);
  445 + }
  446 + }
431 447 ,playCallback: function(){ // 播放
432   - playCode();
433   - GBCodePlayBack.htmlplayereditor.setOption('readOnly', true);
  448 + if (GBCodePlayBack.playTimes != 0) {
  449 + playCode();
  450 + GBCodePlayBack.htmlplayereditor.setOption('readOnly', true);
  451 + }
434 452 }
435 453 ,pauseCallback: function(){ // 暂停
436 454 GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000)
... ... @@ -462,7 +480,10 @@ $(function(){
462 480 }
463 481  
464 482 GBCodePlayBack.records = coderecords;
465   - player.play();
  483 + if(GBCodePlayBack.playTimes === 0){
  484 + player.play();
  485 + GBCodePlayBack.playTimes++
  486 + }
466 487 }
467 488  
468 489 // 使编辑器满屏
... ... @@ -1585,7 +1606,7 @@ $(function(){
1585 1606 contentType: "application/json",
1586 1607 success: function(data) {
1587 1608 compileResult(data)
1588   - // l.stop();
  1609 + l.stop();
1589 1610  
1590 1611 $('.compile-loading').hide();
1591 1612 $('.compile-reslut').show();
... ... @@ -1746,7 +1767,7 @@ $(function(){
1746 1767 // $('#comprunbtngrp').html('<button id="runnow" type="button" data-style="expand-right" class="btn" title="运行代码">&nbsp; 运行</button>');
1747 1768 }else{
1748 1769 $('#fontendrun').addClass('hidden');
1749   - $('#comprunbtngrp').html('<button id="comprun" type="button" data-run="1" data-style="expand-right" class="btn comprun" title="编译并运行代码"><span class="pc">编译&运行</span><span class="m-label"><p>编译</p><p>运行</p></span></button>');
  1770 + $('#comprunbtngrp').html('<button id="comprun" type="button" data-run="1" data-style="expand-right" class="btn comprun"><span class="pc">编译&运行</span><span class="m-label"><p>编译</p><p>运行</p></span></button>');
1750 1771  
1751 1772 $('#ifrcontainer').addClass('hidden');
1752 1773 $('#cmprun-output').removeClass('hidden');
... ...