From bea7e81c9430e87a1ec4f09d761e060ce7365f50 Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Thu, 5 Apr 2012 15:35:43 -0500 Subject: [PATCH] Refinements to the IE8 cross domain issue, added Google Doc Viewer Support Also implemented new LoadLib for loading 3rd party javascript APIs --- source/js/VMM.js | 321 +++++++++++------------ source/js/timeline.js | 9 +- timeline-min.js | 14 +- timeline.js | 587 +++++++++++++++++++++++++++++------------- 4 files changed, 570 insertions(+), 361 deletions(-) diff --git a/source/js/VMM.js b/source/js/VMM.js index b6a57b4..c8e470e 100644 --- a/source/js/VMM.js +++ b/source/js/VMM.js @@ -1,8 +1,9 @@ /* Verite * Verite JS Master - * Version: 0.1 - * Date: December 12, 2011 - * Copyright 2011 Verite + * 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 * ----------------------------------------------------- */ @@ -11,131 +12,87 @@ ================================================== */ - /* Simple JavaScript Inheritance * By John Resig http://ejohn.org/ * MIT Licensed. ================================================== */ +(function() { + var initializing = false, + fnTest = /xyz/.test(function() { + xyz; + }) ? /\b_super\b/: /.*/; + // The base Class implementation (does nothing) + this.Class = function() {}; + + // Create a new Class that inherits from this class + Class.extend = function(prop) { + var _super = this.prototype; + + // Instantiate a base class (but only create the instance, + // don't run the init constructor) + initializing = true; + var prototype = new this(); + initializing = false; + + // Copy the properties over onto the new prototype + for (var name in prop) { + // Check if we're overwriting an existing function + prototype[name] = typeof prop[name] == "function" && + typeof _super[name] == "function" && fnTest.test(prop[name]) ? + (function(name, fn) { + return function() { + var tmp = this._super; + + // Add a new ._super() method that is the same method + // but on the super-class + this._super = _super[name]; + + // The method only need to be bound temporarily, so we + // remove it when we're done executing + var ret = fn.apply(this, arguments); + this._super = tmp; + + return ret; + }; + })(name, prop[name]) : + prop[name]; + } -(function(){ - var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; - // The base Class implementation (does nothing) - this.Class = function(){}; - - // Create a new Class that inherits from this class - Class.extend = function(prop) { - var _super = this.prototype; - - // Instantiate a base class (but only create the instance, - // don't run the init constructor) - initializing = true; - var prototype = new this(); - initializing = false; - - // Copy the properties over onto the new prototype - for (var name in prop) { - // Check if we're overwriting an existing function - prototype[name] = typeof prop[name] == "function" && - typeof _super[name] == "function" && fnTest.test(prop[name]) ? - (function(name, fn){ - return function() { - var tmp = this._super; - - // Add a new ._super() method that is the same method - // but on the super-class - this._super = _super[name]; - - // The method only need to be bound temporarily, so we - // remove it when we're done executing - var ret = fn.apply(this, arguments); - this._super = tmp; - - return ret; - }; - })(name, prop[name]) : - prop[name]; - } - - // The dummy class constructor - function Class() { - // All construction is actually done in the init method - if ( !initializing && this.init ) - this.init.apply(this, arguments); - } - - // Populate our constructed prototype object - Class.prototype = prototype; - - // Enforce the constructor to be what we expect - Class.prototype.constructor = Class; - - // And make this class extendable - Class.extend = arguments.callee; - - return Class; - }; -})(); - - - -/* CLASS EXTEND EXAMPLE -================================================== */ -/* -var Person = Class.extend({ - init: function(isDancing){ - this.dancing = isDancing; - }, - dance: function(){ - return this.dancing; - } -}); -var Ninja = Person.extend({ - init: function(){ - this._super( false ); - }, - dance: function(){ - // Call the inherited version of dance() - return this._super(); - }, - swingSword: function(){ - return true; - } -}); - -var p = new Person(true); -p.dance(); // => true + // The dummy class constructor + function Class() { + // All construction is actually done in the init method + if (!initializing && this.init) + this.init.apply(this, arguments); + } -var n = new Ninja(); -n.dance(); // => false -n.swingSword(); // => true + // Populate our constructed prototype object + Class.prototype = prototype; -// Should all be true -p instanceof Person && p instanceof Class && -n instanceof Ninja && n instanceof Person && n instanceof Class -*/ + // Enforce the constructor to be what we expect + Class.prototype.constructor = Class; + // And make this class extendable + Class.extend = arguments.callee; + return Class; + }; +})(); /* Access to the Global Object * access the global object without hard-coding the identifier window ================================================== */ - var global = (function () { return this || (1,eval)('this'); }()); - /* VMM ================================================== */ - if (typeof VMM == 'undefined') { /* Main Scope Container ================================================== */ //var VMM = {}; - var VMM = Class.extend({ - - }); + var VMM = Class.extend({}); /* Master Config ================================================== */ @@ -239,7 +196,6 @@ if (typeof VMM == 'undefined') { }; - /* LIBRARY ABSTRACTION ================================================== */ @@ -344,7 +300,30 @@ if (typeof VMM == 'undefined') { // VMM.getJSON(url, the_function); VMM.getJSON = function(url, the_function) { if( typeof( jQuery ) != 'undefined' ){ - $.getJSON(url, the_function); + + /* CHECK FOR IE AND USE Use Microsoft XDR + ================================================== */ + if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.Browser.version, 10) >= 8 && window.XDomainRequest) { + trace("it's ie"); + var ie_url = url; + + if (ie_url.match('^http://')){ + //ie_url = ie_url.replace("http://","//"); + $.getJSON(url, the_function); + } else if (ie_url.match('^https://')) { + ie_url = ie_url.replace("https://","http://"); + var xdr = new XDomainRequest(); + xdr.open("get", ie_url); + xdr.onload = function() { + var ie_json = VMM.parseJSON(xdr.responseText); + return the_function(ie_json); + } + xdr.send(); + } + } else { + $.getJSON(url, the_function); + + } } } // VMM.parseJSON(the_json); @@ -1259,6 +1238,8 @@ if (typeof VMM == 'undefined') { } else if (m.type == "youtube") { mediaElem = "
"; return mediaElem; + } else if (m.type == "googledoc") { + mediaElem = ""; } else if (m.type == "vimeo") { mediaElem = "
"; return mediaElem; @@ -1278,7 +1259,9 @@ if (typeof VMM == 'undefined') { mediaElem = ""; return mediaElem; } else if (m.type == "website") { - mediaElem = "
"; + //mediaElem = "
"; + mediaElem = "
"; + return mediaElem; } else { mediaElem = "
"; @@ -1331,6 +1314,14 @@ if (typeof VMM == 'undefined') { var flickr_id = "flickr_" + m.id; mediaElem = ""; VMM.ExternalAPI.flickr.getPhoto(m.id, "#" + flickr_id); + } else if (m.type == "googledoc") { + if (m.id.match(/docs.google.com/i)) { + mediaElem = ""; + } else { + mediaElem = ""; + } + + } else if (m.type == "youtube") { mediaElem = "
Loading YouTube video...
"; VMM.ExternalAPI.youtube.init(m.id); @@ -1355,7 +1346,8 @@ if (typeof VMM == 'undefined') { trace("NO KNOWN MEDIA TYPE FOUND TRYING TO JUST PLACE THE HTML"); mediaElem = VMM.Util.properQuotes(m.id); } else if (m.type == "website") { - mediaElem = "" + //mediaElem = ""; + mediaElem = "" + ""; } else { trace("NO KNOWN MEDIA TYPE FOUND"); trace(m.type); @@ -1431,7 +1423,7 @@ if (typeof VMM == 'undefined') { //maps.google.com media.type = "google-map"; media.id = d.split(/src=['|"][^'|"]*?['|"]/gi); - trace("google map " + media.id); + //trace("google map " + media.id); success = true; } else if (d.match("flickr.com/photos")) { media.type = "flickr"; @@ -1439,12 +1431,17 @@ if (typeof VMM == 'undefined') { media.id = d.split("photos\/")[1].split("/")[1]; //media.id = media.id.split("/")[1]; - trace("FLICKR " + media.id); + //trace("FLICKR " + media.id); success = true; } else if (d.match(/jpg|jpeg|png|gif/i)) { media.type = "image"; media.id = d; success = true; + + } else if (d.match(/docs.google.com|.DOC|.DOCX|.XLS|.XLSX|.PPT|.PPTX|.PDF|.PAGES|.AI|.PSD|.TIFF|.DXF|.SVG|.EPS|.PS|.TTF|.XPS|.ZIP|.RAR/i)) { + media.type = "googledoc"; + media.id = d; + success = true; } else if (d.indexOf('http://') == 0) { media.type = "website"; media.id = d; @@ -1467,6 +1464,7 @@ if (typeof VMM == 'undefined') { VMM.Keys = { flickr: "6d6f59d8d30d79f4f402a7644d5073e3", + google: "AIzaSyDUHXB8hefYssfwGpySnQmzTqL9n0qZ3T4" } VMM.ExternalAPI = { @@ -1475,13 +1473,13 @@ if (typeof VMM == 'undefined') { tweetArray: [], // VMM.ExternalAPI.twitter.getHTML(id); getHTML: function(id) { - var the_url = "https://api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?"; - - VMM.getJSON(the_url, function(d) { - VMM.ExternalAPI.twitter.onJSONLoaded(d, id); - }); + //var the_url = document.location.protocol + "//api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?"; + var the_url = "http://api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?"; + VMM.getJSON(the_url, VMM.ExternalAPI.twitter.onJSONLoaded); }, - onJSONLoaded: function(d, id) { + onJSONLoaded: function(d) { + trace("TWITTER JSON LOADED"); + var id = d.id; VMM.attachElement("#"+id, VMM.ExternalAPI.twitter.linkify(d.html) ); }, //somestring = VMM.ExternalAPI.twitter.linkify(d); @@ -1531,7 +1529,7 @@ if (typeof VMM == 'undefined') { /* FETCH THE DATA ================================================== */ - var the_url = "https://api.twitter.com/1/statuses/show.json?id=" + twitter_id + "&include_entities=true&callback=?"; + var the_url = "http://api.twitter.com/1/statuses/show.json?id=" + twitter_id + "&include_entities=true&callback=?"; VMM.getJSON(the_url, function(d) { var tweet = {} @@ -1602,43 +1600,32 @@ if (typeof VMM == 'undefined') { // VMM.ExternalAPI.twitter.prettyHTML(id); prettyHTML: function(id) { - // https://api.twitter.com/1/statuses/show.json?id=164165553810976768&include_entities=true - var the_url = "https://api.twitter.com/1/statuses/show.json?id=" + id + "&include_entities=true&callback=?"; - VMM.getJSON(the_url, function(d) { - VMM.ExternalAPI.twitter.formatJSON(d, id); - }); + // https://api.twitter.com/1/statuses/show.json?id=164165553810976768&include_entities=true&callback=? + var the_url = "http://api.twitter.com/1/statuses/show.json?id=" + id + "&include_entities=true&callback=?"; + VMM.getJSON(the_url, VMM.ExternalAPI.twitter.formatJSON); }, - formatJSON: function(d, id) { + formatJSON: function(d) { + trace("TWITTER JSON LOADED F"); + var id = d.id_str; + var twit = "

"; var td = VMM.Util.linkify(d.text); td = td.replace(/(@([\w]+))/g,"$1"); td = td.replace(/(#([\w]+))/g,"$1"); - //twit += VMM.Util.linkify(d.text); twit += td; twit += "

"; - //twit += "— " + d.user.name + " (@" + d.user.screen_name + ") " + d.created_at + " "; - //twit += "" + VMM.ExternalAPI.twitter.prettyParseTwitterDate(d.created_at); - //twit += "" + VMM.ExternalAPI.twitter.prettyParseTwitterDate(d.created_at) + " "; - //twit += "" + "Tweet Details" + " "; twit += " " + "" + " "; - twit += "
" + twit += "" + twit += ""; + twit += "
"; - - /* -
-

Tom Brokaw asks #Romney to remove from ads 1997 NBC report on #Gingrich legal troubles. Romney unmoved. thecaucus.blogs.nytimes.com/2012/01/28/nbc…

- — Jim Roberts (@nytjim) January 29, 2012 -
- */ VMM.attachElement("#"+id, twit ); - //VMM.attachElement("#"+id, VMM.ExternalAPI.twitter.linkify(twit) ); + } }, @@ -1650,32 +1637,38 @@ if (typeof VMM == 'undefined') { flickr: { getPhoto: function(mid, id) { - // http://soundcloud.com/oembed?iframe=true&url=http://soundcloud.com/erasedtapes/olafur-arnalds-poland - var the_url = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=" + VMM.Keys.flickr + "&photo_id=" + mid + "&format=json&nojsoncallback=1"; - VMM.getJSON(the_url, function(d) { - - var flickr_large_id = id + "_large"; - var flickr_thumb_id = id + "_thumb"; - var flickr_img_large = d.sizes.size[d.sizes.size.length - 1].source; - var flickr_img_thumb = d.sizes.size[0].source; - - VMM.Element.attr(flickr_large_id, "src", flickr_img_large); - VMM.Element.attr(flickr_thumb_id, "src", flickr_img_thumb); - }); + // http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=6d6f59d8d30d79f4f402a7644d5073e3&photo_id=6115056146&format=json&nojsoncallback=1 + var the_url = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=" + VMM.Keys.flickr + "&photo_id=" + mid + "&format=json&jsoncallback=?"; + VMM.getJSON(the_url, VMM.ExternalAPI.flickr.setPhoto); }, + //VMM.ExternalAPI.flickr.setPhoto(d); + setPhoto: function(d) { + var flickr_id = d.sizes.size[0].url.split("photos\/")[1].split("/")[1]; + var id = "flickr_" + flickr_id; + var flickr_large_id = id + "_large"; + var flickr_thumb_id = id + "_thumb"; + var flickr_img_large = d.sizes.size[d.sizes.size.length - 1].source; + var flickr_img_thumb = d.sizes.size[0].source; + VMM.Element.attr("#"+flickr_large_id, "src", flickr_img_large); + VMM.Element.attr("#"+flickr_thumb_id, "src", flickr_img_thumb); + } }, soundcloud: { // VMM.ExternalAPI.soundcloud.getSound(url, id) + /* + REFORMAT TO USE API FOR CUSTOM PLAYERS + */ getSound: function(url, id) { // http://soundcloud.com/oembed?iframe=true&url=http://soundcloud.com/erasedtapes/olafur-arnalds-poland - var the_url = "http://soundcloud.com/oembed?iframe=true&url=" + url + ""; + var the_url = "http://soundcloud.com/oembed?url=" + url + "&format=js&callback=?"; VMM.getJSON(the_url, function(d) { VMM.attachElement("#"+id, d.html ); }); }, + }, // VMM.ExternalAPI.youtube.init(id); @@ -1691,11 +1684,10 @@ if (typeof VMM == 'undefined') { if (VMM.master_config.youtube.api_loaded) { } else { - var tag = document.createElement('script'); - tag.src = "http://www.youtube.com/player_api"; - var firstScriptTag = document.getElementsByTagName('script')[0]; - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); - VMM.master_config.youtube.api_loaded = true; + + VMM.LoadLib.js('http://www.youtube.com/player_api', function() { + trace("YouTube API Library Loaded"); + }); } } @@ -2034,18 +2026,3 @@ if( typeof( jQuery ) != 'undefined' ){ - - -/* CLONE OBJECTS -================================================== */ -/* -Object.prototype.clone = function() { - var newObj = (this instanceof Array) ? [] : {}; - for (i in this) { - if (i == 'clone') continue; - if (this[i] && typeof this[i] == "object") { - newObj[i] = this[i].clone(); - } else newObj[i] = this[i] - } return newObj; -}; -*/ diff --git a/source/js/timeline.js b/source/js/timeline.js index 66b9daa..45319f7 100755 --- a/source/js/timeline.js +++ b/source/js/timeline.js @@ -38,6 +38,7 @@ // @codekit-prepend "VMM.js"; // @codekit-prepend "VMM.Core.js"; // @codekit-prepend "VMM.Util.js"; +// @codekit-prepend "VMM.LoadLib.js"; // @codekit-prepend "bootstrap-tooltip.js"; /* Timeline Class contained in VMM (verite) namespace @@ -350,6 +351,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { //c._media = VMM.createElement("div", c._media, "media-wrapper"); slide = VMM.createElement("div", c._text + c._media, _layout_class); + + + //trace(slide); } @@ -1973,7 +1977,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { getData: function(raw_data) { var _key = VMM.Util.getUrlVars(raw_data)["key"]; var _url = "https://spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json"; - + VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); + /* if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.Browser.version, 10) >= 8 && window.XDomainRequest) { // Use Microsoft XDR // going to move this to VMM.getJSON @@ -1993,11 +1998,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { trace("not ie"); VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); } + */ }, buildData: function(d) { - var _data_obj = VMM.Timeline.DataObj.data_template_obj; for(var i = 0; i < d.feed.entry.length; i++) { diff --git a/timeline-min.js b/timeline-min.js index 93b1144..7b5928a 100644 --- a/timeline-min.js +++ b/timeline-min.js @@ -1,13 +1 @@ -/* 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+""}return f};VMM.createMediaElement=function(a,b,c){var d="",e=!1;d+="
";if(a!=null&&a!=""){valid=!0;d+="";c!=null&&c!=""&&(d+=VMM.createElement("div",c,"credit"));b!=null&&b!=""&&(d+=VMM.createElement("div",b,"caption"))}d+="
";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="
",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:function(a){var b;typeof jQuery!="undefined"&&(b=$(a).offset());return b},position:function(a){var b;typeof jQuery!="undefined"&&(b=$(a).position());return b},width:function(a,b){if(b!=null&&b!="")typeof jQuery!="undefined"&&$(a).width(b);else if(typeof jQuery!="undefined")return $(a).width()},height:function(a,b){if(b!=null&&b!="")typeof jQuery!="undefined"&&$(a).height(b);else if(typeof jQuery!="undefined")return $(a).height()},toggleClass:function(a,b){typeof jQuery!="undefined"&&$(a).toggleClass(b)},each:function(a,b){typeof jQuery!="undefined"&&$(a).each(b)},html:function(a,b){var c;if(typeof jQuery!="undefined"){c=$(a).html();return c}if(b!=null&&b!="")typeof jQuery!="undefined"&&$(a).html(b);else{var c;if(typeof jQuery!="undefined"){c=$(a).html();return c}}},find:function(a,b){if(typeof jQuery!="undefined")return $(a).find(b)},stop:function(a){typeof jQuery!="undefined"&&$(a).stop()},animate:function(a,b,c,d,e){var f="easein",g=1e3,h={};b!=null&&(b<1?g=1:g=Math.round(b));c!=null&&c!=""&&(f=c);d!=null?h=d:h={opacity:0};if(VMM.Browser.device=="mobile"||VMM.Browser.device=="tablet"){var i=Math.round(g/1500*10)/10,j=i+"s";VMM.Element.css(a,"-webkit-transition","all "+j+" ease");VMM.Element.css(a,"-moz-transition","all "+j+" ease");VMM.Element.css(a,"-o-transition","all "+j+" ease");VMM.Element.css(a,"-ms-transition","all "+j+" ease");VMM.Element.css(a,"transition","all "+j+" ease");VMM.Element.cssmultiple(a,h)}else typeof jQuery!="undefined"&&(e!=null&&e!=""?$(a).animate(h,{queue:!1,duration:g,easing:f,complete:e}):$(a).animate(h,{queue:!1,duration:g,easing:f}))}}.init();VMM.TouchSlider={createPanel:function(a,b,c,d,e,f){VMM.TouchSlider.vertical=!1;VMM.TouchSlider.vertical=e;var g=d;VMM.TouchSlider.width=c;VMM.TouchSlider.height=f;VMM.TouchSlider.makeTouchable(a,b)},removePanel:function(a){VMM.unbindEvent(a,VMM.TouchSlider.onTouchStart,"touchstart");VMM.unbindEvent(a,VMM.TouchSlider.onTouchMove,"touchmove");VMM.unbindEvent(a,VMM.TouchSlider.onTouchEnd,"touchend")},makeTouchable:function(a,b){VMM.bindEvent(a,VMM.TouchSlider.onTouchStart,"touchstart",{element:b});VMM.bindEvent(a,VMM.TouchSlider.onTouchMove,"touchmove",{element:b});VMM.bindEvent(a,VMM.TouchSlider.onTouchEnd,"touchend",{element:b})},onTouchStart:function(a){VMM.TouchSlider.touchStart(a.data.element,a);a.preventDefault();a.stopPropagation();return!0},onTouchEnd:function(a){a.preventDefault();a.stopPropagation();if(VMM.TouchSlider.sliding){VMM.TouchSlider.sliding=!1;VMM.TouchSlider.touchEnd(a.data.element,a);return!1}return!0},onTouchMove:function(a){VMM.TouchSlider.touchMove(a.data.element,a);a.preventDefault();a.stopPropagation();return!1},getLeft:function(a){return parseInt(VMM.Element.css(a,"left").substring(0,VMM.Element.css(a,"left").length-2),10)},getTop:function(a){return parseInt(VMM.Element.css(a,"top").substring(0,VMM.Element.css(a,"top").length-2),10)},touchStart:function(a,b){VMM.Element.css(a,"-webkit-transition-duration","0");VMM.TouchSlider.startX=b.originalEvent.touches[0].screenX;VMM.TouchSlider.startY=b.originalEvent.touches[0].screenY;VMM.TouchSlider.startLeft=VMM.TouchSlider.getLeft(a);VMM.TouchSlider.startTop=VMM.TouchSlider.getTop(a);VMM.TouchSlider.touchStartTime=(new Date).getTime()},touchEnd:function(a,b){if(VMM.TouchSlider.getLeft(a)>0){VMM.TouchSlider.vertical?VMM.Element.animate(a,1e3,"",{top:0}):VMM.Element.animate(a,1e3,"",{left:0});VMM.TouchSlider.startX=null;VMM.TouchSlider.startY=null;VMM.fireEvent(a,"TOUCHUPDATE",[0])}else VMM.TouchSlider.slideMomentum(a,b)},slideMomentum:function(a,b){var c=((new Date).getTime()-VMM.TouchSlider.touchStartTime)*10,d=c,e=VMM.TouchSlider.getLeft(a),f=VMM.TouchSlider.getTop(a),g=6e3*(Math.abs(VMM.TouchSlider.startLeft)-Math.abs(e)),h=6e3*(Math.abs(VMM.TouchSlider.startTop)-Math.abs(f));c=Math.round(g/c);slideAdjustY=Math.round(h/c);var i=c+e,j=slideAdjustY+f,k=j%VMM.TouchSlider.height,l=i%VMM.TouchSlider.width,m={top:Math.min(0,j),left:Math.min(0,i),time:d};VMM.fireEvent(a,"TOUCHUPDATE",[m]);VMM.TouchSlider.startX=null;VMM.TouchSlider.startY=null},doSlide:function(a,b,c){VMM.Element.css(a,"-webkit-transition-property","left");VMM.Element.css(a,"-webkit-transition-duration",c);VMM.Element.css(a,"left",b)},touchMove:function(a,b){!!VMM.TouchSlider.sliding;VMM.TouchSlider.sliding=!0;if(VMM.TouchSlider.vertical)if(VMM.TouchSlider.startY>b.originalEvent.touches[0].screenY){VMM.Element.css(a,"top",-(VMM.TouchSlider.startY-b.originalEvent.touches[0].screenY-VMM.TouchSlider.startTop));VMM.TouchSlider.slidingTop=!0}else{var c=b.originalEvent.touches[0].screenY-VMM.TouchSlider.startY+VMM.TouchSlider.startTop;VMM.Element.css(a,"top",-(VMM.TouchSlider.startY-b.originalEvent.touches[0].screenY-VMM.TouchSlider.startTop));VMM.TouchSlider.slidingTop=!1}else if(VMM.TouchSlider.startX>b.originalEvent.touches[0].screenX){VMM.Element.css(a,"left",-(VMM.TouchSlider.startX-b.originalEvent.touches[0].screenX-VMM.TouchSlider.startLeft));VMM.TouchSlider.slidingLeft=!0}else{var d=b.originalEvent.touches[0].screenX-VMM.TouchSlider.startX+VMM.TouchSlider.startLeft;VMM.Element.css(a,"left",-(VMM.TouchSlider.startX-b.originalEvent.touches[0].screenX-VMM.TouchSlider.startLeft));VMM.TouchSlider.slidingLeft=!1}}};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)}};VMM.DragSlider={createPanel:function(a,b,c,d,e){var f=d;VMM.DragSlider.width=c;VMM.DragSlider.makeDraggable(a,b);VMM.DragSlider.drag_elem=a;VMM.DragSlider.sticky=e},makeDraggable:function(a,b){VMM.bindEvent(a,VMM.DragSlider.onDragStart,"mousedown",{element:b,delement:a});VMM.bindEvent(a,VMM.DragSlider.onDragEnd,"mouseup",{element:b,delement:a});VMM.bindEvent(a,VMM.DragSlider.onDragLeave,"mouseleave",{element:b,delement:a})},cancelSlide:function(a){VMM.unbindEvent(VMM.DragSlider.drag_elem,VMM.DragSlider.onDragMove,"mousemove");return!0},onDragLeave:function(a){VMM.unbindEvent(a.data.delement,VMM.DragSlider.onDragMove,"mousemove");a.preventDefault();a.stopPropagation();return!0},onDragStart:function(a){VMM.DragSlider.dragStart(a.data.element,a.data.delement,a);a.preventDefault();a.stopPropagation();return!0},onDragEnd:function(a){a.preventDefault();a.stopPropagation();if(VMM.DragSlider.sliding){VMM.DragSlider.sliding=!1;VMM.DragSlider.dragEnd(a.data.element,a.data.delement,a);return!1}return!0},onDragMove:function(a){VMM.DragSlider.dragMove(a.data.element,a);a.preventDefault();a.stopPropagation();return!1},dragStart:function(a,b,c){VMM.DragSlider.startX=c.pageX;VMM.DragSlider.startLeft=VMM.DragSlider.getLeft(a);VMM.DragSlider.dragStartTime=(new Date).getTime();VMM.DragSlider.dragWidth=VMM.Element.width(b);var d=Math.round(VMM.DragSlider.startX-c.pageX-VMM.DragSlider.startLeft);VMM.Element.stop(a);VMM.bindEvent(b,VMM.DragSlider.onDragMove,"mousemove",{element:a})},dragEnd:function(a,b,c){VMM.unbindEvent(b,VMM.DragSlider.onDragMove,"mousemove");VMM.DragSlider.getLeft(a)>0||VMM.DragSlider.dragMomentum(a,c)},dragMove:function(a,b){!!VMM.DragSlider.sliding;VMM.DragSlider.sliding=!0;if(VMM.DragSlider.startX>b.pageX){VMM.Element.css(a,"left",-(VMM.DragSlider.startX-b.pageX-VMM.DragSlider.startLeft));VMM.DragSlider.slidingLeft=!0}else{var c=b.pageX-VMM.DragSlider.startX+VMM.DragSlider.startLeft;VMM.Element.css(a,"left",-(VMM.DragSlider.startX-b.pageX-VMM.DragSlider.startLeft));VMM.DragSlider.slidingLeft=!1}},dragMomentum:function(a,b){var c=((new Date).getTime()-VMM.DragSlider.dragStartTime)*10,d=c,e=VMM.DragSlider.getLeft(a),f=6e3*(Math.abs(VMM.DragSlider.startLeft)-Math.abs(e));c=Math.round(f/c);var g=e+c,h=g%VMM.DragSlider.width,i={left:Math.min(g),time:d};VMM.fireEvent(a,"DRAGUPDATE",[i]);var j="easeOutExpo";i.time>0&&VMM.Element.animate(a,i.time,j,{left:i.left})},getLeft:function(a){return parseInt(VMM.Element.css(a,"left").substring(0,VMM.Element.css(a,"left").length-2),10)}};VMM.Browser={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";this.device=this.searchDevice(navigator.userAgent)},searchDevice:function(a){return a.match(/Android/i)||a.match(/iPhone|iPod/i)?"mobile":a.match(/iPad/i)?"tablet":a.match(/BlackBerry/i)||a.match(/IEMobile/i)?"other mobile":"desktop"},searchString:function(a){for(var b=0;b
";return d}if(e.type=="flickr"){d="
";return d}if(e.type=="youtube"){d="
";return d}if(e.type=="vimeo"){d="
";return d}if(e.type=="twitter"){d="
";return d}if(e.type=="twitter-ready"){d="
";return d}if(e.type=="soundcloud"){d="
";return d}if(e.type=="google-map"){d="
";return d}if(e.type=="unknown"){d="";return d}if(e.type=="website"){d="
";return d}d="
";return d}},create:function(a,b,c,d,e){_return=c;_w=500;_h=400;$mediacontainer=a;var f=!1;d!=null&&d!=""&&(_w=d);e!=null&&e!=""&&(_h=e);if(b.media!=null&&b.media!=""){f=!0;var g="",h="",i="",j={},k=_h-50,l=!1;b.credit!=null&&b.credit!=""&&(i="
"+b.credit+"
");b.caption!=null&&b.caption!=""&&(h="
"+b.caption+"
");j=VMM.MediaType(b.media);if(j.type=="image")g="";else if(j.type=="flickr"){var m="flickr_"+j.id;g="";VMM.ExternalAPI.flickr.getPhoto(j.id,"#"+m)}else if(j.type=="youtube"){g="
Loading YouTube video...
";VMM.ExternalAPI.youtube.init(j.id)}else if(j.type=="vimeo")g="";else if(j.type=="twitter"){g="
Loading Tweet
";trace("TWITTER");VMM.ExternalAPI.twitter.prettyHTML(j.id);l=!0}else if(j.type=="twitter-ready")g=j.id;else if(j.type=="soundcloud"){var n="soundcloud_"+VMM.Util.unique_ID(5);g="
Loading Sound
";VMM.ExternalAPI.soundcloud.getSound(j.id,n)}else if(j.type=="google-map")g="";else if(j.type=="unknown"){trace("NO KNOWN MEDIA TYPE FOUND TRYING TO JUST PLACE THE HTML");g=VMM.Util.properQuotes(j.id)}else if(j.type=="website")g="";else{trace("NO KNOWN MEDIA TYPE FOUND");trace(j.type)}g="
"+g+i+h+"
";if(_return)return l?"
"+g+"
":"
"+g+"
";VMM.appendElement($mediacontainer,g);VMM.appendElement($mediacontainer,i);VMM.appendElement($mediacontainer,h)}}}.init();VMM.MediaType=function(a){var b=!1,c={};if(a.match("div class='twitter'")){c.type="twitter-ready";c.id=a;b=!0}else if(a.match("(www.)?youtube|youtu.be")){a.match("embed")?youtube_id=a.split(/embed\//)[1].split('"')[0]:youtube_id=a.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0];c.type="youtube";c.id=youtube_id;b=!0}else if(a.match("(player.)?vimeo.com")){vimeo_id=a.split(/video\/|\/\/vimeo\.com\//)[1].split(/[?&]/)[0];c.type="vimeo";c.id=vimeo_id;b=!0}else if(a.match("(player.)?soundcloud.com")){c.type="soundcloud";c.id=a;b=!0}else if(a.match("(www.)?twitter.com")){trace("TWITTER MATCH");a.match("status/")?twitter_id=a.split("status/")[1]:a.match("statuses/")?twitter_id=a.split("statuses/")[1]:twitter_id="";c.type="twitter";c.id=twitter_id;b=!0}else if(a.match("maps.google.com")){c.type="google-map";c.id=a.split(/src=['|"][^'|"]*?['|"]/gi);trace("google map "+c.id);b=!0}else if(a.match("flickr.com/photos")){c.type="flickr";c.id=a.split("photos/")[1].split("/")[1];trace("FLICKR "+c.id);b=!0}else if(a.match(/jpg|jpeg|png|gif/i)){c.type="image";c.id=a;b=!0}else if(a.indexOf("http://")==0){c.type="website";c.id=a;b=!0}else{trace("unknown media");c.type="unknown";c.id=a;b=!0}if(b)return c;trace("No valid media id detected");trace(a);return!1};VMM.Keys={flickr:"6d6f59d8d30d79f4f402a7644d5073e3"};VMM.ExternalAPI={twitter:{tweetArray:[],getHTML:function(a){var b="https://api.twitter.com/1/statuses/oembed.json?id="+a+"&callback=?";VMM.getJSON(b,function(b){VMM.ExternalAPI.twitter.onJSONLoaded(b,a)})},onJSONLoaded:function(a,b){VMM.attachElement("#"+b,VMM.ExternalAPI.twitter.linkify(a.html))},linkify:function(a){return a.replace(/[@]+[A-Za-z0-9-_]+/g,function(a){var b=a.replace("@","");return a.link("http://twitter.com/"+b)})},parseTwitterDate:function(a){var b=new Date(Date.parse(a));return b},prettyParseTwitterDate:function(a){var b=new Date(Date.parse(a));return VMM.Util.date.prettyDate(b,!0)},getTweets:function(a){var b=[],c=a.length;for(var d=0;d

",f=VMM.Util.linkify(a.text);f=f.replace(/(@([\w]+))/g,"$1");f=f.replace(/(#([\w]+))/g,"$1");e+=f;e+="

";e+="— "+a.user.name+" (@"+a.user.screen_name+") "+VMM.ExternalAPI.twitter.prettyParseTwitterDate(a.created_at)+"
";d.content=e;d.raw=a;b.push(d);if(b.length==c){var g={tweetdata:b};VMM.fireEvent(global,"TWEETSLOADED",g)}})}},getTweetSearch:function(a,b){var c=40;b!=null&&b!=""&&(c=b);var d="http://search.twitter.com/search.json?q="+a+"&rpp="+c+"&include_entities=true&result_type=mixed",e=[];VMM.getJSON(d,function(a){for(var b=0;b