Prettier buttons
[scpubgit/stemmaweb.git] / root / js / stemmagadget.js
1 var colors = ['#ffeeaa','#afc6e9','#d5fff6','#ffccaa','#ffaaaa','#e5ff80','#e5d5ff','#ffd5e5'];
2
3 $(document).ready(function() {
4   $('svg').width('485px');
5 })
6
7
8
9 function load_stemma_svg( topic, data, subscriberData ) {
10     var params = {};
11         var postData = {};
12
13         postData.textid = data;
14
15         params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
16         params[gadgets.io.RequestParameters.POST_DATA] = gadgets.io.encodeValues(postData);
17         var url = "http://eccentricity.org:3000/svg_service";
18
19         gadgets.io.makeRequest(url,
20                 function (o) {
21                         displaySVG(o.text);
22                 }, params);
23         
24 }
25
26 function loaded() {
27         gadgets.window.adjustHeight(400);
28         subId = gadgets.Hub.subscribe("interedition.svg.dot.coloring", do_color_nodes);
29         subId = gadgets.Hub.subscribe("interedition.svg.dot.decoloring", de_color_nodes);
30         subId = gadgets.Hub.subscribe("interedition.tradition.selected", load_stemma_svg);
31 }
32
33 if (gadgets.util.hasFeature('pubsub-2')) {
34         gadgets.HubSettings.onConnect = function(hum, suc, err) { loaded(); };
35 }
36 else gadgets.util.registerOnLoadHandler(loaded);