/* * Timemap.js Copyright 2008 Nick Rabinowitz. * Licensed under the MIT License (see LICENSE.txt) */ (function(){var j=this,g,h=j.Timeline,i=h.DateTime,d=j.jQuery,q=j.mxn,s=q.Mapstraction,c=q.LatLonPoint,a=q.BoundingBox,f=q.Marker,o=q.Polyline,r="itemsloaded",k="http://www.google.com/intl/en_us/mapfiles/ms/icons/",l,p,n,m,e;l=function(u,w,v){var t=this,y={mapCenter:new c(0,0),mapZoom:0,mapType:"physical",showMapTypeCtrl:true,showMapCtrl:true,syncBands:true,mapFilter:"hidePastFuture",centerOnItems:true,theme:"red",dateParser:"hybrid",checkResize:true,multipleInfoWindows:false},x;t.mElement=w;t.tElement=u;t.datasets={};t.chains={};t.opts=v=d.extend(y,v);x=v.mapCenter;if(x.constructor!=c&&x.lat){v.mapCenter=new c(x.lat,x.lon)}v.mapType=b.lookup(v.mapType,l.mapTypes);v.mapFilter=b.lookup(v.mapFilter,l.filters);v.theme=m.create(v.theme,v);t.initMap()};l.version="2.0.1";var b=l.util={};l.init=function(v){var C="TimeMap.init: Either %Id or %Selector is required",B={options:{},datasets:[],bands:false,bandInfo:false,bandIntervals:"wk",scrollTo:"earliest"},t=l.state,F,I,D=[],G,y,A,u,z=[],w;v.mapSelector=v.mapSelector||"#"+v.mapId;v.timelineSelector=v.timelineSelector||"#"+v.timelineId;if(t){t.setConfigFromUrl(v)}v=d.extend(B,v);if(!v.bandInfo&&!v.bands){F=b.lookup(v.bandIntervals,l.intervals);v.bandInfo=[{width:"80%",intervalUnit:F[0],intervalPixels:70},{width:"20%",intervalUnit:F[1],intervalPixels:100,showEventText:false,overview:true,trackHeight:0.4,trackGap:0.2}]}I=new l(d(v.timelineSelector).get(0),d(v.mapSelector).get(0),v.options);v.datasets.forEach(function(K,J){y=d.extend({title:K.title,theme:K.theme,dateParser:K.dateParser},K.options);u=K.id||"ds"+J;D[J]=I.createDataset(u,y);if(J>0){D[J].eventSource=D[0].eventSource}});I.eventSource=D[0].eventSource;w=(D[0]&&D[0].eventSource)||new h.DefaultEventSource();if(v.bands){v.bands.forEach(function(x){if(x.eventSource!==null){x.eventSource=w}});z=v.bands}else{v.bandInfo.forEach(function(K,J){if(!(("eventSource" in K)&&!K.eventSource)){K.eventSource=w}else{K.eventSource=null}z[J]=h.createBandInfo(K);if(J>0&&b.TimelineVersion()=="1.2"){z[J].eventPainter.setLayout(z[0].eventPainter.getLayout())}})}I.initTimeline(z);var E=l.loadManager,H=function(){E.increment()};E.init(I,v.datasets.length,v);v.datasets.forEach(function(P,K){var Q=D[K],M=P.data||P.options||{},O=P.type||M.type,N=(typeof O=="string")?l.loaders[O]:O,J=new N(M);J.load(Q,H)});return I};l.prototype={initMap:function(){var t=this,u=t.opts,w,v;t.map=w=new s(t.mElement,u.mapProvider);w.setCenterAndZoom(u.mapCenter,u.mapZoom);w.addControls({pan:u.showMapCtrl,zoom:u.showMapCtrl?"large":false,map_type:u.showMapTypeCtrl});w.setMapType(u.mapType);if(u.multipleInfoWindows){w.setOption("enableMultipleBubbles",true)}t.getNativeMap=function(){return w.getMap()}},initTimeline:function(w){var C=this,B,u=C.opts,D=function(x){return x.visible},v=function(x){return x.dataset.visible},y=function(E,G,F){F.item.openInfoWindow()},t,A,z;for(A=1;A0?true:false;switch(t){case"now":break;case"earliest":case"first":if(w){v=u.getEarliestDate()}break;case"latest":case"last":if(w){v=u.getLatestDate()}break;default:v=x(t)}return v},scrollToDate:function(z,A,y){var G=this.timeline,u=G.getBand(0),D,v,E=[],F,w,t;z=this.parseDate(z);if(z){v=z.getTime();for(D=0;Dw&&v=t.target){t.complete()}};t.complete=function(){var u=t.tm,w=t.opts,v=w.dataLoadedFunction;if(v){v(u)}else{u.scrollToDate(w.scrollTo,true);if(u.initState){u.initState()}v=w.dataDisplayedFunction;if(v){v(u)}}}}();l.loaders={cb:{},cancel:function(u){var t=l.loaders.cb;t[u]=function(){delete t[u]}},cancelAll:function(){var t=l.loaders,u=t.cb,v;for(v in u){if(u.hasOwnProperty(v)){t.cancel(v)}}},counter:0,base:function(u){var v=function(w){return w},t=this;t.parse=u.parserFunction||v;t.preload=u.preloadFunction||v;t.transform=u.transformFunction||v;t.scrollTo=u.scrollTo||"earliest";t.getCallbackName=function(y,z){var w=l.loaders.cb,x="_"+l.loaders.counter++;z=z||function(){y.timemap.scrollToDate(t.scrollTo,true)};w[x]=function(A){var B=t.parse(A);B=t.preload(B);y.loadItems(B,t.transform);z();delete w[x]};return x};t.getCallback=function(x,y){var w=t.getCallbackName(x,y);return l.loaders.cb[w]};t.cancel=function(){l.loaders.cancel(t.callbackName)}},basic:function(u){var t=new l.loaders.base(u);t.data=u.items||u.value||[];t.load=function(v,w){(this.getCallback(v,w))(this.data)};return t},remote:function(u){var t=new l.loaders.base(u);t.opts=d.extend({},u,{type:"GET",dataType:"text"});t.load=function(v,w){t.callbackName=t.getCallbackName(v,w);t.opts.success=l.loaders.cb[t.callbackName];d.ajax(t.opts)};return t}};p=function(v,u,t,A,x,w){var y=this,z=d.noop;y.timemap=v;y.chain=w||[];y.on=u||z;y.off=t||z;y.pre=A||z;y.post=x||z};p.prototype={add:function(t){return this.chain.push(t)},remove:function(v){var u=this.chain,t=v?u.indexOf(v):u.length-1;return u.splice(t,1)},run:function(){var u=this,t=u.chain;if(!t.length){return}u.pre();u.timemap.eachItem(function(x){var v,w=t.length;L:while(!v){while(w--){if(!t[w](x)){u.off(x);break L}}u.on(x);v=true}});u.post()}};l.filters={hidePastFuture:function(t){return t.onVisibleTimeline()},hideFuture:function(v){var u=v.timeline.getBand(0).getMaxVisibleDate().getTime(),t=v.getStartTime();if(t!==g){return tx||t>x)}return true}};n=function(t,u){var v=this;v.timemap=t;v.eventSource=new h.DefaultEventSource();v.items=[];v.visible=true;v.opts=u=d.extend({},t.opts,u);u.dateParser=b.lookup(u.dateParser,l.dateParsers);u.theme=m.create(u.theme,u)};n.prototype={getItems:function(u){var t=this.items;return u===g?t:u in t?t[u]:null},getTitle:function(){return this.opts.title},each:function(t){this.items.forEach(t)},loadItems:function(v,t){if(v){var u=this;v.forEach(function(w){u.loadItem(w,t)});d(u).trigger(r)}},loadItem:function(w,t){if(t){w=t(w)}if(w){var v=this,u;w.options=d.extend({},v.opts,{title:null},w.options);u=new e(w,v);v.items.push(u);return u}}};m=function(t){var v={color:"#FE766A",lineOpacity:1,lineWeight:2,fillOpacity:0.4,eventTextColor:null,eventIconPath:"timemap/images/",eventIconImage:"red-circle.png",classicTape:false,icon:k+"red-dot.png",iconSize:[32,32],iconShadow:k+"msmarker.shadow.png",iconShadowSize:[59,32],iconAnchor:[16,33]};var u=d.extend(v,t);v={lineColor:u.color,fillColor:u.color,eventColor:u.color,eventIcon:u.eventIcon||u.eventIconPath+u.eventIconImage};return d.extend(v,u)};m.create=function(v,t){v=b.lookup(v,l.themes);if(!v){return new m(t)}if(t){var w=false,u;for(u in t){if(v.hasOwnProperty(u)){w={};break}}if(w){for(u in v){if(v.hasOwnProperty(u)){w[u]=t[u]||v[u]}}w.eventIcon=t.eventIcon||w.eventIconPath+w.eventIconImage;return w}}return v};e=function(O,F){var M=this,z=d.extend({type:"none",description:"",infoPoint:null,infoHtml:"",infoUrl:"",openInfoWindow:O.options.infoUrl?e.openInfoWindowAjax:e.openInfoWindowBasic,infoTemplate:'
{{title}}
{{description}}
',templatePattern:/\{\{([^}]+)\}\}/g,closeInfoWindow:e.closeInfoWindowBasic},O.options),x=F.timemap,N=z.theme=m.create(z.theme,z),w=z.dateParser,E=h.DefaultEventSource.Event,C=O.start,A=O.end,u=N.eventIcon,B=N.eventTextColor,P=z.title=O.title||"Untitled",J=null,v,D=[],H=[],t=null,y="",I=null,K;M.dataset=F;M.map=x.map;M.timeline=x.timeline;M.opts=z;C=C?w(C):null;A=A?w(A):null;v=!A;if(C!==null){if(b.TimelineVersion()=="1.2"){J=new E(C,A,null,null,v,P,null,null,null,u,N.eventColor,N.eventTextColor)}else{if(!B){B=(N.classicTape&&!v)?"#FFFFFF":"#000000"}J=new E({start:C,end:A,instant:v,text:P,icon:u,color:N.eventColor,textColor:B})}J.item=M;if(!z.noEventLoad){F.eventSource.add(J)}}M.event=J;function G(U){var T=null,W="",Z=null,ac;if(U.point){var V=U.point.lat,Q=U.point.lon;if(V===g||Q===g){return T}Z=new c(parseFloat(V),parseFloat(Q));T=new f(Z);T.setLabel(U.title);T.addData(N);W="marker"}else{if(U.polyline||U.polygon){var aa=[],R="polygon" in U,ab=U.polyline||U.polygon,X;ac=new a();if(ab&&ab.length){for(X=0;X1?"array":y;z.infoPoint=z.infoPoint?new c(parseFloat(z.infoPoint.lat),parseFloat(z.infoPoint.lon)):I;D.forEach(function(Q){Q.item=M;Q.click.addHandler(function(){M.openInfoWindow()});if(!z.noPlacemarkLoad){if(b.getPlacemarkType(Q)=="marker"){x.map.addMarker(Q)}else{x.map.addPolyline(Q)}Q.hide()}});M.placemark=D.length==1?D[0]:D.length?D:null;M.getNativePlacemark=function(){var Q=M.placemark;return Q&&(Q.proprietary_marker||Q.proprietary_polyline)};M.getType=function(){return z.type};M.getTitle=function(){return z.title};M.getInfoPoint=function(){return z.infoPoint||M.map.getCenter()};M.getStart=function(){return M.event?M.event.getStart():null};M.getEnd=function(){return M.event?M.event.getEnd():null};M.getStartTime=function(){var Q=M.getStart();if(Q){return Q.getTime()}};M.getEndTime=function(){var Q=M.getEnd();if(Q){return Q.getTime()}};M.isSelected=function(){return x.getSelected()===M};M.visible=true;M.placemarkVisible=false;M.eventVisible=true;M.openInfoWindow=function(){z.openInfoWindow.call(M);x.setSelected(M)};M.closeInfoWindow=function(){z.closeInfoWindow.call(M);x.setSelected(g)}};e.prototype={showPlacemark:function(){var t=this,u=function(v){if(v.api){v.show()}};if(t.placemark&&!t.placemarkVisible){if(t.getType()=="array"){t.placemark.forEach(u)}else{u(t.placemark)}t.placemarkVisible=true}},hidePlacemark:function(){var t=this,u=function(v){if(v.api){v.hide()}};if(t.placemark&&t.placemarkVisible){if(t.getType()=="array"){t.placemark.forEach(u)}else{u(t.placemark)}t.placemarkVisible=false}t.closeInfoWindow()},showEvent:function(){var u=this,t=u.event;if(t&&!u.eventVisible){u.timeline.getBand(0).getEventSource()._events._events.add(t);u.eventVisible=true}},hideEvent:function(){var u=this,t=u.event;if(t&&u.eventVisible){u.timeline.getBand(0).getEventSource()._events._events.remove(t);u.eventVisible=false}},scrollToStart:function(u){var t=this;if(t.event){t.dataset.timemap.scrollToDate(t.getStart(),false,u)}},getInfoHtml:function(){var v=this.opts,u=v.infoHtml,w=v.templatePattern,t;if(!u){u=v.infoTemplate;t=w.exec(u);while(t){u=u.replace(t[0],v[t[1]]||"");t=w.exec(u)}v.infoHtml=u}return u},onVisibleTimeline:function(){var w=this,y=w.timeline.getBand(0),u=y.getMaxVisibleDate().getTime(),v=y.getMinVisibleDate().getTime(),t=w.getStartTime(),x=w.getEndTime();return t!==g?tv||t>v):true}};e.openInfoWindowBasic=function(){var v=this,u=v.getInfoHtml(),w=v.dataset,t=v.placemark;if(!v.onVisibleTimeline()){w.timemap.scrollToDate(v.getStart())}if(v.getType()=="marker"&&t.api){t.setInfoBubble(u);t.openBubble();v.closeHandler=t.closeInfoBubble.addHandler(function(){w.timemap.setSelected(g);t.closeInfoBubble.removeHandler(v.closeHandler)})}else{v.map.openBubble(v.getInfoPoint(),u);v.map.tmBubbleItem=v}};e.openInfoWindowAjax=function(){var t=this;if(!t.opts.infoHtml&&t.opts.infoUrl){d.get(t.opts.infoUrl,function(u){t.opts.infoHtml=u;t.openInfoWindow()});return}t.openInfoWindow=function(){e.openInfoWindowBasic.call(t);t.dataset.timemap.setSelected(t)};t.openInfoWindow()};e.closeInfoWindowBasic=function(){var t=this;if(t.getType()=="marker"){t.placemark.closeBubble()}else{if(t==t.map.tmBubbleItem){t.map.closeBubble();t.map.tmBubbleItem=null}}};l.util.getTagValue=function(v,t,u){return b.getNodeList(v,t,u).first().text()};l.util.nsMap={};l.util.getNodeList=function(w,u,v){var t=l.util.nsMap;w=w.jquery?w[0]:w;return !w?d():!v?d(u,w):(w.getElementsByTagNameNS&&t[v])?d(w.getElementsByTagNameNS(t[v],u)):d(w.getElementsByTagName(v+":"+u))};l.util.makePoint=function(u,v){var t=null;if(u.lat&&u.lng){t=[u.lat(),u.lng()]}if(d.type(u)=="array"){t=u}if(!t){u=d.trim(u);if(u.indexOf(",")>-1){t=u.split(",")}else{t=u.split(/[\r\n\f ]+/)}}if(t.length>2){t=t.slice(0,2)}if(v){t.reverse()}return{lat:d.trim(t[0]),lon:d.trim(t[1])}};l.util.makePoly=function(w,z){var v=[],u,t,y=d.trim(w).split(/[\r\n\f ]+/);for(t=0;t0)?y[t].split(","):[y[t],y[++t]];if(u.length>2){u=u.slice(0,2)}if(z){u.reverse()}v.push({lat:u[0],lon:u[1]})}return v};l.util.formatDate=function(z,y){y=y||3;var A="";if(z){var x=z.getUTCFullYear(),u=z.getUTCMonth(),B=z.getUTCDate();if(x<1000){return(x<1?(x*-1+"BC"):x+"")}if(z.toISOString&&y==3){return z.toISOString()}var t=function(D){return((D<10)?"0":"")+D};A+=x+"-"+t(u+1)+"-"+t(B);if(y>1){var v=z.getUTCHours(),w=z.getUTCMinutes(),C=z.getUTCSeconds();A+="T"+t(v)+":"+t(w);if(y>2){A+=t(C)}A+="Z"}}return A};l.util.TimelineVersion=function(){return h.version||(h.DurationEventPainter?"1.2":"2.2.0")};l.util.getPlacemarkType=function(t){return t.constructor==f?"marker":t.constructor==o?(t.closed?"polygon":"polyline"):false};l.util.lookup=function(t,u){return typeof t=="string"?u[t]:t};if(!([].indexOf)){Array.prototype.indexOf=function(v){var t=this,u=t.length;while(--u>=0){if(t[u]===v){break}}return u}}if(!([].forEach)){Array.prototype.forEach=function(v){var t=this,u;for(u=0;u1){g=e[1];h=e[0]}d.setConfig(f,TimeMap.util.getTagValue(i,g,h))}},OptionParam:function(d,b){b=b||{};var c={get:function(e){return e.opts[d]},set:function(f,e){f.opts[d]=e},setConfig:function(e,f){e.options=e.options||{};e.options[d]=f}};b=$.extend(c,b);return new a.Param(d,b)}};TimeMap.loaders.base.prototype.params={title:new a.Param("title"),start:new a.Param("start"),end:new a.Param("end"),description:new a.OptionParam("description"),lat:new a.Param("lat",{setConfig:function(b,c){b.point=b.point||{};b.point.lat=c}}),lon:new a.Param("lon",{setConfig:function(b,c){b.point=b.point||{};b.point.lon=c}})}})();(function(){var b=TimeMap.params,a=TimeMap.state={fromUrl:function(){var d=location.hash.substring(1).split("&"),e=a.params,c={};d.forEach(function(g){var f=g.split("=");if(f.length>1){key=f[0];if(key&&key in e){c[key]=e[key].fromString(decodeURI(f[1]))}}});return c},toParamString:function(e){var f=a.params,c=[],d;for(d in e){if(e.hasOwnProperty(d)){if(d in f){c.push(d+"="+encodeURI(f[d].toString(e[d])))}}}return c.join("&")},toUrl:function(d){var e=a.toParamString(d),c=location.href.split("#")[0];return c+"#"+e},setConfig:function(c,e){var f=a.params,d;for(d in e){if(e.hasOwnProperty(d)){if(d in f){f[d].setConfig(c,e[d])}}}},setConfigFromUrl:function(c){a.setConfig(c,a.fromUrl())}};TimeMap.prototype.setState=function(d){var e=a.params,c;for(c in d){if(d.hasOwnProperty(c)){if(c in e){e[c].set(this,d[c])}}}};TimeMap.prototype.getState=function(){var d={},e=a.params,c;for(c in e){if(e.hasOwnProperty(c)){d[c]=e[c].get(this)}}return d};TimeMap.prototype.initState=function(){var c=this;c.setStateFromUrl();window.onhashchange=function(){c.setStateFromUrl()}};TimeMap.prototype.setStateFromUrl=function(){this.setState(a.fromUrl())};TimeMap.prototype.getStateParamString=function(){return a.toParamString(this.getState())};TimeMap.prototype.getStateUrl=function(){return a.toUrl(this.getState())};TimeMap.state.params={zoom:new b.OptionParam("mapZoom",{get:function(c){return c.map.getZoom()},set:function(c,d){c.map.setZoom(d)},fromStr:function(c){return parseInt(c,10)}}),center:new b.OptionParam("mapCenter",{get:function(c){return c.map.getCenter()},set:function(c,d){c.map.setCenter(d)},fromStr:function(c){var d=c.split(",");if(d.length<2){return null}return new mxn.LatLonPoint(parseFloat(d[0]),parseFloat(d[1]))},toStr:function(c){return c.lat+","+c.lng}}),date:new b.Param("scrollTo",{get:function(c){return c.timeline.getBand(0).getCenterVisibleDate()},set:function(c,d){c.scrollToDate(d)},fromStr:function(c){return TimeMap.dateParsers.hybrid(c)},toStr:function(c){return TimeMap.util.formatDate(c)}}),selected:new b.OptionParam("selected",{set:function(c,f){var e=f&&c.datasets[f.dataset],d;if(e){d=e.getItems()[f.index];if(d){d.openInfoWindow()}}},fromStr:function(e){if(e){var d=e.lastIndexOf("-"),f,c;if(d>=0){return{dataset:e.substr(0,d),index:parseInt(e.substr(d+1))}}}},toStr:function(c){var d=c&&c.dataset;return c?d.id+"-"+d.items.indexOf(c):""}})}})();(function(){var a=TimeMap.loaders;a.jsonp=function(c){var b=new a.remote(c);b.opts.dataType="jsonp";return b};a.json=function(c){var b=new a.remote(c);b.opts.dataType="json";return b};a.json_string=a.json})();TimeMap.loaders.xml=function(c){var a=new TimeMap.loaders.remote(c),e=c.tagMap||{},b=c.extraTags||[],d=a.params;a.load=function(f,g){a.callbackName=a.getCallbackName(f,g);a.opts.dataType=$.browser.msie?"text":"xml";a.opts.success=function(i){var h;if(typeof i=="string"){h=new ActiveXObject("Microsoft.XMLDOM");h.async=false;h.loadXML(i)}else{h=i}TimeMap.loaders.cb[a.callbackName](h)};$.ajax(a.opts)};a.extraParams=[];b.forEach(function(f){a.extraParams.push(new TimeMap.params.OptionParam(e[f]||f,{sourceName:f}))});a.parseExtra=function(f,g){a.extraParams.forEach(function(h){h.setConfigXML(f,g)});g=null};return a};TimeMap.loaders.flickr=function(b){var a=new TimeMap.loaders.jsonp(b);a.opts.jsonp="jsoncallback";a.preload=function(c){return c.items};a.transform=function(d){var c={title:d.title,start:d.date_taken,point:{lat:d.latitude,lon:d.longitude},options:{description:d.description.replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"')}};if(b.transformFunction){c=b.transformFunction(c)}return c};return a};TimeMap.loaders.georss=function(b){var a=new TimeMap.loaders.xml(b);a.parse=TimeMap.loaders.georss.parse;return a};TimeMap.loaders.georss.parse=function(l){var j=[],v,f,q,n,u;var a=TimeMap.util,c=a.getTagValue,r=a.getNodeList,o=a.makePoint,b=a.makePoly,g=a.formatDate,e=a.nsMap;e.georss="http://www.georss.org/georss";e.gml="http://www.opengis.net/gml";e.geo="http://www.w3.org/2003/01/geo/wgs84_pos#";e.kml="http://www.opengis.net/kml/2.2";var t=(l.firstChild.tagName=="rss")?"rss":"atom";var p=(t=="rss"?"item":"entry");f=r(l,p);for(n=0;n0){v.start=c(u[0],"when","kml")}if(!v.start){u=r(q,"TimeSpan","kml");if(u.length>0){v.start=c(u[0],"begin","kml");v.end=c(u[0],"end","kml")||g(new Date())}}if(!v.start){if(t=="rss"){var s=new Date(Date.parse(c(q,"pubDate")));v.start=g(s)}else{v.start=c(q,"updated")}}var h=false;PLACEMARK:while(!h){var m,k;m=c(q,"point","georss");if(m){v.point=o(m);break PLACEMARK}u=r(q,"Point","gml");if(u.length>0){m=c(u[0],"pos","gml");if(!m){m=c(u[0],"coordinates","gml")}if(m){v.point=o(m);break PLACEMARK}}if(c(q,"lat","geo")){m=[c(q,"lat","geo"),c(q,"long","geo")];v.point=o(m);break PLACEMARK}m=c(q,"line","georss");if(m){v.polyline=b(m);break PLACEMARK}m=c(q,"polygon","georss");if(m){v.polygon=b(m);break PLACEMARK}u=r(q,"LineString","gml");if(u.length>0){k="polyline"}else{u=r(q,"Polygon","gml");if(u.length>0){k="polygon"}}if(u.length>0){m=c(u[0],"posList","gml");if(!m){m=c(u[0],"coordinates","gml")}if(m){v[k]=b(m);break PLACEMARK}}h=true}this.parseExtra(v,q);j.push(v)}l=f=q=u=null;return j};TimeMap.loaders.gss=function(c){var b=new TimeMap.loaders.jsonp(c),h=b.params,g,a,f=TimeMap.loaders.gss.setParamField,d=c.paramMap||{},e=c.extraColumns||[];if(!b.opts.url&&c.key){b.opts.url="http://spreadsheets.google.com/feeds/list/"+c.key+"/1/public/values?alt=json-in-script&callback=?"}for(a=0;af.getTime())&&!g[u]){l.load(p,w,new Date(r),u)}if(vq.getMinDate().getTime()&&(!f||s>f.getTime())&&!g[u-1]){l.load(p,w,new Date(s),u-1)}});a=false};l.load=function(r,t,s,q){s=c(s)||m;q=q||0;var p=new Date(s.getTime()+d);g[q]=true;l.opts.url=k(h,s,p);i.call(l,r,function(){if(a){a(r)}t()})};return l};