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) {
|
function button_img(url,action) {
|
||||||
var i=img(url);
|
var i=node("img",{"class":"button","src":url});
|
||||||
i.setAttribute("class","button");
|
i.onclick=action;
|
||||||
i.setAttribute("onclick",action);
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,10 +204,18 @@ Translations.prototype.alignment_button=function(abs,all,toLangs) {
|
|||||||
|
|
||||||
Translations.prototype.parsetree_button=function(abs,lang) {
|
Translations.prototype.parsetree_button=function(abs,lang) {
|
||||||
var f=this.options.tree_img_format;
|
var f=this.options.tree_img_format;
|
||||||
var i=button_img(tree_icon,"toggle_img(this)");
|
var img=this.server.current_grammar_url
|
||||||
i.title="Click to display parse tree"
|
+"?command=parsetree&format="+f+"&nodefont=arial"
|
||||||
i.other=this.server.current_grammar_url
|
+"&from="+lang+"&tree="+encodeURIComponent(abs);
|
||||||
+"?command=parsetree&format="+f+"&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;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user