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
115 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
:"stamen"},sterrain:{url:"http://{S}tile.stamen.com/terrain/{Z}/{X}/{Y}.jpg",minZoom:4,maxZoom:20,attribution:"stamen"},apple:{url:"http://gsp2.apple.com/tile?api=1&style=slideshow&layers=default&lang=en_US&z={z}&x={x}&y={y}&v=9",minZoom:4,maxZoom:14,attribution:"apple"},watercolor:{url:"http://{S}tile.stamen.com/watercolor/{Z}/{X}/{Y}.jpg",minZoom:3,maxZoom:16,attribution:"stamen"}}},googledocs:{get:function(a,b){var c={url:a,id:b};VMM.master_config.googledocs.que.push(c);VMM.master_config.googledocs.active=!0},create:function(a){var b="";a.url.match(/docs.google.com/i)?b="<iframe class='doc' frameborder='0' width='100%' height='100%' src='"+a.url+"&amp;embedded=true'></iframe>":b="<iframe class='doc' frameborder='0' width='100%' height='100%' src='http://docs.google.com/viewer?url="+a.url+"&amp;embedded=true'></iframe>";VMM.attachElement("#"+a.id,b)},pushQue:function(){for(var a=0;a<VMM.master_config.googledocs.que.length;a++)VMM.ExternalAPI.googledocs.create(VMM.master_config.googledocs.que[a]);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){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&redirects=&titles="+a.url+"&exintro=1&format=json&callback=?";VMM.Browser.browser=="Explorer"&&parseInt(VMM.Browser.version,10)>=7&&window.XDomainRequest&&VMM.attachElement("#"+a.id,"<p>Wikipedia entry unable to load using Internet Explorer 8 or below.</p>");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)}else VMM.attachElement("#"+a.id,"<p>Wikipedia entry unable to load using Internet Explorer 8 or below.</p>")})},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.yout
replace("&#38;","&"):b.match("&amp;")&&(b=b.replace("&amp;","&"));var c=[],d,e=b.slice(b.indexOf("?")+1).split("&");for(var f=0;f<e.length;f++){d=e[f].split("=");c.push(d[0]);c[d[0]]=d[1]}return c},toHTML:function(a){a=this.nl2br(a);a=this.linkify(a);return a.replace(/\s\s/g,"&nbsp;&nbsp;")},toCamelCase:function(a,b){b!==!1&&(b=!0);var c=(b?a.toLowerCase():a).split(" ");for(var d=0;d<c.length;d++)c[d]=c[d].substr(0,1).toUpperCase()+c[d].substr(1);return c.join(" ")},properQuotes:function(a){return a.replace(/\"([^\"]*)\"/gi,"&#8220;$1&#8221;")},niceNumber:function(a){var b=String(Math.abs(Number(a))),c=b.split(/\./g)[0],d=b.split(/\./g)[1],e="",f=c.toArray();f.reverse();for(var g=1;g<=f.length;g++)g%3==0&&g<f.length?e=","+f[g-1]+e:e=f[g-1]+e;return d!=null&&d!=""&&d!=undefined?e+"."+d:e},toTitleCase:function(a){var b={__smallWords:["a","an","and","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])(.*)$/);if(b[1]){b[1]=b[1].toUpperCase();return b.join("")}return""}};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]
p.epochs;u.age.type="age";u.age.first=a.ages;u.age.base=Math.floor(a.ages);u.age.last=b.ages;u.age.number=e.ages;u.age.multiplier=p.ages;u.age.minor=p.ages;u.millenium.type="millenium";u.millenium.first=a.milleniums;u.millenium.base=Math.floor(a.milleniums);u.millenium.last=b.milleniums;u.millenium.number=e.milleniums;u.millenium.multiplier=p.millenium;u.millenium.minor=p.millenium;u.century.type="century";u.century.first=a.centuries;u.century.base=Math.floor(a.centuries);u.century.last=b.centuries;u.century.number=e.centuries;u.century.multiplier=p.century;u.century.minor=p.century;u.decade.type="decade";u.decade.first=a.decades;u.decade.base=Math.floor(a.decades);u.decade.last=b.decades;u.decade.number=e.decades;u.decade.multiplier=p.decade;u.decade.minor=p.decade;u.year.type="year";u.year.first=a.years;u.year.base=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