minibar: show parse trees without or with function names

Click once to show the parse tree without function names. Click again to
add function names.
This commit is contained in:
hallgren
2013-03-26 14:24:22 +00:00
parent 1962574941
commit 155c559e5f
2 changed files with 14 additions and 7 deletions

View File

@@ -24,9 +24,8 @@ function update_language_menu(menu,grammar) {
}
function button_img(url,action) {
var i=img(url);
i.setAttribute("class","button");
i.setAttribute("onclick",action);
var i=node("img",{"class":"button","src":url});
i.onclick=action;
return i;
}

View File

@@ -204,10 +204,18 @@ Translations.prototype.alignment_button=function(abs,all,toLangs) {
Translations.prototype.parsetree_button=function(abs,lang) {
var f=this.options.tree_img_format;
var i=button_img(tree_icon,"toggle_img(this)");
i.title="Click to display parse tree"
i.other=this.server.current_grammar_url
+"?command=parsetree&format="+f+"&from="+lang+"&tree="+encodeURIComponent(abs);
var img=this.server.current_grammar_url
+"?command=parsetree&format="+f+"&nodefont=arial"
+"&from="+lang+"&tree="+encodeURIComponent(abs);
var imgs=[tree_icon,img+"&nofun=true",img]
var current=0;
function cycle() {
current++;
if(current>=imgs.length) current=0;
i.src=imgs[current]
}
var i=button_img(tree_icon,cycle);
i.title="Click to display parse tree. Click again to show function names."
return i;
}