minibar: use SVG instead of PNG for trees and alignment diagrams if supported by the browser

This commit is contained in:
hallgren
2015-05-18 14:54:29 +00:00
parent 09a57b34a8
commit 011e980e9d
2 changed files with 8 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ var online_options={
var minibar_options= {
show_abstract: true,
show_trees: true,
tree_img_format: "png", // or "svg"
// tree_img_format: "png", // or "svg"
show_grouped_translations: false,
show_brackets: true,
word_replacements: true,

View File

@@ -12,8 +12,9 @@ function Translations(server,opts) {
abstract_action: null, // action when selecting the abstracy syntax tree
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"
tree_img_format: supportsSVG() ? "svg" : "png",
// format for trees & alignment images,
// can be "gif", "png" or "svg"
show_grouped_translations: true,
to_multiple: true, // allow selection of multiple target languages
show_brackets: false, // show bracketed string
@@ -297,3 +298,7 @@ function draw_bracketss(bs) {
? bs.map(draw_brackets) //with gf>3.5, in some cases
: draw_brackets(bs) // with gf<=3.5
}
function supportsSVG() {
return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")
}