//for timeline parent library, will be accessable by main library and API library for other people to use.. default inherits orbitDesktopAPI
// Harry Bomrah
var orbitTimeline = function(dom){
t = this;
this.dom = $("#"+dom);
this.timelineHtml = $("
");
//this.marker = t.timelineHtml.find("#timline_marker");
this.scale = t.timelineHtml.find("#timeline_scale");
//this.container = t.timelineHtml.find("#t_container");
this.initialize = function(){
t.dom.html(t.timelineHtml);
$("div.scrollbar").hide();
//var cursor = t.marker.draggable({containment:"parent","option":"cursorAt"});
var timelineScale = t.constructTimeScale();
$("#timeline_scale").html(timelineScale);
t.makeBubble("012012");
t.makeBubble("012012");
$("#test_bubble").click(function(){
t.makeBubble("062012");
})
}
this.constructTimeScale = function(){
//$.getJSON("test.json",function(){
var scale = $("");
scale.append($("2013
2012
"));
scale.find(".scale_region").each(function(){
var verticalchars = "";
var txt = $(this).text();
var margin = ($(this).width()-20)/2;
// for(c in txt){
// if($(this).hasClass('month')){
// verticalchars+=""+txt.charAt(c)+"";
// }else
// verticalchars+=""+txt.charAt(c)+"";
// }
//$(this).html(verticalchars);
})
return scale;
//})
}
this.makeBubble = function(timestamp){
var totalul = $("#scale_wrapper").find("div[data-content="+timestamp+"] ul").length;
var targetul = $("#scale_wrapper div[data-content="+timestamp+"] div.bubble_list ul").eq(totalul-1);
if(totalul == 0){
var ul = $("");
$("#scale_wrapper").find("div[data-content="+timestamp+"] div.bubble_list").append(ul);
targetul = ul;
}else{
var totalli = targetul.find("li").length;
if(totalli >= 5){
var ul = $("");
$("#scale_wrapper").find("div[data-content="+timestamp+"] div.bubble_list").append(ul);
targetul = ul;
}
}
var bubble = $("This is test bubble.");
bubble.css("margin-left","25px");
targetul.prepend(bubble);
bubble.show("bounce",{},500);
bubble.click(function(){
o.toolPopup({
parent: $(this),
html : ""+timestamp+"
",
height: "auto",
width:"300px"
});
})//.mouseout(function(){t.oapi.toolPopup("destroy");})
}
}