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,11 +1,11 @@
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({
@ -21,7 +21,7 @@
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
}) })
@ -29,18 +29,17 @@
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);
} }
} }