diff --git a/docs/assets/css/style.css b/docs/assets/css/style.css index 9a78e8a31..ea3453950 100644 --- a/docs/assets/css/style.css +++ b/docs/assets/css/style.css @@ -136,6 +136,10 @@ img { background-color: rgb(39, 41, 54); } +.header .run:hover { + background-color: #2e3350; +} + .main { display: flex; flex: 1; diff --git a/docs/assets/js/common.js b/docs/assets/js/common.js index 8e359d68a..319182606 100644 --- a/docs/assets/js/common.js +++ b/docs/assets/js/common.js @@ -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(); + } + }); })(); diff --git a/docs/index.html b/docs/index.html index 4771a772e..fd4369ba3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -45,7 +45,7 @@ Document Github -
Run Code
+
▶ Run Code