wp/wp-content/themes/IN-MOTION-package-u1/in-motion/js/plugins.js
changeset 0 d970ebf37754
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     1 
       
     2 // usage: log('inside coolFunc', this, arguments);
       
     3 window.log = function(){
       
     4   log.history = log.history || [];   // store logs to an array for reference
       
     5   log.history.push(arguments);
       
     6   if(this.console) {
       
     7       arguments.callee = arguments.callee.caller;
       
     8       console.log( Array.prototype.slice.call(arguments) );
       
     9   }
       
    10 };
       
    11 (function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
       
    12 
       
    13 /*global jQuery */
       
    14 /*!	
       
    15 * FitText.js 1.0
       
    16 *
       
    17 * Copyright 2011, Dave Rupert http://daverupert.com
       
    18 * Released under the WTFPL license 
       
    19 * http://sam.zoy.org/wtfpl/
       
    20 *
       
    21 * Date: Thu May 05 14:23:00 2011 -0600
       
    22 */
       
    23 
       
    24 (function($){$.fn.fitText=function(kompressor,options){var settings={'minFontSize':Number.NEGATIVE_INFINITY,'maxFontSize':Number.POSITIVE_INFINITY};return this.each(function(){var $this=$(this);var compressor=kompressor||1;if(options){$.extend(settings,options);}
       
    25 var resizer=function(){$this.css('font-size',Math.max(Math.min($this.width()/(compressor*10),parseFloat(settings.maxFontSize)),parseFloat(settings.minFontSize)));};resizer();$(window).resize(resizer);});};})(jQuery);
       
    26 
       
    27 
       
    28 
       
    29 /** backgroundPosition
       
    30  * @author Alexander Farkas
       
    31  * v. 1.22
       
    32  */
       
    33 
       
    34 
       
    35 
       
    36 (function($){if(!document.defaultView||!document.defaultView.getComputedStyle){var oldCurCSS=$.curCSS;$.curCSS=function(elem,name,force){if(name==='background-position'){name='backgroundPosition';}
       
    37 if(name!=='backgroundPosition'||!elem.currentStyle||elem.currentStyle[name]){return oldCurCSS.apply(this,arguments);}
       
    38 var style=elem.style;if(!force&&style&&style[name]){return style[name];}
       
    39 return oldCurCSS(elem,'backgroundPositionX',force)+' '+oldCurCSS(elem,'backgroundPositionY',force);};}
       
    40 var oldAnim=$.fn.animate;$.fn.animate=function(prop){if('background-position'in prop){prop.backgroundPosition=prop['background-position'];delete prop['background-position'];}
       
    41 if('backgroundPosition'in prop){prop.backgroundPosition='('+prop.backgroundPosition;}
       
    42 return oldAnim.apply(this,arguments);};function toArray(strg){strg=strg.replace(/left|top/g,'0px');strg=strg.replace(/right|bottom/g,'100%');strg=strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");var res=strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);return[parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];}
       
    43 $.fx.step.backgroundPosition=function(fx){if(!fx.bgPosReady){var start=$.curCSS(fx.elem,'backgroundPosition');if(!start){start='0px 0px';}
       
    44 start=toArray(start);fx.start=[start[0],start[2]];var end=toArray(fx.end);fx.end=[end[0],end[2]];fx.unit=[end[1],end[3]];fx.bgPosReady=true;}
       
    45 var nowPosX=[];nowPosX[0]=((fx.end[0]-fx.start[0])*fx.pos)+fx.start[0]+fx.unit[0];nowPosX[1]=((fx.end[1]-fx.start[1])*fx.pos)+fx.start[1]+fx.unit[1];fx.elem.style.backgroundPosition=nowPosX[0]+' '+nowPosX[1];};})(jQuery);
       
    46 
       
    47 
       
    48 /**
       
    49  * jQuery.ScrollTo - Easy element scrolling using jQuery.
       
    50  * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
       
    51  * Dual licensed under MIT and GPL.
       
    52  * Date: 5/25/2009
       
    53  * @author Ariel Flesler
       
    54  * @version 1.4.2
       
    55  *
       
    56  * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
       
    57  */
       
    58 ;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'y',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
       
    59 
       
    60 /**
       
    61  * jQuery.LocalScroll - Animated scrolling navigation, using anchors.
       
    62  * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
       
    63  * Dual licensed under MIT and GPL.
       
    64  * Date: 3/11/2009
       
    65  * @author Ariel Flesler
       
    66  * @version 1.2.7
       
    67  **/
       
    68 ;(function($){var l=location.href.replace(/#.*/,'');var g=$.localScroll=function(a){$('body').localScroll(a)};g.defaults={duration:1e3,axis:'y',event:'click',stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollTo(0,a);a.duration=e}i(0,location,a)}};$.fn.localScroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentNode]).filter(d)[0];if(e)i(a,e,b)}):this.find('a,area').filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getElementById(d)||document.getElementsByName(d)[0];if(!f)return;if(a)a.preventDefault();var h=$(b.target);if(b.lock&&h.is(':animated')||b.onBefore&&b.onBefore.call(b,a,f,h)===false)return;if(b.stop)h.stop(true);if(b.hash){var j=f.id==d?'id':'name',k=$('<a> </a>').attr(j,d).css({position:'absolute',top:$(window).scrollTop(),left:$(window).scrollLeft()});f[j]='';$('body').prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollTo(f,b).trigger('notify.serialScroll',[f])}})(jQuery);
       
    69 
       
    70 
       
    71 /**
       
    72  * author Remy Sharp
       
    73  * url http://remysharp.com/2009/01/26/element-in-view-event-plugin/
       
    74  */
       
    75 
       
    76 (function($){function getViewportHeight(){var height=window.innerHeight;var mode=document.compatMode;if((mode||!$.support.boxModel)){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}
       
    77 return height;}
       
    78 $(window).scroll(function(){var vpH=getViewportHeight(),scrolltop=(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop),elems=[];$.each($.cache,function(){if(this.events&&this.events.inview){elems.push(this.handle.elem);}});if(elems.length){$(elems).each(function(){var $el=$(this),top=$el.offset().top,height=$el.height(),inview=$el.data('inview')||false;if(scrolltop>(top+height)||scrolltop+vpH<top){if(inview){$el.data('inview',false);$el.trigger('inview',[false]);}}else if(scrolltop<(top+height)){if(!inview){$el.data('inview',true);$el.trigger('inview',[true]);}}});}});$(function(){$(window).scroll();});})(jQuery);
       
    79 
       
    80 
       
    81 // http://bit.ly/ishiv | WTFPL License
       
    82 window.innerShiv=function(){function h(c,e,b){return/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i.test(b)?c:e+"></"+b+">"}var c,e=document,j,g="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" ");return function(d,i){if(!c&&(c=e.createElement("div"),c.innerHTML="<nav></nav>",j=c.childNodes.length!==1)){for(var b=e.createDocumentFragment(),f=g.length;f--;)b.createElement(g[f]);b.appendChild(c)}d=d.replace(/^\s\s*/,"").replace(/\s\s*$/,"").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/(<([\w:]+)[^>]*?)\/>/g,h);c.innerHTML=(b=d.match(/^<(tbody|tr|td|col|colgroup|thead|tfoot)/i))?"<table>"+d+"</table>":d;b=b?c.getElementsByTagName(b[1])[0].parentNode:c;if(i===!1)return b.childNodes;for(var f=e.createDocumentFragment(),k=b.childNodes.length;k--;)f.appendChild(b.firstChild);return f}}();
       
    83 
       
    84 // jQuery plugin based on .load() for use with innerShiv
       
    85 // http://jdbartlett.github.com/innershiv for more info
       
    86 // $('selector').loadShiv('example.html selector');
       
    87 jQuery.fn.loadShiv = function (url, params, callback) {
       
    88 	var off, selector, self, type;
       
    89 
       
    90 	if (!this.length || typeof url !== 'string') {
       
    91 		return this;
       
    92 	}
       
    93 
       
    94 	off = url.indexOf(' ');
       
    95 	if (off >= 0) {
       
    96 		selector = url.slice(off, url.length);
       
    97 		url = url.slice(0, off);
       
    98 	}
       
    99 
       
   100 	type = 'GET';
       
   101 
       
   102 	if (params) {
       
   103 		if (jQuery.isFunction(params)) {
       
   104 			callback = params;
       
   105 			params = null;
       
   106 		} else if (typeof params === 'object') {
       
   107 			params = jQuery.param(params, jQuery.ajaxSettings.traditional);
       
   108 			type = 'POST';
       
   109 		}
       
   110 	}
       
   111 
       
   112 	self = this;
       
   113 
       
   114 	jQuery.ajax({
       
   115 		url: url,
       
   116 		type: type,
       
   117 		dataType: 'html',
       
   118 		data: params,
       
   119 		complete: function (res, status) {
       
   120 			var shivved;
       
   121 
       
   122 			if (status === 'success' || status === 'notmodified') {
       
   123 				shivved = jQuery(innerShiv((selector ? '<div>' : '') + res.responseText, false));
       
   124 
       
   125 				if (selector) {
       
   126 					shivved = shivved.find(selector);
       
   127 				}
       
   128 
       
   129 				self.empty().append(shivved);
       
   130 			}
       
   131 
       
   132 			if (callback) {
       
   133 				self.each(callback, [res.responseText, status, res]);
       
   134 			}
       
   135 		}
       
   136 	});
       
   137 
       
   138 	return this;
       
   139 }
       
   140