Log updates
[beagleboard.org.git] / static / jquery.movingboxes.min.js
blob7c33bb466f0dbe59edc651337bc2a0a4f88012b2
1 /*!
2  * Moving Boxes v2.3.1 minified
3  * by Chris Coyier 
4  * http://css-tricks.com/moving-boxes/
5  */
6 ;(function(e){e.movingBoxes=function(g,k){var c,a=this;a.$el=e(g).addClass("mb-slider");a.el=g;a.$el.data("movingBoxes",a);a.init=function(){a.options=c=e.extend({},e.movingBoxes.defaultOptions,k);a.$el.wrap('<div class="movingBoxes mb-wrapper"><div class="mb-scroll" /></div>');a.$window=a.$el.parent();a.$wrap=a.$window.parent().prepend('<a class="mb-scrollButtons mb-left"></a>').append('<a class="mb-scrollButtons mb-right"></a><div class="mb-left-shadow"></div><div class="mb-right-shadow"></div>'); a.$panels=a.$el.children().addClass("mb-panel");a.runTime=e(".mb-slider").index(a.$el)+1;a.regex=RegExp("slider"+a.runTime+"=(\\d+)","i");a.initialized=!1;a.currentlyMoving=!1;a.curPanel=c.initAnimation?1:a.getHash()||c.startPanel;a.width=c.width?parseInt(c.width,10):a.$el.width();a.pWidth=c.panelWidth?2>=c.panelWidth?c.panelWidth*a.width:c.panelWidth:a.$panels.eq(0).width();a.$left=a.$wrap.find(".mb-left").click(function(){a.goBack();return!1});a.$right=a.$wrap.find(".mb-right").click(function(){a.goForward(); return!1});a.update(!1);a.setWrap(a.curPanel);a.$el.delegate(".mb-panel","click",function(b){e(this).hasClass(c.currentPanel)||(b.preventDefault(),a.change(a.$panels.index(e(this))+a.adj,{},!0))});a.$wrap.click(function(){a.$wrap.hasClass("mb-active-slider")||a.active()});a.$panels.delegate("a","focus",function(b){b.preventDefault();b=a.$panels.index(e(this).closest(".mb-panel"))+a.adj;b!==a.curPanel&&a.change(b,{},!0)});e(document).keyup(function(b){if(!b.target.tagName.match("TEXTAREA|INPUT|SELECT"))switch(b.which){case 39:case 32:a.$wrap.is(".mb-active-slider")&& a.goForward();break;case 37:a.$wrap.is(".mb-active-slider")&&a.goBack()}});e.each(["preinit","initialized","initChange","beforeAnimation","completed"],function(b,f){e.isFunction(c[f])&&a.$el.bind(f+".movingBoxes",c[f])});a.$el.trigger("preinit.movingBoxes",[a,a.curPanel])};a.update=function(b,f){a.$el.children(".cloned").remove();a.$panels=a.$el.children();a.adj=c.wrap&&1<a.$panels.length?0:1;a.width=c.width?parseInt(c.width,10):a.width;a.$wrap.css("width",a.width);c.wrap&&1<a.$panels.length&&(a.$el.prepend(a.$panels.filter(":last").clone().addClass("cloned")), a.$el.append(a.$panels.filter(":first").clone().addClass("cloned")),a.$el.find(".cloned").each(function(){e(this).find("a,input,textarea,select,button,area").removeAttr("name").attr("disabled","disabled");e(this).find("[id]").andSelf().removeAttr("id")}));a.$panels=a.$el.children().addClass("mb-panel").each(function(){0===e(this).find(".mb-inside").length&&e(this).wrapInner('<div class="mb-inside" />')});a.totalPanels=a.$panels.filter(":not(.cloned)").length;a.setSizes(b);a.buildNav();a.change(a.curPanel, f,b);a.imagesLoaded(function(){a.setSizes(!1);a.change(a.curPanel,{},!1);a.initialized||setTimeout(function(){a.change(a.getHash()||c.startPanel);a.initialized=!0;a.$el.trigger("initialized.movingBoxes",[a,a.curPanel])},2*c.speed)})};a.setSizes=function(b){a.padding=parseInt(a.$panels.css("padding-left"),10)+parseInt(a.$panels.css("margin-left"),10);a.curWidth=c.panelWidth?2>=c.panelWidth?c.panelWidth*a.width:c.panelWidth:a.pWidth;a.regWidth=a.curWidth*c.reducedSize;a.$panels.css({width:a.curWidth, fontSize:"1em"});a.$panels.eq(a.curPanel-a.adj).addClass(c.currentPanel);a.heights=a.$panels.css("height","auto").map(function(a,b){return e(b).outerHeight(!0)}).get();a.returnToNormal(a.curPanel,0);a.growBigger(a.curPanel,0,b);a.updateArrows(a.curPanel);a.$el.css({position:"absolute",width:(a.curWidth+2*a.padding)*a.$panels.length+(a.width-a.curWidth)/2,height:Math.max.apply(this,a.heights)+10,"padding-left":(a.width-a.curWidth)/2});a.$window.css({height:c.fixedHeight?Math.max.apply(this,a.heights): a.heights[a.curPanel-a.adj]})};a.buildNav=function(){a.$nav?a.$nav.find(".mb-links").empty():a.$nav=e('<div class="mb-controls"><span class="mb-links"></span></div>').appendTo(a.$wrap);if(c.buildNav&&1<a.totalPanels){var b,f,d="",j;a.$panels.filter(":not(.cloned)").each(function(i){f=i+1;d='<a class="mb-link mb-panel'+f+'" href="#"></a>';j=e(d);e.isFunction(c.navFormatter)?(b=c.navFormatter(f,e(this)),"string"===typeof b?j.html(b):j=e("<a/>",b)):j.html(f);j.appendTo(a.$nav.find(".mb-links")).addClass("mb-link mb-panel"+ f).data("index",f)});a.$nav.find("a.mb-link").bind("click",function(){a.change(e(this).data("index"));return!1})}};a.returnToNormal=function(b,f){var d=a.$panels.not(":eq("+(b-a.adj)+")").removeClass(c.currentPanel);1===c.reducedSize?d.css({width:a.regWidth}):d.stop(!0,!1).animate({width:a.regWidth,fontSize:c.reducedSize+"em"},0===f?0:c.speed)};a.growBigger=function(b,f,d){var e=a.$panels.eq(b-a.adj);1===c.reducedSize?(e.css({width:a.curWidth}),setTimeout(function(){a.completed(b,d)},0===f?0:c.speed)): e.stop(!0,!1).animate({width:a.curWidth,fontSize:"1em"},0===f?0:c.speed,function(){a.completed(b,d)})};a.setWrap=function(b){a.growBigger(b,0,!1);b=a.$panels.eq(b).position().left-(a.width-a.curWidth)/2+a.padding;a.$window.scrollLeft(b)};a.completed=function(b,f){var d=a.$panels.eq(b-a.adj);d.hasClass("cloned")||d.addClass(c.currentPanel);!1!==f&&a.$el.trigger("completed.movingBoxes",[a,b])};a.goForward=function(b){a.initialized&&a.change(a.curPanel+1,b)};a.goBack=function(b){a.initialized&&a.change(a.curPanel- 1,b)};a.change=function(b,f,d){if(1>a.totalPanels)"function"===typeof f&&f(a);else{var j,i,h,g=!1;h=(d=!1!==d)?c.speed:0;b=/^[#|.]/.test(b)&&e(b).length?e(b).closest(".mb-panel").index()+a.adj:parseInt(b,10);a.initialized&&d&&(a.$wrap.hasClass("mb-active-slider")||a.active(),a.$el.trigger("initChange.movingBoxes",[a,b]));c.wrap&&(b>a.totalPanels?(g=!0,b=1,a.returnToNormal(0,0),a.setWrap(0)):0===b&&(g=!1,b=a.totalPanels,a.setWrap(b+1)));b<a.adj&&(b=c.wrap?a.totalPanels:1);b>a.totalPanels-a.adj&&(b= c.wrap?1:a.totalPanels);if(a.curPanel!==b&&(!a.currentlyMoving||!a.initialized)){a.currentlyMoving=!c.stopAnimation;a.$curPanel=a.$panels.eq(b-a.adj);i=a.$curPanel.position().left-(a.width-a.curWidth)/2+a.padding;if(b>a.curPanel||g)i-=a.curWidth-a.regWidth;j=c.fixedHeight?{scrollLeft:i}:{scrollLeft:i,height:a.heights[b-a.adj]};a.curPanel=b;a.initialized&&d&&a.$el.trigger("beforeAnimation.movingBoxes",[a,b]);c.delayBeforeAnimate?setTimeout(function(){a.animateBoxes(b,j,h,d,f)},parseInt(c.delayBeforeAnimate, 10)||0):a.animateBoxes(b,j,h,d,f)}else a.endAnimation()}};a.animateBoxes=function(b,f,d,e,g){a.$window.scrollTop(0).stop(!0,!1).animate(f,{queue:!1,duration:d,easing:c.easing,complete:function(){a.initialized&&a.$window.scrollTop(0);a.currentlyMoving=!1;"function"===typeof g&&g(a)}});a.returnToNormal(b,d);a.growBigger(b,d,e);a.updateArrows(b);c.hashTags&&a.initialized&&a.setHash(b);a.endAnimation()};a.endAnimation=function(){c.buildNav&&a.$nav.length&&a.$nav.find("a.mb-link").removeClass(c.currentPanel).eq(a.curPanel- 1).addClass(c.currentPanel)};a.updateArrows=function(b){a.$left.toggleClass(c.disabled,!c.wrap&&b===a.adj);a.$right.toggleClass(c.disabled,!c.wrap&&(b===a.totalPanels||0===a.totalPanels))};a.getHash=function(){var b=window.location.hash,f=b.indexOf("&"),d=b.match(a.regex);null===d&&!/^#&/.test(b)&&!/#!?\//.test(b)?(b=b.substring(0,0<=f?f:b.length),d=e(b).length&&e(b).closest(".mb-slider")[0]===a.el?e(b).closest(".mb-panel").index()+a.adj:null):null!==d&&(d=c.hashTags?parseInt(d[1],10):null);return d}; a.setHash=function(b){var c="slider"+a.runTime+"=",d=window.location.hash;"undefined"!==typeof d&&(window.location.hash=0<d.indexOf(c)?d.replace(a.regex,c+b):d+"&"+c+b)};a.active=function(){e(".mb-active-slider").removeClass("mb-active-slider");a.$wrap.addClass("mb-active-slider")};a.currentPanel=function(b,c){"undefined"!==typeof b&&a.change(b,c);return a.curPanel};a.imagesLoaded=function(b,c){var d,g,i=!0,h=c?e(c):a.$panels.find("img"),k=h.length,c=c||[];for(d=0;d<k;d++)"IMG"===h[d].tagName&&(g= "fileSize"in h[d]&&0>h[d].fileSize&&10<h[d].count?!0:h[d].complete,i=i&&g&&0!==h[d].height,!1===g&&(c.push(h[d]),h[d].count=(h[d].count||0)+1));i?"function"===typeof b&&b():setTimeout(function(){a.imagesLoaded(b,c)},200)};a.init()};e.movingBoxes.defaultOptions={startPanel:1,reducedSize:0.8,fixedHeight:!1,initAnimation:!0,stopAnimation:!1,hashTags:!0,wrap:!1,buildNav:!1,navFormatter:null,easing:"swing",speed:500,delayBeforeAnimate:0,currentPanel:"current",tooltipClass:"tooltip",disabled:"disabled", preinit:null,initialized:null,initChange:null,beforeAnimation:null,completed:null};e.fn.movingBoxes=function(g,k,c){var a,b;return this.each(function(){b=e(this).data("movingBoxes");(typeof g).match("object|undefined")?b?b.update():new e.movingBoxes(this,g):/\d/.test(g)&&(!isNaN(g)&&b)&&(a="number"===typeof g?g:parseInt(e.trim(g),10),1<=a&&a<=b.totalPanels&&b.change(a,k,c))})};e.fn.getMovingBoxes=function(){return this.data("movingBoxes")}})(jQuery);