Beautifully crafted timelines that are easy and intuitive to use. http://timeline.knightlab.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
112 KiB

/*!
13 years ago
TimelineJS
Designed and built by Zach Wise at VéritéCo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
http://www.gnu.org/licenses/
*//***********************************************
Begin VMM.js
***********************************************//* Verite
* Verite JS Master
* Version: 0.6
* Date: April 26, 2012
* Copyright 2012 Verite unless part of Verite Timeline,
* if part of Timeline then it inherits Timeline's license.
* Designed and built by Zach Wise digitalartwork.net
* ----------------------------------------------------- *//* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
================================================== */function trace(a){VMM.debug&&(window.console?console.log(a):typeof jsTrace!="undefined"&&jsTrace.send(a))}function onYouTubePlayerAPIReady(){trace("GLOBAL YOUTUBE API CALLED");VMM.ExternalAPI.youtube.onAPIReady()}(function(){var a=!1,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(c){function g(){!a&&this.init&&this.init.apply(this,arguments)}var d=this.prototype;a=!0;var e=new this;a=!1;for(var f in c)e[f]=typeof c[f]=="function"&&typeof d[f]=="function"&&b.test(c[f])?function(a,b){return function(){var c=this._super;this._super=d[a];var e=b.apply(this,arguments);this._super=c;return e}}(f,c[f]):c[f];g.prototype=e;g.prototype.constructor=g;g.extend=arguments.callee;return g}})();var global=function(){return this||(1,eval)("this")}();if(typeof VMM=="undefined"){var VMM=Class.extend({});VMM.debug=!0;VMM.master_config={init:function(){return this},sizes:{api:{width:0,height:0}},vp:"Pellentesque nibh felis, eleifend id, commodo in, interdum vitae, leo",api_keys_master:{flickr:"RAIvxHY4hE/Elm5cieh4X5ptMyDpj7MYIxziGxi0WGCcy1s+yr7rKQ==",google:"jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo=",twitter:""},flickr:{active:!1,array:[],api_loaded:!1,que:[]},youtube:{active:!1,array:[],api_loaded:!1,que:[]},vimeo:{active:!1,array:[],api_loaded:!1,que:[]},googlemaps:{active:!1,map_active:!1,places_active:!1,array:[],api_loaded:!1,que:[]},googledocs:{active:!1,array:[],api_loaded:!1,que:[]},wikipedia:{active:!1,array:[],api_loaded:!1,que:[]},soundcloud:{active:!1,array:[],api_loaded:!1,que:[]}}.init();VMM.createElement=function(a,b,c,d,e){var f="";if(a!=null&&a!=""){f+="<"+a;c!=null&&c!=""&&(f+=" class='"+c+"'");d!=null&&d!=""&&(f+=" "+d);e!=null&&e!=""&&(f+=" style='"+e+"'");f+=">";b!=null&&b!=""&&(f+=b);f=f+"</"+a+">"}return f};VMM.createMediaElement=function(a,b,c){var d="",e=!1;d+="<div class='media'>";if(a!=null&&a!=""){valid=!0;d+="<img src='"+a+"'>";c!=null&&c!=""&&(d+=VMM.createElement("div",c,"credit"));b!=null&&b!=""&&(d+=VMM.createElement("div",b,"caption"))}d+="</div>";return d};VMM.hideUrlBar=function(){var a=window,b=a.document;if(!location.hash||!a.addEventListener){window.scrollTo(0,1);var c=1,d=setInterval(function(){if(b.body){clearInterval(d);c="scrollTop"in b.body?b.body.scrollTop:1;a.scrollTo(0,c===1?0:1)}},15);a.addEventListener("load",function(){setTimeout(function(){a.scrollTo(0,c===1?0:1)},0)},!1)}}}Date.prototype.getWeek=function(){var a=new Date(this.getFullYear(),0,1);return Math.ceil(((this-a)/864e5+a.getDay()+1)/7)};Date.prototype.getDayOfYear=function(){var a=new Date(this.getFullYear(),0,1);return Math.ceil((this-a)/864e5)};var is={Null:function(a){return a===null},Undefined:function(a){return a===undefined},nt:function(a){return a===null||a===undefined},Function:function(a){return typeof a=="function"?a.constructor.toString().match(/Function/)!==null:!1},String:function(a){return typeof a=="string"?!0:typeof a=="object"?a.constructor.toString().match(/string/i)!==null:!1},Array:function(a){return typeof a=="object"?a.constructor.toString().match(/array/i)!==null||a.length!==undefined:!1},Boolean:function(a){return typeof a=="boolean"?!0:typeof a=="object"?a.constructor.toString().match(/boolean/i)!==null:!1},Date:function(a){return typeof a=="date"?!0:typeof a=="object"?a.constructor.toString().match(/date/i)!==null:!1},HTML:function(a){return typeof a=="object"?a.constructor.toString().match(/html/i)!==null:!1},Number:function(a){return typeof a=="number"?!0:typeof a=="object"?a.constructor.toString().match(/Number/)!==null:!1},Object:function(a){return typeof a=="object"?a.constructor.toString().match(/object/i)!==null:!1},RegExp:function(a){return typeof a=="function"?a.constructor.toString().match(/regexp/i)!==null:!1}},type={of:function(a){for(var b in is)if(is[b](a))return b.toLowerCase()}};if(typeof VMM!="undefined"){VMM.attachElement=function(a,b){typeof jQuery!="undefined"&&jQuery(a).html(b)};VMM.appendElement=function(a,b){typeof jQuery!="undefined"&&jQuery(a).append(b)};VMM.ge
c+"&photo_id="+a+"&format=json&jsoncallback=?";VMM.getJSON(d,VMM.ExternalAPI.flickr.create)},create:function(a){var b=a.sizes.size[0].url.split("photos/")[1].split("/")[1],c="flickr_"+b,d=c+"_large",e=c+"_thumb",f,g,h=!1,i="Large";i=VMM.ExternalAPI.flickr.sizes(VMM.master_config.sizes.api.height);for(var j=0;j<a.sizes.size.length;j++)if(a.sizes.size[j].label==i){h=!0;f=a.sizes.size[j].source}h||(f=a.sizes.size[a.sizes.size.length-1].source);g=a.sizes.size[0].source;VMM.Lib.attr("#"+d,"src",f);VMM.attachElement("#"+e,"<img src='"+g+"'>")},sizes:function(a){var b="";a<=75?b="Thumbnail":a<=180?b="Small":a<=240?b="Small 320":a<=375?b="Medium":a<=480?b="Medium 640":a<=600?b="Medium 800":b="Large";return b}},soundcloud:{get:function(a,b){var c={url:a,id:b};VMM.master_config.soundcloud.que.push(c);VMM.master_config.soundcloud.active=!0},create:function(a){var b="http://soundcloud.com/oembed?url="+a.url+"&format=js&callback=?";VMM.getJSON(b,function(b){VMM.attachElement("#"+a.id,b.html)})},pushQue:function(){for(var a=0;a<VMM.master_config.soundcloud.que.length;a++)VMM.ExternalAPI.soundcloud.create(VMM.master_config.soundcloud.que[a]);VMM.master_config.soundcloud.que=[]}},wikipedia:{get:function(a,b){trace("WIKIPEDIA GET");var c={url:a,id:b};VMM.master_config.wikipedia.que.push(c);VMM.master_config.wikipedia.active=!0},create:function(a){var b="http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles="+a.url+"&format=json&exintro=1&callback=?";VMM.getJSON(b,function(b){var c=VMM.Util.getObjectAttributeByIndex(b.query.pages,0).extract,d=VMM.Util.getObjectAttributeByIndex(b.query.pages,0).title,e="",f="",g=c.split("<p>"),h=1;for(var i=0;i<g.length;i++)i+1<=h&&i+1<g.length&&(f+="<p>"+g[i+1]);e="<h4><a href='http://en.wikipedia.org/wiki/"+d+"' target='_blank'>"+d+"</a></h4>";e+="<div class='wiki-source'>From Wikipedia, the free encyclopedia</span>";e+=VMM.Util.linkify_wikipedia(f);c.match("REDIRECT")||VMM.attachElement("#"+a.id,e)})},pushQue:function(){trace("WIKIPEDIA PUSH QUE");for(var a=0;a<VMM.master_config.wikipedia.que.length;a++)VMM.ExternalAPI.wikipedia.create(VMM.master_config.wikipedia.que[a]);VMM.master_config.wikipedia.que=[]}},youtube:{get:function(a){var b="http://gdata.youtube.com/feeds/api/videos/"+a+"?v=2&alt=jsonc&callback=?";if(VMM.master_config.youtube.active)VMM.master_config.youtube.que.push(a);else{VMM.master_config.youtube.que.push(a);VMM.master_config.youtube.api_loaded||VMM.LoadLib.js("http://www.youtube.com/player_api",function(){trace("YouTube API Library Loaded")})}VMM.getJSON(b,VMM.ExternalAPI.youtube.createThumb)},create:function(a){var b={active:!1,player:{},name:"youtube_"+a,playing:!1};b.player["youtube_"+a]=new YT.Player("youtube_"+a,{height:"390",width:"640",playerVars:{enablejsapi:1,color:"white",showinfo:0,theme:"light",rel:0},videoId:a,events:{onReady:VMM.ExternalAPI.youtube.onPlayerReady,onStateChange:VMM.ExternalAPI.youtube.onStateChange}});VMM.master_config.youtube.array.push(b)},createThumb:function(a){trace(a.data.id);trace(a.data.thumbnail.sqDefault);var b="youtube_"+a.data.id+"_thumb";VMM.attachElement("#"+b,"<img src='"+a.data.thumbnail.sqDefault+"'>")},pushQue:function(){for(var a=0;a<VMM.master_config.youtube.que.length;a++)VMM.ExternalAPI.youtube.create(VMM.master_config.youtube.que[a]);VMM.master_config.youtube.que=[]},onAPIReady:function(){VMM.master_config.youtube.active=!0;VMM.ExternalAPI.youtube.pushQue()},stopPlayers:function(){for(var a=0;a<VMM.master_config.youtube.array.length;a++)if(VMM.master_config.youtube.array[a].playing){var b=VMM.master_config.youtube.array[a].name;VMM.master_config.youtube.array[a].player[b].stopVideo()}},onStateChange:function(a){for(var b=0;b<VMM.master_config.youtube.array.length;b++){var c=VMM.master_config.youtube.array[b].name;VMM.master_config.youtube.array[b].player[c]==a.target&&a.data==YT.PlayerState.PLAYING&&(VMM.master_config.youtube.array[b].playing=!0)}},onPlayerReady:function(a){}},vimeo:{get:function(a){VMM.master_config.vimeo.que.push(a);VMM.master_config.vimeo.active=!0},create:function(a){trace("VIMEO CREATE");var b="ht
:function(a){return a.match(/[a-zA-Z][.][a-zA-Z]/)?a:b.__firstToUpperCase(a)},__lowerReplacer:function(a){return a.toLowerCase()},__upperReplacer:function(a){return a.toUpperCase()},__firstToUpperCase:function(a){var b=a.split(/(^[^a-zA-Z0-9]*[a-zA-Z0-9])(.*)$/);b[1]=b[1].toUpperCase();return b.join("")}};b.init();a=a.replace(/_/g," ");a=b.toTitleCase(a);return a}}.init();String.linkify||(String.prototype.linkify=function(){var a=/\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim,b=/(^|[^\/])(www\.[\S]+(\b|$))/gim,c=/(([a-zA-Z0-9_\-\.]+)@[a-zA-Z_]+?(?:\.[a-zA-Z]{2,6}))+/gim,d=/(@([\w]+))/g,e=/(#([\w]+))/g;return this.replace(a,'<a target="_blank" href="$&">$&</a>').replace(b,'$1<a target="_blank" href="http://$2">$2</a>').replace(c,'<a target="_blank" href="mailto:$1">$1</a>').replace(d,"<a href='http://twitter.com/$2' target='_blank'>$1</a>").replace(e,"<a href='http://twitter.com/#search?q=%23$2' target='_blank'>$1</a>")});var dateFormat=function(){var a=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,b=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,c=/[^-+\dA-Z]/g,d=function(a,b){a=String(a);b=b||2;while(a.length<b)a="0"+a;return a};return function(e,f,g){var h=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(e)=="[object String]"&&!/\d/.test(e)){f=e;e=undefined}e=e?new Date(e):new Date;if(isNaN(e))throw SyntaxError("invalid date");f=String(h.masks[f]||f||h.masks["default"]);if(f.slice(0,4)=="UTC:"){f=f.slice(4);g=!0}var i=g?"getUTC":"get",j=e[i+"Date"](),k=e[i+"Day"](),l=e[i+"Month"](),m=e[i+"FullYear"](),n=e[i+"Hours"](),o=e[i+"Minutes"](),p=e[i+"Seconds"](),q=e[i+"Milliseconds"](),r=g?0:e.getTimezoneOffset(),s={d:j,dd:d(j),ddd:h.i18n.dayNames[k],dddd:h.i18n.dayNames[k+7],m:l+1,mm:d(l+1),mmm:h.i18n.monthNames[l],mmmm:h.i18n.monthNames[l+12],yy:String(m).slice(2),yyyy:m,h:n%12||12,hh:d(n%12||12),H:n,HH:d(n),M:o,MM:d(o),s:p,ss:d(p),l:d(q,3),L:d(q>99?Math.round(q/10):q),t:n<12?"a":"p",tt:n<12?"am":"pm",T:n<12?"A":"P",TT:n<12?"AM":"PM",Z:g?"UTC":(String(e).match(b)||[""]).pop().replace(c,""),o:(r>0?"-":"+")+d(Math.floor(Math.abs(r)/60)*100+Math.abs(r)%60,4),S:["th","st","nd","rd"][j%10>3?0:(j%100-j%10!=10)*j%10]};return f.replace(a,function(a){return a in s?s[a]:a.slice(1,a.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};Date.prototype.format=function(a,b){return dateFormat(this,a,b)}}window.loadedJS=[];typeof VMM!="undefined"&&typeof VMM.LoadLib=="undefined"&&(VMM.LoadLib=function(a){function i(a){var b=!1;for(var c=0;c<h.length;c++)h[c]==a&&(b=!0);b||h.push(a);return b}function j(b,c){var d=a.createElement(b),e;for(e in c)c.hasOwnProperty(e)&&d.setAttribute(e,c[e]);return d}function k(a){var b=d[a],c,g;if(b){c=b.callback;g=b.urls;g.shift();e=0;if(!g.length){c&&c.call(b.context,b.obj);d[a]=null;f[a].length&&m(a)}}}function l(){var c=navigator.userAgent;b={async:a.createElement("script").async===!0};(b.webkit=/AppleWebKit\//.test(c))||(b.ie=/MSIE/.test(c))||(b.opera=/Opera/.test(c))||(b.gecko=/Gecko\//.test(c))||(b.unknown=!0)}function m(e,g,h,i,m){var p=function(){k(e)},q=e==="css",r=[],s,t,u,v,w,x;b||l();if(g){g=typeof g=="string"?[g]:g.concat();if(q||b.async||b.gecko||b.opera)f[e].push({urls:g,callback:h,obj:i,context:m});else for(s=0,t=g.length;s<t;++s)f[e].push({urls:[g[s]],callback:s===t-1?h:null,obj:i,context:m})}if(d[e]||!(v=d[e]=f[
c.days/q.month;c.years=c.months/q.year;c.hours=c.days*q.hour;c.minutes=c.days*q.minute;c.seconds=c.days*q.second;c.decades=c.years/q.decade;c.centuries=c.years/q.century;c.milleniums=c.years/q.millenium;c.ages=c.years/q.age;c.epochs=c.years/q.epoch;c.eras=c.years/q.era;c.eons=c.years/q.eon;return c},$=function(a,b,c){var d=a.type,e=a.multiplier,f=Z(b),g,h,i;h=b.months;if(type.of(c)=="date"){g=Z(c);i=c.months;if(d=="eon"){h=f.eons;i=g.eons}else if(d=="era"){h=f.eras;i=g.eras}else if(d=="epoch"){h=f.epochs;i=g.epochs}else if(d=="age"){h=f.ages;i=g.ages}else if(d=="millenium"){h=b.milleniums;i=c.milleniums}else if(d=="century"){h=f.centuries;i=g.centuries}else if(d=="decade"){h=f.decades;i=g.decades}else if(d=="year"){h=f.years;i=g.years}else if(d=="month"){h=f.months;i=g.months}else if(d=="week"){h=f.weeks;i=g.weeks}else if(d=="day"){h=f.days;i=g.days}else if(d=="hour"){h=f.hours;i=g.hours}else if(d=="minute"){h=f.minutes;i=g.minutes}_pos=(h-r.base)*(J.nav.interval_width/J.nav.multiplier.current);_pos_end=(i-r.base)*(J.nav.interval_width/J.nav.multiplier.current)}else{if(d=="eon"){h=f.eons;i=f.eons}else if(d=="era"){h=f.eras;i=f.eras}else if(d=="epoch"){h=f.epochs;i=f.epochs}else if(d=="age"){h=f.ages;i=f.ages}else if(d=="millenium"){h=b.milleniums;i=b.milleniums}else if(d=="century"){h=f.centuries;i=f.centuries}else if(d=="decade"){h=f.decades;i=f.decades}else if(d=="year"){h=f.years;i=f.years}else if(d=="month"){h=f.months;i=f.months}else if(d=="week"){h=f.weeks;i=f.weeks}else if(d=="day"){h=f.days;i=f.days}else if(d=="hour"){h=f.hours;i=f.hours}else if(d=="minute"){h=f.minutes;i=f.minutes}_pos=(h-r.base)*(J.nav.interval_width/J.nav.multiplier.current);_pos_end=_pos}return pos={begin:_pos,end:_pos_end}},_=function(a){var b=r.type,c=r.multiplier,d=2,e=0,f=0,j=150,k=6,l=0;VMM.Lib.removeClass(".flag","row1");VMM.Lib.removeClass(".flag","row2");VMM.Lib.removeClass(".flag","row3");for(var m=0;m<i.length;m++){var o,p=i[m].marker,q=i[m].flag,s=i[m].lineevent,t=$(r,g[m].startdate,g[m].enddate),u=-2;z=t.begin;_pos_end=t.end;z=Math.round(z+u);_pos_end=Math.round(_pos_end+u);o=Math.round(_pos_end-z);if(a){VMM.Lib.stop(p);VMM.Lib.animate(p,J.duration/2,J.ease,{left:z})}else VMM.Lib.css(p,"left",z);m==n&&(l=z);if(o>5){VMM.Lib.css(s,"height",k);VMM.Lib.css(s,"width",o);VMM.Lib.css(s,"top",j)}if(z-e<J.nav.marker.width+J.spacing)if(d<J.nav.rows.length-1)d++;else{d=0;f++}else{f=0;d=0}e=z;if(a){VMM.Lib.stop(q);VMM.Lib.animate(q,J.duration,J.ease,{top:J.nav.rows[d]})}else VMM.Lib.css(q,"top",J.nav.rows[d]);J.start_page&&i[m].type=="start"&&VMM.Lib.visible(p,!1)}for(var w=0;w<h.length;w++){var o,x=h[w],y=x.content,z=$(r,x.startdate,x.enddate),A=z.end-z.begin,B=25;VMM.Lib.css(y,"left",z.begin);VMM.Lib.css(y,"width",A)}VMM.Lib.stop(v);VMM.Lib.animate(v,J.duration/2,J.ease,{left:J.width/2-l})},ab=function(a,b,c){var d=r.type,e=r.multiplier,f=0,g=0;for(var h=0;h<a.length;h++){var i=a[h].interval_element,j=a[h].interval_date,k=a[h].interval_visible,l=$(r,j),m=l.begin,n=!0,o=50;b?VMM.Lib.animate(i,J.duration/2,J.ease,{left:m}):VMM.Lib.css(i,"left",m);J.nav.multiplier.current>16&&c?n=!1:m-f<65&&(m-f<35?h%4==0?m==0&&(n=!1):n=!1:VMM.Util.isEven(h)||(n=!1));if(k){if(!n){b?VMM.Lib.animate(i,J.duration*2,J.ease,{opacity:0}):VMM.Lib.css(i,"opacity",0);a[h].interval_visible=!1}}else if(n){b?VMM.Lib.animate(i,J.duration*2,J.ease,{opacity:100}):VMM.Lib.css(i,"opacity",100);a[h].interval_visible=!0}f=m;m>J.nav.minor_width&&(J.nav.minor_width=m)}VMM.Lib.css(F,"left",-(J.width/2));VMM.Lib.width(F,J.nav.minor_width+J.width)},bb=function(a,b,c){var d=0,e=!0,f=0,h=0;VMM.attachElement(c,"");a.date=new Date(g[0].startdate.getFullYear(),0,1,0,0,0);for(var i=0;i<Math.ceil(a.number)+1;i++){var j,k,l,m=VMM.appendAndGetElement(c,"<div>",a.classname),n,o=!1;if(a.type=="eon"){e&&a.date.setFullYear(Math.floor(g[0].startdate.getFullYear()/5e8)*5e8);a.date.setFullYear(a.date.getFullYear()+d*5e8)}else if(a.type=="era"){e&&a.date.setFullYear(Math.floor(g[0].startdate.getFullYear()/1e8)*1e8);a.date.setFullYear(a.date.getFullYear()+d*1e8)}else if(a.type=="epoch"){e&&a.date.set