This commit is contained in:
Harvey Zack committed 2018-11-14 09:25:44 +08:00
1 parent 0f56ffbef8
commit bac873deeb
2 files changed
+10 -12

No files matched your search

+1 -8
View File
@@ -251,14 +251,7 @@ Note: You need to initialize a size for the container element, like:
<td> <td>
Type: <code>object</code><br> Type: <code>object</code><br>
Default:<br> Default:<br>
<code> <code>{'controls': false,'preload': 'auto'}</code><br><br>
{<br>
'controls': false,<br>
'preload': 'auto',<br>
'webkit-playsinline': true,<br>
'playsinline': true<br>
}
</code><br><br>
More video Attributes<br> More video Attributes<br>
</td> </td>
</tr> </tr>
+9 -4
View File
@@ -1,6 +1,7 @@
(function(win) { (function(win) {
var $code = document.querySelector('.code'); var $code = document.querySelector('.code');
var $run = document.querySelector('.run'); var $run = document.querySelector('.run');
var fileCode = '';
consola.creat({ consola.creat({
target: '.console', target: '.console',
@@ -44,8 +45,10 @@
return response.text(); return response.text();
}) })
.then(text => { .then(text => {
mirror.setValue(text.trim()); var code = text.trim();
mirror.setValue(code);
runCode(); runCode();
fileCode = code;
return text; return text;
}) })
.catch(err => { .catch(err => {
@@ -65,9 +68,11 @@
$run.addEventListener('click', function(e) { $run.addEventListener('click', function(e) {
runCode(); runCode();
const code = encodeURIComponent(mirror.getValue()); if (fileCode !== mirror.getValue()) {
const url = window.location.origin + window.location.pathname + '?code=' + code; const code = encodeURIComponent(mirror.getValue());
history.pushState(null, null, url); const url = window.location.origin + window.location.pathname + '?code=' + code;
history.pushState(null, null, url);
}
}); });
win.addEventListener('error', err => { win.addEventListener('error', err => {