forked from GitHub/gf-core
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user