reformat time.js and fix overview bug.

This commit is contained in:
wlx 2009-12-20 07:55:31 +00:00
parent d23c5896bc
commit a702606cdd
1 changed files with 44 additions and 45 deletions

View File

@ -1,46 +1,45 @@
var tl; var tl;
var date = "Nov 22 2007 13:00:00"; var date = "Nov 22 2007 13:00:00";
var theme = Timeline.ClassicTheme.create(); var theme = Timeline.ClassicTheme.create();
theme.event.label.width = 250; // px theme.event.label.width = 250; // px
theme.event.bubble.width = 250; theme.event.bubble.width = 250;
theme.event.bubble.height = 200; theme.event.bubble.height = 200;
window.onload=function() { window.onload=function() {
var eventSource = new Timeline.DefaultEventSource(); var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [ var bandInfos = [
Timeline.createBandInfo({ Timeline.createBandInfo({
width: "70%", width: "70%",
intervalUnit: Timeline.DateTime.MONTH, intervalUnit: Timeline.DateTime.MONTH,
eventSource: eventSource, eventSource: eventSource,
date: date, date: date,
intervalPixels: 100, intervalPixels: 100,
theme: theme theme: theme
}), }),
Timeline.createBandInfo({ Timeline.createBandInfo({
width: "30%", width: "30%",
intervalUnit: Timeline.DateTime.YEAR, intervalUnit: Timeline.DateTime.YEAR,
eventSource: eventSource, eventSource: eventSource,
date: date, date: date,
showEventText: false, overview: true,
intervalPixels: 200, intervalPixels: 200,
theme:theme theme:theme
}) })
]; ];
bandInfos[1].syncWith = 0; bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true; bandInfos[1].highlight = true;
tl = Timeline.create(document.getElementById("tl"), bandInfos);
tl = Timeline.create(document.getElementById("tl"), bandInfos); tl.loadXML("/time.xml", function(xml, url) {
tl.loadXML("/time.xml", function(xml, url) { eventSource.loadXML(xml, url);
eventSource.loadXML(xml, url); });
}); }
} var resizeTimerID = null;
var resizeTimerID = null; window.onresize=function() {
window.onresize=function() { if (resizeTimerID == null) {
if (resizeTimerID == null) { resizeTimerID = window.setTimeout(function() {
resizeTimerID = window.setTimeout(function() { resizeTimerID = null;
resizeTimerID = null; tl.layout();
tl.layout(); }, 500);
}, 500); }
} }
}