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.
13 lines
68 KiB
13 lines
68 KiB
13 years ago
|
/* Verite
|
||
|
* Verite JS Master
|
||
|
* Version: 0.1
|
||
|
* Date: December 12, 2011
|
||
|
* Copyright 2011 Verite
|
||
|
* Designed and built by Zach Wise digitalartwork.net
|
||
|
* ----------------------------------------------------- *//* CodeKit Import
|
||
|
================================================== *//* Simple JavaScript Inheritance
|
||
|
* By John Resig http://ejohn.org/
|
||
|
* MIT Licensed.
|
||
|
================================================== */function trace(a){window.console?console.log(a):typeof jsTrace!="undefined"&&jsTrace.send(a)}function onYouTubePlayerAPIReady(){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.master_config={init:function(){return this},youtube:{active:!1,array:[],api_loaded:!1}}.init();VMM.master_config={init:function(){return this},youtube:{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+=" "+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.attachElement=function(a,b){typeof jQuery!="undefined"&&$(a).html(b)};VMM.appendElement=function(a,b){typeof jQuery!="undefined"&&$(a).append(b)};VMM.getHTML=function(a){var b;if(typeof jQuery!="undefined"){b=$(a).html();return b}};VMM.getElement=function(a,b){var c;if(typeof jQuery!="undefined"){b?c=$(a).parent().get(0):c=$(a).get(0);return c}};VMM.bindEvent=function(a,b,c,d){var e,f="click",g={};c!=null&&c!=""&&(f=c);g!=null&&g!=""&&(g=d);typeof jQuery!="undefined"&&$(a).bind(f,g,b)};VMM.unbindEvent=function(a,b,c){var d,e="click",f={};c!=null&&c!=""&&(e=c);typeof jQuery!="undefined"&&$(a).unbind(e,b)};VMM.fireEvent=function(a,b,c){var d,e="click",f=[];b!=null&&b!=""&&(e=b);c!=null&&c!=""&&(f=c);typeof jQuery!="undefined"&&$(a).trigger(e,f)};VMM.getJSON=function(a,b){typeof jQuery!="undefined"&&$.getJSON(a,b)};VMM.appendAndGetElement=function(a,b,c,d){var e,f="<div>",g="",h="";b!=null&&b!=""&&(f=b);c!=null&&c!=""&&(g=c);d!=null&&d!=""&&(h=d);if(typeof jQuery!="undefined"){e=$(b);e.addClass(g);e.html(h);$(a).append(e)}return e};VMM.Element={init:function(){return this},hide:function(a,b){b!=null&&b!=""?typeof jQuery!="undefined"&&$(a).hide(b):typeof jQuery!="undefined"&&$(a).hide()},remove:function(a){typeof jQuery!="undefined"&&$(a).remove()},detach:function(a){typeof jQuery!="undefined"&&$(a).detach()},append:function(a,b){typeof jQuery!="undefined"&&$(a).append(b)},show:function(a,b){b!=null&&b!=""?typeof jQuery!="undefined"&&$(a).show(b):typeof jQuery!="undefined"&&$(a).show()},load:function(a,b,c){var d={elem:a};d!=null&&d!=""&&(d=c);typeof jQuery!="undefined"&&$(a).load(d,b)},addClass:function(a,b){typeof jQuery!="undefined"&&$(a).addClass(b)},removeClass:function(a,b){typeof jQuery!="undefined"&&$(a).removeClass(b)},attr:function(a,b,c){if(c!=null&&c!="")typeof jQuery!="undefined"&&$(a).attr(b,c);else if(typeof jQuery!="undefined")return $(a).attr(b)},prop:function(a,b,c){typeof jQuery=="undefined"||!/[1-9]\.[3-9].[1-9]/.test($.fn.jquery)?VMM.Element.attribute(a,b,c):$(a).prop(b,c)},attribute:function(a,b,c){if(c!=null&&c!="")typeof jQuery!="undefined"&&$(a).attr(b,c);else if(typeof jQuery!="undefined")return $(a).attr(b)},visible:function(a,b){if(b!=null)typeof jQuery!="undefined"&&(b?$(a).show(0):$(a).hide(0));else if(typeof jQuery!="undefined")return $(a).is(":visible")?!0:!1},css:function(a,b,c){if(c!=null&&c!="")typeof jQuery!="undefined"&&$(a).css(b,c);else if(typeof jQuery!="undefined")return $(a).css(b)},cssmultiple:function(a,b){if(typeof jQuery!="undefined")return $(a).css(b)},offset:fun
|
||
|
.width(".slider-item .layout-media .media .media-container .soundcloud",o.content_width);VMM.Element.width(".slider-item .layout-text-media .media .media-container .soundcloud",c);VMM.Element.height(".slider-item .media .media-container .map",a);VMM.Element.css(".slider-item .layout-text-media .media .media-container .media-frame","max-width",o.content_width);var e=0;for(var f=0;f<i.length;f++){e=f*(o.width+o.spacing);VMM.Element.css(i[f],"left",e)}},H=function(a){var b="linear";for(var c=0;c<i.length;c++)c==k?VMM.Element.animate(i[c],o.duration,b,{opacity:1}):c==k-1?VMM.Element.animate(i[c],o.duration,b,{opacity:.1}):c==k+1?VMM.Element.animate(i[c],o.duration,b,{opacity:.1}):VMM.Element.css(i[c],"opacity",a)},I=function(a,b,c,d,e){VMM.ExternalAPI.youtube.stopPlayers();k=a;var f=o.ease,h=o.duration,j=!1,l=!1;k==0&&(l=!0);k+1==i.length&&(j=!0);b!=null&&b!=""&&(f=b);c!=null&&c!=""&&(h=c);var m=VMM.Element.position(i[k]);if(l)VMM.Element.visible(w.prevBtn,!1);else{VMM.Element.visible(w.prevBtn,!0);o.timeline&&VMM.attachElement(w.prevDate,g[k-1].date);VMM.attachElement(w.prevTitle,VMM.Util.unlinkify(g[k-1].title))}if(j)VMM.Element.visible(w.nextBtn,!1);else{VMM.Element.visible(w.nextBtn,!0);o.timeline&&VMM.attachElement(w.nextDate,g[k+1].date);VMM.attachElement(w.nextTitle,VMM.Util.unlinkify(g[k+1].title))}if(d)VMM.Element.css(u,"left",-(m.left-o.content_padding));else{VMM.Element.stop(u);VMM.Element.animate(u,h,f,{left:-(m.left-o.content_padding)})}e&&VMM.fireEvent(x,"LOADED");if(VMM.Element.height(i[k])>o.height)VMM.Element.css(".slider","overflow-y","scroll");else{VMM.Element.css(x,"overflow-y","hidden");VMM.Element.animate(x,h,f,{scrollTop:VMM.Element.prop(x,"scrollHeight")-VMM.Element.height(x)})}},J=function(){var a="<div class='icon'> </div>";w.nextBtn=VMM.appendAndGetElement(s,"<div>","nav-next");w.prevBtn=VMM.appendAndGetElement(s,"<div>","nav-previous");w.nextBtnContainer=VMM.appendAndGetElement(w.nextBtn,"<div>","nav-container",a);w.prevBtnContainer=VMM.appendAndGetElement(w.prevBtn,"<div>","nav-container",a);if(o.timeline){w.nextDate=VMM.appendAndGetElement(w.nextBtnContainer,"<div>","date","1957");w.prevDate=VMM.appendAndGetElement(w.prevBtnContainer,"<div>","date","1957")}w.nextTitle=VMM.appendAndGetElement(w.nextBtnContainer,"<div>","title","Title Goes Here");w.prevTitle=VMM.appendAndGetElement(w.prevBtnContainer,"<div>","title","Title Goes Here");VMM.bindEvent(".nav-next",A);VMM.bindEvent(".nav-previous",B)},K=function(){VMM.attachElement(x,"");s=VMM.getElement("div.slider");t=VMM.appendAndGetElement(s,"<div>","slider-container-mask");u=VMM.appendAndGetElement(t,"<div>","slider-container");v=VMM.appendAndGetElement(u,"<div>","slider-item-container");J();F(g);var a=3e3;if(VMM.Browser.device=="tablet"||VMM.Browser.device=="mobile"){o.duration=500;a=1e3;VMM.TouchSlider.createPanel(u,u,VMM.Element.width(i[0]),o.spacing,!0);VMM.bindEvent(u,C,"TOUCHUPDATE")}else VMM.Browser.device!="mobile";z(!1,!0);VMM.Element.visible(w.prevBtn,!1);I(0,"easeOutExpo",a,!0,!0);r=!0}});typeof VMM!="undefined"&&typeof VMM.Util=="undefined"&&(VMM.Util={init:function(){return this},randomBetween:function(a,b){return Math.floor(Math.random()*(b-a+1)+a)},customSort:function(a,b){var c=a,d=b;return c==d?0:c>d?1:-1},number2money:function(a,b,c){var b=b!==null?b:!0,c=c!==null?c:!1,d=VMM.Math2.floatPrecision(a,2),e=this.niceNumber(d);!e.split(/\./g)[1]&&c&&(e+=".00");b&&(e="$"+e);return e},wordCount:function(a){var b=a+" ",c=/^[^A-Za-z0-9\'\-]+/gi,d=b.replace(c,""),e=/[^A-Za-z0-9\'\-]+/gi,f=d.replace(e," "),g=f.split(" "),h=g.length-1;b.length<2&&(h=0);return h},parseDate:function(a){var b;if(a.match(/,/gi)){var c=a.split(",");for(var d=0;d<c.length;d++)c[d]=parseInt(c[d]);b=new Date;c[0]&&b.setFullYear(c[0]);c[1]>1?b.setMonth(c[1]-1):b.setMonth(0);c[2]>1?b.setDate(c[2]):b.setDate(1);c[3]>1?b.setHours(c[3]):b.setHours(0);c[4]>1?b.setMinutes(c[4]):b.setMinutes(0);c[5]>1?b.setSeconds(c[5]):b.setSeconds(0);c[6]>1?b.setMilliseconds(c[6]):b.setMilliseconds(0)}else if(a.match("/"))b=new Date(a);else if(a.length<5){b=new Date;b.setFullYear(par
|
||
|
.find("#timeline section","figcaption")))}}VMM.Element.each("#timeline li",function(a,c){var d=!1,e={type:"default",startDate:"",headline:"",text:"",asset:{media:"",credit:"",caption:""},tags:"Optional"};if(VMM.Element.find(this,"time")!=0){d=!0;e.startDate=VMM.Element.html(VMM.Element.find(this,"time")[0]);VMM.Element.find(this,"time")[1]&&(e.endDate=VMM.Element.html(VMM.Element.find(this,"time")[0]));e.headline=VMM.Element.html(VMM.Element.find(this,"h3"));e.text=VMM.Element.html(VMM.Element.find(this,"article"));var f=!1;if(VMM.Element.find(this,"figure img").length!=0){f=!0;e.asset.media=VMM.Element.attr(VMM.Element.find(this,"figure img"),"src")}else if(VMM.Element.find(this,"figure a").length!=0){f=!0;e.asset.media=VMM.Element.attr(VMM.Element.find(this,"figure a"),"href")}if(f){VMM.Element.find(this,"cite").length!=0&&(e.asset.credit=VMM.Element.html(VMM.Element.find(this,"cite")));VMM.Element.find(this,"figcaption").length!=0&&(e.asset.caption=VMM.Element.html(VMM.Element.find(this,"figcaption")))}trace(e);b.timeline.date.push(e)}});VMM.fireEvent(global,"DATAREADY",b)},parseJSON:function(a){if(a.timeline.type=="default"){trace("DATA SOURCE: JSON STANDARD TIMELINE");VMM.fireEvent(global,"DATAREADY",a)}else if(a.timeline.type=="twitter"){trace("DATA SOURCE: JSON TWEETS");VMM.Timeline.DataObj.model_Tweets.buildData(a)}else{trace("DATA SOURCE: NO IDEA");trace(type.of(a.timeline))}},model_Tweets:{type:"twitter",buildData:function(a){VMM.bindEvent(global,VMM.Timeline.DataObj.model_Tweets.onTwitterDataReady,"TWEETSLOADED");VMM.ExternalAPI.twitter.getTweets(a.timeline.tweets)},getData:function(a){VMM.bindEvent(global,VMM.Timeline.DataObj.model_Tweets.onTwitterDataReady,"TWEETSLOADED");VMM.ExternalAPI.twitter.getTweetSearch(a)},onTwitterDataReady:function(a,b){var c=VMM.Timeline.DataObj.data_template_obj;for(var d=0;d<b.tweetdata.length;d++){var e={type:"tweets",startDate:"",headline:"",text:"",asset:{media:"",credit:"",caption:""},tags:"Optional"};e.startDate=b.tweetdata[d].raw.created_at;type.of(b.tweetdata[d].raw.from_user_name)?e.headline=b.tweetdata[d].raw.from_user_name+" (<a href='https://twitter.com/"+b.tweetdata[d].raw.from_user+"'>"+"@"+b.tweetdata[d].raw.from_user+"</a>)":e.headline=b.tweetdata[d].raw.user.name+" (<a href='https://twitter.com/"+b.tweetdata[d].raw.user.screen_name+"'>"+"@"+b.tweetdata[d].raw.user.screen_name+"</a>)";e.asset.media=b.tweetdata[d].content;c.timeline.date.push(e)}VMM.fireEvent(global,"DATAREADY",c)}},model_GoogleSpreadsheet:{type:"google spreadsheet",getData:function(a){var b=VMM.Util.getUrlVars(a).key,c="https://spreadsheets.google.com/feeds/list/"+b+"/od6/public/values?alt=json";VMM.getJSON(c,VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData)},buildData:function(a){var b=VMM.Timeline.DataObj.data_template_obj;for(var c=0;c<a.feed.entry.length;c++){var d=a.feed.entry[c];if(d.gsx$titleslide.$t=="start"){b.timeline.startDate=d.gsx$startdate.$t;b.timeline.headline=d.gsx$headline.$t;b.timeline.asset.media=d.gsx$media.$t;b.timeline.asset.caption=d.gsx$mediacaption.$t;b.timeline.asset.credit=d.gsx$mediacredit.$t;b.timeline.text=d.gsx$text.$t;b.timeline.type="google spreadsheet"}else{var e={type:"google spreadsheet",startDate:"",endDate:"",headline:"",text:"",type:"google spreadsheet",asset:{media:"",credit:"",caption:""},tags:"Optional"};e.endDate=d.gsx$enddate.$t;e.startDate=d.gsx$startdate.$t;e.headline=d.gsx$headline.$t;e.asset.media=d.gsx$media.$t;e.asset.caption=d.gsx$mediacaption.$t;e.asset.credit=d.gsx$mediacredit.$t;e.text=d.gsx$text.$t;b.timeline.date.push(e)}}VMM.fireEvent(global,"DATAREADY",b)}},data_template_obj:{timeline:{headline:"",description:"",asset:{media:"",credit:"",caption:""},date:[]}},date_obj:{startDate:"2012,2,2,11,30",headline:"",text:"",asset:{media:"http://youtu.be/vjVfu8-Wp6s",credit:"",caption:""},tags:"Optional"}}};
|