update demo

This commit is contained in:
Harvey committed 2021-12-08 12:43:34 +08:00
1 parent 95c0887939
commit 3567a487f0
3 files changed
+25 -10

No files matched your search

+4
View File
@@ -136,6 +136,10 @@ img {
background-color: rgb(39, 41, 54);
}
.header .run:hover {
background-color: #2e3350;
}
.main {
display: flex;
flex: 1;
+20 -9
View File
@@ -174,15 +174,7 @@
});
}
window.addEventListener('error', function (err) {
console.error(err);
});
window.addEventListener('unhandledrejection', function (err) {
console.error(err);
});
$run.addEventListener('click', function (e) {
$run.addEventListener('click', function () {
var libs = encodeURIComponent($lib.value);
var code = encodeURIComponent(editor.getValue());
var url = window.location.origin + window.location.pathname + '?libs=' + libs + '&code=' + code;
@@ -195,4 +187,23 @@
this.style.display = 'none';
}
});
window.addEventListener('error', function (err) {
console.error(err);
});
window.addEventListener('unhandledrejection', function (err) {
console.error(err);
});
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();
}
});
})();
+1 -1
View File
@@ -45,7 +45,7 @@
<a class="item" href="./document/">Document</a>
<a class="item" href="https://github.com/zhw2590582/ArtPlayer">Github</a>
</div>
<div class="run">Run Code</div>
<div class="run">▶ Run Code</div>
</header>
<div class="libs">
<textarea class="libsInput"