mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-11 22:06:17 -08:00
new docs init
This commit is contained in:
1 parent
f04493a8fa
commit
f2947edacb
36 files changed
+14
-4651
No files matched your search
@@ -0,0 +1,25 @@
|
||||
(function () {
|
||||
window.runCode = function(hook) {
|
||||
hook.ready(function() {
|
||||
Array.from(document.querySelectorAll('.markdown-section a'))
|
||||
.filter(function(item) {
|
||||
return item.innerHTML === 'Run Code';
|
||||
})
|
||||
.forEach(function(item) {
|
||||
item.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
var codeElement = item.parentElement.nextElementSibling;
|
||||
if (
|
||||
codeElement.tagName === 'PRE' &&
|
||||
codeElement.dataset.lang === 'js'
|
||||
) {
|
||||
var libs = item.href.split('/lib=')[1] || '';
|
||||
var code = encodeURIComponent(codeElement.innerText);
|
||||
var url = 'https://artplayer.org/lab/?libs=' + libs + '&code=' + code;
|
||||
window.open(url);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
})();
|
||||
Reference in new issue
Block a user