Commit a836d74a5b5fefc625386328556dc54e71b4a059

Authored by ykxie
1 parent ee3eb1ff

发灰度

src/index.html
... ... @@ -8,6 +8,7 @@
8 8 <link href="css/validationEngine.jquery.css" rel="stylesheet">
9 9 <link href="css/codemirror.css" rel="stylesheet">
10 10 <link href="css/cm-theme/gbtags.css" rel="stylesheet">
  11 + <link href="css/cm-theme/eclipse.css" rel="stylesheet">
11 12 <link href="css/cm-theme/gbtags-dark.css" rel="stylesheet">
12 13 <link href="css/font/iconfont.css" rel="stylesheet">
13 14 <link href="css/font_all/iconfont.css" rel="stylesheet">
... ... @@ -54,6 +55,7 @@
54 55 <script src="js/gbdebug/mode/javascript/javascript.js"></script>
55 56 <script src="js/gbdebug/mode/css/css.js"></script>
56 57 <script src="js/gbdebug/mode/htmlmixed/htmlmixed.js"></script>
  58 + <script src="js/gbdebug/mode/clike/clike.js"></script>
57 59  
58 60 </head>
59 61 <body>
... ...
src/js/gbreplayer.js
... ... @@ -31,6 +31,7 @@ $(function(){
31 31 replay_enhancement:1, //是否优化播放,即匀速播放
32 32 replay_enhancement_value: 250,
33 33 speed: 1,
  34 + playstatus: 0,
34 35 recordtimeoutcontrolls: [],
35 36 excercise_recordtimeoutcontrolls: [],
36 37 isgblibreplay: 0,
... ... @@ -386,10 +387,12 @@ $(function(){
386 387 ,playCallback: function(){
387 388 // playCoder();
388 389 $('#play').trigger('click');
  390 + GBCodePlayBack.playstatus = 0;
389 391 }
390 392 ,pauseCallback: function(){
391 393 // playCoder();
392 394 $('#play').trigger('click');
  395 + GBCodePlayBack.playstatus = 0;
393 396 }
394 397 ,seekedCallback: function(){}
395 398 ,endedCallback: function(){
... ... @@ -426,7 +429,7 @@ $(function(){
426 429 }, 50)
427 430  
428 431 /* #STRAT: 播放和暂停控制元素 */
429   - $('#play').click(function(){
  432 + $('#play').unbind('click').click(function(){
430 433 var myAudio = $('#play_audio');
431 434  
432 435 //禁用修改
... ... @@ -446,6 +449,10 @@ $(function(){
446 449 $('#play').find('i').removeClass('icon-play').addClass('icon-playcopy').attr('data-original-title', '暂停');
447 450 }
448 451 }
  452 +
  453 + if(GBCodePlayBack.playstatus = 1){
  454 + GBCodePlayBack.htmlplayereditor.setValue('');
  455 + }
449 456  
450 457 if(!playstatus){
451 458 var playbackrecord = GBCodePlayBack.records,
... ... @@ -516,8 +523,15 @@ $(function(){
516 523  
517 524  
518 525 // 播放录制代码过程
519   - $('.audio-play').click(function(){
  526 + $('.audio-play').unbind('click').click(function(){
520 527 Hourglass.init();
  528 + var resultData = {
  529 + output: '',
  530 + stderr: '',
  531 + cmpinfo: '',
  532 + result: 1
  533 + }
  534 + compileResult(resultData);
521 535  
522 536 var data = $(this).attr('data');
523 537 if (_role == 0) {
... ... @@ -527,24 +541,24 @@ $(function(){
527 541 $(this).attr('data', 0).attr('data-original-title', '播放录音');
528 542  
529 543 var playbtn= $('#play'),
530   - playbackrecord = GBCodePlayBack.records;
531   -
532   - GBCodePlayBack.triggertotal = 0;
  544 + playbackrecord = GBCodePlayBack.records;
  545 +
  546 + GBCodePlayBack.triggertotal = 0;
533 547  
534   - /* 初始化播放 */
535   - for (var i = 0; i < playbackrecord.length; i++) {
536   - playbackrecord[i].trigger = 0;
537   - }
  548 + for(var i=0;i<playbackrecord.length;i++){
  549 + playbackrecord[i].trigger = 0;
  550 + }
538 551  
539   - for (var i = 0; i < GBCodePlayBack.recordtimeoutcontrolls.length; i++) {
540   - clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]);
541   - }
542   - GBCodePlayBack.recordtimeoutcontrolls = [];
  552 + for(var i=0;i<GBCodePlayBack.recordtimeoutcontrolls.length;i++){
  553 + clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]);
  554 + }
  555 + GBCodePlayBack.recordtimeoutcontrolls = [];
543 556 /* END 初始化播放 */
544 557 GBCodePlayBack.htmlplayereditor.setValue('');
545 558  
546 559 playbtn.data('status', 0);
547 560 $('#play').trigger('click');
  561 + console.log('--------------=============')
548 562 });
549 563  
550 564 //setting speed in cookie
... ... @@ -598,7 +612,7 @@ $(function(){
598 612 }
599 613  
600 614 //播放代码回放
601   - $('#playrecord').click(function(){
  615 + $('#playrecord').unbind('click').click(function(){
602 616 console.log("---------------------")
603 617 // 根据不同的角色请求不同的接口播放
604 618 $('#playrecord').hide();
... ... @@ -820,14 +834,14 @@ $(function(){
820 834  
821 835 });
822 836  
823   - $('#cancel').click(function(){
  837 + $('#cancel').unbind('click').click(function(){
824 838 $(window).unbind('beforeunload', function(){
825 839 return '确认退出? 将不保存你的代码';
826 840 });
827 841 window.close();
828 842 })
829 843 // 保存代码
830   - $('#savecorde').click(function(){
  844 + $('#savecorde').unbind('click').click(function(){
831 845 $('#savemsg').addClass('hidden');
832 846 $('.upload-tip').show();
833 847  
... ... @@ -1084,7 +1098,7 @@ $(function(){
1084 1098 })
1085 1099  
1086 1100 // 不保存编译结果
1087   - $('#cancel_compile').click(function(){
  1101 + $('#cancel_compile').unbind('click').click(function(){
1088 1102 Hourglass.pauseTimer();
1089 1103 contrlPause()
1090 1104 GBCodePlayBack.record_continue_time = new Date().getTime();
... ... @@ -1409,10 +1423,13 @@ $(function(){
1409 1423 output: record.output || '',
1410 1424 stderr: record.stderr || '',
1411 1425 cmpinfo: record.cmpinfo || '',
1412   - result: record.result || 1
  1426 + result: record.result
  1427 + }
  1428 +
  1429 + if(resultData.cmpinfo || resultData.result == 1){
  1430 + compileResult(resultData);
1413 1431 }
1414 1432  
1415   - compileResult(resultData);
1416 1433 console.log(record);
1417 1434  
1418 1435 if(replay_type){
... ... @@ -1479,11 +1496,7 @@ $(function(){
1479 1496  
1480 1497 GBCodePlayBack.triggeroffset=0; //reset offset for 滑动进度条
1481 1498  
1482   - if($('#readonly').length>0){
1483   - setTimeout(function(){$('#readonly').popover({html:true, placement:'right', container: 'body', content:''}).popover('show');}, 2000);
1484   - setTimeout(function(){$('#readonly').trigger('click');},1500);
1485   - setTimeout(function(){$('#readonly').popover('destroy');}, 5000);
1486   - }
  1499 +
1487 1500 }
1488 1501  
1489 1502 if(GBCodePlayBack.excercise_triggertotal === GBCodePlayBack.excercise_records.length){
... ... @@ -1545,13 +1558,15 @@ $(function(){
1545 1558 $("#countdown").show();
1546 1559 if(data == 1){
1547 1560 $("#countdown").find('img').attr('src', 'img/ready-go.gif');
1548   - var countdown = setInterval(function(){
1549   - seconds += 1;
1550   - if(seconds == 2){
1551   - $("#countdown").hide();
1552   - startReacoder();
1553   - }
1554   - },1000);
  1561 + $("#countdown").find('img').load(function(){
  1562 + var countdown = setInterval(function(){
  1563 + seconds += 1;
  1564 + if(seconds == 2){
  1565 + $("#countdown").hide();
  1566 + startReacoder();
  1567 + }
  1568 + },1000);
  1569 + })
1555 1570 }else{
1556 1571 $("#countdown").hide();
1557 1572 $("#re-recoding").show();
... ... @@ -1563,11 +1578,6 @@ $(function(){
1563 1578 }
1564 1579 })
1565 1580  
1566   - // 暂停录制
1567   - $('.pause-recording').click(function(){
1568   - // recorder.pause();
1569   - })
1570   -
1571 1581 $('#re-recoding').click(function(){
1572 1582 $('.re-tips').show();
1573 1583 })
... ... @@ -1616,7 +1626,7 @@ $(function(){
1616 1626 $('#cmprun-tabs a[href="#stderr"]').tab('show');
1617 1627 }else if(data.output.length){
1618 1628 $('#cmprun-tabs a[href="#output"]').tab('show');
1619   - }
  1629 + }
1620 1630  
1621 1631 if(!data.cmpinfo.length){
1622 1632 $('#cmpinfo').prepend('<p class="alert alert-success"><i class="glyphicon glyphicon-ok-sign"></i> 编译已成功</p>');
... ... @@ -1629,6 +1639,7 @@ $(function(){
1629 1639 if(!data.output.length){
1630 1640 $('#output').prepend('<p class="alert alert-warning"><i class="glyphicon glyphicon-exclamation-sign"></i> 代码编译错误或者运行相关功能受限制</p>');
1631 1641 }
  1642 +
1632 1643 }else{
1633 1644 $('#cmpinfo').html('<p class="alert alert-danger"><i class="glyphicon glyphicon-exclamation-sign"></i> 云端编译超时,请稍后重新尝试</p>');
1634 1645 $('#cmprun-tabs a[href="#cmpinfo"]').tab('show');
... ... @@ -1961,6 +1972,8 @@ $(function(){
1961 1972  
1962 1973 GBCodePlayBack.triggertotal = 0;
1963 1974  
  1975 + GBCodePlayBack.playstatus = 1;
  1976 +
1964 1977 /* 初始化播放 */
1965 1978 for (var i = 0; i < GBCodePlayBack.records.length; i++) {
1966 1979 GBCodePlayBack.records[i].trigger = 0;
... ... @@ -1969,6 +1982,12 @@ $(function(){
1969 1982 for (var i = 0; i < GBCodePlayBack.recordtimeoutcontrolls.length; i++) {
1970 1983 clearTimeout(GBCodePlayBack.recordtimeoutcontrolls[i]);
1971 1984 }
  1985 +
  1986 + if($('#readonly').length>0){
  1987 + setTimeout(function(){$('#readonly').popover({html:true, placement:'right', container: 'body', content:''}).popover('show');}, 2000);
  1988 + setTimeout(function(){$('#readonly').trigger('click');},1500);
  1989 + setTimeout(function(){$('#readonly').popover('destroy');}, 5000);
  1990 + }
1972 1991 }
1973 1992  
1974 1993 });
... ...
src/js/recorder/Myna.js
... ... @@ -131,18 +131,15 @@
131 131 console.log(context.state);
132 132 if (context.state === 'running') {
133 133 context.suspend().then(function() {
134   - console.log('-----------------暂停录制------------------')
135 134 });
136 135 } else if (context.state === 'suspended') {
137 136 context.resume().then(function() {
138   - console.log('-----------------继续录制------------------')
139 137 });
140 138 }
141 139 }
142 140  
143 141 //停止
144 142 this.stop = function() {
145   - console.log('&&&&&&&&&&&&');
146 143 recorder.disconnect();
147 144 }
148 145  
... ...