summaryrefslogtreecommitdiff
path: root/src/runtime/javascript/minibar/minibar.html
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2010-10-26 12:42:33 +0000
committerhallgren <hallgren@chalmers.se>2010-10-26 12:42:33 +0000
commit5fc0e059c5b35ad426f361f37f28036d01f5b412 (patch)
tree2afd76ff64ff1e39eae40e39cf7a2ab643cc2b89 /src/runtime/javascript/minibar/minibar.html
parent1e51a2e9e54898cb157139a508da851a9f6a137e (diff)
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.)
Diffstat (limited to 'src/runtime/javascript/minibar/minibar.html')
-rw-r--r--src/runtime/javascript/minibar/minibar.html28
1 files changed, 18 insertions, 10 deletions
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 @@
<link rel=stylesheet type="text/css" href="minibar.css">
<script type="text/JavaScript" src="support.js"></script>
<script type="text/JavaScript" src="minibar.js"></script>
+<script type="text/JavaScript" src="pgf_online.js"></script>
<meta name = "viewport" content = "width = device-width">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
@@ -12,8 +13,8 @@
</head>
<body>
-<h1>Minibar</h1>
-<div id=minibar>
+<h2>Minibar online</h2>
+<div id=minibar1>
</div>
<noscript>
This page doesn't works unless JavaScript is enabled.
@@ -26,26 +27,33 @@ This page doesn't works unless JavaScript is enabled.
&amp; <a href="http://www.grammaticalframework.org:41296/translate/">Translator</a>]
</small>
<small class=modtime>
-HTML <!-- hhmts start --> Last modified: Fri Sep 24 14:30:47 CEST 2010 <!-- hhmts end -->
+HTML <!-- hhmts start --> Last modified: Tue Oct 26 14:40:33 CEST 2010 <!-- hhmts end -->
</small>
<address>
<a href="http://www.cs.chalmers.se/~hallgren/">TH</a>
<img src="http://www.altocumulus.org/~hallgren/online.cgi?icon" alt=""></address>
-</body>
<script type="text/javascript">
-var my_options= {
- //server: "http://www.grammaticalframework.org:41296",
- //server: "http://tournesol.cs.chalmers.se:41296",
- server: "http://localhost:41296",
- //grammar_list: ["Foods.pgf"],
+var online_options={
+ grammars_url: "http://www.grammaticalframework.org/grammars/"
+//grammars_url: "http://tournesol.cs.chalmers.se:41296/grammars",
+//grammars_url: "http://localhost:41296/grammars",
+//grammar_list: ["Foods.pgf"], // leave undefined to get list from server
+}
+
+var server=pgf_online(online_options);
+
+var minibar_options= {
show_abstract: true,
show_trees: true,
show_grouped_translations: false,
default_source_language: "Eng",
try_google: true
}
-start_minibar(my_options)
+start_minibar(server,minibar_options,"minibar1");
+
</script>
+
+</body>
</html>