2024-09-23 17:53:59 +02:00
|
|
|
#!/bin/js
|
|
|
|
|
2024-10-23 18:51:56 +02:00
|
|
|
if( args[1] == undefined ) return "usage: codemirror <file>"
|
2024-09-23 17:53:59 +02:00
|
|
|
|
2024-10-23 18:51:56 +02:00
|
|
|
AFRAME.utils.require({
|
2024-09-23 17:53:59 +02:00
|
|
|
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-09-23 17:53:59 +02:00
|
|
|
})
|
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)
|
|
|
|
})
|
2024-09-23 17:53:59 +02:00
|
|
|
|
|
|
|
return "" // empty stdout(put)
|
|
|
|
|
|
|
|
// for shellscript-equivalent see bin/codemirror
|