diff options
| author | hallgren <hallgren@chalmers.se> | 2012-02-28 17:24:34 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2012-02-28 17:24:34 +0000 |
| commit | 6f42f58f71e54ffdd89cb4d53c68e9212eb5a0ee (patch) | |
| tree | 46b183fac486510a8212eb9e4846b3a857b58f48 /demos/TransQuiz/pgf_online.js | |
| parent | c1c1a73dc3db1f1ae8b298f836dfa7a2a17f2638 (diff) | |
gfse: Translation Quiz integration
Also moved the translation quiz from demos/TransQuiz to src/www/TransQuiz so
that it will be installed by 'cabal install' along with the other files that
are installed for use by gf -server mode.
Diffstat (limited to 'demos/TransQuiz/pgf_online.js')
| -rw-r--r-- | demos/TransQuiz/pgf_online.js | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/demos/TransQuiz/pgf_online.js b/demos/TransQuiz/pgf_online.js deleted file mode 100644 index 06ed87a60..000000000 --- a/demos/TransQuiz/pgf_online.js +++ /dev/null @@ -1,56 +0,0 @@ - -/* --- Grammar access object ------------------------------------------------ */ - -function pgf_online(options) { - var server = { - // State variables (private): - grammars_url: "/grammars/", - grammar_list: null, - current_grammar_url: null, - - // Methods: - switch_grammar: function(grammar_url,cont) { - this.current_grammar_url=this.grammars_url+grammar_url; - if(cont) cont(); - }, - get_grammarlist: function(cont) { - http_get_json(this.grammars_url+"grammars.cgi",cont); - }, - pgf_call: function(cmd,args,cont) { - var url=this.current_grammar_url+"?command="+cmd; - for(var arg in args) url+="&"+arg+"="+encodeURIComponent(args[arg]); - http_get_json(url,cont); - }, - - get_languages: function(cont) { - this.pgf_call("grammar",{},cont); - }, - - get_random: function(cont) { - this.pgf_call("random",{random:Math.random()},cont); - }, - linearize: function(tree,to,cont) { - this.pgf_call("linearize",{tree:tree,to:to},cont); - }, - linearizeAll: function(tree,to,cont) { - this.pgf_call("linearizeAll",{tree:tree,to:to},cont); - }, - complete: function(from,input,cont) { - this.pgf_call("complete",{from:from,input:input},cont); - }, - parse: function(from,input,cont) { - this.pgf_call("parse",{from:from,input:input},cont); - }, - translate: function(from,input,cont) { - this.pgf_call("translate",{from:from,input:input},cont); - }, - translategroup: function(from,input,cont) { - this.pgf_call("translategroup",{from:from,input:input},cont); - } - - }; - for(var o in options) server[o]=options[o]; - if(server.grammar_list && server.grammar_list.length>0) - server.switch_grammar(server.grammar_list[0]); - return server; -}
\ No newline at end of file |
