1
0
forked from GitHub/gf-core

Minibar: make it possible to configure a list of preferred grammars

A preferred grammar is selected when a user visits the Minibar for the
first time. (Like before, Minibar remembers the selected grammar for future
visits.)

A preferred list of grammars can be specified in config.js in the .../minibar
directory on the server, e.g. like this:

  preferred_grammars=["/grammars/Foods.pgf","/grammars/ResourceDemo.pgf"]

The first available grammar from the list is used.
This commit is contained in:
Thomas Hallgren
2019-11-21 14:25:07 +01:00
parent 14e5528544
commit e6b33ac8b8
3 changed files with 22 additions and 1 deletions
+3
View File
@@ -21,6 +21,9 @@ var minibar_options= {
try_google: true
}
if(window.preferred_grammars)
minibar_options.preferred_grammars=preferred_grammars
if(/^\?\/(tmp|grammars)\//.test(location.search)) {
var args=decodeURIComponent(location.search.substr(1)).split(" ")
if(args[0]) online_options.grammars_url=args[0];