summaryrefslogtreecommitdiff
path: root/src/www/syntax-editor/editor_online.js
diff options
context:
space:
mode:
authorjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-11-22 12:45:20 +0000
committerjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-11-22 12:45:20 +0000
commitbac6b7fe6438d06fab3451263d4d94e9055f6f88 (patch)
treeabcb68ac3df3fa2e17fd3ba38cc9f5f899c9b913 /src/www/syntax-editor/editor_online.js
parent486a510611b72d4daf551f30156fa59608d099af (diff)
Syntax editor: can now load minibar (in-place) from a linearised tree
Diffstat (limited to 'src/www/syntax-editor/editor_online.js')
-rw-r--r--src/www/syntax-editor/editor_online.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/www/syntax-editor/editor_online.js b/src/www/syntax-editor/editor_online.js
new file mode 100644
index 000000000..8b7c48acd
--- /dev/null
+++ b/src/www/syntax-editor/editor_online.js
@@ -0,0 +1,41 @@
+var server_options = {
+ // grammars_url: "http://www.grammaticalframework.org/grammars/",
+ // grammars_url: "http://localhost:41296/grammars/",
+}
+var editor_options = {
+ target: "editor",
+ // initial: {
+ // grammar: "http://localhost:41296/grammars/Phrasebook.pgf",
+ // startcat: "Proposition",
+ // languages: ["Eng","Swe","Ita"],
+ // abstr: "PropOpenDate (SuperlPlace TheMostExpensive School) Tomorrow",
+ // node_id: null
+ // },
+ show: {
+ grammar_menu: true,
+ startcat_menu: true,
+ to_menu: true,
+ random_button: true
+ }
+}
+if(window.Minibar) // Minibar loaded?
+ editor_options.lin_action=function(s,langFrom) {
+ editor.shutdown();
+ var minibar_options = {
+ target: "editor",
+ initial_grammar: editor.menu.ui.grammar_menu.value, // hmm
+ initial: {
+ from: langFrom,
+ input: s.split(" ") // is it that easy?
+ }
+ }
+ editor.minibar=new Minibar(server,minibar_options);
+ }
+if(/^\?\/tmp\//.test(location.search)) {
+ var args=decodeURIComponent(location.search.substr(1)).split(" ")
+ if(args[0]) server_options.grammars_url=args[0];
+}
+var server = pgf_online(server_options);
+var editor = new Editor(server, editor_options);
+
+