|
|
|
/* Verite
|
|
|
|
* Verite JS Master
|
|
|
|
* Version: 0.5
|
|
|
|
* Date: April 5, 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
|
|
|
|
* ----------------------------------------------------- *//* 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(){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.master_config={init:function(){return this},vp:"Pellentesque nibh felis, eleifend id, commodo in, interdum vitae, leo",keys:{flickr:"RAIvxHY4hE/Elm5cieh4X5ptMyDpj7MYIxziGxi0WGCcy1s+yr7rKQ==",google:"jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo="},youtube:{active:!1,array:[],api_loaded:!1,que:[]},googlemaps:{active:!1,map_active:!1,places_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,c){if(typeof jQuery!="undefined"){if(!(VMM.Browser.browser=="Explorer"&&parseInt(VMM.Browser.version,10)>=8&&window.XDomainRequest))return jQuery.getJSON(a,b,c);trace("it's ie");var d=a;if(d.match("^http://")){trace("RUNNING GET JSON");return jQuery.getJSON(a,b,c)}if(!d.match("^https://"))return jQuery.getJSON(a,b,c);trace("RUNNING XDR");d=d.replace("https://","http://");var e=new XDomainRequest;e.open("get",d);e.onload=function(){var a=VMM.parseJSON(e.responseText);trace(e.responseText);if(type.of(a)!="null"&&type.of(a)!="undefined")return b(a);trace("IE JSON ERROR")};e.send()}};VMM.parseJSON=function(a){if(typeof jQuery!="undefined")return $.parseJSON(a)};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)},removeCl
|
|
|
|
){e=a;m()}else trace("NO DATA")}};VMM.Media.prototype.height=function(a){if(a==null||a=="")return config.height;config.height=a;reSize()};VMM.Media.prototype.width=function(a){if(a==null||a=="")return config.width;config.width=a;reSize()};VMM.Media.prototype.getData=function(){return data};VMM.Media.prototype.setConfig=function(a){typeof a!="undefined"?config=a:trace("NO CONFIG DATA")};VMM.Media.prototype.getConfig=function(){return config};VMM.Media.prototype.setSize=function(a,b){a!=null&&(config.width=a);b!=null&&(config.height=b);_active&&reSize()};VMM.Media.prototype.active=function(){return _active}}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 jQuery!="undefined"){jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c}})}typeof VMM!="undefined"&&typeof VMM.Sequence=="undefined"&&(VMM.Sequence=Class.extend({initialize:function(a,b){trace("sequence init");this.increment=1;this.decrement=1;this.wrap=!1;this.length=a==null?0:a;this.index=b==null?a==0?-1:0:b>=a?a-1:b;this.synced=[]},setLength:function(a){this.length=a;this.setIndex(this.index)},getLength:function(){return this.length},setIndex:function(a){if(this.length<=0){this.index=-1;return}a<0?a=this.wrap?this.length-a%this.length:0:a>=this.length&&(a=this.wrap?a%this.length:this.length-1);var b=this.index;this.index=a;if(b!=this.index)for(var c=0;c<this.synced.length;c++){var d=this.synced[c];d.getIndex()!=this.index&&d.setIndex(this.index)}},getIndex:function(){return this.index},next:function(){this.setIndex(this.index+this.increment)},prev:function(){this.setIndex(this.index-this.decrement)},sync:function(a,b){if(a instanceof NYTMM.Sequence&&a!=this){this.synced.push(a);b&&a.sync(this);return!0}return!1},unsync:function(a,b){for(var c=0;c<this.synced.length;c++)if(this.synced[c]==a){this.synced.splice(c,1);b&&a.unsync(this);return!0}return!1}}));typeof VMM!="undefined"&&typeof VMM.Slider=="undefined"&&(VMM.Slider=function(a,b,c,d){function y(){trace("onConfigSet")}function z(a,b){var c=!0,d=!1;a!=null&&(c=a);b!=null&&(d=b);l=o.width;o.nav_height=VMM.Element.height(w.prevBtnContainer);o.content_width=l-o.content_padding*2
|
|
|
|
:o.feature_height=o.height-o.nav_height;if(typeof timeline_config=="object"){trace("HAS TIMELINE CONFIG");var p;for(p in timeline_config)Object.prototype.hasOwnProperty.call(timeline_config,p)&&(o[p]=timeline_config[p])}else if(typeof c=="object"){var p;for(p in c)Object.prototype.hasOwnProperty.call(c,p)&&(o[p]=c[p])}var q=!1;VMM.Browser.browser=="MSIE"&&parseInt(VMM.Browser.version,10)==7&&(q=!0);this.init=function(a){trace("init");VMM.bindEvent(global,r,"DATAREADY");if(q){f=VMM.appendAndGetElement(e,"<div>","feedback","");g=VMM.appendAndGetElement(f,"<div>","messege","Internet Explorer 7 is not supported by Timeline.")}else{type.of(a)=="string"?VMM.Timeline.DataObj.getData(a):VMM.Timeline.DataObj.getData(h);f=VMM.appendAndGetElement(e,"<div>","feedback","");g=VMM.appendAndGetElement(f,"<div>","messege","Loading Timeline")}};this.iframeLoaded=function(){trace("iframeLoaded")};var z=function(a){VMM.getJSON(a,function(a){m=VMM.Timeline.DataObj.getData(a);VMM.fireEvent(global,"DATAREADY")})},A=function(a){},B=function(){VMM.Element.animate(f,o.duration,o.ease*4,{opacity:0},C)},C=function(){VMM.Element.detach(f)},D=function(){VMM.attachElement(e,"");VMM.appendElement(e,"<div class='container main'><div class='feature'><div class='slider'></div></div><div class='navigation'></div></div>");t();VMM.bindEvent("div.slider",u,"LOADED");VMM.bindEvent("div.navigation",w,"LOADED");VMM.bindEvent("div.slider",x,"UPDATE");VMM.bindEvent("div.navigation",y,"UPDATE");i.init(n);j.init(n,m.era);VMM.bindEvent(global,t,"resize");VMM.bindEvent(global,function(a){a.preventDefault()},"touchmove")},E=function(a,b){F();var c=a,d="",e={};e._text="";e._media="";var f=!1,g=!1,h=!1;if(type.of(b)=="date"){f=!0;a.type!="start"&&(e._text+=VMM.createElement("h2",VMM.Util.date.prettyDate(b),"date"));c.headline!=null&&c.headline!=""&&c.type!="tweets"&&(a.type=="start"?e._text+=VMM.createElement("h2",VMM.Util.linkify_with_twitter(c.headline,"_blank"),"start"):e._text+=VMM.createElement("h3",VMM.Util.linkify_with_twitter(c.headline,"_blank")));if(c.text!=null&&c.text!=""){h=!0;e._text+=VMM.createElement("p",VMM.Util.linkify_with_twitter(c.text,"_blank"))}e._text=VMM.createElement("div",e._text,"container");e._text=VMM.createElement("div",e._text,"text")}if(f&&c.asset!=null&&c.asset!=""&&c.asset.media!=null&&c.asset.media!=""){g=!0;e._media=VMM.MediaElement.create("",c.asset,!0,o.feature_width,o.feature_height)}if(f){var i="content-container layout";h&&(i+="-text");g&&(i+="-media");d=VMM.createElement("div",e._text+e._media,i)}return d},F=function(){o.width=VMM.Element.width(e);o.height=VMM.Element.height(e);o.nav_width=o.width;o.feature_width=o.width;VMM.Browser.device=="mobile"?o.feature_height=o.height:o.feature_height=o.height-o.nav_height-3},G=function(){if(o.width<500){VMM.Element.hide("div.navigation");VMM.Element.hide("div.nav-next");VMM.Element.hide("div.nav-previous");VMM.Element.height(".slider-container-mask",o.height)}else{VMM.Element.show("div.navigation");VMM.Element.show("div.nav-next");VMM.Element.show("div.nav-previous");VMM.Element.height(".slider-container-mask",o.feature_height)}o.width<820&&!(o.width<500)},H=function(){F();if(m.headline!=null&&m.headline!=""&&m.text!=null&&m.text!=""){trace("HAS STARTPAGE");var a={};if(m.type=="google spreadsheet"){trace("google spreadsheet startpage date"+m.startDate);a.startdate=new Date(Date.parse(m.startDate));trace(a.startdate)}else a.startdate=VMM.Util.parseDate(m.startDate);a.uniqueid=VMM.Util.unique_ID(5);a.enddate=a.startdate;a.title=m.headline;a.headline=m.headline;a.text=m.text;a.type="start";a.date=VMM.Util.date.prettyDate(m.startDate);a.asset=m.asset;a.fulldate=a.startdate.getTime();a.content=E(a,a.startdate);a.content!=null&&a.content!=""&&n.push(a)}for(var b=0;b<m.date.length;b++)if(m.date[b].startDate!=null&&m.date[b].startDate!=""){var a={};if(m.date[b].type=="tweets")a.startdate=VMM.ExternalAPI.twitter.parseTwitterDate(m.date[b].startDate);else if(m.date[b].type=="google spreadsheet"){a.startdate=new Date(Date.parse(m.date[b].startDate));trace(a.startdate)}else a.startdate=VMM.Util.par
|