From 26cf675c75962fc3d4eff7940f1ab830dac0aafe Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Fri, 30 Mar 2012 21:30:59 -0500 Subject: [PATCH 01/53] Replaced with markdown version --- README.html | 1 - 1 file changed, 1 deletion(-) delete mode 100755 README.html diff --git a/README.html b/README.html deleted file mode 100755 index 7fe1c4b..0000000 --- a/README.html +++ /dev/null @@ -1 +0,0 @@ -Timeline Documentation

Document history with Timeline

There are lots of timeline tools on the web but they are almost all either hard on the eyes or hard to use. Create timelines that are at the same time beautiful and intuitive for users

Timeline is great for pulling in media from different sources. Just throw in a link from Twitter, YouTube, Flickr, Vimeo, Google Maps or SoundCloud and Timeline will format it to fit perfectly. More media types will be supported in the future.

Creating one is as easy as filling in a Google spreadsheet or as detailed as JSON.

Add it to your site

Step 1

Include these lines in the <head> of your site.

        <!-- CSS -->

        <link href="timeline.css" rel="stylesheet">

        

        <!-- JavaScript -->

        <script type="text/javascript" src="jquery-min.js"></script>

        <script type="text/javascript" src="timeline-min.js"></script>

Step 2

Add a <div> with an id called “timeline” in the <body> of your site.

<div id="timeline"></div>

Step 3

Initialize the data source in either the <head> or the <body>

<script>

                $(document).ready(function() {

                        timeline = new VMM.Timeline();

                        timeline.init("your_data.json");                        

                });

</script>

File Formats

JSON:

JSON is the native data format of Timeline. It is easy to work with and even people non-coders can create timelines with this method.

JSON is picky though. Pay special attention to the small details. A misplaced comma or quotation mark can prevent the timeline from loading properly.

Instructions on actually using the JSON file are included in the example data.JSON file.

A few hints about working with JSON files.

  1. JSON works in pairs. In the file you will notice “parameters”:”specific attributes”
  1. The part you will want to change goes in the specific attributes section.
  1. Pay special attention to the formatting notes in the json-guide/data.json file.

Google Docs:

If you don’t want to mess with JSON, grab a spreadsheet in Google Docs to build your timeline. It’s as simple as dropping a date, text, and links into the appropriate columns in Timeline’s template.

You can find the template here: https://docs.google.com/a/digitalartwork.net/previewtemplate?id=0AppSVxABhnltdEhzQjQ4MlpOaldjTmZLclQxQWFTOUE&mode=public

There are only four things you need to know in order to create a timeline using Google Docs:

  1. Make the spreadsheet public:
    Google Docs are automatically set to private but the spreadsheet must be public.

    Click the blue “Share” button on the top right-hand corner. In the “Share settings” window, you’ll see the private setting of the spreadsheet: click “Change...”. In the Visibility options window, choose “Public on the Web” and save.

  1. Publish to the Web
    Under the File menu, select “Publish to the Web.”

    In the next window, check the box next to “
    Automatically republish when changes are made.” Uncheck all other boxes. Click “start publishing.” This will give you the URL to embed in your HTML file.

  1. Copy/paste the Web URL into your Timeline HTML file
    After you publish the spreadsheet, Google Docs will generate a link to the file. Copy the link for the Web Page option (as opposed to PDF, HTML, XLS, etc.), then paste it into the timeline’s HTML file:

    timeline.init(“URL goes here”)

  1. Designate the “start” slide
    This indicates which event is the title slide, the one that begins the timeline.

    Only one should be labeled "start" (generally, the first one). The title slide must have a start date, headline and text to appear properly.

Getting Timeline onto the web

The zipped folder contains all of the files that you need in order to get Timeline working on your site. Upload the entire folder to your server and then you can play with the example timelines.

To create a new timeline, decide which file format you would like to use. Check out the examples folder of your chosen format.

For a google spreadsheet:

  1. Start by dropping in a placeholder, like “Timeline title goes here.”
  1. Save, make the spreadsheet public and publish it.
  1. To publish: File > Publish to the Web
  2. Copy/paste the link into HTML page
  3. Save, upload to server
  1. After making changes in the spreadsheet, reload the page in the browser to make sure everything is working well.

Media

Included in the zip file is a kitchen sink example. This timeline shows how to incorporate the different media types from different services like Twitter, YouTube, Flickr and Vimeo.

Twitter: Just copy and paste the address of the tweet from the browser bar into the media parameter. Timeline will auto-magically pull in the tweet and format it so that it looks beautiful.

