Commit 362233c96f38ef270fe6e643d421c0e9391d55f3
合并代码
Showing
4 changed files
with
162 additions
and
181 deletions
src/css/recording.css
| ... | ... | @@ -502,7 +502,8 @@ button { |
| 502 | 502 | position: absolute; |
| 503 | 503 | top: 50%; |
| 504 | 504 | left: 50%; |
| 505 | - transform: translate(-50%, -50%); } | |
| 505 | + transform: translate(-50%, -50%); | |
| 506 | + z-index: 999; } | |
| 506 | 507 | |
| 507 | 508 | .re-tips .btn-success, .pause-shodow .btn-success { |
| 508 | 509 | background-color: #1FB6FF; | ... | ... |
src/js/gbreplayer.js
| ... | ... | @@ -10,6 +10,7 @@ $(function(){ |
| 10 | 10 | _source = getQuery('source'); |
| 11 | 11 | var $recording_time = $('.recording-time'); |
| 12 | 12 | var tag = 1; // 标记第一次暂停 |
| 13 | + var player = $.AudioPlayer; | |
| 13 | 14 | |
| 14 | 15 | // 根据不同的角色渲染页面 |
| 15 | 16 | if(_role == 1){ |
| ... | ... | @@ -38,7 +39,9 @@ $(function(){ |
| 38 | 39 | isgblibreplay: 0, |
| 39 | 40 | continue_recording: 0, //是否继续自动保`存的录制 |
| 40 | 41 | recording_status: 1, //当前是否在录制 |
| 41 | - isRcording: 0, // 判断当前是否在录制 0:未录制 1:录制中 | |
| 42 | + times: 0, // 播放次数 | |
| 43 | + isPause: 1, // 是否暂停 1:不暂停,0:暂停 | |
| 44 | + isRcording: 0, // 是否录制 1:录制中,0:暂停中 | |
| 42 | 45 | recordinit: function(codereplaytype, preload) { |
| 43 | 46 | /* #STRAT:生成CodeMirror Editor for JS/CSS/HTML */ |
| 44 | 47 | var htmlid = document.getElementById('HTMLeditor'), |
| ... | ... | @@ -377,8 +380,6 @@ $(function(){ |
| 377 | 380 | compileMode(langid); |
| 378 | 381 | |
| 379 | 382 | $("#play_audio").attr('src', "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl); |
| 380 | - | |
| 381 | - var player = $.AudioPlayer; | |
| 382 | 383 | player.init({ |
| 383 | 384 | container: '#audioWrap' |
| 384 | 385 | ,source: "http://gxb-file.oss-cn-beijing.aliyuncs.com/" + coderecords.audioUrl |
| ... | ... | @@ -386,36 +387,15 @@ $(function(){ |
| 386 | 387 | ,debuggers: false |
| 387 | 388 | ,allowSeek: false |
| 388 | 389 | ,playCallback: function(){ // 播放 |
| 389 | - if (GBCodePlayBack.firstPlay == 0) { | |
| 390 | - $('#readonly').trigger('click'); | |
| 391 | - GBCodePlayBack.htmlplayereditor.setValue(GBCodePlayBack.pauseValue) | |
| 392 | - }else{ | |
| 393 | - GBCodePlayBack.htmlplayereditor.setValue('') | |
| 394 | - var resultData = { | |
| 395 | - output: '', | |
| 396 | - stderr: '', | |
| 397 | - cmpinfo: '', | |
| 398 | - result: 1 | |
| 399 | - }; | |
| 400 | - compileResult(resultData); | |
| 401 | - } | |
| 402 | - | |
| 403 | - playCoder(); | |
| 404 | - // $('#play').trigger('click'); | |
| 390 | + playCode(); | |
| 405 | 391 | } |
| 406 | - ,pauseCallback: function(){ // 暂停 | |
| 407 | - | |
| 408 | - GBCodePlayBack.pauseTime = new Date().getTime(); // 暂停的时间 | |
| 409 | - | |
| 410 | - $('#readonly').trigger('click'); | |
| 411 | - | |
| 392 | + ,pauseCallback: function(){ // 暂停 | |
| 393 | + GBCodePlayBack.audioTime = parseInt(player.elements.audioDom.currentTime*1000) | |
| 394 | + console.log(parseInt(player.elements.audioDom.currentTime*1000)); | |
| 395 | + pauseCode(); | |
| 412 | 396 | GBCodePlayBack.firstPlay = 0; |
| 413 | - | |
| 414 | 397 | GBCodePlayBack.pauseValue = GBCodePlayBack.htmlplayereditor.getValue(); |
| 415 | - | |
| 416 | - // $('#play').trigger('click'); | |
| 417 | - playCoder(); | |
| 418 | - | |
| 398 | + $('#readonly').trigger('click'); | |
| 419 | 399 | } |
| 420 | 400 | ,seekedCallback: function(){} // 拖拽 |
| 421 | 401 | ,endedCallback: function(){ // 结束播放 |
| ... | ... | @@ -923,6 +903,7 @@ $(function(){ |
| 923 | 903 | |
| 924 | 904 | var keepTimer = $('.recording-time').val() |
| 925 | 905 | replaydto.totaltime = parseInt(keepTimer); |
| 906 | + console.log(JSON.stringify(replaydto)); | |
| 926 | 907 | if(_role == 0){ |
| 927 | 908 | replaydto.codeRecordList = recorddatas; |
| 928 | 909 | $.ajax({ |
| ... | ... | @@ -984,8 +965,6 @@ $(function(){ |
| 984 | 965 | $(this).toggleClass('btn-primary').toggleClass('btn-default'); |
| 985 | 966 | GBCodePlayBack.replay_enhancement = !GBCodePlayBack.replay_enhancement; |
| 986 | 967 | }); |
| 987 | - | |
| 988 | - | |
| 989 | 968 | |
| 990 | 969 | // 进度条滚动控制播放进度 |
| 991 | 970 | var $sliderpropress = $(".replayprogress"); |
| ... | ... | @@ -1152,16 +1131,15 @@ $(function(){ |
| 1152 | 1131 | |
| 1153 | 1132 | this.resizeWindow($('#ifrcontainer').find('#resultiframe')); |
| 1154 | 1133 | |
| 1155 | - // $(window).bind('beforeunload', function(){ | |
| 1156 | - | |
| 1157 | - // return '确认立刻退出? 请确保已录制的代码回放以保存,以防回放数据丢失'; | |
| 1158 | - | |
| 1159 | - // }); | |
| 1134 | + if (document.URL.indexOf('index.htm')>=0) { | |
| 1135 | + $(window).bind('beforeunload', function(){ | |
| 1136 | + return '确认立刻退出? 请确保已录制的代码回放以保存,以防回放数据丢失'; | |
| 1137 | + }); | |
| 1138 | + } | |
| 1160 | 1139 | |
| 1161 | 1140 | /* 解决Chrome浏览器非激活标签页下错乱问题 */ |
| 1162 | 1141 | (function() { |
| 1163 | - var hidden = "hidden"; | |
| 1164 | - | |
| 1142 | + var hidden = "hidden"; | |
| 1165 | 1143 | // Standards: |
| 1166 | 1144 | if (hidden in document) |
| 1167 | 1145 | document.addEventListener("visibilitychange", onchange); |
| ... | ... | @@ -1190,13 +1168,11 @@ $(function(){ |
| 1190 | 1168 | }else{ |
| 1191 | 1169 | document.body.className = this[hidden] ? "hidden" : "visible"; |
| 1192 | 1170 | } |
| 1193 | - | |
| 1194 | 1171 | /* Bugfix: Mobile Firefox has a bug here, when loading page it shows blur */ |
| 1195 | - | |
| 1196 | 1172 | if(document.body.className==='hidden'){ |
| 1197 | - if($('#play').data('status')==1){ | |
| 1198 | - $('#play').trigger('click'); | |
| 1199 | - } | |
| 1173 | + // player.pauseCallback(); | |
| 1174 | + // pauseCode() | |
| 1175 | + | |
| 1200 | 1176 | } |
| 1201 | 1177 | } |
| 1202 | 1178 | // set the initial state |
| ... | ... | @@ -1293,6 +1269,7 @@ $(function(){ |
| 1293 | 1269 | |
| 1294 | 1270 | record.trigger = 1; //标记已运行 |
| 1295 | 1271 | record.playTime = new Date().getTime(); // 播放开始时间 |
| 1272 | + GBCodePlayBack.codeTimes = 1; // | |
| 1296 | 1273 | |
| 1297 | 1274 | var resultData = { |
| 1298 | 1275 | output: record.output || '', |
| ... | ... | @@ -1425,7 +1402,7 @@ $(function(){ |
| 1425 | 1402 | |
| 1426 | 1403 | // 开始录制 |
| 1427 | 1404 | $('#start-recording').click(function(){ |
| 1428 | - GBCodePlayBack.isRcording = 1; | |
| 1405 | + $('#recordertab a:eq(0)').tab('show'); | |
| 1429 | 1406 | // 编译状态 |
| 1430 | 1407 | var data = $(this).attr('data'); |
| 1431 | 1408 | var seconds = 0; |
| ... | ... | @@ -1438,6 +1415,7 @@ $(function(){ |
| 1438 | 1415 | }; |
| 1439 | 1416 | runResult() |
| 1440 | 1417 | if(data == 1){ |
| 1418 | + GBCodePlayBack.isRcording = 1; | |
| 1441 | 1419 | $("#countdown").find('img').attr('src', 'img/ready-go.gif'); |
| 1442 | 1420 | $("#countdown").find('img').load(function(){ |
| 1443 | 1421 | var countdown = setInterval(function(){ |
| ... | ... | @@ -1450,6 +1428,8 @@ $(function(){ |
| 1450 | 1428 | },1000); |
| 1451 | 1429 | }) |
| 1452 | 1430 | }else{ |
| 1431 | + GBCodePlayBack.isRcording = 0; | |
| 1432 | + GBCodePlayBack.htmleditor.setOption('readOnly', true); | |
| 1453 | 1433 | $("#countdown").hide(); |
| 1454 | 1434 | $("#re-recoding").show(); |
| 1455 | 1435 | $("#start-recording").hide(); |
| ... | ... | @@ -1489,8 +1469,6 @@ $(function(){ |
| 1489 | 1469 | runResult() |
| 1490 | 1470 | }); |
| 1491 | 1471 | |
| 1492 | - | |
| 1493 | - | |
| 1494 | 1472 | // 使用服务端编译语言 |
| 1495 | 1473 | $('#comprunbtngrp').unbind("click").on('click', '#comprun', function(event){ |
| 1496 | 1474 | event.preventDefault(); |
| ... | ... | @@ -1498,23 +1476,59 @@ $(function(){ |
| 1498 | 1476 | $('#comprun').find('ladda-spinner').remove(); |
| 1499 | 1477 | l.start(); |
| 1500 | 1478 | |
| 1501 | - // 是否在录制录制 | |
| 1502 | - if(!GBCodePlayBack.isRcording){ | |
| 1503 | - compileRun(l); | |
| 1504 | - }else{ | |
| 1505 | - timerRecord(); | |
| 1506 | - pushRecords(); | |
| 1507 | - compileRun(l); | |
| 1508 | - } | |
| 1509 | - | |
| 1479 | + if (!GBCodePlayBack.isRcording) { | |
| 1480 | + compileRun(l) | |
| 1481 | + }else{ | |
| 1482 | + var runStatus = $("#comprun").data('run'); | |
| 1483 | + if (runStatus == 1) { | |
| 1484 | + Hourglass.pauseTimer(); // 暂停计时器 | |
| 1485 | + recorder.pause(); // 音频暂停 | |
| 1486 | + } | |
| 1487 | + $("#comprun").data('run', 0); | |
| 1488 | + $('.compile-loading').show(); | |
| 1489 | + console.log($("#comprun").data('run')); | |
| 1490 | + // 暂停录制 | |
| 1491 | + var pauseState = $('#pause').data('pause'); | |
| 1492 | + if (pauseState == 1 && _role == 0) { | |
| 1493 | + GBCodePlayBack.record_pause_time = new Date().getTime(); // 暂停的时间 | |
| 1494 | + var recordobj = { | |
| 1495 | + intervaltime: GBCodePlayBack.record_pause_time - GBCodePlayBack.record_startime, | |
| 1496 | + editor: 'html', | |
| 1497 | + changeobj: { | |
| 1498 | + from: { | |
| 1499 | + ch: 0, | |
| 1500 | + line: 0, | |
| 1501 | + }, | |
| 1502 | + text: '', | |
| 1503 | + to: { | |
| 1504 | + ch: 0, | |
| 1505 | + line: 0, | |
| 1506 | + } | |
| 1507 | + }, | |
| 1508 | + trigger: 0, | |
| 1509 | + playTime: 0 | |
| 1510 | + }; | |
| 1511 | + GBCodePlayBack.records.push(recordobj); | |
| 1512 | + console.log(GBCodePlayBack.records); | |
| 1513 | + | |
| 1514 | + $('#pause').data('status', '1'); | |
| 1515 | + $('#pause').data('pause', '0'); | |
| 1516 | + $('#pause').removeClass('hidden').addClass('show'); | |
| 1517 | + $('#start-recording').hide(); | |
| 1518 | + | |
| 1519 | + $('.pause-shodow').removeClass('hidden').addClass('show'); | |
| 1520 | + console.log('0000---1111') | |
| 1521 | + } | |
| 1522 | + compileRun(l) | |
| 1523 | + } | |
| 1510 | 1524 | }); |
| 1511 | 1525 | |
| 1512 | 1526 | |
| 1513 | 1527 | // 保存编译结果 |
| 1514 | 1528 | $('#save_compile').unbind("click").click(function(){ |
| 1515 | 1529 | var length = GBCodePlayBack.records.length - 1; |
| 1516 | - Hourglass.pauseTimer(); | |
| 1517 | - $("#comprun").data('run', 1); | |
| 1530 | + recodingConf() | |
| 1531 | + | |
| 1518 | 1532 | GBCodePlayBack.records[length].compile = GBCodePlayBack.compileResultData; |
| 1519 | 1533 | |
| 1520 | 1534 | GBCodePlayBack.records[length].output = GBCodePlayBack.compileResultData.output; |
| ... | ... | @@ -1522,70 +1536,48 @@ $(function(){ |
| 1522 | 1536 | GBCodePlayBack.records[length].cmpinfo = GBCodePlayBack.compileResultData.cmpinfo; |
| 1523 | 1537 | GBCodePlayBack.records[length].result = GBCodePlayBack.compileResultData.result; |
| 1524 | 1538 | |
| 1525 | - GBCodePlayBack.record_continue_time = new Date().getTime(); | |
| 1526 | - | |
| 1527 | 1539 | contrlPause(); |
| 1528 | - | |
| 1529 | 1540 | }) |
| 1530 | 1541 | |
| 1531 | 1542 | // 不保存编译结果 |
| 1532 | 1543 | $('#cancel_compile').unbind('click').click(function(){ |
| 1533 | - Hourglass.pauseTimer(); | |
| 1534 | - $("#comprun").data('run', 1); | |
| 1544 | + recodingConf() | |
| 1535 | 1545 | contrlPause() |
| 1536 | - GBCodePlayBack.record_continue_time = new Date().getTime(); | |
| 1537 | 1546 | }) |
| 1538 | 1547 | |
| 1539 | - // 暂停计时、暂停录音 | |
| 1540 | - function timerRecord(){ | |
| 1541 | - var runStatus = $("#comprun").data('run'); | |
| 1542 | - if(runStatus == 1){ | |
| 1543 | - Hourglass.pauseTimer(); // 暂停计时器 | |
| 1544 | - recorder.pause(); // 音频暂停 | |
| 1545 | - } | |
| 1548 | + // 继续录制配置 | |
| 1549 | + function recodingConf(){ | |
| 1550 | + Hourglass.pauseTimer(); | |
| 1551 | + $("#comprun").data('run', 1); | |
| 1552 | + GBCodePlayBack.record_startime = new Date().getTime(); | |
| 1553 | + GBCodePlayBack.record_continue_time = new Date().getTime(); | |
| 1546 | 1554 | } |
| 1547 | 1555 | |
| 1548 | - // 禁止编写代码,添加遮罩 | |
| 1549 | - function showMask(){ | |
| 1550 | - $('#pause').data('status', '1'); | |
| 1551 | - $('#pause').data('pause', '0'); | |
| 1552 | - $('#pause').removeClass('hidden').addClass('show'); | |
| 1553 | - $('#start-recording').hide(); | |
| 1554 | - | |
| 1555 | - $('.pause-shodow').removeClass('hidden').addClass('show'); | |
| 1556 | + // 切换自动/手动运行代码 | |
| 1557 | + function autoRun(autorun){ | |
| 1558 | + if(autorun===1){ | |
| 1559 | + $('#runnow').prop('disabled',false).html('手动运行').attr('data-original-title', '手动运行'); | |
| 1560 | + }else{ | |
| 1561 | + $('#runnow').prop('disabled',true).html('自动运行').attr('data-original-title', '自动运行'); | |
| 1562 | + } | |
| 1556 | 1563 | } |
| 1557 | 1564 | |
| 1558 | - // 给数组插入一个元素 | |
| 1559 | - function pushRecords(){ | |
| 1560 | - // 暂停录制 | |
| 1561 | - var pauseState = $('#pause').data('pause'); | |
| 1562 | - if(pauseState == 1 && _role == 0){ | |
| 1563 | - GBCodePlayBack.record_pause_time = new Date().getTime(); // 暂停的时间 | |
| 1564 | - var recordobj = { | |
| 1565 | - intervaltime: GBCodePlayBack.record_pause_time - GBCodePlayBack.record_startime, | |
| 1566 | - editor: 'html', | |
| 1567 | - changeobj: { | |
| 1568 | - from:{ | |
| 1569 | - ch: 0, | |
| 1570 | - line: 0, | |
| 1571 | - }, | |
| 1572 | - text: '', | |
| 1573 | - to:{ | |
| 1574 | - ch: 0, | |
| 1575 | - line: 0, | |
| 1576 | - } | |
| 1577 | - }, | |
| 1578 | - trigger: 0, | |
| 1579 | - playTime: 0 | |
| 1580 | - }; | |
| 1581 | - GBCodePlayBack.records.push(recordobj); | |
| 1582 | - showMask(); | |
| 1565 | + // 编译结果 | |
| 1566 | + function runResult(){ | |
| 1567 | + if(typeof GBCodePlayBack.htmleditor !== 'undefined'){ | |
| 1568 | + GBCodePlayBack.generateResult(GBCodePlayBack.htmleditor.getValue()); | |
| 1569 | + return false; | |
| 1570 | + } | |
| 1571 | + if(typeof GBCodePlayBack.htmlplayereditor !== 'undefined'){ | |
| 1572 | + GBCodePlayBack.generateResult(GBCodePlayBack.htmlplayereditor.getValue()); | |
| 1583 | 1573 | } |
| 1584 | 1574 | } |
| 1585 | 1575 | |
| 1586 | - // 编译 | |
| 1576 | + | |
| 1577 | + // 云编译 | |
| 1587 | 1578 | function compileRun(l){ |
| 1588 | - var code = (typeof GBCodePlayBack.htmleditor !=='undefined' && GBCodePlayBack.htmleditor.getValue()) || (typeof GBCodePlayBack.htmlplayereditor !=='undefined' && GBCodePlayBack.htmlplayereditor.getValue()); | |
| 1579 | + var code = (typeof GBCodePlayBack.htmleditor !=='undefined' && GBCodePlayBack.htmleditor.getValue()) | |
| 1580 | + || (typeof GBCodePlayBack.htmlplayereditor !=='undefined' && GBCodePlayBack.htmlplayereditor.getValue()); | |
| 1589 | 1581 | var langid = $('#htmlbutton').data("languageid"); |
| 1590 | 1582 | var input = $('#input').val() || ''; |
| 1591 | 1583 | var compileData = { |
| ... | ... | @@ -1615,27 +1607,6 @@ $(function(){ |
| 1615 | 1607 | }); |
| 1616 | 1608 | } |
| 1617 | 1609 | |
| 1618 | - // 切换自动/手动运行代码 | |
| 1619 | - function autoRun(autorun){ | |
| 1620 | - if(autorun===1){ | |
| 1621 | - $('#runnow').prop('disabled',false).html('手动运行').attr('data-original-title', '手动运行'); | |
| 1622 | - }else{ | |
| 1623 | - $('#runnow').prop('disabled',true).html('自动运行').attr('data-original-title', '自动运行'); | |
| 1624 | - } | |
| 1625 | - } | |
| 1626 | - | |
| 1627 | - // 编译结果 | |
| 1628 | - function runResult(){ | |
| 1629 | - if(typeof GBCodePlayBack.htmleditor !== 'undefined'){ | |
| 1630 | - GBCodePlayBack.generateResult(GBCodePlayBack.htmleditor.getValue()); | |
| 1631 | - return false; | |
| 1632 | - } | |
| 1633 | - if(typeof GBCodePlayBack.htmlplayereditor !== 'undefined'){ | |
| 1634 | - GBCodePlayBack.generateResult(GBCodePlayBack.htmlplayereditor.getValue()); | |
| 1635 | - } | |
| 1636 | - } | |
| 1637 | - | |
| 1638 | - | |
| 1639 | 1610 | // 初始化页面 |
| 1640 | 1611 | function initRecoding(){ |
| 1641 | 1612 | GBCodePlayBack.recordinit(); |
| ... | ... | @@ -1784,60 +1755,61 @@ $(function(){ |
| 1784 | 1755 | } |
| 1785 | 1756 | |
| 1786 | 1757 | // 播发代码 |
| 1787 | - function playCoder() { | |
| 1788 | - | |
| 1789 | - $('#recordertab a:eq(1)').tab('show'); | |
| 1790 | - | |
| 1791 | - var playstatus = $('#play').data('status'); | |
| 1792 | - if (!playstatus) { | |
| 1793 | - var playbackrecord = GBCodePlayBack.records; | |
| 1794 | - var starttime = playbackrecord[0].intervaltime; | |
| 1795 | - | |
| 1796 | - for (var i = 0; i < playbackrecord.length; i++) { | |
| 1797 | - if (playbackrecord[i].trigger === 0) { | |
| 1798 | - var timeoutcontroller = null; | |
| 1799 | - var replayinterval = playbackrecord[i].intervaltime, | |
| 1800 | - replay_enhancement_interval = GBCodePlayBack.replay_enhancement_value; | |
| 1801 | - | |
| 1802 | - if (i === 0) { | |
| 1803 | - starttime = replayinterval; | |
| 1804 | - if (GBCodePlayBack.pauseTime) { | |
| 1805 | - if (tag === 1) { | |
| 1806 | - GBCodePlayBack.stopIntervalTime = playbackrecord[0].intervaltime - (GBCodePlayBack.pauseTime - GBCodePlayBack.playRecordStart); | |
| 1807 | - starttime = GBCodePlayBack.stopIntervalTime; | |
| 1808 | - tag++; | |
| 1809 | - } else { | |
| 1810 | - GBCodePlayBack.stopIntervalTime = GBCodePlayBack.stopIntervalTime - (GBCodePlayBack.pauseTime - GBCodePlayBack.playRecordStart); | |
| 1811 | - starttime = GBCodePlayBack.stopIntervalTime; | |
| 1812 | - } | |
| 1813 | - } | |
| 1814 | - } else { | |
| 1815 | - starttime = parseInt(starttime) + parseInt(replayinterval); | |
| 1816 | - | |
| 1817 | - if (GBCodePlayBack.pauseTime && GBCodePlayBack.pauseTime - playbackrecord[i - 1].playTime > 0) { | |
| 1818 | - GBCodePlayBack.stopIntervalTime = GBCodePlayBack.pauseTime - playbackrecord[i - 1].playTime; | |
| 1819 | - starttime = GBCodePlayBack.stopIntervalTime + parseInt(replayinterval); | |
| 1820 | - } | |
| 1821 | - } | |
| 1822 | - timeoutcontroller = setTimeout(GBCodePlayBack.changeValueCallback(playbackrecord[i]), starttime); | |
| 1823 | - GBCodePlayBack.recordtimeoutcontrolls.push(timeoutcontroller); | |
| 1824 | - } | |
| 1825 | - } | |
| 1826 | - // 记录播放的时间 | |
| 1827 | - GBCodePlayBack.playRecordStart = new Date().getTime(); | |
| 1828 | - } else { | |
| 1829 | - var recordtimeoutcontrolls = GBCodePlayBack.recordtimeoutcontrolls; | |
| 1758 | + function playCode(){ | |
| 1759 | + if (GBCodePlayBack.firstPlay == 0) { | |
| 1760 | + $('#readonly').trigger('click'); | |
| 1761 | + GBCodePlayBack.htmlplayereditor.setValue(GBCodePlayBack.pauseValue) | |
| 1762 | + }else{ | |
| 1763 | + GBCodePlayBack.htmlplayereditor.setValue('') | |
| 1764 | + var resultData = { | |
| 1765 | + output: '', | |
| 1766 | + stderr: '', | |
| 1767 | + cmpinfo: '', | |
| 1768 | + result: 1 | |
| 1769 | + }; | |
| 1770 | + compileResult(resultData); | |
| 1771 | + } | |
| 1830 | 1772 | |
| 1831 | - for (var i = 0; i < recordtimeoutcontrolls.length; i++) { | |
| 1832 | - clearTimeout(recordtimeoutcontrolls[i]); | |
| 1833 | - } | |
| 1834 | - GBCodePlayBack.recordtimeoutcontrolls = []; | |
| 1835 | - GBCodePlayBack.recordtimeouts = []; | |
| 1836 | - } | |
| 1837 | - $('#play').data('status', !playstatus); | |
| 1773 | + var playbackrecord = GBCodePlayBack.records; | |
| 1774 | + var starttime = 0; | |
| 1775 | + var playTotalTime = 0; | |
| 1776 | + | |
| 1777 | + console.log(playbackrecord) | |
| 1778 | + for (var i = 0; i < playbackrecord.length; i++) { | |
| 1779 | + if (playbackrecord[i].trigger === 1) { | |
| 1780 | + playTotalTime += parseInt(playbackrecord[i].intervaltime); | |
| 1781 | + }else if (playbackrecord[i].trigger === 0) { | |
| 1782 | + var timeoutcontroller = null; | |
| 1783 | + var replayinterval = playbackrecord[i].intervaltime; | |
| 1784 | + | |
| 1785 | + if (!GBCodePlayBack.isPause) { | |
| 1786 | + starttime = replayinterval - (GBCodePlayBack.audioTime - playTotalTime); | |
| 1787 | + GBCodePlayBack.isPause = 1 | |
| 1788 | + }else{ | |
| 1789 | + if (i == 0) { | |
| 1790 | + starttime = replayinterval; | |
| 1791 | + }else{ | |
| 1792 | + starttime = parseInt(starttime) + parseInt(replayinterval); | |
| 1793 | + } | |
| 1794 | + } | |
| 1795 | + console.log(starttime); | |
| 1796 | + timeoutcontroller = setTimeout(GBCodePlayBack.changeValueCallback(playbackrecord[i]), starttime/GBCodePlayBack.speed); | |
| 1797 | + GBCodePlayBack.recordtimeoutcontrolls.push(timeoutcontroller); | |
| 1798 | + } | |
| 1799 | + } | |
| 1800 | + console.log(GBCodePlayBack.recordtimeoutcontrolls); | |
| 1838 | 1801 | } |
| 1839 | 1802 | |
| 1803 | + function pauseCode(){ | |
| 1804 | + var recordtimeoutcontrolls = GBCodePlayBack.recordtimeoutcontrolls; | |
| 1805 | + GBCodePlayBack.isPause = 0; | |
| 1840 | 1806 | |
| 1807 | + for (var i = 0; i < recordtimeoutcontrolls.length; i++) { | |
| 1808 | + clearTimeout(recordtimeoutcontrolls[i]); | |
| 1809 | + } | |
| 1810 | + GBCodePlayBack.recordtimeoutcontrolls = []; | |
| 1811 | + GBCodePlayBack.recordtimeouts = []; | |
| 1812 | + } | |
| 1841 | 1813 | |
| 1842 | 1814 | |
| 1843 | 1815 | var htmlhlLine = null, |
| ... | ... | @@ -1908,6 +1880,12 @@ $(function(){ |
| 1908 | 1880 | |
| 1909 | 1881 | function selectLang(langid){ |
| 1910 | 1882 | switch (langid) { |
| 1883 | + case 1: | |
| 1884 | + $('#htmlbutton').data('languageid', 1).html("C++").trigger('click'); | |
| 1885 | + break; | |
| 1886 | + case 42: | |
| 1887 | + $('#htmlbutton').data('languageid', 42).html("C++").trigger('click'); | |
| 1888 | + break; | |
| 1911 | 1889 | case 10: |
| 1912 | 1890 | $('#htmlbutton').data('languageid', 10).html("JAVA").trigger('click'); |
| 1913 | 1891 | break; |
| ... | ... | @@ -1970,7 +1948,7 @@ $(function(){ |
| 1970 | 1948 | } |
| 1971 | 1949 | |
| 1972 | 1950 | GBCodePlayBack.firstPlay = 1; |
| 1973 | - | |
| 1951 | + console.log(GBCodePlayBack.records); | |
| 1974 | 1952 | /* 初始化播放 */ |
| 1975 | 1953 | $('#play').data('status', 0); |
| 1976 | 1954 | for (var i = 0; i < GBCodePlayBack.records.length; i++) { | ... | ... |
src/js/recorder/Myna.js
| ... | ... | @@ -221,6 +221,7 @@ |
| 221 | 221 | coment_size: 0, |
| 222 | 222 | errorNum: 0 |
| 223 | 223 | } |
| 224 | + console.log(obj); | |
| 224 | 225 | uploadArr.push(obj) |
| 225 | 226 | for (var partIndex = 0; partIndex < parts.total_num; partIndex++) { |
| 226 | 227 | var partItem = parts.multi_list[partIndex]; |
| ... | ... | @@ -260,13 +261,13 @@ |
| 260 | 261 | |
| 261 | 262 | var headers = { 'x-amz-acl': 'public-read' } |
| 262 | 263 | if (isMultiPart == true) { |
| 263 | - headers = { 'Access-Control-Allow-Origin': "http://" + window.location.host } | |
| 264 | + headers = { 'Access-Control-Allow-Origin': "https://" + window.location.host } | |
| 264 | 265 | } else { |
| 265 | 266 | headers = { 'x-amz-acl': 'public-read' } |
| 266 | 267 | } |
| 267 | 268 | console.log(url); |
| 268 | 269 | |
| 269 | - url = 'https' + url.split('http')[1]; | |
| 270 | + url = 'https' + url.split('https')[1]; | |
| 270 | 271 | $.ajax({ |
| 271 | 272 | url: url, |
| 272 | 273 | type: 'PUT', | ... | ... |