/* Verite * Verite JS Master * Version: 0.6 * Date: April 26, 2012 * Copyright 2012 Verite unless part of Verite Timeline, * if part of Timeline then it inherits Timeline's license. * Designed and built by Zach Wise digitalartwork.net * ----------------------------------------------------- */ /* Simple JavaScript Inheritance * By John Resig http://ejohn.org/ * MIT Licensed. ================================================== */ (function() { 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; }; })(); /* 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({}); /* Debug ================================================== */ VMM.debug = true; /* Master Config ================================================== */ 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: false, array: [], api_loaded:false, que: [] }, googlemaps: { active: false, map_active: false, places_active: false, array: [], api_loaded:false, que: [] } }).init(); //VMM.createElement(tag, value, cName, attrs, styles); VMM.createElement = function(tag, value, cName, attrs, styles) { var ce = ""; if (tag != null && tag != "") { // TAG ce += "<" + tag; if (cName != null && cName != "") { ce += " class='" + cName + "'"; }; if (attrs != null && attrs != "") { ce += " " + attrs; }; if (styles != null && styles != "") { ce += " " + styles; }; ce += ">"; if (value != null && value != "") { ce += value; } // CLOSE TAG ce = ce + ""; } return ce; }; VMM.createMediaElement = function(media, caption, credit) { var ce = ""; var _valid = false; ce += "
"; if (media != null && media != "") { valid = true; ce += ""; // CREDIT if (credit != null && credit != "") { ce += VMM.createElement("div", credit, "credit"); } // CAPTION if (caption != null && caption != "") { ce += VMM.createElement("div", caption, "caption"); } } ce += "
"; return ce; }; // Hide URL Bar for iOS and Android by Scott Jehl // https://gist.github.com/1183357 VMM.hideUrlBar = function () { var win = window, doc = win.document; // If there's a hash, or addEventListener is undefined, stop here if( !location.hash || !win.addEventListener ){ //scroll to 1 window.scrollTo( 0, 1 ); var scrollTop = 1, //reset to 0 on bodyready, if needed bodycheck = setInterval(function(){ if( doc.body ){ clearInterval( bodycheck ); scrollTop = "scrollTop" in doc.body ? doc.body.scrollTop : 1; win.scrollTo( 0, scrollTop === 1 ? 0 : 1 ); } }, 15 ); win.addEventListener( "load", function(){ setTimeout(function(){ //reset to hide addr bar at onload win.scrollTo( 0, scrollTop === 1 ? 0 : 1 ); }, 0); }, false ); } }; } /* Trace (console.log) ================================================== */ function trace( msg ) { if (VMM.debug) { if (window.console) { console.log(msg); } else if ( typeof( jsTrace ) != 'undefined' ) { jsTrace.send( msg ); } else { //alert(msg); } } } /* Extending Date to include Week ================================================== */ Date.prototype.getWeek = function() { var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7); } /* Extending Date to include Day of Year ================================================== */ Date.prototype.getDayOfYear = function() { var onejan = new Date(this.getFullYear(),0,1); return Math.ceil((this - onejan) / 86400000); } /* A MORE SPECIFIC TYPEOF(); // http://rolandog.com/archives/2007/01/18/typeof-a-more-specific-typeof/ ================================================== */ // type.of() 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:false;}, String:function(a){return(typeof(a)==="string")?true:(typeof(a)==="object")?a.constructor.toString().match(/string/i)!==null:false;}, Array:function(a){return(typeof(a)==="object")?a.constructor.toString().match(/array/i)!==null||a.length!==undefined:false;}, Boolean:function(a){return(typeof(a)==="boolean")?true:(typeof(a)==="object")?a.constructor.toString().match(/boolean/i)!==null:false;}, Date:function(a){return(typeof(a)==="date")?true:(typeof(a)==="object")?a.constructor.toString().match(/date/i)!==null:false;}, HTML:function(a){return(typeof(a)==="object")?a.constructor.toString().match(/html/i)!==null:false;}, Number:function(a){return(typeof(a)==="number")?true:(typeof(a)==="object")?a.constructor.toString().match(/Number/)!==null:false;}, Object:function(a){return(typeof(a)==="object")?a.constructor.toString().match(/object/i)!==null:false;}, RegExp:function(a){return(typeof(a)==="function")?a.constructor.toString().match(/regexp/i)!==null:false;} }; var type={ of:function(a){ for(var i in is){ if(is[i](a)){ return i.toLowerCase(); } } } }; /*********************************************** Begin bootstrap-tooltip.js ***********************************************/ /* =========================================================== * bootstrap-tooltip.js v2.0.1 * http://twitter.github.com/bootstrap/javascript.html#tooltips * Inspired by the original jQuery.tipsy by Jason Frame * =========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function( $ ) { "use strict" /* TOOLTIP PUBLIC CLASS DEFINITION * =============================== */ var Tooltip = function ( element, options ) { this.init('tooltip', element, options) } Tooltip.prototype = { constructor: Tooltip , init: function ( type, element, options ) { var eventIn , eventOut this.type = type this.$element = $(element) this.options = this.getOptions(options) this.enabled = true if (this.options.trigger != 'manual') { eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this)) } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } , getOptions: function ( options ) { options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay , hide: options.delay } } return options } , enter: function ( e ) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (!self.options.delay || !self.options.delay.show) { self.show() } else { self.hoverState = 'in' setTimeout(function() { if (self.hoverState == 'in') { self.show() } }, self.options.delay.show) } } , leave: function ( e ) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (!self.options.delay || !self.options.delay.hide) { self.hide() } else { self.hoverState = 'out' setTimeout(function() { if (self.hoverState == 'out') { self.hide() } }, self.options.delay.hide) } } , show: function () { var $tip , inside , pos , actualWidth , actualHeight , placement , tp if (this.hasContent() && this.enabled) { $tip = this.tip() this.setContent() if (this.options.animation) { $tip.addClass('fade') } placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement inside = /in/.test(placement) $tip .remove() .css({ top: 0, left: 0, display: 'block' }) .appendTo(inside ? this.$element : document.body) pos = this.getPosition(inside) actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight switch (inside ? placement.split(' ')[1] : placement) { case 'bottom': tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'top': tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'left': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} break case 'right': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} break } $tip .css(tp) .addClass(placement) .addClass('in') } } , setContent: function () { var $tip = this.tip() $tip.find('.tooltip-inner').html(this.getTitle()) $tip.removeClass('fade in top bottom left right') } , hide: function () { var that = this , $tip = this.tip() $tip.removeClass('in') function removeWithAnimation() { var timeout = setTimeout(function () { $tip.off($.support.transition.end).remove() }, 500) $tip.one($.support.transition.end, function () { clearTimeout(timeout) $tip.remove() }) } $.support.transition && this.$tip.hasClass('fade') ? removeWithAnimation() : $tip.remove() } , fixTitle: function () { var $e = this.$element if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') } } , hasContent: function () { return this.getTitle() } , getPosition: function (inside) { return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { width: this.$element[0].offsetWidth , height: this.$element[0].offsetHeight }) } , getTitle: function () { var title , $e = this.$element , o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) title = title.toString().replace(/(^\s*|\s*$)/, "") return title } , tip: function () { return this.$tip = this.$tip || $(this.options.template) } , validate: function () { if (!this.$element[0].parentNode) { this.hide() this.$element = null this.options = null } } , enable: function () { this.enabled = true } , disable: function () { this.enabled = false } , toggleEnabled: function () { this.enabled = !this.enabled } , toggle: function () { this[this.tip().hasClass('in') ? 'hide' : 'show']() } } /* TOOLTIP PLUGIN DEFINITION * ========================= */ $.fn.tooltip = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tooltip') , options = typeof option == 'object' && option if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.tooltip.Constructor = Tooltip $.fn.tooltip.defaults = { animation: true , delay: 0 , selector: false , placement: 'top' , trigger: 'hover' , title: '' , template: '
' } }( window.jQuery ); /*********************************************** Begin AES.js ***********************************************/ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* AES implementation in JavaScript (c) Chris Veness 2005-2011 */ /* - see http://csrc.nist.gov/publications/PubsFIPS.html#197 */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ var Aes = {}; // Aes namespace /** * AES Cipher function: encrypt 'input' state with Rijndael algorithm * applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage * * @param {Number[]} input 16-byte (128-bit) input state array * @param {Number[][]} w Key schedule as 2D byte-array (Nr+1 x Nb bytes) * @returns {Number[]} Encrypted output state array */ Aes.cipher = function(input, w) { // main Cipher function [§5.1] var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES) var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys var state = [[],[],[],[]]; // initialise 4xNb byte-array 'state' with input [§3.4] for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i]; state = Aes.addRoundKey(state, w, 0, Nb); for (var round=1; round 6 && i%Nk == 4) { temp = Aes.subWord(temp); } for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t]; } return w; } /* * ---- remaining routines are private, not called externally ---- */ Aes.subBytes = function(s, Nb) { // apply SBox to state S [§5.1.1] for (var r=0; r<4; r++) { for (var c=0; c>> i*8) & 0xff; for (var i=0; i<2; i++) counterBlock[i+2] = (nonceRnd >>> i*8) & 0xff; for (var i=0; i<4; i++) counterBlock[i+4] = (nonceSec >>> i*8) & 0xff; // and convert it to a string to go on the front of the ciphertext var ctrTxt = ''; for (var i=0; i<8; i++) ctrTxt += String.fromCharCode(counterBlock[i]); // generate key schedule - an expansion of the key into distinct Key Rounds for each round var keySchedule = Aes.keyExpansion(key); var blockCount = Math.ceil(plaintext.length/blockSize); var ciphertxt = new Array(blockCount); // ciphertext as array of strings for (var b=0; b>> c*8) & 0xff; for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8) var cipherCntr = Aes.cipher(counterBlock, keySchedule); // -- encrypt counter block -- // block size is reduced on final block var blockLength = b>> c*8) & 0xff; for (var c=0; c<4; c++) counterBlock[15-c-4] = (((b+1)/0x100000000-1) >>> c*8) & 0xff; var cipherCntr = Aes.cipher(counterBlock, keySchedule); // encrypt counter block var plaintxtByte = new Array(ciphertext[b].length); for (var i=0; i 0) { while (c++ < 3) { pad += '='; plain += '\0'; } } // note: doing padding here saves us doing special-case packing for trailing 1 or 2 chars for (c=0; c>18 & 0x3f; h2 = bits>>12 & 0x3f; h3 = bits>>6 & 0x3f; h4 = bits & 0x3f; // use hextets to index into code string e[c/3] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } coded = e.join(''); // join() is far faster than repeated string concatenation in IE // replace 'A's from padded nulls with '='s coded = coded.slice(0, coded.length-pad.length) + pad; return coded; } /** * Decode string from Base64, as defined by RFC 4648 [http://tools.ietf.org/html/rfc4648] * (instance method extending String object). As per RFC 4648, newlines are not catered for. * * @param {String} str The string to be decoded from base-64 * @param {Boolean} [utf8decode=false] Flag to indicate whether str is Unicode string to be decoded * from UTF8 after conversion from base64 * @returns {String} decoded string */ Base64.decode = function(str, utf8decode) { utf8decode = (typeof utf8decode == 'undefined') ? false : utf8decode; var o1, o2, o3, h1, h2, h3, h4, bits, d=[], plain, coded; var b64 = Base64.code; coded = utf8decode ? str.decodeUTF8() : str; for (var c=0; c>>16 & 0xff; o2 = bits>>>8 & 0xff; o3 = bits & 0xff; d[c/4] = String.fromCharCode(o1, o2, o3); // check for padding if (h4 == 0x40) d[c/4] = String.fromCharCode(o1, o2); if (h3 == 0x40) d[c/4] = String.fromCharCode(o1); } plain = d.join(''); // join() is far faster than repeated string concatenation in IE return utf8decode ? plain.decodeUTF8() : plain; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Utf8 class: encode / decode between multi-byte Unicode characters and UTF-8 multiple */ /* single-byte character encoding (c) Chris Veness 2002-2011 */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ var Utf8 = {}; // Utf8 namespace /** * Encode multi-byte Unicode string into utf-8 multiple single-byte characters * (BMP / basic multilingual plane only) * * Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars * * @param {String} strUni Unicode string to be encoded as UTF-8 * @returns {String} encoded string */ Utf8.encode = function(strUni) { // use regular expressions & String.replace callback function for better efficiency // than procedural approaches var strUtf = strUni.replace( /[\u0080-\u07ff]/g, // U+0080 - U+07FF => 2 bytes 110yyyyy, 10zzzzzz function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f); } ); strUtf = strUtf.replace( /[\u0800-\uffff]/g, // U+0800 - U+FFFF => 3 bytes 1110xxxx, 10yyyyyy, 10zzzzzz function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); } ); return strUtf; } /** * Decode utf-8 encoded string back into multi-byte Unicode characters * * @param {String} strUtf UTF-8 string to be decoded back to Unicode * @returns {String} decoded string */ Utf8.decode = function(strUtf) { // note: decode 3-byte chars first as decoded 2-byte strings could appear to be 3-byte char! var strUni = strUtf.replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, // 3-byte chars function(c) { // (note parentheses for precence) var cc = ((c.charCodeAt(0)&0x0f)<<12) | ((c.charCodeAt(1)&0x3f)<<6) | ( c.charCodeAt(2)&0x3f); return String.fromCharCode(cc); } ); strUni = strUni.replace( /[\u00c0-\u00df][\u0080-\u00bf]/g, // 2-byte chars function(c) { // (note parentheses for precence) var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f; return String.fromCharCode(cc); } ); return strUni; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /*********************************************** Begin VMM.Library.js ***********************************************/ /* LIBRARY ABSTRACTION ================================================== */ if(typeof VMM != 'undefined') { //VMM.attachElement(element, content); VMM.attachElement = function(element, content) { if( typeof( jQuery ) != 'undefined' ){ $(element).html(content); } }; //VMM.appendElement(element, content); VMM.appendElement = function(element, content) { if( typeof( jQuery ) != 'undefined' ){ $(element).append(content); } }; VMM.getHTML = function(element) { var e; if( typeof( jQuery ) != 'undefined' ){ e = jQuery(element).html(); return e; } }; //VMM.getElement(element); VMM.getElement = function(element, p) { var e; if( typeof( jQuery ) != 'undefined' ){ if (p) { e = jQuery(element).parent().get(0); } else { e = jQuery(element).get(0); } return e; } }; //VMM.bindEvent(element, the_handler, the_event_type, event_data); //VMM.bindEvent(window, the_handler, "event type", {event_data}); VMM.bindEvent = function(element, the_handler, the_event_type, event_data) { var e; var _event_type = "click"; var _event_data = {}; if (the_event_type != null && the_event_type != "") { _event_type = the_event_type; } if (_event_data != null && _event_data != "") { _event_data = event_data; } if( typeof( jQuery ) != 'undefined' ){ jQuery(element).bind(_event_type, _event_data, the_handler); //return e; } }; //VMM.unbindEvent(window, the_handler, "event type"); VMM.unbindEvent = function(element, the_handler, the_event_type) { var e; var _event_type = "click"; var _event_data = {}; if (the_event_type != null && the_event_type != "") { _event_type = the_event_type; } if( typeof( jQuery ) != 'undefined' ){ jQuery(element).unbind(_event_type, the_handler); //return e; } }; //VMM.fireEvent(element, "resize", [data]); VMM.fireEvent = function(element, the_event_type, the_data) { var e; var _event_type = "click"; var _data = []; if (the_event_type != null && the_event_type != "") { _event_type = the_event_type; } if (the_data != null && the_data != "") { _data = the_data; } if( typeof( jQuery ) != 'undefined' ){ jQuery(element).trigger(_event_type, _data); //return e; } }; // VMM.getJSON(url, the_function); VMM.getJSON = function(url, data, callback) { if( typeof( jQuery ) != 'undefined' ){ /* CHECK FOR IE AND USE Use Microsoft XDR ================================================== */ if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.Browser.version, 10) >= 7 && window.XDomainRequest) { trace("it's ie"); var ie_url = url; if (ie_url.match('^http://')){ trace("RUNNING GET JSON") ie_url = ie_url.replace("http://","//"); return jQuery.getJSON(url, data, callback); } else if (ie_url.match('^https://')) { trace("RUNNING XDR"); 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); trace(xdr.responseText); if (type.of(ie_json) == "null" || type.of(ie_json) == "undefined") { trace("IE JSON ERROR") } else { return data(ie_json) } } xdr.send(); } else { return jQuery.getJSON(url, data, callback); } } else { //$.getJSON(url, data); trace("getJSON"); return jQuery.getJSON(url, data, callback); } } } // VMM.parseJSON(the_json); VMM.parseJSON = function(the_json) { if( typeof( jQuery ) != 'undefined' ){ return jQuery.parseJSON(the_json); } } // ADD ELEMENT AND RETURN IT // VMM.appendAndGetElement(append_to_element, tag, cName, content, [attrib]); VMM.appendAndGetElement = function(append_to_element, tag, cName, content) { var e; var _tag = "
"; var _class = ""; var _content = ""; if (tag != null && tag != "") { _tag = tag; } if (cName != null && cName != "") { _class = cName; } if (content != null && content != "") { _content = content; } if( typeof( jQuery ) != 'undefined' ){ e = $(tag); e.addClass(_class); e.html(_content); jQuery(append_to_element).append(e); //$(e).appendTo(element); } return e; }; VMM.Element = ({ init: function() { return this; }, // VMM.Element.hide(element); hide: function(element, duration) { if (duration != null && duration != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).hide(duration); } } else { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).hide(); } } }, // VMM.Element.remove(element); remove: function(element) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).remove(); } }, // VMM.Element.detach(element); detach: function(element) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).detach(); } }, // VMM.Element.append(element, value); append: function(element, value) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).append(value); } }, // VMM.Element.show(element); show: function(element, duration) { if (duration != null && duration != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).show(duration); } } else { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).show(); } } }, // VMM.Element.load(element, callback_function, event_data); load: function(element, callback_function, event_data) { var _event_data = {elem:element}; // return element by default if (_event_data != null && _event_data != "") { _event_data = event_data; } if( typeof( jQuery ) != 'undefined' ){ jQuery(element).load(_event_data, callback_function); } }, //VMM.Element.addClass(element, cName); addClass: function(element, cName) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).addClass(cName); } }, //VMM.Element.removeClass(element, cName); removeClass: function(element, cName) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).removeClass(cName); } }, //VMM.Element.attr(element, aName, value); attr: function(element, aName, value) { if (value != null && value != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).attr(aName, value); } } else { if( typeof( jQuery ) != 'undefined' ){ return jQuery(element).attr(aName); } } }, //VMM.Element.prop(element, aName, value); prop: function(element, aName, value) { if (typeof jQuery == 'undefined' || !/[1-9]\.[3-9].[1-9]/.test($.fn.jquery)) { VMM.Element.attribute(element, aName, value); } else { jQuery(element).prop(aName, value); } }, //VMM.Element.attribute(element, aName, value); attribute: function(element, aName, value) { if (value != null && value != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).attr(aName, value); } } else { if( typeof( jQuery ) != 'undefined' ){ return jQuery(element).attr(aName); } } }, /* Sets or gets the visability of a dom element ================================================== */ //VMM.Element.visible(element, show); visible: function(element, show) { if (show != null) { if( typeof( jQuery ) != 'undefined' ){ if (show) { jQuery(element).show(0); } else { jQuery(element).hide(0); } } } else { if( typeof( jQuery ) != 'undefined' ){ if ( jQuery(element).is(':visible')){ return true; } else { return false; } } } }, /* Sets a style for the specified element or gets the style ================================================== */ //VMM.Element.css(element, prop, value); css: function(element, prop, value) { if (value != null && value != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).css(prop, value); } } else { if( typeof( jQuery ) != 'undefined' ){ return jQuery(element).css(prop); } } }, cssmultiple: function(element, propval) { if( typeof( jQuery ) != 'undefined' ){ return jQuery(element).css(propval); } }, /* Gets offset ================================================== */ //VMM.Element.offset(element); offset: function(element) { var p; if( typeof( jQuery ) != 'undefined' ){ p = jQuery(element).offset(); } return p; }, /* Gets position ================================================== */ //VMM.Element.position(element); position: function(element) { var p; if( typeof( jQuery ) != 'undefined' ){ p = jQuery(element).position(); } return p; }, /* Sets or gets the width of a dom element ================================================== */ //VMM.Element.width(element, s); width: function(element, s) { if (s != null && s != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).width(s); } } else { if( typeof( jQuery ) != 'undefined' ){ return jQuery(element).width(); } } }, /* Sets or gets the width of a dom element ================================================== */ height: function(element, s) { if (s != null && s != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).height(s); } } else { if( typeof( jQuery ) != 'undefined' ){ return jQuery(element).height(); } } }, /* TOGGLE CLASS ================================================== */ // VMM.Element.toggleClass(element, cName); toggleClass: function(element, cName) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).toggleClass(cName); } }, /* Each ================================================== */ // VMM.Element.each(element, return_function); each:function(element, return_function) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).each(return_function); } }, /* Each ================================================== */ // VMM.Element.html(element, str); html: function(element, str) { var e; if( typeof( jQuery ) != 'undefined' ){ e = jQuery(element).html(); return e; } if (str != null && str != "") { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).html(str); } } else { var e; if( typeof( jQuery ) != 'undefined' ){ e = jQuery(element).html(); return e; } } }, /* Find ================================================== */ // VMM.Element.find(element, selec); find: function(element, selec) { if( typeof( jQuery ) != 'undefined' ){ return jQuery(element).find(selec); } }, /* Animate ================================================== */ // VMM.Element.stop(element); stop: function(element) { if( typeof( jQuery ) != 'undefined' ){ jQuery(element).stop(); } }, // VMM.Element.animate(element, duration, ease, att, callback_function); animate: function(element, duration, ease, att, callback_function) { var _ease = "easein"; var _duration = 1000; var _att = {}; if (duration != null) { if (duration < 1) { _duration = 1; } else { _duration = Math.round(duration); } } if (ease != null && ease != "") { _ease = ease; } if (att != null) { _att = att } else { _att = {opacity: 0} } if (VMM.Browser.device == "mobile" || VMM.Browser.device == "tablet") { var _tdd = Math.round((_duration/1500)*10)/10 var __duration = _tdd + 's'; VMM.Element.css(element, '-webkit-transition', 'all '+ __duration + ' ease'); VMM.Element.css(element, '-moz-transition', 'all '+ __duration + ' ease'); VMM.Element.css(element, '-o-transition', 'all '+ __duration + ' ease'); VMM.Element.css(element, '-ms-transition', 'all '+ __duration + ' ease'); VMM.Element.css(element, 'transition', 'all '+ __duration + ' ease'); VMM.Element.cssmultiple(element, _att); //callback_function(); /* if( typeof( jQuery ) != 'undefined' ){ if (callback_function != null && callback_function != "") { jQuery(element).animate(_att, {queue:false, duration:_duration, easing:_ease, complete:callback_function} ); } else { jQuery(element).animate(_att, {queue:false, duration:_duration, easing:_ease} ); } } */ } else { if( typeof( jQuery ) != 'undefined' ){ if (callback_function != null && callback_function != "") { jQuery(element).animate(_att, {queue:false, duration:_duration, easing:_ease, complete:callback_function} ); } else { jQuery(element).animate(_att, {queue:false, duration:_duration, easing:_ease} ); } } } /* VMM.Element.cssmultiple(element, { '-webkit-transition': 'all 1s ease-in-out', '-moz-transition': 'all 1s ease-in-out', '-o-transition': 'all 1s ease-in-out', '-ms-transition': 'all 1s ease-in-out', 'transition': 'all 1s ease-in-out', }); */ }, }).init(); } /* jQuery Easing v1.3 http://gsgd.co.uk/sandbox/jquery/easing/ ================================================== */ if( typeof( jQuery ) != 'undefined' ){ jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { //alert(jQuery.easing.default); return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, }); } /*********************************************** Begin VMM.Browser.js ***********************************************/ /* DEVICE AND BROWSER DETECTION ================================================== */ if(typeof VMM != 'undefined' && typeof VMM.Browser == 'undefined') { 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); this.orientation = this.searchOrientation(window.orientation); }, searchOrientation: function(orientation) { if ( orientation == 0 || orientation == 180) { return "portrait"; } else if ( orientation == 90 || orientation == -90) { return "landscape"; } else { return "normal"; } }, searchDevice: function(d) { if (d.match(/Android/i) || d.match(/iPhone|iPod/i)) { return "mobile"; } else if (d.match(/iPad/i)) { return "tablet"; } else if (d.match(/BlackBerry/i) || d.match(/IEMobile/i)) { return "other mobile"; } else { return "desktop"; } }, searchString: function (data) { for (var i=0;i
"; return mediaElem; } else if (m.type == "flickr") { mediaElem = "
"; return mediaElem; } else if (m.type == "youtube") { mediaElem = "
"; return mediaElem; } else if (m.type == "googledoc") { mediaElem = ""; } else if (m.type == "vimeo") { mediaElem = "
"; return mediaElem; } else if (m.type == "twitter"){ mediaElem = ""; return mediaElem; } else if (m.type == "twitter-ready") { mediaElem = ""; return mediaElem; } else if (m.type == "soundcloud") { mediaElem = "
"; return mediaElem; } else if (m.type == "google-map") { mediaElem = "
"; return mediaElem; } else if (m.type == "unknown") { mediaElem = ""; return mediaElem; } else if (m.type == "website") { mediaElem = "
"; //mediaElem = "
"; return mediaElem; } else { mediaElem = "
"; return mediaElem; } } }, //VMM.MediaElement.create(element, data, returntrue); create: function(element, data, __return, w, h) { _return = __return; _w = 500; _h = 400; $mediacontainer = element; //VMM.MediaElement.container = element; var _valid = false; if (w != null && w != "") { _w = w; } if (h != null && h != "") { _h = h; } if (data.media != null && data.media != "") { _valid = true; var mediaElem = ""; var captionElem = ""; var creditElem = ""; var m = {}; var media_height = (_h - 50); var isTextMedia = false; // CREDIT if (data.credit != null && data.credit != "") { creditElem = "
" + VMM.Util.linkify_with_twitter(data.credit, "_blank") + "
"; } // CAPTION if (data.caption != null && data.caption != "") { captionElem = "
" + VMM.Util.linkify_with_twitter(data.caption, "_blank") + "
"; } // MEDIA TYPE m = VMM.MediaType(data.media); //returns an object with .type and .id // CREATE MEDIA CODE if (m.type == "image") { mediaElem = ""; } else if (m.type == "flickr") { 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); //mediaElem = ""; } else if (m.type == "vimeo") { mediaElem = ""; } else if (m.type == "twitter"){ mediaElem = ""; //VMM.ExternalAPI.twitter.getHTML(m.id); trace("TWITTER"); VMM.ExternalAPI.twitter.prettyHTML(m.id); isTextMedia = true; } else if (m.type == "twitter-ready") { mediaElem = m.id; } else if (m.type == "soundcloud") { var soundcloud_id = "soundcloud_" + VMM.Util.unique_ID(5); mediaElem = "
Loading Sound
"; VMM.ExternalAPI.soundcloud.getSound(m.id, soundcloud_id) } else if (m.type == "google-map") { //mediaElem = "" var map_id = "googlemap_" + VMM.Util.unique_ID(7); mediaElem = "
Loading Map...
"; VMM.ExternalAPI.googlemaps.getMap(m.id, map_id); } else if (m.type == "unknown") { 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 = "" + ""; } else { trace("NO KNOWN MEDIA TYPE FOUND"); trace(m.type); } // WRAP THE MEDIA ELEMENT mediaElem = "
" + mediaElem + creditElem + captionElem + "
"; if (_return) { if (isTextMedia) { return "
" + mediaElem + "
"; } else { return "
" + mediaElem + "
"; } } else { VMM.appendElement($mediacontainer, mediaElem); VMM.appendElement($mediacontainer, creditElem); VMM.appendElement($mediacontainer, captionElem); } }; }, }).init(); } /*********************************************** Begin VMM.MediaType.js ***********************************************/ /* MediaType ================================================== */ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') { //VMM.mediaType.youtube(d); //should return a true or false // VMM.MediaType(url); //returns an object with .type and .id VMM.MediaType = function(d) { var success = false; var media = {}; if (d.match("div class='twitter'")) { media.type = "twitter-ready"; media.id = d; success = true; } else if (d.match('(www.)?youtube|youtu\.be')) { if (d.match('v=')) { youtube_id = VMM.Util.getUrlVars(d)["v"]; //youtube_id = d.split(/embed\//)[1].split('"')[0]; } else { youtube_id = d.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0]; } //youtube_id = d.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0]; // http://www.youtube.com/watch?feature=player_embedded&v=0l-ivcnLrSc //http://www.youtube.com/watch?v=0l-ivcnLrSc media.type = "youtube"; media.id = youtube_id; success = true; } else if (d.match('(player.)?vimeo\.com')) { //vimeo_id = d.split(/video\/|http:\/\/vimeo\.com\//)[1].split(/[?&]/)[0]; vimeo_id = d.split(/video\/|\/\/vimeo\.com\//)[1].split(/[?&]/)[0]; media.type = "vimeo"; media.id = vimeo_id; success = true; } else if (d.match('(player.)?soundcloud\.com')) { //soundcloud_url = unescape(d.split(/value="/)[1].split(/["]/)[0]); //soundcloud_id = soundcloud_url.split(/tracks\//)[1].split(/[&"]/)[0]; media.type = "soundcloud"; media.id = d; success = true; } else if (d.match('(www.)?twitter\.com')) { trace("TWITTER MATCH"); // https://twitter.com/#!/twitterapi/statuses/133640144317198338 // https://twitter.com/#!/DeliciousHot/status/23189589820702720 if (d.match("status\/")) { twitter_id = d.split("status\/")[1]; } else if (d.match("statuses\/")) { twitter_id = d.split("statuses\/")[1]; } else { twitter_id = ""; } media.type = "twitter"; media.id = twitter_id; success = true; } else if (d.match("maps.google") && !d.match("staticmap")) { //maps.google.com media.type = "google-map"; media.id = d.split(/src=['|"][^'|"]*?['|"]/gi); //trace("google map " + media.id); success = true; } else if (d.match("flickr.com/photos")) { media.type = "flickr"; //media.id = d.split('/photos/[^/]+/([0-9]+)/gi'); media.id = d.split("photos\/")[1].split("/")[1]; media.link = d; //media.id = media.id.split("/")[1]; //trace("FLICKR " + media.id); success = true; } else if (d.match(/jpg|jpeg|png|gif/i) || d.match("staticmap")) { media.type = "image"; media.id = d; success = true; } else if (VMM.FileExtention.googleDocType(d)) { media.type = "googledoc"; media.id = d; success = true; } else if (d.indexOf('http://') == 0) { media.type = "website"; media.id = d; success = true; } else { trace("unknown media"); media.type = "unknown"; media.id = d; success = true; } if (success) { return media; } else { trace("No valid media id detected"); trace(d); } return false; } } /*********************************************** Begin VMM.Media.js ***********************************************/ /* Media ================================================== */ if(typeof VMM != 'undefined' && typeof VMM.Media == 'undefined') { // something = new VMM.Media(parent, w, h, {thedata}); VMM.Media = function(parent, w, h, thedata) { /* PRIVATE VARS ================================================== */ var data = {}; // HOLDS DATA var _valid = false; var config = { width: 720, height: 400, content_width: 720, content_height: 400, ease: "easeInOutExpo", duration: 1000, spacing: 15 }; /* ELEMENTS ================================================== */ var $media = ""; var $container = ""; var $mediacontainer = ""; var $mediaelement = ""; var layout = parent; // expecting media div if (w != null && w != "") {config.width = w}; if (h != null && h != "") {config.height = h}; /* if (typeof thedata != "undefined") { data = thedata; this.init(data); } */ /* PUBLIC FUNCTIONS ================================================== */ this.init = function(d) { if(typeof d != 'undefined') { this.setData(d); } else { trace("WAITING ON DATA"); } }; var build = function(media, caption, credit) { $media = VMM.appendAndGetElement(layout, "
", "media"); $container = VMM.appendAndGetElement($media, "
", "container"); $mediacontainer = VMM.appendAndGetElement($container, "
", "media-container"); if (data.media != null && data.media != "") { _valid = true; var m = {}; m = VMM.MediaType(data.media); //returns an object with .type and .id if (m.type == "image") { VMM.appendElement($mediacontainer, ""); } else if (m.type == "youtube") { VMM.appendElement($mediacontainer, "