westdc-zf1/htdocs/js/timemap.2.0.1/lib/timeline-1.2.js

9 lines
87 KiB
JavaScript
Raw Normal View History

2011-11-08 09:02:14 +00:00
/* Timeline API
* Copyright Massachusetts Institute of Technology
* and Contributors 2006-2009 ~ Some rights reserved
* Timeline is open source software and is licensed
* under the BSD license.
* http://www.simile-widgets.org/timeline/
*/
var Timeline=new Object();Timeline.Platform=new Object();(function(){try{(function(){if(typeof Timeline_urlPrefix=="string"){Timeline.urlPrefix=Timeline_urlPrefix}else{var l=document.documentElement.getElementsByTagName("head");for(var k=0;k<l.length;k++){var e=l[k].getElementsByTagName("script");for(var j=0;j<e.length;j++){var f=e[j].src;var g=f.indexOf("timeline-1.2.js");if(g>=0){Timeline.urlPrefix=f.substr(0,g);return}}}throw new Error("Failed to derive URL prefix for Timeline API code files")}})();var b;var d=function(){return document.getElementsByTagName("head")[0]};var a=function(f){if(document.body==null){try{document.write("<link rel='stylesheet' href='"+f+"' type='text/css'/>");return}catch(h){}}var g=document.createElement("link");g.setAttribute("rel","stylesheet");g.setAttribute("type","text/css");g.setAttribute("href",f);d().appendChild(g)};b=function(e,g){for(var f=0;f<g.length;f++){a(e+g[f])}};b(Timeline.urlPrefix,["timeline-1.2.css"]);Timeline.Platform.serverLocale="en";Timeline.Platform.clientLocale="en"}catch(c){alert(c)}})();Timeline.strings={};Timeline.strings.en={wikiLinkLabel:"Discuss"};Timeline.create=function(c,b,a,d){return new Timeline._Impl(c,b,a,d)};Timeline.HORIZONTAL=0;Timeline.VERTICAL=1;Timeline._defaultTheme=null;Timeline.createBandInfo=function(h){var g=("theme" in h)?h.theme:Timeline.getDefaultTheme();var f=("eventSource" in h)?h.eventSource:null;var e=new Timeline.LinearEther({centersOn:("date" in h)?h.date:new Date(),interval:Timeline.DateTime.gregorianUnitLengths[h.intervalUnit],pixelsPerInterval:h.intervalPixels});var c=new Timeline.GregorianEtherPainter({unit:h.intervalUnit,multiple:("multiple" in h)?h.multiple:1,theme:g,align:("align" in h)?h.align:undefined});var d=new Timeline.StaticTrackBasedLayout({eventSource:f,ether:e,showText:("showEventText" in h)?h.showEventText:true,theme:g});var a={showText:("showEventText" in h)?h.showEventText:true,layout:d,theme:g};if("trackHeight" in h){a.trackHeight=h.trackHeight}if("trackGap" in h){a.trackGap=h.trackGap}var b=new Timeline.DurationEventPainter(a);return{width:h.width,eventSource:f,timeZone:("timeZone" in h)?h.timeZone:0,ether:e,etherPainter:c,eventPainter:b}};Timeline.createHotZoneBandInfo=function(h){var g=("theme" in h)?h.theme:Timeline.getDefaultTheme();var f=("eventSource" in h)?h.eventSource:null;var e=new Timeline.HotZoneEther({centersOn:("date" in h)?h.date:new Date(),interval:Timeline.DateTime.gregorianUnitLengths[h.intervalUnit],pixelsPerInterval:h.intervalPixels,zones:h.zones});var c=new Timeline.HotZoneGregorianEtherPainter({unit:h.intervalUnit,zones:h.zones,theme:g,align:("align" in h)?h.align:undefined});var d=new Timeline.StaticTrackBasedLayout({eventSource:f,ether:e,theme:g});var a={showText:("showEventText" in h)?h.showEventText:true,layout:d,theme:g};if("trackHeight" in h){a.trackHeight=h.trackHeight}if("trackGap" in h){a.trackGap=h.trackGap}var b=new Timeline.DurationEventPainter(a);return{width:h.width,eventSource:f,timeZone:("timeZone" in h)?h.timeZone:0,ether:e,etherPainter:c,eventPainter:b}};Timeline.getDefaultTheme=function(){if(Timeline._defaultTheme==null){Timeline._defaultTheme=Timeline.ClassicTheme.create(Timeline.Platform.getDefaultLocale())}return Timeline._defaultTheme};Timeline.setDefaultTheme=function(a){Timeline._defaultTheme=a};Timeline.loadXML=function(a,c){var d=function(g,e,f){alert("Failed to load data xml from "+a+"\n"+g)};var b=function(f){var e=f.responseXML;if(!e.documentElement&&f.responseStream){e.load(f.responseStream)}c(e,a)};Timeline.XmlHttp.get(a,d,b)};Timeline.loadJSON=function(url,f){var fError=function(statusText,status,xmlhttp){alert("Failed to load json data from "+url+"\n"+statusText)};var fDone=function(xmlhttp){f(eval("("+xmlhttp.responseText+")"),url)};Timeline.XmlHttp.get(url,fError,fDone)};Timeline._Impl=function(c,b,a,d){this._containerDiv=c;this._bandInfos=b;this._orientation=a==null?Timeline.HORIZONTAL:a;this._unit=(d!=null)?d:Timeline.NativeDateUnit;this._initialize()};Timeline._Impl.prototype.dispose=function(){for(var a=0;a<this._bands.length;a++){this._bands[a].disp