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