codemirror pkg + fs/THREE.js
This commit is contained in:
parent
301cad8398
commit
dc3fe69bc8
|
@ -26,7 +26,7 @@
|
|||
::sysinit:/etc/init.d/rcS
|
||||
|
||||
# Put a getty on the serial port
|
||||
console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL
|
||||
#console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL
|
||||
#console::respawn:-/bin/sh # vga console
|
||||
|
||||
# Auto-login as root on ttyS0
|
||||
|
|
|
@ -56,8 +56,9 @@ test -d /dev/browser || {
|
|||
}
|
||||
|
||||
setup_mounts(){
|
||||
mkdir /mnt/helloworld
|
||||
mkdir /mnt/helloworld /mnt/THREE
|
||||
fusescript /root/fs/helloworld /mnt/helloworld
|
||||
fusescript /root/fs/THREE.js /mnt/THREE
|
||||
}
|
||||
|
||||
modprobe fuse # load fuse
|
||||
|
|
|
@ -9,6 +9,11 @@ alias make="mim"
|
|||
|
||||
# minimalist autoenv version [https://github.com/hyperupcall/autoenv]
|
||||
cd(){
|
||||
dir_cur=$(pwd)
|
||||
ignore=0
|
||||
test "${dir_cur:0:4}" = /mnt && ignore=1
|
||||
test "${1:0:4}" = /mnt && ignore=1
|
||||
test "$ignore" = 1 && { command cd ${1:+"$@"}; return 1; }
|
||||
test -f $(pwd)/.env.leave && source $(pwd)/.env.leave # cleanup environment
|
||||
command cd ${1:+"$@"} && {
|
||||
hook cd "$@"
|
||||
|
|
|
@ -2,3 +2,6 @@
|
|||
msg = args.join(' ')
|
||||
console.log(msg)
|
||||
//alert(msg)
|
||||
|
||||
const term = document.querySelector('[isoterminal]').components.isoterminal.term
|
||||
term.exec("logger bin/helloworld.js "+msg)
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/js
|
||||
|
||||
// Function to handle getattr command
|
||||
function getattr(path,obj) {
|
||||
let size = 1
|
||||
if (path === '/' || path.match(/\/[0-9]+$/) ) {
|
||||
return "16877 2 1000 1000 4096 8\n"
|
||||
} else {
|
||||
return `33188 1 1000 1000 ${size} 1\n`
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function getPath(str){
|
||||
const scene = document.querySelector('a-scene').object3D
|
||||
const path = str.split("/")
|
||||
const name = path.pop()
|
||||
const parent = path.pop()
|
||||
let obj = name == ""
|
||||
? scene
|
||||
: scene.getObjectById( parseInt(name.substr(1)) )
|
||||
const propvalue = ""
|
||||
if( obj && obj[ name ] ) propvalue = obj[name]
|
||||
return {obj,propname:name,propvalue}
|
||||
}
|
||||
|
||||
// Main function to handle commands
|
||||
function main(args) {
|
||||
console.log( 'fs/THREE '+args.join(' ') )
|
||||
let children = ''
|
||||
let props = ['name','uuid','position','rotation']
|
||||
|
||||
|
||||
switch (args[0]) {
|
||||
case 'readdir':{
|
||||
const {obj,propvalue,propname} = getPath( args[1] )
|
||||
if( obj && obj.children ){
|
||||
children = obj.children.map( (n) => n.name || n.id )
|
||||
.join("\n")
|
||||
}
|
||||
return `${children}\n${props.join('\n')}\n`
|
||||
break;
|
||||
}
|
||||
|
||||
case 'getattr':{
|
||||
const {obj,propvalue,propname} = getPath( args[1] )
|
||||
return getattr(args[1],{args,obj,propvalue,propname});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'read':{
|
||||
const {propvalue,propname} = getPath( args[1] )
|
||||
return propvalue;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
// Run the main function
|
||||
return main(args.slice(1));
|
||||
|
|
@ -5,4 +5,4 @@ me="$(dirname $(readlink -f $0))"
|
|||
file="$(readlink -f "$1")"
|
||||
|
||||
$me/codemirror.js "$file"
|
||||
echo "press ctrl-X to exit editor"
|
||||
echo "press ctrl-Q to exit editor"
|
||||
|
|
|
@ -88,7 +88,7 @@ AFRAME.registerComponent('codemirror', {
|
|||
})
|
||||
this.editor.setOption("theme", "shadowfox")
|
||||
this.editor.setOption("extraKeys", {
|
||||
"Ctrl-X": (cm) => {
|
||||
"Ctrl-Q": (cm) => {
|
||||
this.el.emit('close',true) // window.js will react accordingly
|
||||
}
|
||||
})
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue