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
113 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
);VMM.master_config.googledocs.que=[]}},flickr:{get:function(a,b){var c;VMM.master_config.Timeline.api_keys.flickr!=""?c=VMM.master_config.Timeline.api_keys.flickr:c=Aes.Ctr.decrypt(VMM.master_config.api_keys_master.flickr,VMM.master_config.vp,256);var d="http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key="+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){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&redirects=&titles="+a.url+"&exintro=1&format=json&callback=?";if(VMM.Browser.browser=="Explorer"&&parseInt(VMM.Browser.version,10)>=7&&window.XDomainRequest){var c="<h4><a href='http://en.wikipedia.org/wiki/"+a.url+"' target='_blank'>"+a.url+"</a></h4>";c+="<div class='wiki-source'>From Wikipedia, the free encyclopedia</span>";c+="<p>Wikipedia entry unable to load using Internet Explorer 8 or below.</p>";VMM.attachElement("#"+a.id,c)}VMM.getJSON(b,function(b){if(b.query){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=!
,"as","at","but","by","en","for","if","in","of","on","or","the","to","v[.]?","via","vs[.]?"],init:function(){this.__smallRE=this.__smallWords.join("|");this.__lowerCaseWordsRE=new RegExp("\\b("+this.__smallRE+")\\b","gi");this.__firstWordRE=new RegExp("^([^a-zA-Z0-9 \\r\\n\\t]*)("+this.__smallRE+")\\b","gi");this.__lastWordRE=new RegExp("\\b("+this.__smallRE+")([^a-zA-Z0-9 \\r\\n\\t]*)$","gi")},toTitleCase:function(a){var b="",c=a.split(/([:.;?!][ ]|(?:[ ]|^)["“])/);for(var d=0;d<c.length;++d){var e=c[d];e=e.replace(/\b([a-zA-Z][a-z.'’]*)\b/g,this.__titleCaseDottedWordReplacer);e=e.replace(this.__lowerCaseWordsRE,this.__lowerReplacer);e=e.replace(this.__firstWordRE,this.__firstToUpperCase);e=e.replace(this.__lastWordRE,this.__firstToUpperCase);b+=e}b=b.replace(/ V(s?)\. /g," v$1. ");b=b.replace(/(['’])S\b/g,"$1s");b=b.replace(/\b(AT&T|Q&A)\b/ig,this.__upperReplacer);return b},__titleCaseDottedWordReplacer: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]=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"
Math.floor(a.years);u.year.last=b.years;u.year.number=e.years;u.year.multiplier=1;u.year.minor=p.month;u.month.type="month";u.month.first=a.months;u.month.base=Math.floor(a.months);u.month.last=b.months;u.month.number=e.months;u.month.multiplier=1;u.month.minor=Math.round(p.week);u.week.type="week";u.week.first=a.weeks;u.week.base=Math.floor(a.weeks);u.week.last=b.weeks;u.week.number=e.weeks;u.week.multiplier=1;u.week.minor=7;u.day.type="day";u.day.first=a.days;u.day.base=Math.floor(a.days);u.day.last=b.days;u.day.number=e.days;u.day.multiplier=1;u.day.minor=24;u.hour.type="hour";u.hour.first=a.hours;u.hour.base=Math.floor(a.hours);u.hour.last=b.hours;u.hour.number=e.hours;u.hour.multiplier=1;u.hour.minor=60;u.minute.type="minute";u.minute.first=a.minutes;u.minute.base=Math.floor(a.minutes);u.minute.last=b.minutes;u.minute.number=e.minutes;u.minute.multiplier=1;u.minute.minor=60;u.second.type="decade";u.second.first=a.seconds;u.second.base=Math.floor(a.seconds);u.second.last=b.seconds;u.second.number=e.seconds;u.second.multiplier=1;u.second.minor=10},Z=function(a,b){var c={};c.days=a/q.day;c.weeks=c.days/q.week;c.months=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