* 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.)
Using AJAX instead of JSONP can give better caching in the browser, since the
URL doesn't need to contain a (dynamically generated) callback function name.
But because of the same origin policy in JavaScript, AJAX can only be used when
the HTML file is served from the same server as the PGF. The new function
http_get_json in support.js uses AJAX if this is the case, and falls back to
JSONP otherwise.