From bac6b7fe6438d06fab3451263d4d94e9055f6f88 Mon Sep 17 00:00:00 2001 From: "john.j.camilleri" Date: Thu, 22 Nov 2012 12:45:20 +0000 Subject: Syntax editor: can now load minibar (in-place) from a linearised tree --- src/www/syntax-editor/editor_online.js | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/www/syntax-editor/editor_online.js (limited to 'src/www/syntax-editor/editor_online.js') 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); + + -- cgit v1.2.3