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
120 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
)})},formatJSON:function(a){var b=a.id_str,c="<blockquote><p>",d=VMM.Util.linkify_with_twitter(a.text,"_blank");c+=d;c+="</p></blockquote>";c+="<div class='vcard author'>";c+="<a class='screen-name url' href='https://twitter.com/"+a.user.screen_name+"' data-screen-name='"+a.user.screen_name+"' target='_blank'>";c+="<span class='avatar'><img src=' "+a.user.profile_image_url+"' alt=''></span>";c+="<span class='fn'>"+a.user.name+"</span>";c+="<span class='nickname'>@"+a.user.screen_name+"<span class='thumbnail-inline'></span></span>";c+="</a>";c+="</div>";typeof a.entities.media!="undefined"&&a.entities.media[0].type=="photo"&&(c+="<img src=' "+a.entities.media[0].media_url+"' alt=''>");VMM.attachElement("#twitter_"+b.toString(),c)}},googlemaps:{get:function(a,b){var c,d=VMM.Util.getUrlVars(a),e;VMM.master_config.Timeline.api_keys.google!=""?e=VMM.master_config.Timeline.api_keys.google:e=Aes.Ctr.decrypt(VMM.master_config.api_keys_master.google,VMM.master_config.vp,256);var f="http://maps.googleapis.com/maps/api/js?key="+e+"&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady",g={url:a,vars:d,id:b};if(VMM.master_config.googlemaps.active)VMM.master_config.googlemaps.que.push(g);else{VMM.master_config.googlemaps.que.push(g);VMM.master_config.googlemaps.api_loaded||VMM.LoadLib.js(f,function(){trace("Google Maps API Library Loaded")})}},create:function(a){function e(a){if(a in VMM.ExternalAPI.googlemaps.map_providers){b=VMM.ExternalAPI.googlemaps.map_attribution[VMM.ExternalAPI.googlemaps.map_providers[a].attribution];return VMM.ExternalAPI.googlemaps.map_providers[a]}if(VMM.ExternalAPI.googlemaps.defaultType(a)){trace("GOOGLE MAP DEFAULT TYPE");return google.maps.MapTypeId[a.toUpperCase()]}trace("Not a maptype: "+a)}function o(){var b=a.url+"&output=kml";b=b.replace("&output=embed","");var c=new google.maps.KmlLayer(b,{preserveViewport:!0}),e=new google.maps.InfoWindow;c.setMap(d);google.maps.event.addListenerOnce(c,"defaultviewport_changed",function(){d.fitBounds(c.getDefaultViewport());i&&d.panTo(f);j&&d.setZoom(h)});google.maps.event.addListener(c,"click",function(a){function c(a){e.setContent(a);e.open(d)}var b=a.featureData.description;c(b)})}var b="",c,d;google.maps.VeriteMapType=function(a){if(VMM.ExternalAPI.googlemaps.defaultType(a))return google.maps.MapTypeId[a.toUpperCase()];var b=e(a);return google.maps.ImageMapType.call(this,{getTileUrl:function(a,c){var d=(c+a.x+a.y)%VMM.ExternalAPI.googlemaps.map_subdomains.length;return[b.url.replace("{S}",VMM.ExternalAPI.googlemaps.map_subdomains[d]).replace("{Z}",c).replace("{X}",a.x).replace("{Y}",a.y).replace("{z}",c).replace("{x}",a.x).replace("{y}",a.y)]},tileSize:new google.maps.Size(256,256),name:a,minZoom:b.minZoom,maxZoom:b.maxZoom})};google.maps.VeriteMapType.prototype=new google.maps.ImageMapType("_");type.of(VMM.master_config.Timeline.maptype)=="string"?VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)?c=google.maps.MapTypeId[VMM.master_config.Timeline.maptype.toUpperCase()]:c=VMM.master_config.Timeline.maptype:c="toner";var f=new google.maps.LatLng(41.875696,-87.624207),g,h=11,i=!1,j=!1,k;if(type.of(VMM.Util.getUrlVars(a.url)["ll"])=="string"){i=!0;g=VMM.Util.getUrlVars(a.url).ll.split(",");f=new google.maps.LatLng(parseFloat(g[0]),parseFloat(g[1]))}else if(type.of(VMM.Util.getUrlVars(a.url)["sll"])=="string"){g=VMM.Util.getUrlVars(a.url).sll.split(",");f=new google.maps.LatLng(parseFloat(g[0]),parseFloat(g[1]))}if(type.of(VMM.Util.getUrlVars(a.url)["z"])=="string"){j=!0;h=parseFloat(VMM.Util.getUrlVars(a.url).z)}var l={zoom:h,disableDefaultUI:!0,mapTypeControl:!1,zoomControl:!0,zoomControlOptions:{style:google.maps.ZoomControlStyle.SMALL,position:google.maps.ControlPosition.TOP_RIGHT},center:f,mapTypeId:c,mapTypeControlOptions:{mapTypeIds:[c]}},m=a.id.toString()+"_gmap";VMM.attachElement("#"+a.id,"<div class='google-map' id='"+m+"' style='width=100%;height=100%;'></div>");var d=new google.maps.Map(document.getElementById(m),l);if(!VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)){d.
(".slider-item .layout-text-media .text","width","40%");VMM.Lib.css(".slider-item .layout-text-media .text","display","table-cell");VMM.Lib.css(".slider-item .layout-text-media .text .container","display","table-cell");VMM.Lib.css(".slider-item .layout-text-media .text .container","width","auto");VMM.Lib.css(".slider-item .layout-text-media .text .container .start","width",e.text_media.text.width);VMM.Lib.removeClass(".slider-item .content-container","pad-top");VMM.Lib.css(".slider-item .layout-text-media .media","float","left");VMM.Lib.css(".slider-item .layout-text-media","display","table");VMM.Lib.css(".slider-item .media blockquote p","line-height","36px");VMM.Lib.css(".slider-item .media blockquote p","font-size","28px");VMM.Lib.css(".slider-item","display","table");VMM.Lib.css(".slider-item","overflow-y","auto")}VMM.Lib.css(a+".media-frame","max-width",e.text_media.width);VMM.Lib.height(a+".media-frame",e.text_media.height);VMM.Lib.width(a+".media-frame",e.text_media.width);VMM.Lib.css(a+"img","max-height",e.text_media.height);VMM.Lib.css(b+"img","max-height",e.media.height);VMM.Lib.css(a+"img","max-width",e.text_media.width);VMM.Lib.css(a+".twitter .avatar img","max-width",32);VMM.Lib.css(a+".twitter .avatar img","max-height",32);VMM.Lib.css(b+".twitter .avatar img","max-width",32);VMM.Lib.css(b+".twitter .avatar img","max-height",32);VMM.Lib.width(a+".media-frame",e.text_media.video.width);VMM.Lib.height(a+".media-frame",e.text_media.video.height);VMM.Lib.width(b+".media-frame",e.media.video.width);VMM.Lib.height(b+".media-frame",e.media.video.height);VMM.Lib.css(b+".media-frame","max-height",e.media.video.height);VMM.Lib.css(b+".media-frame","max-width",e.media.video.width);VMM.Lib.height(b+".soundcloud",168);VMM.Lib.height(a+".soundcloud",168);VMM.Lib.width(b+".soundcloud",e.media.width);VMM.Lib.width(a+".soundcloud",e.text_media.width);VMM.Lib.css(c+".soundcloud","max-height",168);VMM.Lib.height(a+".map",e.text_media.height);VMM.Lib.css(b+".map","max-height",e.media.height);VMM.Lib.width(b+".map",e.media.width);VMM.Lib.height(a+".doc",e.text_media.height);VMM.Lib.height(b+".doc",e.media.height);VMM.Lib.width(b+".wikipedia",e.media.width);VMM.Lib.width(b+".twitter",e.media.width);for(var g=0;g<j.length;g++){j[g].layout(f);j[g].content_height()>d.slider.height+20?j[g].css("display","block"):j[g].css("display","table")}},G=function(){var a=0;for(var b=0;b<j.length;b++){a=b*(d.slider.width+d.spacing);j[b].leftpos(a)}},H=function(a){var b="linear";for(var c=0;c<j.length;c++)c==m?j[c].animate(d.duration,b,{opacity:1}):c==m-1||c==m+1?j[c].animate(d.duration,b,{opacity:.1}):j[c].opacity(a)},I=function(a,b,c,e,f){VMM.ExternalAPI.youtube.stopPlayers();m=a;var h=d.ease,k=d.duration,l=!1,n=!1,o=j[m].leftpos(),p="";m==0&&(n=!0);m+1>=j.length&&(l=!0);b!=null&&b!=""&&(h=b);c!=null&&c!=""&&(k=c);if(n)VMM.Lib.visible(s.prevBtn,!1);else{VMM.Lib.visible(s.prevBtn,!0);p=VMM.Util.unlinkify(i[m-1].title);if(d.type=="timeline")if(typeof i[m-1].date=="undefined"){VMM.attachElement(s.prevDate,p);VMM.attachElement(s.prevTitle,"")}else{VMM.attachElement(s.prevDate,VMM.Date.prettyDate(i[m-1].startdate));VMM.attachElement(s.prevTitle,p)}else VMM.attachElement(s.prevTitle,p)}if(l)VMM.Lib.visible(s.nextBtn,!1);else{VMM.Lib.visible(s.nextBtn,!0);p=VMM.Util.unlinkify(i[m+1].title);if(d.type=="timeline")if(typeof i[m+1].date=="undefined"){VMM.attachElement(s.nextDate,p);VMM.attachElement(s.nextTitle,"")}else{VMM.attachElement(s.nextDate,VMM.Date.prettyDate(i[m+1].startdate));VMM.attachElement(s.nextTitle,p)}else VMM.attachElement(s.nextTitle,p)}if(e)VMM.Lib.css(g,"left",-(o-d.slider.content.padding));else{VMM.Lib.stop(g);VMM.Lib.animate(g,k,h,{left:-(o-d.slider.content.padding)})}f&&VMM.fireEvent(r,"LOADED");if(j[m].height()>d.slider_height)VMM.Lib.css(".slider","overflow-y","scroll");else{VMM.Lib.css(r,"overflow-y","hidden");VMM.Lib.animate(r,k,h,{scrollTop:VMM.Lib.prop(r,"scrollHeight")-VMM.Lib.height(r)})}D()},J=function(){var a="<div class='icon'>&nbsp;</div>";s.nextBtn=VMM.appendAndGetElement(e,"<div>","nav-next");s.prevBtn=VMM.appendAnd
.length;e++)if(g[e].type!="start"){var f=_(s,g[e].startdate,g[e].enddate);a=b;b=f.begin;c=b-a;d.push(c)}return VMM.Util.average(d).mean},X=function(){var a=0,b=0,c=0,d=[],e=!0;for(var f=0;f<g.length;f++)if(g[f].type=="start")trace("DATA DATE IS START");else{var h=g[f].startdate;a=b;b=h;c=b-a;d.push(c)}return VMM.Util.average(d)},Y=function(){var a=K.nav.multiplier.current;for(var b=0;b<a;b++)W()<75&&K.nav.multiplier.current>1&&(K.nav.multiplier.current=K.nav.multiplier.current-1)},Z=function(){var a=$(g[0].startdate),b=$(g[g.length-1].enddate);v.eon.type="eon";v.eon.first=a.eons;v.eon.base=Math.floor(a.eons);v.eon.last=b.eons;v.eon.number=e.eons;v.eon.multiplier=q.eons;v.eon.minor=q.eons;v.era.type="era";v.era.first=a.eras;v.era.base=Math.floor(a.eras);v.era.last=b.eras;v.era.number=e.eras;v.era.multiplier=q.eras;v.era.minor=q.eras;v.epoch.type="epoch";v.epoch.first=a.epochs;v.epoch.base=Math.floor(a.epochs);v.epoch.last=b.epochs;v.epoch.number=e.epochs;v.epoch.multiplier=q.epochs;v.epoch.minor=q.epochs;v.age.type="age";v.age.first=a.ages;v.age.base=Math.floor(a.ages);v.age.last=b.ages;v.age.number=e.ages;v.age.multiplier=q.ages;v.age.minor=q.ages;v.millenium.type="millenium";v.millenium.first=a.milleniums;v.millenium.base=Math.floor(a.milleniums);v.millenium.last=b.milleniums;v.millenium.number=e.milleniums;v.millenium.multiplier=q.millenium;v.millenium.minor=q.millenium;v.century.type="century";v.century.first=a.centuries;v.century.base=Math.floor(a.centuries);v.century.last=b.centuries;v.century.number=e.centuries;v.century.multiplier=q.century;v.century.minor=q.century;v.decade.type="decade";v.decade.first=a.decades;v.decade.base=Math.floor(a.decades);v.decade.last=b.decades;v.decade.number=e.decades;v.decade.multiplier=q.decade;v.decade.minor=q.decade;v.year.type="year";v.year.first=a.years;v.year.base=Math.floor(a.years);v.year.last=b.years;v.year.number=e.years;v.year.multiplier=1;v.year.minor=q.month;v.month.type="month";v.month.first=a.months;v.month.base=Math.floor(a.months);v.month.last=b.months;v.month.number=e.months;v.month.multiplier=1;v.month.minor=Math.round(q.week);v.week.type="week";v.week.first=a.weeks;v.week.base=Math.floor(a.weeks);v.week.last=b.weeks;v.week.number=e.weeks;v.week.multiplier=1;v.week.minor=7;v.day.type="day";v.day.first=a.days;v.day.base=Math.floor(a.days);v.day.last=b.days;v.day.number=e.days;v.day.multiplier=1;v.day.minor=24;v.hour.type="hour";v.hour.first=a.hours;v.hour.base=Math.floor(a.hours);v.hour.last=b.hours;v.hour.number=e.hours;v.hour.multiplier=1;v.hour.minor=60;v.minute.type="minute";v.minute.first=a.minutes;v.minute.base=Math.floor(a.minutes);v.minute.last=b.minutes;v.minute.number=e.minutes;v.minute.multiplier=1;v.minute.minor=60;v.second.type="decade";v.second.first=a.seconds;v.second.base=Math.floor(a.seconds);v.second.last=b.seconds;v.second.number=e.seconds;v.second.multiplier=1;v.second.minor=10},$=function(a,b){var c={};c.days=a/r.day;c.weeks=c.days/r.week;c.months=c.days/r.month;c.years=c.months/r.year;c.hours=c.days*r.hour;c.minutes=c.days*r.minute;c.seconds=c.days*r.second;c.decades=c.years/r.decade;c.centuries=c.years/r.century;c.milleniums=c.years/r.millenium;c.ages=c.years/r.age;c.epochs=c.years/r.epoch;c.eras=c.years/r.era;c.eons=c.years/r.eon;return c},_=function(a,b,c){var d=a.type,e=a.multiplier,f=$(b),g,h,i;h=b.months;if(type.of(c)=="date"){g=$(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-s.base)*(K.nav.interval_width/K.nav.multiplier.current);_pos_end=(i-s.base)*(K.nav.interval_width/K.nav.multiplier.current)}else{if(d=="eon"){h=f.eons;i=f.eons}else