mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
minibar.js: server API code cleanup
This commit is contained in:
@@ -33,22 +33,21 @@ var server = {
|
|||||||
get_grammarlist: function(cont) {
|
get_grammarlist: function(cont) {
|
||||||
http_get_json(options.grammars_url+"grammars.cgi",cont);
|
http_get_json(options.grammars_url+"grammars.cgi",cont);
|
||||||
},
|
},
|
||||||
get_languages: function(cont) {
|
|
||||||
http_get_json(this.current_grammar_url,cont);
|
|
||||||
},
|
|
||||||
pgf_call: function(cmd,args,cont) {
|
pgf_call: function(cmd,args,cont) {
|
||||||
var url=this.current_grammar_url+"?command="+cmd;
|
var url=this.current_grammar_url+"?command="+cmd;
|
||||||
for(var arg in args) url+="&"+arg+"="+encodeURIComponent(args[arg]);
|
for(var arg in args) url+="&"+arg+"="+encodeURIComponent(args[arg]);
|
||||||
http_get_json(url,cont);
|
http_get_json(url,cont);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get_languages: function(cont) {
|
||||||
|
this.pgf_call("grammar",{},cont);
|
||||||
|
},
|
||||||
|
|
||||||
get_random: function(cont) {
|
get_random: function(cont) {
|
||||||
//jsonpf(this.current_grammar_url+"?command=random&random="+Math.random(),cont);
|
|
||||||
this.pgf_call("random",{random:Math.random()},cont);
|
this.pgf_call("random",{random:Math.random()},cont);
|
||||||
},
|
},
|
||||||
linearize: function(tree,to,cont) {
|
linearize: function(tree,to,cont) {
|
||||||
jsonpf(this.current_grammar_url+"?command=linearize&tree="
|
this.pgf_call("linearize",{tree:tree,to:to},cont);
|
||||||
+encodeURIComponent(tree)+"&to="+to,cont)
|
|
||||||
},
|
},
|
||||||
complete: function(from,input,cont) {
|
complete: function(from,input,cont) {
|
||||||
this.pgf_call("complete",{from:from,input:input},cont);
|
this.pgf_call("complete",{from:from,input:input},cont);
|
||||||
|
|||||||
Reference in New Issue
Block a user