Commit | Line | Data |
cf9626aa |
1 | function loadTradition( textid ) { |
56455620 |
2 | // First insert the placeholder image |
3 | var imghtml = '<img src="/images/ajax-loader.gif" alt="Loading SVG..."/>' |
4 | $('#stemma_graph').empty(); |
5 | $('#variant_graph').empty(); |
6 | $('#stemma_graph').append( imghtml ); |
7 | $('#variant_graph').append( imghtml ); |
8 | // Then get and load the actual content. |
e2f647b9 |
9 | // TODO: scale #stemma_grpah both horizontally and vertically |
10 | // TODO: load svgs from SVG.Jquery (to make scaling react in Safari) |
a88e75b1 |
11 | $('#stemma_graph').load( "stemma/" + textid , function() { |
12 | var stemma_svg_element = $('#stemma_graph svg').svg().svg('get').root(); |
e2f647b9 |
13 | console.log( stemma_svg_element ); |
a88e75b1 |
14 | stemma_svg_element.height.baseVal.value = $('#stemma_graph').height(); |
15 | }); |
16 | $('#variant_graph').load( "variantgraph/" + textid , function() { |
17 | var variant_svg_element = $('#variant_graph svg').svg().svg('get').root(); |
18 | var svg_height = variant_svg_element.height.baseVal.value; |
19 | var svg_width = variant_svg_element.width.baseVal.value; |
20 | var container_height = $('#variant_graph').height(); |
21 | variant_svg_element.height.baseVal.value = container_height; |
22 | variant_svg_element.width.baseVal.value = (svg_width/svg_height * container_height); |
23 | }); |
24 | } |