This commit is contained in:
Harvey committed 2021-11-24 17:53:45 +08:00
1 parent 932b2005d5
commit 6518c9b213
11 files changed
+101 -683

No files matched your search

@@ -58,3 +58,14 @@ table p {
padding-left: 1rem;
padding-left: var(--ifm-navbar-padding-horizontal);
}
.run-code {
display: inline-block;
padding: 3px 7px;
color: #fff;
border-radius: 3px;
background-color: #25c2a0;
margin-bottom: 10px;
font-size: 14px;
cursor: pointer;
}
@@ -0,0 +1,12 @@
document.addEventListener('click', (event) => {
if (event.target.className === 'run-code') {
event.preventDefault();
const codeElement = event.target.nextElementSibling.querySelector('pre code');
if (codeElement) {
const libs = event.target.dataset.libs || '';
const code = encodeURIComponent(codeElement.innerText);
const url = 'https://artplayer.org/?libs=' + libs + '&code=' + code;
window.open(url);
}
}
});