1
0
forked from GitHub/gf-core

minibar: add an option to make it easy to select png or svg output

for abstract synax trees, parse trees and word alignment diagrams.
This commit is contained in:
hallgren
2012-03-08 15:30:31 +00:00
parent b3a66202ae
commit f5737e8222
2 changed files with 11 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ var online_options={
var minibar_options= {
show_abstract: true,
show_trees: true,
tree_img_format: "png", // or "svg"
show_grouped_translations: false,
default_source_language: "Eng",
//feedback_url: "feedback.html",

View File

@@ -9,7 +9,10 @@ function Translations(server,opts) {
// Default values for options:
this.options={
show_abstract: false,
show_trees: false,
show_trees: false, // add buttons to show abstract syntax trees,
// parse trees & word alignment
tree_img_format: "png", // format for trees & alignment images,
// can be "gif", "png" or "svg"
show_grouped_translations: true,
}
@@ -141,23 +144,26 @@ Translations.prototype.show_groupedtranslations=function(translationsResult) {
Translations.prototype.abstree_button=function(abs) {
var f=this.options.tree_img_format;
var i=button_img(tree_icon,"toggle_img(this)");
i.title="Click to display abstract syntax tree"
i.other=this.server.current_grammar_url+"?command=abstrtree&tree="+encodeURIComponent(abs);
i.other=this.server.current_grammar_url+"?command=abstrtree&format="+f+"&tree="+encodeURIComponent(abs);
return i;
}
Translations.prototype.alignment_button=function(abs) {
var f=this.options.tree_img_format;
var i=button_img(alignment_icon,"toggle_img(this)");
i.title="Click to display word alignment"
i.other=this.server.current_grammar_url+"?command=alignment&tree="+encodeURIComponent(abs);
i.other=this.server.current_grammar_url+"?command=alignment&format="+f+"&tree="+encodeURIComponent(abs);
return i;
}
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&from="+lang+"&tree="+encodeURIComponent(abs);
+"?command=parsetree&format="+f+"&from="+lang+"&tree="+encodeURIComponent(abs);
return i;
}