diff --git a/sources/index.html b/sources/index.html index 5f14b02..4cdacd2 100644 --- a/sources/index.html +++ b/sources/index.html @@ -7,6 +7,8 @@ + + diff --git a/sources/scripts/commander.js b/sources/scripts/commander.js index 7b9cad2..321965d 100644 --- a/sources/scripts/commander.js +++ b/sources/scripts/commander.js @@ -15,6 +15,9 @@ function Commander() this.validate = function(query_str = ronin.commander.input_el.value) { var q = new Query(query_str); - console.log(q); + + if(!ronin.modules[q.module]){ console.log("Unknown module"); return; } + + ronin.modules[q.module].run(q) } } \ No newline at end of file diff --git a/sources/scripts/modules/rescale.js b/sources/scripts/modules/rescale.js new file mode 100644 index 0000000..aa35d95 --- /dev/null +++ b/sources/scripts/modules/rescale.js @@ -0,0 +1,7 @@ +function Rescale() +{ + this.run = function(q) + { + console.log(q); + } +} \ No newline at end of file diff --git a/sources/scripts/query.js b/sources/scripts/query.js index e7c7e06..ca4e7c1 100644 --- a/sources/scripts/query.js +++ b/sources/scripts/query.js @@ -1,8 +1,8 @@ function Query(query_str) { - this.method_name = query_str.split(" ")[0]; + this.module = query_str.split(" ")[0]; var parts = query_str.split(" ").splice(1); - this.parameters = {}; + this.parameters = {all:parts.join(" ")}; for(part_id in parts){ var part = parts[part_id]; var key = part.indexOf(":") > -1 ? part.split(":")[0] : "any"; diff --git a/sources/scripts/ronin.js b/sources/scripts/ronin.js index 2d8caba..8a429cd 100644 --- a/sources/scripts/ronin.js +++ b/sources/scripts/ronin.js @@ -8,6 +8,10 @@ function Ronin() this.commander = new Commander(); this.cursor = new Cursor(); this.render = new Render(); + + this.modules = { + rescale : new Rescale() + }; this.install = function() {