/* * jQuery.fracs-core 0.11 * http://larsjung.de/fracs * * provided under the terms of the MIT License */ (function(a){"use strict";var b="_ModPlug_0.5_API",c={plugin:function(c,d){if(!c||a[c]||a.fn[c])return c?a[c]?2:3:1;var e={statics:{},methods:{},defaultStatic:undefined,defaultMethod:undefined},f=a.extend({},e,d),g=function(){var b,d;b=Array.prototype.slice.call(arguments),d=f.defaultStatic instanceof Function?f.defaultStatic.apply(this,b):f.defaultStatic;if(g[d]instanceof Function)return g[d].apply(this,b);a.error("Static method defaulted to '"+d+"' does not exist on 'jQuery."+c+"'")},h={},i=function(b){var d,e;if(h[b]instanceof Function)return d=Array.prototype.slice.call(arguments,1),h[b].apply(this,d);d=Array.prototype.slice.call(arguments),e=f.defaultMethod instanceof Function?f.defaultMethod.apply(this,d):f.defaultMethod;if(h[e]instanceof Function)return h[e].apply(this,d);a.error("Method '"+b+"' defaulted to '"+e+"' does not exist on 'jQuery."+c+"'")},j={addStatics:function(c){return a.extend(g,c),g[b]=j,this},addMethods:function(b){return a.extend(h,b),this}};return j.addStatics(f.statics).addMethods(f.methods),a[c]=g,a.fn[c]=i,0},module:function(c,d){if(!a[c]||!a[c][b])return a[c]?2:1;var e={statics:{},methods:{}},f=a.extend({},e,d);return a[c][b].addStatics(f.statics).addMethods(f.methods),0}};window.ModPlug=a.ModPlug=c})(jQuery),function(a){"use strict";var b=window.Fracs=window.Fracs||{},c=a(window),d=a(document),e=a("html,body"),f="fracs",g;b.Rect=function(a,c,d,e){if(this instanceof b.Rect)this.left=Math.round(a),this.top=Math.round(c),this.width=Math.round(d),this.height=Math.round(e),this.right=this.left+this.width,this.bottom=this.top+this.height;else return new b.Rect(a,c,d,e)},a.extend(b.Rect,{prototype:{equals:function(a){return this.left===a.left&&this.top===a.top&&this.width===a.width&&this.height===a.height},area:function(){return this.width*this.height},intersection:function(a){var c=Math.max(this.left,a.left),d=Math.min(this.right,a.right),e=Math.max(this.top,a.top),f=Math.min(this.bottom,a.bottom),g=d-c,h=f-e;return g>=0&&h>=0?b.Rect(c,e,g,h):undefined},envelope:function(a){var c=Math.min(this.left,a.left),d=Math.max(this.right,a.right),e=Math.min(this.top,a.top),f=Math.max(this.bottom,a.bottom),g=d-c,h=f-e;return b.Rect(c,e,g,h)},fracs:function(){return b.Fractions.ofRect(this)}},ofDocument:function(){return b.Rect(0,0,d.width(),d.height())},ofViewport:function(){return b.Rect(c.scrollLeft(),c.scrollTop(),c.width(),c.height())},ofElement:function(c){var d=a(c),e;return d.is(":visible")?(e=d.offset(),b.Rect(e.left,e.top,d.outerWidth(),d.outerHeight())):b.Rect(0,0,-1,0)}}),b.Fractions=function(a,c,d,e,f,g){if(this instanceof b.Fractions)!a||!c||!d||!e||!f||!g?(this.rects=undefined,this.visible=0,this.viewport=0,this.possible=0):(this.rects={document:a,element:c,viewport:d},this.visible=e,this.viewport=f,this.possible=g);else return new b.Fractions(a,c,d,e,f,g)},a.extend(b.Fractions,{prototype:{equals:function(a){return this.fracsEqual(a)&&this.rectsEqual(a)},fracsEqual:function(a){return this.visible===a.visible&&this.viewport===a.viewport&&this.possible===a.possible},rectsEqual:function(a){return!this.rects||!a.rects?this.rects===a.rects:this.rects.document.equals(a.rects.document)&&this.rects.element.equals(a.rects.element)&&this.rects.viewport.equals(a.rects.viewport)}},ofRect:function(a,c){var d,e,f,g,h;return c=c||b.Rect.ofViewport(),d=a.intersection(c),d?(e=b.Rect(d.left-a.left,d.top-a.top,d.width,d.height),f=b.Rect(d.left-c.left,d.top-c.top,d.width,d.height),g=d.area(),h=Math.min(a.width,c.width)*Math.min(a.height,c.height),b.Fractions(d,e,f,g/a.area(),g/c.area(),g/h)):b.Fractions()},ofElement:function(a,c){return b.Fractions.ofRect(b.Rect.ofElement(a),c)}}),b.Cursor=function(a,c){if(this instanceof b.Mouse)this.distX=a,this.distY=c,this.distMin=Math.min(a,c),this.distMax=Math.max(a,c);else return new b.Mouse(a,c)},a.extend(b.Cursor,{prototype:{equals:function(a){return this.distX===a.distX&&this.distY===a.distY},dist:function(){return Math.sqrt(this.distX*this.distX+this.distY*this.distY)}},ofRect:function(a,c,d){var e=ad.right?a-d.right:0,f=cd.bottom?c-d.bottom:0;return b.Cursor(e,f)},ofElement:function(a,c,d){return b.Cursor.ofRect(a,c,b.Rect.ofElement(d))}}),b.Callbacks=function(){if(this instanceof b.Callbacks)this.callbacks=[];else return new b.Callbacks},b.Callbacks.prototype={size:function(){return this.callbacks.length},bind:function(b){b instanceof Function&&a.inArray(b,this.callbacks)===-1&&this.callbacks.push(b)},unbind:function(b){var c;b instanceof Function?(c=a.inArray(b,this.callbacks),c>=0&&this.callbacks.splice(c,1)):this.callbacks=[]},trigger:function(b,c){a.each(this.callbacks,function(a,d){d.apply(b,c)})}},b.FracsCallbacks=function(c){if(this instanceof b.FracsCallbacks)this.callbacks=[],this.element=c,this.fracs=undefined,this.prevFracs=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.FracsCallbacks(c)},b.FracsCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,this.element,[this.fracs,this.prevFracs])},check:function(){var a=this.element instanceof b.Rect?this.element:b.Rect.ofElement(this.element),c=b.Fractions.ofRect(a);return!this.fracs||!this.fracs.equals(c)?(this.prevFracs=this.fracs,this.fracs=c,this.trigger(),!0):!1},autoCheck:function(a){var b="resize scroll load",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.ScrollStateCallbacks=function(){if(this instanceof b.ScrollStateCallbacks)this.callbacks=[],this.state=undefined,this.prevState=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.ScrollStateCallbacks},b.ScrollStateCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,window,[this.state,this.prevState])},check:function(){var a=b.ScrollState();return!this.state||!this.state.equals(a)?(this.prevState=this.state,this.state=a,this.trigger(),!0):!1},autoCheck:function(a){var b="resize scroll load",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.GroupCallbacks=function(c,d,e){if(this instanceof b.GroupCallbacks)this.callbacks=[],this.group=b.Group(c),this.type=d,this.property=e,this.best=undefined,this.prevBest=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.GroupCallbacks(c,d,e)},b.GroupCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,this.group,[this.best,this.prevBest])},check:function(){var a=this.group[this.type](this.property),b=a.elements.length===0||a.value===0?undefined:a.elements[0];return!this.best||this.best!==b?(this.prevBest=this.best,this.best=b,this.trigger(),!0):!1},autoCheck:function(a){var b="resize scroll load",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.CursorCallbacks=function(c){if(this instanceof b.CursorCallbacks)this.callbacks=[],this.element=c,this.cursor=undefined,this.prevCursor=undefined,this.checkProxy=a.proxy(this.check,this),this.autoCheck();else return new b.CursorCallbacks(c)},b.CursorCallbacks.prototype=a.extend({},b.Callbacks.prototype,{trigger:function(){b.Callbacks.prototype.trigger.call(this,this.element,[this.cursor,this.prevCursor])},check:function(a){var c=b.Cursor.ofElement(a.pageX,a.pageY,this.element);return!this.cursor||!this.cursor.equals(c)?(this.prevCursor=this.cursor,this.cursor=c,this.trigger(),!0):!1},autoCheck:function(a){var b="cursormove",d=a===!1?"unbind":"bind";c[d](b,this.checkProxy)}}),b.ScrollState=function(a,c,d,e,f,g){if(!(this instanceof b.ScrollState))return new b.ScrollState(a,c,d,e,f,g);if(a===undefined||c===undefined||d===undefined||e===undefined||f===undefined||g===undefined){var h=b.Rect.ofDocument(),i=b.Rect.ofViewport(),j=h.width-i.width,k=h.height-i.height;this.width=j<=0?undefined:i.left/j,this.height=k<=0?undefined:i.top/k,this.left=i.left,this.top=i.top,this.right=h.right-i.right,this.bottom=h.bottom-i.bottom}else this.width=a,this.height=c,this.left=d,this.top=e,this.right=f,this.bottom=g},a.extend(b.ScrollState,{prototype:{equals:function(a){return this.width===a.width&&this.height===a.height&&this.left===a.left&&this.top===a.top&&this.right===a.right&&this.bottom===a.bottom}},scrollTo:function(a,b,c){a=a||0,b=b||0,c=isNaN(c)?1e3:c,e.stop(!0).animate({scrollLeft:a,scrollTop:b},c)},scroll:function(a,d,e){a=a||0,d=d||0,b.ScrollState.scrollTo(c.scrollLeft()+a,c.scrollTop()+d,e)},scrollToRect:function(a,c,d,e){c=c||0,d=d||0,b.ScrollState.scrollTo(a.left-c,a.top-d,e)},scrollToElement:function(a,c,d,e){var f=b.Rect.ofElement(a);b.ScrollState.scrollToRect(f,c,d,e)}}),b.Element=function(a){if(this instanceof b.Element)this.element=a,this.fracs=undefined,this.prevFracs=undefined,this.rect=undefined,this.prevRect=undefined,this.update();else return new b.Element(a)},b.Element.prototype={update:function(){var a=b.Fractions.ofElement(this.element),c=b.Rect.ofElement(this.element),d=!1;if(!this.fracs||!this.fracs.equals(a))this.prevFracs=this.fracs,this.fracs=a,d=!0;if(!this.rect||!this.rect.equals(c))this.prevRect=this.rect,this.rect=c,d=!0;return d}},function(a,b){var c=["possible","visible","viewport"],d=["width","height","left","right","top","bottom"],e=function(b){if(a.inArray(b,c)>=0)return"fracs";if(a.inArray(b,d)>=0)return"rect"},f=function(a,b){return a>b},g=function(a,b){return a