update demo

This commit is contained in:
Harvey committed 2021-12-08 14:23:04 +08:00
1 parent 0e0bdd00dd
commit 9e2c725dd1
10 files changed
+17 -1055

No files matched your search

+9 -13
View File
@@ -3,15 +3,11 @@
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
var isIE = /MSIE|Trident/.test(userAgent);
if (isMobile) {
if (isMobile || isIE) {
window.location.href = './mobile.html';
return;
}
if (isIE) {
new VConsole();
}
var $codeMirror = document.querySelector('.codeMirrorWrap');
var $lib = document.querySelector('.libsInput');
var $run = document.querySelector('.run');
@@ -193,16 +189,20 @@
});
}
$run.addEventListener('click', function () {
function restart() {
var libs = encodeURIComponent($lib.value);
var code = encodeURIComponent(editor.getValue());
var url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
history.pushState(null, null, url);
initApp();
}
$run.addEventListener('click', function () {
restart();
});
$popups.addEventListener('click', function (e) {
if (e.target === this) {
$popups.addEventListener('click', function (event) {
if (event.target === this) {
this.style.display = 'none';
}
});
@@ -218,11 +218,7 @@
document.addEventListener('keydown', function (event) {
if ((event.ctrlKey || event.metaKey) && event.key === 's') {
event.preventDefault();
var libs = encodeURIComponent($lib.value);
var code = encodeURIComponent(editor.getValue());
var url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
history.pushState(null, null, url);
initApp();
restart();
}
});
})();