From 4f7255dae2e8a652e7ae5e39f08a2273b2a4e4ba Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 26 Oct 2010 12:42:33 +0000 Subject: [PATCH] minibar: restructured code and improved user interface * 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.) --- src/runtime/javascript/minibar/minibar.html | 28 +- src/runtime/javascript/minibar/minibar.js | 804 +++++++++--------- src/runtime/javascript/minibar/pgf_online.js | 51 ++ .../javascript/minibar/phrasebook.html | 45 +- 4 files changed, 498 insertions(+), 430 deletions(-) create mode 100644 src/runtime/javascript/minibar/pgf_online.js diff --git a/src/runtime/javascript/minibar/minibar.html b/src/runtime/javascript/minibar/minibar.html index dc53167dd..57ee54b38 100644 --- a/src/runtime/javascript/minibar/minibar.html +++ b/src/runtime/javascript/minibar/minibar.html @@ -4,6 +4,7 @@ + @@ -12,8 +13,8 @@ -

Minibar

-
+

Minibar online

+