diff options
| author | hallgren <hallgren@chalmers.se> | 2012-02-10 15:24:59 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2012-02-10 15:24:59 +0000 |
| commit | 6b29296060a0fcbc32ddb27fe56325bccff144e0 (patch) | |
| tree | ab2a0233332fe3dbbd8a635303c9b068a88d2cd7 /src/www | |
| parent | d8958ed68d1b315d9a49ca45f4db3a7472d36cbb (diff) | |
gfse&minibar: select the right grammar in minibar when invoked from gfse
The grammar that the user is currently working is now the one shown initially
in minibar, instead of the first grammar in alphabetical order.
Also GFServer.hs now removes absolute paths to the grammar files on the server in error messages from GF returned to to gfse.
Diffstat (limited to 'src/www')
| -rw-r--r-- | src/www/minibar/about.html | 4 | ||||
| -rw-r--r-- | src/www/minibar/minibar.js | 7 | ||||
| -rw-r--r-- | src/www/minibar/minibar_online.js | 15 |
3 files changed, 16 insertions, 10 deletions
diff --git a/src/www/minibar/about.html b/src/www/minibar/about.html index 08f891bbc..ddf897073 100644 --- a/src/www/minibar/about.html +++ b/src/www/minibar/about.html @@ -170,11 +170,13 @@ Some implementation details: <li>[Added 2011-10-18] Added a button to display some grammar info and a start category menu. The start category menu can be turned off by passing the option <code>{startcat_menu:false}</code> when starting the minibar. + <li>[Added 2012-02-10] New minibar option <code>initial_grammar</code> to + control which of the available grammars is selected initially. </ul> <hr> <small class=modtime> -<!-- hhmts start --> Last modified: Tue Oct 18 17:18:42 CEST 2011 <!-- hhmts end --> +<!-- hhmts start --> Last modified: Fri Feb 10 15:55:30 CET 2012 <!-- hhmts end --> </small> <address> <a href="http://www.cs.chalmers.se/~hallgren/">TH</a> diff --git a/src/www/minibar/minibar.js b/src/www/minibar/minibar.js index a94cc5629..e37b33a7c 100644 --- a/src/www/minibar/minibar.js +++ b/src/www/minibar/minibar.js @@ -32,7 +32,8 @@ function Minibar(server,opts) { target: "minibar", try_google: true, feedback_url: null, - help_url: null + help_url: null, + initial_grammar: null } // Apply supplied options @@ -81,7 +82,9 @@ Minibar.prototype.show_grammarlist=function(grammars) { } if(options.help_url) menubar.appendChild(button("Help",bind(open_help,this))); - select_grammar(grammars[0]); + var grammar0=options.initial_grammar || grammars[0]; + grammar_menu.value=grammar0; + select_grammar(grammar0); } } diff --git a/src/www/minibar/minibar_online.js b/src/www/minibar/minibar_online.js index 1c15e87bf..e6693f7a0 100644 --- a/src/www/minibar/minibar_online.js +++ b/src/www/minibar/minibar_online.js @@ -7,13 +7,6 @@ var online_options={ //grammar_list: ["Foods.pgf"], // leave undefined to get list from server } - -if(/^\?\/tmp\//.test(location.search)) { - online_options.grammars_url=location.search.substr(1); -} - -var server=pgf_online(online_options); - var minibar_options= { show_abstract: true, show_trees: true, @@ -22,4 +15,12 @@ var minibar_options= { //feedback_url: "feedback.html", try_google: true } + +if(/^\?\/tmp\//.test(location.search)) { + var args=decodeURIComponent(location.search.substr(1)).split(" ") + if(args[0]) online_options.grammars_url=args[0]; + if(args[1]) minibar_options.initial_grammar=args[1]; +} + +var server=pgf_online(online_options); var minibar=new Minibar(server,minibar_options); |
