Commit 698647f2ce355a354ee280ae35b7b288d2de5188

Authored by ykxie
1 parent 754a8ff8

add dist

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