xrsh-buildroot/buildroot-v86/board/v86/rootfs_overlay/root/bin/codemirror

27 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/js
2024-10-23 18:51:56 +02:00
if( args[1] == undefined ) return "usage: codemirror <file>"
2024-10-23 18:51:56 +02:00
AFRAME.utils.require({
codemirrorjs: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.1/codemirror.js",
codemirrorcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/codemirror.css",
cmtheme: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/theme/shadowfox.css"
2024-10-23 18:51:56 +02:00
})
.then( () => AFRAME.utils.require({
cmxml: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/xml/xml.js",
cmjavascript: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/javascript/javascript.js",
cmcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/css/css.js",
highlight: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/htmlmixed/htmlmixed.js",
codemirrorAF: "com/codemirror.js"
})
2024-10-23 18:51:56 +02:00
)
.then( () => {
let el = document.createElement("a-entity")
el.setAttribute("codemirror", `file: ${args[1]}`)
document.querySelector("a-scene").appendChild(el)
})
return "" // empty stdout(put)
// for shellscript-equivalent see bin/codemirror