summaryrefslogtreecommitdiff
path: root/src/www/minibar/about.html
blob: 4880a20a39bcf5f2dd9878e830101179c19ef4aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<html> <head>
<title>About Minibar</title>
<link rel=stylesheet type="text/css" href="minibar.css">
<meta charset="UTF-8">
<meta name = "viewport" content = "width = device-width">
<style>
:target .summary { font-weight: bold; background: white; }
</style>
</head>

<body class=minibar>
<header>
<h1>About Minibar</h1>
</header>
<main>
<a href="minibar.html">Minibar</a> is an alternative implementation of the
<a href="http://www.grammaticalframework.org/">GF</a> web app
<a href="http://www.grammaticalframework.org:41296/fridge/">Fridge Poetry</a>.
It doesn't do everything the original Fridge Poetry does (e.g. drag-and-drop is missing),
so I refer to it as a minibar rather than a full refrigerator :-)

<p>
Some implementation details:

<ul class=space>
  <li>It is implemented directly in JavaScipt. It does not use Google Web Toolkit or any big JavaScript libraries.
  <li>It has been tested and found to work in the following browsers:
  <ul>
    <li>On the Mac: Firefox 3.5 &amp; 3.6, Safari 4.0, Opera 10.10 and
    Google Chrome 4.0.249.49.
    <li>On Linux: Firefox 3.0.18 & 3.5, Opera 10.10.
    <li>On the Android Dev Phone: Android Mobile Safari 3.0.4 & 3.1.2
    and Android Opera Mini 4.2.
  </ul>
  It does not seem work in Internet Explorer 7
  (there are both styling and scripting issues).
  There seems to be some rendering bugs in Chrome 5.0.342.9 β.
  <li>The implementation consist of two JavaScript files:
  <a href="minibar.js">minibar.js</a> and <a href="../js/support.js">support.js</a>
  The latter is also used in
  <a href="http://spraakbanken.gu.se/swe/forskning/saldo/ordspel">a couple of
  small web apps</a> based on the
  <a href="http://spraakbanken.gu.se/sal/ws/">SALDO web services</a>.
  <li>To access the GF web service, it uses the
  <a href="http://en.wikipedia.org/wiki/JSONP">JSONP method</a>
  mentioned in the GF
  web services paper, which allows the web app to be hosted on a different server
  from the GF web service. (To demonstrate this, I put the Minibar demo on
  www.cs.chalmers.se, while the GF server that it calls is on
  www.grammaticalframework.org.)
  <li>As an experiment, it does no use the <code>grammars.xml</code> file,
  but instead calls a little CGI script,
  <a href="http://www.grammaticalframework.org:41296/grammars/grammars.cgi.txt">grammars.cgi</a>
  which lists the .pgf files in the directory, in JSONP format.
  (Note: if you want to install this on your own computer,
  <ul>
    <li>if you click on the link,
        the CGI script will be downloaded as <code>grammars.cgi.txt</code>,
        but it should be called <code>grammars.cgi</code> and stored on the server
        in the same directory as the grammar files.
    <li>for CGI scripts to work with lighttpd, <code>"mod_cgi"</code> needs
    to be included in the definition of <code>server.modules</code> in the
    <code>lighttpd.conf</code> file.)
  </ul>
  <li>[Added 2010-02-16] There is a button for generating random sentences.
  <li>[Added 2010-02-23] All translations are shown, not just the first one,
  if there are multiple parses.
  <li>[Added 2010-02-25] Next to each translation, there is now a little tree
  icon that you can click on to see a drawing of an abstract syntax tree or a
  parse tree. If you click on a drawing it collapses back into a tree icon.
  <li>[Added 2010-04-09] Preparations to support different ways to access the
  grammar: currently we access a PGF server via JSONP, but I would also like
  to support AJAX, and local/downloaded JavaScript grammars.
  <li>[Added 2010-04-19] A text entry field appears when you click in
  the sentence area (with a dashed border). This allows you to enter words by
  typing on the keyboard. As you start typing word magnets that don't match what
  you are typing are removed. When only one magnet remains, you can press enter
  to complete the word.
  <li>[Added 2010-04-19] There is a menu for choosing the output language:
  you can pick "All" to translate to all available languages, or pick one
  particular language.
  <li>[Added 2010-04-19] You can pass options to the function
  <code>start_minibar</code> to customize the user interface. The default is
  <code>{show_abstract:true,show_trees:true}</code> to show the abstract syntax
  of parsed sentences, and to show icons that expand to syntax/parse trees next
  each translation.
  These features can be turned off by setting the fields to <code>false</code>.
  <li>[Added 2010-04-30] The grammar menu is omitted if there is only one
      grammar in the grammar list.
  <li>[Added 2010-04-30] Fewer hardwired constants and new
  <code>start_minibar</code> options (server, grammars_url, grammar_list,
  show_grouped_translations, delete_button_text) to make
  <code>minibar.js</code> more resuable.)
  <li>[Added 2010-05-26] The magnets are now created with
  <code>&lt;input type=button&gt;</code> tags to make them clickable in more
  browsers.
  <li>[Added 2010-05-26] The text entry field is now visible from the start,
  and it is removed when no more words can be added to the sentence. When you
  press enter, a word is added if there is only one magnet left,
  <em>or</em> if what you have entered exactly matches one of the remaining
  magnet.
  <li>[Added 2010-05-28] Added a link to make it easy to try the same sentence in
  <a href="http://translate.google.com">Google Translate</a>.This can be
  turned off by passing the option <code>{try_google:false}</code> to
  <code>start_minibar</code>.
  <li>[Added 2010-06-02] Added support for Help and Feedback buttons, controlled
  by the options <code>feedback_url</code> and <code>help_url</code> passed to
  <code>start_minibar</code>.
  <li>[Added 2010-06-02] New option: <code>default_source_language</code>.
  <li>[Added 2010-09-10] Minibar now automatically uses
      <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XHR</a>
      instead of JSONP when possible (i.e. when the HTML document and the
      PGF service are on the same server).
  <li>[Added 2010-09-10] The default input language is now the user's preferred
  language, if possible. This is implemented by consulting the
  <code>userLanguage</code> field in the grammar info output by pgf-server.
  <li>[Added 2010-10-27] Keyboard input and completion should now work much
      more smoothly:
  <ul>
    <li>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.
    <li>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.
  </ul>
  <li>[Added 2010-10-27] Code restructuring:
    <ul>
    <li>The PGF server API has been moved to its own file:
      <a href="../js/pgf_online.js">pgf_online.js</a>. 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. <a href="minibar.html">minibar.html</a> has been updated to
      show how you use the new <a href="minibar.js">minibar.js</a> and
      <a href="../js/pgf_online.js">pgf_online.js</a>.
    <li>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 containing
      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.)
   </ul>
 <li>[Added 2010-11-09] Some new documentation:
   <ul>
     <li><a href="gf-web-api-examples.html">gf-web-api-examples.html</a>:
     examples illustrating the PGF server API provided by
     <a href="../js/pgf_online.js">pgf_online.js</a>.
     <li><a href="example.html">example.html</a>: a minimal example of a web
     page that uses <a href="../js/pgf_online.js">pgf_online.js</a> to talk to the
     PGF server.
   </ul>
 <li>[Added 2011-03-03] Added a button to display word alignment.
 <li>[Changed 2011-03-22] Don't force focus to the typed input field
   after every word. 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.
 <li>[Changed 2011-08-03] Moved the initialization code in minibar.html to
   <a href="minibar_online.js">minibar_online.js</a>.
 <li>[Changed 2011-08-08] For improved modularity and reusability,
   two smaller objects have been factored out from the Minibar object:
   Input and Translations. These have been placed in two separate files:
   <a href="minibar_input.js">minibar_input.js</a> and
   <a href="minibar_translations.js">minibar_translations.js</a>.
   Some common auxiliary functions have also been moved to a separate file:
   <a href="minibar_support.js">minibar_support.js</a>.
 <li>[Added 2011-08-09] Added some <a href="minibar-api.html">Minibar API</a>
   documentation.
 <li>[Changed 2011-08-22] Quick fix to allow literals to be entered:
   if you press Enter, the current word will be accepted, even if there are no
   matching completions.
   (You can now use names of people when constructing sentences in the Letter
   grammar, for example.)
 <li>[Added 2011-10-18] Added a button to display some grammar info and a
   start category menu. The start category menu can be turned off by passing
   the option <code>{startcat_menu:false}</code> when starting the minibar.
 <li>[Added 2012-02-10] New minibar option <code>initial_grammar</code> to
   control which of the available grammars is selected initially.
 <li>[Added 2012-03-08] Added the option
   <code>{tree_img_format: <var>fmt</var>}</code>
   to make it easy to select <code>"gif"</code>, <code>"png"</code> or
   <code>"svg"</code> output
   for abstract synax trees, parse trees and word alignment diagrams.
 <li>[Added 2012-03-19] Minibar now remembers the most recently used grammar
   and automatically selects it the next time you return to the minibar.
   (This is implemented using localStorage, i.e. the data is stored locally on
   the user's device.)
 <li>[Added 2012-03-26] Support for adding grammars from several servers to
  the grammar menu. You can also add grammars from several directories on the
  same server of course. The included minibar configuration file adds the
  user's own grammars from the grammar editor.
 <li id=wordforword>
   [Added 2012-04-02] <span class=summary>Word-for-word replacements</span>:
  when a complete and
   unambiguous sentence has been entered, the words glow blue and when you
   click on one, possible replacements appear. (Replacements are shown as names
   of functions in the abstract syntax for now. They should be shown as words
   in the concrete syntax instead.) When you click on a replacement word,
   the sentence is reconstructed with the new word, adjusting other words
   as needed for agreement. This functionality is activated by passing the
   option <code>{word_replacements:true}</code> when starting the minibar.
 <li>[Added 2012-04-03]
   If you leave the minibar and later return, the previous input will be
   restored. One input string per grammar is remembered, so you can also switch
   back and forth between grammars without losing the input.
   (This is implemented using localStorage, i.e. the data is stored locally on
   the user's device.)
 <li>[Added 2012-04-04] Grammar editor integration: as part of the
   word-for-word replacement interface, minibar can now show a button for
   extending the grammar with a new word. This is activated by passing the
   option <code>{extend_grammar:<var>func</var>}</code> when starting the
   minibar, where <var>func</var> is the editor function to call
   (to be document further).
 <li>[Added 2012-04-18] Added buttons to use generated translations as input.
   (This functionality is available in the original Fridge Poetry, but has
   been missing in Minibar, until now.)
 <li>[Added 2012-11-23] Added support for switching back and forth between the
     minibar and the new syntax tree editor. The default configuration in
     <code>minibar_online.js</code> shows how to enable it.
  <li>[Added 2012-11-29] After pressing the <strong>i</strong> button to view
      grammar info, there is now a <strong>More info</strong> button to get
      more detailed information about all categories and functions in the
      grammar.
  <li>[Added 2013-03-25] Initial support for selecting an arbitrary subset
      of languages to appear in the translations and in word alignment
      diagrams.
  <li>[Added 2013-03-26] Parse tree visualizations: click once to show parse
      trees without function names. Click again to add function names.
  <li>[Added 2013-03-27] Click on a linearization to obtain a table with all
      variants and forms. Click again to hide the table.
  <li>[Added 2013-04-02] Abstract syntax tree visualizations: click once to
      show abstract syntax trees without category names. Click again to add
      category names.
  <li>[Added 2013-04-02] Minibar now remembers from one visit to the next
      the selected set of target languages for each grammar.
  <li>[Added 2019-08-05] Minibar can now display grammar documentation.
      The documentation is taken from a file called
      <var>Grammar</var><code>.pgf_info</code>, located
      next to the <var>Grammar</var><code>.pgf</code> file on the server.
      The first line of the documentation is displayed below the menu bar in
      the minibar. The rest of the documentation is displayed when you press
      the <b>More info</b> button (or the <b>i</b> button). The documentation
      can contain HTML markup. Blank lines are treated as paragraph breaks.
  <li>[Added 2019-11-21] It is now possible to configure a list of preferred
      grammars.
      A preferred grammar is selected when a user visits Minibar for the
      first time. (Like before, Minibar remembers the selected grammar for
      future visits.)
      <p>
      A preferred list of grammars can be specified in <code>config.js</code>
      in the <code>…/minibar</code> directory on the server, e.g. like this:
      <pre>  preferred_grammars=["/grammars/Foods.pgf","/grammars/ResourceDemo.pgf"]</pre>
      The first available grammar from the list is used.
</ul>
</main>
<footer>
<hr>
<div class=modtime><small>
<!-- hhmts start -->Last modified: Thu Nov 21 14:23:59 CET 2019 <!-- hhmts end -->
</small></div>
<address>
<a href="http://www.cse.chalmers.se/~hallgren/">Thomas Hallgren</a>
</address>
</footer>
</body> </html>