diff --git a/links/main.css b/links/main.css index 908fe1a..a9fd84b 100644 --- a/links/main.css +++ b/links/main.css @@ -15,6 +15,7 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_medium" #terminal input:focus { color:#fff; } #terminal #logs { position:fixed; bottom:30px; border-bottom:1px solid #222; } +#terminal #logs .module { font-family: 'input_mono_regular'; color:red; } #terminal #widget { text-align: right} #terminal #widget .mouse { color:white; } diff --git a/presets/default.rin b/presets/default.rin index 15eb23b..4605975 100644 --- a/presets/default.rin +++ b/presets/default.rin @@ -1,4 +1,3 @@ -~ Setup frame.resize 300x300 frame.select main @@ -12,3 +11,4 @@ type:color white type.write 38,262 "RONIN" type.write 38,252 "B07" brush:color #000000 +brush:size 10 diff --git a/scripts/core/init.js b/scripts/core/init.js index 0c559d4..b4ff873 100644 --- a/scripts/core/init.js +++ b/scripts/core/init.js @@ -24,6 +24,4 @@ ronin.install(); var target_file = window.location.hash ? window.location.hash : "default"; target_file = target_file.substr(1,target_file.length-1); -ronin.start(); - -// ronin.terminal.load(window.location.hash ? target_file+".rin" : "default.rin"); \ No newline at end of file +ronin.start(window.location.hash ? target_file+".rin" : "default.rin"); \ No newline at end of file diff --git a/scripts/core/ronin.js b/scripts/core/ronin.js index 3daeb43..a2afa3f 100644 --- a/scripts/core/ronin.js +++ b/scripts/core/ronin.js @@ -47,11 +47,12 @@ function Ronin() this.widget.install(); } - this.start = function() + this.start = function(target_file) { ronin.terminal.update(); ronin.widget.update(); ronin.terminal.input.focus(); + ronin.load(target_file); } this.cursors = []; @@ -81,4 +82,27 @@ function Ronin() this.on_resize = function() { } + + this.filename = "default.rin"; + + this.load = function readTextFile(name) + { + this.filename = name; + var file = "presets/"+name+'?'+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.run_multi(allText.split("\n").join(";")); + } + } + } + rawFile.send(null); + ronin.widget.update(); + } } \ No newline at end of file diff --git a/scripts/modules/terminal.js b/scripts/modules/terminal.js index 4283b2d..13a0e12 100644 --- a/scripts/modules/terminal.js +++ b/scripts/modules/terminal.js @@ -27,20 +27,20 @@ function Terminal(rune) this.hint_element.innerHTML = ""; } - this.run = function() + this.run = function(target_cmd) { - var command = this.cmd(); + var command = target_cmd ? target_cmd : this.cmd(); var module = command.module(); var method = command.method(); var setting = command.setting(); + console.info(command.content); + if(method){ method.run(command); } - if(setting){ module.settings[setting] = command.values(); - console.log(module.settings) } this.hint_element.innerHTML = ""; this.input.value = ""; @@ -61,6 +61,15 @@ function Terminal(rune) this.input.focus(); } + this.run_multi = function(lines) + { + lines = lines.split(";") + for(id in lines){ + var cmd = new Command(lines[id]); + this.run(cmd); + } + } + this.hint = function(method) { var html = ""; @@ -88,29 +97,6 @@ function Terminal(rune) { return new Command(this.input.value); } - - this.filename = "default.rin"; - - this.load = function readTextFile(name) - { - this.filename = name; - var file = "presets/"+name+'?'+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.input.value = allText; - } - } - } - rawFile.send(null); - ronin.widget.update(); - } } // Log