1
0
forked from GitHub/gf-core

minibar: add tool tips to some of the buttons

Also move the functions title and attr from editor/editor.js to js/support.js.
Also mention recent changes in minibar/about.html.
This commit is contained in:
hallgren
2012-11-29 16:05:42 +00:00
parent d9b0895e57
commit c9522c0a37
6 changed files with 18 additions and 13 deletions

View File

@@ -1908,12 +1908,6 @@ function table(rows) { return wrap("table",rows); }
function td_right(cs) { return node("td",{"class":"right"},cs); }
function td_center(cs) { return node("td",{"class":"center"},cs); }
function jsurl(js) { return "javascript:"+js; }
function title(t,n) { return attr({title:t},n) }
function attr(as,n) {
for(var a in as) n.setAttribute(a,as[a]);
return n
}
/* -------------------------------------------------------------------------- */

View File

@@ -160,12 +160,16 @@ function encodeArgs(args) {
function text(s) { return document.createTextNode(s); }
function node(tag,as,ds) {
var n=document.createElement(tag);
for(var a in as) n.setAttribute(a,as[a]);
var n=attr(as,document.createElement(tag));
if(ds) for(var i in ds) n.appendChild(ds[i]);
return n;
}
function attr(as,n) {
for(var a in as) n.setAttribute(a,as[a]);
return n
}
function empty(tag,name,value) {
var el=node(tag,{},[])
if(name && value) el.setAttribute(name,value);
@@ -221,6 +225,8 @@ function tda(cs) { return node("td",{},cs); }
function img(src) { return empty("img","src",src); }
function title(t,n) { return attr({title:t},n) }
/* --- Document modification ------------------------------------------------ */
function clear(el) { replaceInnerHTML(el,""); }

View File

@@ -214,11 +214,14 @@ Some implementation details:
<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.
</ul>
<hr>
<div class=modtime><small>
<!-- hhmts start -->Last modified: Tue Nov 27 15:02:49 CET 2012 <!-- hhmts end -->
<!-- hhmts start -->Last modified: Thu Nov 29 17:02:43 CET 2012 <!-- hhmts end -->
</small></div>
<address>
<a href="http://www.cse.chalmers.se/~hallgren/">TH</a>

View File

@@ -101,7 +101,7 @@ Minibar.prototype.show_grammarlist=function(dir,grammar_names,dir_count) {
if(t.timeout) clearTimeout(t.timeout),t.timeout=null;
if(t.grammar_menu.length>1 && !t.grammar_menu.parentElement) {
t.grammar_menu.onchange=pick;
insertFirst(t.menubar,button("i",bind(t.show_grammarinfo,t)))
insertFirst(t.menubar,title("Show grammar info",button("i",bind(t.show_grammarinfo,t))))
insertFirst(t.menubar,t.grammar_menu);
insertFirst(t.menubar,text("Grammar: "));
}

View File

@@ -33,7 +33,7 @@ function Input(server,translations,opts) { // Input object constructor
appendChildren(menus,[text(" Startcat: "),startcat_menu])
appendChildren(menus,[text(" From: "),from_menu])
appendChildren(buttons,
[button(options.delete_button_text,bind(delete_last,t),"H"),
[title("Delete last word",button(options.delete_button_text,bind(delete_last,t),"H")),
button("Clear",bind(clear_all,t),"L")]);
if(options.random_button)
buttons.appendChild(button("Random",bind(generate_random,t),"R"));

View File

@@ -106,7 +106,8 @@ Translations.prototype.show_translations=function(translationResults) {
self.options.abstract_action(t.tree)
}
var abs_hdr = options.abstract_action
? button("Abstract",abs_act)
? title("Edit the syntax tree",
button("Abstract",abs_act))
: text("Abstract: ")
tbody.appendChild(
tr([th(abs_hdr),
@@ -122,7 +123,8 @@ Translations.prototype.show_translations=function(translationResults) {
if(to=="All" || lin[i].to==to) {
var langcode=langpart(lin[i].to,grammar.name)
//var hdr=text(langcode+": ")
var hdr=button(langcode,act(lin[i]))
var hdr=title("Switch input language to "+langcode,
button(langcode,act(lin[i])))
//hdr.disabled=lin[i].to==current.from
var btn=parsetree_button(t.tree,lin[i].to)
tbody.appendChild(tr([th(hdr),