Starting to implement load .rin files

This commit is contained in:
Devine Lu Linvega 2017-04-05 11:05:49 -10:00
parent 6f99eebeac
commit 27b75ba5cf
5 changed files with 34 additions and 24 deletions

View File

@ -1,8 +1,8 @@
# Ronin
Ronin is a web based drawing application and visual language.
Ronin is my web based drawing tool it's under constant development.
The repository comes with a script that fires Ronin from within Localhost.
Launch Ronin and press **:**(colon) to display the command prompt.
Enjoy
## TODOs

View File

@ -24,4 +24,5 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_medium"
#terminal menu { display: inline-block;position: absolute;bottom: 0px;right: 0px;padding: 0px 5px;font-size: 10px;line-height: 20px;color:white }
#terminal.hide { height:25px; }
#terminal.mini { height:120px; }
#terminal.mini { height:120px; }
#terminal.full { height:100vh; }

View File

@ -0,0 +1,3 @@
frame.select what ;
frame.resize 400x400 ;
brush:color #ff00ff ;

View File

@ -31,10 +31,7 @@ starting_canvas.height = window.innerHeight - 300;
starting_canvas.width = parseInt(starting_canvas.width/40) * 40;
starting_canvas.height = parseInt(starting_canvas.height/40) * 40;
ronin.terminal.query("~ "+ronin.timestamp());
ronin.terminal.query("frame.select main");
ronin.terminal.query("frame.resize "+starting_canvas.render());
ronin.terminal.query("brush:color #ff0000");
ronin.terminal.query("terminal.load default.rin");
ronin.terminal.input_element.focus();
ronin.terminal.update_hint();

View File

@ -11,8 +11,28 @@ function Terminal(rune)
this.history = [];
this.add_method(new Method("save",["text"]));
this.add_method(new Method("load",["path"]));
this.add_method(new Method("display",["mini/hide/full"]));
this.load = function readTextFile(params, preview = false)
{
var file = "presets/"+params.content+'?'+new Date().getTime();
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var allText = rawFile.responseText;
ronin.terminal.query(allText);
}
}
}
rawFile.send(null);
}
this.display = function(params,preview = false)
{
if(preview){ return; }
@ -53,7 +73,11 @@ function Terminal(rune)
this.input_element.value = "";
if(input_str.indexOf(";") > 0){
this.queue = input_str.split(";");
var parts = input_str.replace("\n","").split(";");
for(id in parts){
parts[id] = parts[id].replace("\n","").trim();
}
this.queue = parts;
}
else{
this.queue = [];
@ -66,7 +90,7 @@ function Terminal(rune)
{
if(!ronin.terminal.queue[0]){ console.log("Finished queue"); return; }
console.info(ronin.terminal.queue[0]);
console.info(ronin.terminal.queue[0].trim());
active(ronin.terminal.queue[0].trim());
ronin.terminal.queue.shift();
@ -108,21 +132,6 @@ function Terminal(rune)
else{
ronin.terminal.log(new Log(ronin.terminal,"Unknown module: "+module_name));
}
// var key = content[0];
// var cmd = new Command(content.substring(1).trim().split(" "));
// if(ronin.modules[key]){
// ronin.modules[key].update_settings(cmd);
// ronin.modules[key].run_methods(cmd);
// // ronin.modules[key].active(cmd);
// ronin.terminal.history.push(content);
// ronin.terminal.history_index = ronin.terminal.history.length-1;
// ronin.terminal.update_menu();
// }
// else{
// ronin.terminal.log(new Log(ronin.terminal,"Unknown module: "+key));
// }
}
this.module_name = null;