Two smaller objects have been factored out from the Minibar object:
Input and Translations. These have been placed in two separate files:
minibar_input.js and minibar_translations.js. Some common auxiliary functions
have also been moved to a separate file: minibar_support.js
pgf_online.js has been simplified and generalized to support the full
GF Web Service API. The changes are backwards incompatible, unfortunately.
The documentation and minibar.js have been updated accordingly.
On touch-based devices, the on-screen keyboard kept popping up after every word,
which was very annoying if you were entering a sentence by tapping on the
magnets.
This means that the relative grammar directory location in the default
configuration will result in AJAX requests rather than the less efficient
JSONP requests.
The grammars will then by default be fetched from the same server as
minibar.html. This means that everything will be served locally when accessing
minibar through a locally running pgf-http.
* Keyboard input and completion should now work much more smoothly:
+ When you press space, the current word will be completed (if incomplete)
and a new magnet will be created. If there is more than one possible
completion, no magnet is created, but the common prefix of the possible
completions is added to the text box.
+ Instead of asking the server for possible completions every time a new
letter is added to the curent word, minibar only ask for completions for
whole words and then filters the list locally when more letters are entered,
speeding things up when server responses are slow.
* Code restructuring:
+ The PGF server API has been moved to its own file: pgf_online.js. This
allows it to be reused in other applicaitons without importing the entire
minibar. It also allows minibar to be used with different server interfaces.
+ The minibar code has been rewritten to avoid storing state information
in the document tree and accessing it by referring to named document
elements. The code now also avoids using string literals contaning
the names of top-level functions to specify event handlers for buttons
and menus. (The code is no longer introspective, so alpha conversion will
not change its meaning.)
+ ajax_http_get(url,callback) now checks the HTTP response status and shows an
error message if the status is not OK (is not 200)
+ New function node(tag,attrs,children) to create document nodes with arbitraty
attributes and children. The functions node() and text() should now be enough
to construct arbitrary document trees in an easy, functional way, and many of
the more specialized functions could be removed.
+ When calling the function button(label,action,key), the action can be a
function instead of a string, so you can use local/anonymous functions.
+ New function debug(str) adds text to the element with id=debug, if it
exists.
Added a meta tag to specify that the file is in UTF-8. This makes the browser
(at least Firefox) assume that the JavaScript files are also in UTF-8, it seems.
Moved the call to start_minibar() from the <body onload="..."> to the end of
the file. The onload action is not executed until all images in the document
has been loaded, while javascipt at the end of the file is executed as soon
as the HTML file has been loaded. (Calling start_minibar() from the head of
the document would be too soon, since it refers to elements in the body,
which hasn't been loaded yet.)