X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=static%2Fpublic%2Ftm.js;h=7dde7e98016032ac42d33b0144dd5614e22db520;hb=f60f09e5b8f639c255e83387770f4af0daf1e679;hp=89b0fb60eed53968666e4ee5dcc4569f999795e6;hpb=b2fc39a56152cce403464477c0e3d5a27d904137;p=p5sagit%2FDevel-Size.git diff --git a/static/public/tm.js b/static/public/tm.js index 89b0fb6..7dde7e9 100644 --- a/static/public/tm.js +++ b/static/public/tm.js @@ -36,7 +36,7 @@ function init(){ //show only one tree level levelsToShow: 1, //parent box title heights - titleHeight: 0, + titleHeight: 11, //enable animations animate: animate, //box offsets @@ -84,7 +84,7 @@ function init(){ } }, //duration of the animations - duration: 1000, + duration: 500, //Enable tips Tips: { enable: true, @@ -99,15 +99,16 @@ function init(){ var html = "
" + node.name + "
"; var data = node.data; - if(data.artist) { - html += "Artist: " + data.artist + "
"; - } - if(data.playcount) { - html += "Play count: " + data.playcount; - } - if(data.image) { - html += ""; + + html += sprintf("Size: %d (%d + %d)
", data.self_size+data.kids_size, data.self_size, data.kids_size); + if (data.child_count) { + html += sprintf("Children: %d of %d
", data.child_count, data.kids_node_count); } + html += sprintf("Depth: %d
", data.depth); + html += sprintf("Parent: %d
", data.parent_id); + html += sprintf("Id: %s%s
", node.id, data._ids_merged ? data._ids_merged : ""); + html += JSON.stringify(data.attr, undefined, 4); + tip.innerHTML = html; } }, @@ -118,7 +119,9 @@ function init(){ //callback method should be called. request: function(nodeId, level, onComplete){ if (true) { - jQuery.getJSON('jit_tree/'+nodeId+'/3', function(data) { + jQuery.getJSON('jit_tree/'+nodeId+'/1', function(data) { + console.log("Node "+nodeId); + console.log(data); onComplete.onComplete(nodeId, data); }); } @@ -137,8 +140,8 @@ function init(){ }); if(true) { - jQuery.getJSON('jit_tree/1/2', function(data) { - console.log(data); + jQuery.getJSON('jit_tree/1/1', function(data) { + console.log(data); tm.loadJSON(data); tm.refresh(); }); @@ -152,27 +155,6 @@ else { tm.refresh(); } - var sq = $jit.id('r-sq'), - st = $jit.id('r-st'), - sd = $jit.id('r-sd'); - var util = $jit.util; - util.addEvent(sq, 'change', function() { - if(!sq.checked) return; - util.extend(tm, new $jit.Layouts.TM.Squarified); - tm.refresh(); - }); - util.addEvent(st, 'change', function() { - if(!st.checked) return; - util.extend(tm, new $jit.Layouts.TM.Strip); - tm.layout.orientation = "v"; - tm.refresh(); - }); - util.addEvent(sd, 'change', function() { - if(!sd.checked) return; - util.extend(tm, new $jit.Layouts.TM.SliceAndDice); - tm.layout.orientation = "v"; - tm.refresh(); - }); //add event to the back button var back = $jit.id('back'); $jit.util.addEvent(back, 'click', function() {