For Flickr, Google Maps, SoundCloud, YouTube and Vimeo, just copy the URL and paste it into the media parameter.

Best practices

Tips and tricks to best utilize Timeline

  1. Timelines look best when they flow well and maintain a good pace. Some ideas to keep in mind:
  1. Keep it light - don’t get bogged down by text or other elements
  2. Include compelling media that help
  1. Chronology
  1. The best timeline stories have a strong chronological flow to the story. It does not  work well for stories that do not have a strong timeline element or that need to jump around in the timeline.
  2. Chronological order is inherent in a timeline, but we’re human: Sometimes we forget a date. Luckily, Timeline will sort events by date regardless of what order they are in on the spreadsheet.
  1. Include more than just the major events
  1. It is generally a more compelling story to include important smaller events that lead up to major events than just showing the major events.
\ No newline at end of file From 472b37485480099b3afeab33da5f5c2221be2fe4 Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Fri, 30 Mar 2012 21:31:36 -0500 Subject: [PATCH 02/53] Ignore DS_Store --- examples/.DS_Store | Bin 12292 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 examples/.DS_Store diff --git a/examples/.DS_Store b/examples/.DS_Store deleted file mode 100644 index 50ee845cdd95304b27b698110fb117e7513c0fae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12292 zcmeI1ze)o^5XNUUg=mBn7C|fy|5Re(8ypflv9Yw!n1rag60MH7$&Cu4fgpNsEQ`aIY?!ZDE z3XMa9A2C84j{d~`Qr9AC94^5RAHkm-{Dczh>6kw;cL`}!)+9gzWdfV=vZnd}a`E}U zJcw5$Kmz}YK&Uis8W&iS=hm6UX|7FB?org#uZU_xP Date: Fri, 30 Mar 2012 21:32:00 -0500 Subject: [PATCH 03/53] Added more DS_STOREs to the ignore file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9bea433..c95f12f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store + +examples/.DS_Store From b2049b9a5e8897d81cc8fd5587f8a7f74d99a331 Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Fri, 30 Mar 2012 21:32:37 -0500 Subject: [PATCH 04/53] Fix for IE7 and removal of analytics --- examples/kitchen-sink/index.html | 19 +------------------ .../template_googlespreadsheet/index.html | 1 - examples/template_html/index.html | 3 --- examples/template_json/index.html | 5 ----- 4 files changed, 1 insertion(+), 27 deletions(-) diff --git a/examples/kitchen-sink/index.html b/examples/kitchen-sink/index.html index eb734ee..420110a 100644 --- a/examples/kitchen-sink/index.html +++ b/examples/kitchen-sink/index.html @@ -6,10 +6,6 @@ - - - - - - - + diff --git a/examples/template_googlespreadsheet/index.html b/examples/template_googlespreadsheet/index.html index f2bc683..157a1dc 100644 --- a/examples/template_googlespreadsheet/index.html +++ b/examples/template_googlespreadsheet/index.html @@ -12,7 +12,13 @@ - + diff --git a/examples/template_html/index.html b/examples/template_html/index.html index 6dd7a45..338dae1 100755 --- a/examples/template_html/index.html +++ b/examples/template_html/index.html @@ -12,7 +12,13 @@ - + diff --git a/examples/template_json/index.html b/examples/template_json/index.html index ca99868..cfc6cb9 100644 --- a/examples/template_json/index.html +++ b/examples/template_json/index.html @@ -12,7 +12,13 @@ - + From e06e1f52d1f6c0d2d7d6da2050873e7ea47b84ae Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Sun, 1 Apr 2012 21:21:48 -0500 Subject: [PATCH 16/53] Updated to non minified ver - Started development asynchronous embed feature --- timeline-embed.js | 505 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 503 insertions(+), 2 deletions(-) diff --git a/timeline-embed.js b/timeline-embed.js index 9f7e1e6..44eb0f4 100644 --- a/timeline-embed.js +++ b/timeline-embed.js @@ -1,4 +1,6 @@ -/*jslint browser: true, eqeqeq: true, bitwise: true, newcap: true, immed: true, regexp: false *//** +/*jslint browser: true, eqeqeq: true, bitwise: true, newcap: true, immed: true, regexp: false */ + +/** LazyLoad makes it easy and painless to lazily load one or more external JavaScript or CSS files on demand either during or after the rendering of a web page. @@ -33,4 +35,503 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @class LazyLoad @static @version 2.0.3 (git) -*/LazyLoad=function(a){function h(b,c){var d=a.createElement(b),e;for(e in c)c.hasOwnProperty(e)&&d.setAttribute(e,c[e]);return d}function i(a){var b=d[a],c,g;if(b){c=b.callback;g=b.urls;g.shift();e=0;if(!g.length){c&&c.call(b.context,b.obj);d[a]=null;f[a].length&&k(a)}}}function j(){var c=navigator.userAgent;b={async:a.createElement("script").async===!0};(b.webkit=/AppleWebKit\//.test(c))||(b.ie=/MSIE/.test(c))||(b.opera=/Opera/.test(c))||(b.gecko=/Gecko\//.test(c))||(b.unknown=!0)}function k(e,g,k,n,o){var p=function(){i(e)},q=e==="css",r=[],s,t,u,v,w,x;b||j();if(g){g=typeof g=="string"?[g]:g.concat();if(q||b.async||b.gecko||b.opera)f[e].push({urls:g,callback:k,obj:n,context:o});else for(s=0,t=g.length;s=0)if(g[b].href===a.urls[0]){i("css");break}e+=1;a&&(e<200?setTimeout(m,50):i("css"))}}var b,c,d={},e=0,f={css:[],js:[]},g=a.styleSheets;return{css:function(a,b,c,d){k("css",a,b,c,d)},js:function(a,b,c,d){k("js",a,b,c,d)}}}(this.document);(function(a,b,c){function j(){LazyLoad.js("http://veritetimeline.appspot.com/latest/timeline-min.js",k)}function k(){d=!0;m()}function l(){e=!0;m()}function m(){if(f>40)return;f++;if(d&&e){var a=new VMM.Timeline;a.init("taylor/data.json")}else setTimeout("checkLoad();",250)}var d=!1,e=!1,f=0,g=document.createElement("div");document.getElementById("timeline-embed").appendChild(g);g.setAttribute("id","timeline");LazyLoad.css("http://veritetimeline.appspot.com/latest/timeline.css",l);try{var h=jQuery;h=!0}catch(i){var h=!1}h?j():LazyLoad.js("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js",j)})(this,document,window); \ No newline at end of file +*/ + +LazyLoad = (function (doc) { + // -- Private Variables ------------------------------------------------------ + + // User agent and feature test information. + var env, + + // Reference to the element (populated lazily). + head, + + // Requests currently in progress, if any. + pending = {}, + + // Number of times we've polled to check whether a pending stylesheet has + // finished loading. If this gets too high, we're probably stalled. + pollCount = 0, + + // Queued requests. + queue = {css: [], js: []}, + + // Reference to the browser's list of stylesheets. + styleSheets = doc.styleSheets; + + // -- Private Methods -------------------------------------------------------- + + /** + Creates and returns an HTML element with the specified name and attributes. + + @method createNode + @param {String} name element name + @param {Object} attrs name/value mapping of element attributes + @return {HTMLElement} + @private + */ + function createNode(name, attrs) { + var node = doc.createElement(name), attr; + + for (attr in attrs) { + if (attrs.hasOwnProperty(attr)) { + node.setAttribute(attr, attrs[attr]); + } + } + + return node; + } + + /** + Called when the current pending resource of the specified type has finished + loading. Executes the associated callback (if any) and loads the next + resource in the queue. + + @method finish + @param {String} type resource type ('css' or 'js') + @private + */ + function finish(type) { + var p = pending[type], + callback, + urls; + + if (p) { + callback = p.callback; + urls = p.urls; + + urls.shift(); + pollCount = 0; + + // If this is the last of the pending URLs, execute the callback and + // start the next request in the queue (if any). + if (!urls.length) { + callback && callback.call(p.context, p.obj); + pending[type] = null; + queue[type].length && load(type); + } + } + } + + /** + Populates the env variable with user agent and feature test + information. + + @method getEnv + @private + */ + function getEnv() { + var ua = navigator.userAgent; + + env = { + // True if this browser supports disabling async mode on dynamically + // created script nodes. See + // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order + async: doc.createElement('script').async === true + }; + + (env.webkit = /AppleWebKit\//.test(ua)) + || (env.ie = /MSIE/.test(ua)) + || (env.opera = /Opera/.test(ua)) + || (env.gecko = /Gecko\//.test(ua)) + || (env.unknown = true); + } + + /** + Loads the specified resources, or the next resource of the specified type + in the queue if no resources are specified. If a resource of the specified + type is already being loaded, the new request will be queued until the + first request has been finished. + + When an array of resource URLs is specified, those URLs will be loaded in + parallel if it is possible to do so while preserving execution order. All + browsers support parallel loading of CSS, but only Firefox and Opera + support parallel loading of scripts. In other browsers, scripts will be + queued and loaded one at a time to ensure correct execution order. + + @method load + @param {String} type resource type ('css' or 'js') + @param {String|Array} urls (optional) URL or array of URLs to load + @param {Function} callback (optional) callback function to execute when the + resource is loaded + @param {Object} obj (optional) object to pass to the callback function + @param {Object} context (optional) if provided, the callback function will + be executed in this object's context + @private + */ + function load(type, urls, callback, obj, context) { + var _finish = function () { finish(type); }, + isCSS = type === 'css', + nodes = [], + i, len, node, p, pendingUrls, url; + + env || getEnv(); + + if (urls) { + // If urls is a string, wrap it in an array. Otherwise assume it's an + // array and create a copy of it so modifications won't be made to the + // original. + urls = typeof urls === 'string' ? [urls] : urls.concat(); + + // Create a request object for each URL. If multiple URLs are specified, + // the callback will only be executed after all URLs have been loaded. + // + // Sadly, Firefox and Opera are the only browsers capable of loading + // scripts in parallel while preserving execution order. In all other + // browsers, scripts must be loaded sequentially. + // + // All browsers respect CSS specificity based on the order of the link + // elements in the DOM, regardless of the order in which the stylesheets + // are actually downloaded. + if (isCSS || env.async || env.gecko || env.opera) { + // Load in parallel. + queue[type].push({ + urls : urls, + callback: callback, + obj : obj, + context : context + }); + } else { + // Load sequentially. + for (i = 0, len = urls.length; i < len; ++i) { + queue[type].push({ + urls : [urls[i]], + callback: i === len - 1 ? callback : null, // callback is only added to the last URL + obj : obj, + context : context + }); + } + } + } + + // If a previous load request of this type is currently in progress, we'll + // wait our turn. Otherwise, grab the next item in the queue. + if (pending[type] || !(p = pending[type] = queue[type].shift())) { + return; + } + + head || (head = doc.head || doc.getElementsByTagName('head')[0]); + pendingUrls = p.urls; + + for (i = 0, len = pendingUrls.length; i < len; ++i) { + url = pendingUrls[i]; + + if (isCSS) { + node = env.gecko ? createNode('style') : createNode('link', { + href: url, + rel : 'stylesheet' + }); + } else { + node = createNode('script', {src: url}); + node.async = false; + } + + node.className = 'lazyload'; + node.setAttribute('charset', 'utf-8'); + + if (env.ie && !isCSS) { + node.onreadystatechange = function () { + if (/loaded|complete/.test(node.readyState)) { + node.onreadystatechange = null; + _finish(); + } + }; + } else if (isCSS && (env.gecko || env.webkit)) { + // Gecko and WebKit don't support the onload event on link nodes. + if (env.webkit) { + // In WebKit, we can poll for changes to document.styleSheets to + // figure out when stylesheets have loaded. + p.urls[i] = node.href; // resolve relative URLs (or polling won't work) + pollWebKit(); + } else { + // In Gecko, we can import the requested URL into a - From a679545cbaee569c49033ce807a10a420211faa7 Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Thu, 5 Apr 2012 15:32:55 -0500 Subject: [PATCH 22/53] small cleanup --- source/js/VMM.Core.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/js/VMM.Core.js b/source/js/VMM.Core.js index 8fed283..5e66ded 100644 --- a/source/js/VMM.Core.js +++ b/source/js/VMM.Core.js @@ -409,7 +409,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') { var _media; bw = VMM.createElement("div", d[i].content, "content"); + _slide = VMM.appendAndGetElement($slides_items, "
", "slider-item" , bw); + slides.push(_slide); } From 6bcf15a3a5f58a4c201d85c0ab10622889c92114 Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Thu, 5 Apr 2012 15:33:04 -0500 Subject: [PATCH 23/53] Small cleanup --- source/js/VMM.Util.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/js/VMM.Util.js b/source/js/VMM.Util.js index 241f96d..fc4bbae 100644 --- a/source/js/VMM.Util.js +++ b/source/js/VMM.Util.js @@ -491,6 +491,4 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') { }).init(); - - } \ No newline at end of file From bea7e81c9430e87a1ec4f09d761e060ce7365f50 Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Thu, 5 Apr 2012 15:35:43 -0500 Subject: [PATCH 24/53] 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 += "
"; - - /* - - */ 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="";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
";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