/** * Isotope v1.5.19 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * * Commercial use requires one-time license fee * http://metafizzy.co/#licenses * * Copyright 2012 David DeSandro / Metafizzy */ (function(a,b,c){"use strict";var d=a.document,e=a.Modernizr,f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},g="Moz Webkit O Ms".split(" "),h=function(a){var b=d.documentElement.style,c;if(typeof b[a]=="string")return a;a=f(a);for(var e=0,h=g.length;e"+d+"{#modernizr{height:3px}}"+"").appendTo("head"),f=b('
').appendTo("html");a=f.height()===3,f.remove(),e.remove()}return a},csstransitions:function(){return!!j}},l;if(e)for(l in k)e.hasOwnProperty(l)||e.addTest(l,k[l]);else{e=a.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var m=" ",n;for(l in k)n=k[l](),e[l]=n,m+=" "+(n?"":"no-")+l;b("html").addClass(m)}if(e.csstransforms){var o=e.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},p=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},g,h={},j;f[c]=d,b.extend(e,f);for(g in e)j=e[g],h[g]=o[g](j);var k=h.translate||"",l=h.scale||"",m=k+l;b.data(a,"isoTransform",e),a.style[i]=m};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){p(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){p(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var q,r;e.csstransitions&&(q={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd",transitionProperty:"transitionEnd"}[j],r=h("transitionDuration"));var s=b.event,t;s.special.smartresize={setup:function(){b(this).bind("resize",s.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",s.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",t&&clearTimeout(t),t=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c,d){this.element=b(c),this._create(a),this._init(d)};var u=["width","height"],v=b(a);b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!b.browser.opera,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(a){this.options=b.extend({},b.Isotope.settings,a),this.styleQueue=[],this.elemCount=0;var c=this.element[0].style;this.originalStyle={};var d=u.slice(0);for(var e in this.options.containerStyle)d.push(e);for(var f=0,g=d.length;fg?1:f0&&(i=function(a,b){b.$el[d](b.style,f).one(q,k)},j=!1)}}b.each(this.styleQueue,i),j&&k(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(a){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._getAtoms(a);this.$allAtoms=this.$allAtoms.add(c),b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,function(a){var d=c._filter(a);c._addHideAppended(d),c._sort(),c.reLayout(),c._revealAppended(d,b)})},appended:function(a,b){var c=this;this.addItems(a,function(a){c._addHideAppended(a),c.layout(a),c._revealAppended(a,b)})},_addHideAppended:function(a){this.$filteredAtoms=this.$filteredAtoms.add(a),a.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:a,style:this.options.hiddenStyle})},_revealAppended:function(a,b){var c=this;setTimeout(function(){a.removeClass("no-transition"),c.styleQueue.push({$el:a,style:c.options.visibleStyle}),c._isInserting=!1,c._processStyleQueue(a,b)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(a,b){var c=this,d=function(){c.$allAtoms=c.$allAtoms.not(a),a.remove(),b&&b.call(c.element)};a.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:a,style:this.options.hiddenStyle}),this.$filteredAtoms=this.$filteredAtoms.not(a),this._sort(),this.reLayout(d)):d()},shuffle:function(a){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(a)},destroy:function(){var a=this.usingTransforms,b=this.options;this.$allAtoms.removeClass(b.hiddenClass+" "+b.itemClass).each(function(){var b=this.style;b.position="",b.top="",b.left="",b.opacity="",a&&(b[i]="")});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".isotope").undelegate("."+b.hiddenClass,"click").removeClass(b.containerClass).removeData("isotope"),v.unbind(".isotope")},_getSegments:function(a){var b=this.options.layoutMode,c=a?"rowHeight":"columnWidth",d=a?"height":"width",e=a?"rows":"cols",g=this.element[d](),h,i=this.options[b]&&this.options[b][c]||this.$filteredAtoms["outer"+f(d)](!0)||g;h=Math.floor(g/i),h=Math.max(h,1),this[b][e]=h,this[b][c]=i},_checkIfSegmentsChanged:function(a){var b=this.options.layoutMode,c=a?"rows":"cols",d=this[b][c];return this._getSegments(a),this[b][c]!==d},_masonryReset:function(){this.masonry={},this._getSegments();var a=this.masonry.cols;this.masonry.colYs=[];while(a--)this.masonry.colYs.push(0)},_masonryLayout:function(a){var c=this,d=c.masonry;a.each(function(){var a=b(this),e=Math.ceil(a.outerWidth(!0)/d.columnWidth);e=Math.min(e,d.cols);if(e===1)c._masonryPlaceBrick(a,d.colYs);else{var f=d.cols+1-e,g=[],h,i;for(i=0;id&&(e.x=0,e.y=e.height),c._pushPosition(a,e.x,e.y),e.height=Math.max(e.y+g,e.height),e.x+=f})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow;a.each(function(){var a=b(this),e=d.index%d.cols,f=Math.floor(d.index/d.cols),g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,0,c.straightDown.y),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var a=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(a--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(a){var c=this,d=c.masonryHorizontal;a.each(function(){var a=b(this),e=Math.ceil(a.outerHeight(!0)/d.rowHeight);e=Math.min(e,d.rows);if(e===1)c._masonryHorizontalPlaceBrick(a,d.rowXs);else{var f=d.rows+1-e,g=[],h,i;for(i=0;id&&(e.x=e.width,e.y=0),c._pushPosition(a,e.x,e.y),e.width=Math.max(e.x+f,e.width),e.y+=g})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn;a.each(function(){var a=b(this),e=Math.floor(d.index/d.rows),f=d.index%d.rows,g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,c.straightAcross.x,0),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var w=function(b){a.console&&a.console.error(b)};b.fn.isotope=function(a,c){if(typeof a=="string"){var d=Array.prototype.slice.call(arguments,1);this.each(function(){var c=b.data(this,"isotope");if(!c){w("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(c[a])||a.charAt(0)==="_"){w("no such method '"+a+"' for isotope instance");return}c[a].apply(c,d)})}else this.each(function(){var d=b.data(this,"isotope");d?(d.option(a),d._init(c)):b.data(this,"isotope",new b.Isotope(a,this,c))});return this}})(window,jQuery); ; /*! // Infinite Scroll jQuery plugin // copyright Paul Irish, licensed GPL & MIT // version 1.5.100504 // home and docs: http://www.infinite-scroll.com */ ;(function($){ $.fn.infinitescroll = function(options,callback){ // console log wrapper. function debug(){ if (opts.debug) { window.console && console.log.call(console,arguments)} } // grab each selector option and see if any fail. function areSelectorsValid(opts){ for (var key in opts){ if (key.indexOf && key.indexOf('Selector') > -1 && $(opts[key]).length === 0){ debug('Your ' + key + ' found no elements.'); return false; } return true; } } // find the number to increment in the path. function determinePath(path){ path.match(relurl) ? path.match(relurl)[2] : path; // there is a 2 in the url surrounded by slashes, e.g. /page/2/ if ( path.match(/^(.*?)\b2\b(.*?$)/) ){ path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1); } else // if there is any 2 in the url at all. if (path.match(/^(.*?)2(.*?$)/)){ // page= is used in django: // http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127 if ( path.match(/^(.*?page=)2(\/.*|$)/) ){ path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1); return path; } debug('Trying backup next selector parse technique. Treacherous waters here, matey.'); path = path.match(/^(.*?)2(.*?$)/).slice(1); } else { // page= is used in drupal too but second page is page=1 not page=2: // thx Jerod Fritz, vladikoff if (path.match(/^(.*?page=)1(\/.*|$)/)) { path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1); return path; } debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.'); props.isInvalidPage = true; //prevent it from running on this page. } return path; } // 'document' means the full document usually, but sometimes the content of the overflow'd div in local mode function getDocumentHeight(){ // weird doubletouch of scrollheight because http://soulpass.com/2006/07/24/ie-and-scrollheight/ return opts.localMode ? ($(props.container)[0].scrollHeight && $(props.container)[0].scrollHeight) // needs to be document's height. (not props.container's) html's height is wrong in IE. : $(document).height() } function isNearBottom(){ // distance remaining in the scroll // computed as: document height - distance already scroll - viewport height - buffer var pixelsFromWindowBottomToBottom = 0 + getDocumentHeight() - ( opts.localMode ? $(props.container).scrollTop() : // have to do this bs because safari doesnt report a scrollTop on the html element ($(props.container).scrollTop() || $(props.container.ownerDocument.body).scrollTop()) ) - $(opts.localMode ? props.container : window).height(); debug('math:',pixelsFromWindowBottomToBottom, props.pixelsFromNavToBottom); // if distance remaining in the scroll (including buffer) is less than the orignal nav to bottom.... return (pixelsFromWindowBottomToBottom - opts.bufferPx < props.pixelsFromNavToBottom); } function showDoneMsg(){ props.loadingMsg.hide(); // user provided callback when done opts.errorCallback(); } function infscrSetup(){ if (props.isDuringAjax || props.isInvalidPage || props.isDone) return; if ( !isNearBottom(opts,props) ) return; $(document).trigger('retrieve.infscr'); } // end of infscrSetup() function kickOffAjax(){ // we dont want to fire the ajax multiple times props.isDuringAjax = true; // show the loading message and hide the previous/next links props.loadingMsg.show(); $( opts.navSelector ).hide(); // increment the URL bit. e.g. /page/3/ props.currPage++; debug('heading into ajax',path); // if we're dealing with a table we can't use DIVs box = $(opts.contentSelector).is('table') ? $('') : $('
'); frag = document.createDocumentFragment(); box.load( path.join( props.currPage ) + ' ' + opts.itemSelector,null,loadCallback); } function loadCallback(){ // if we've hit the last page... if (props.isDone){ showDoneMsg(); return false; } else { var children = box.children().get(); // if it didn't return anything if (children.length == 0){ // fake an ajaxError so we can quit. return $.event.trigger( "ajaxError", [{status:404}] ); } // use a documentFragment because it works when content is going into a table or UL while (box[0].firstChild){ frag.appendChild( box[0].firstChild ); } $(opts.contentSelector)[0].appendChild(frag); // fadeout currently makes the 'd text ugly in IE6 props.loadingMsg.fadeOut('normal' ); // smooth scroll to ease in the new content if (opts.animate){ var scrollTo = $(window).scrollTop() + opts.extraScrollPx + 'px'; $('html,body').animate({scrollTop: scrollTo}, 800,function(){ props.isDuringAjax = false; }); } // previously, we would pass in the new DOM element as context for the callback // however we're now using a documentfragment, which doesnt havent parents or children, // so the context is the contentContainer guy, and we pass in an array // of the elements collected as the first argument. callback.call( $(opts.contentSelector)[0], children ); if (!opts.animate) props.isDuringAjax = false; // once the call is done, we can allow it again. } } // lets get started. $.browser.ie6 = $.browser.msie && $.browser.version < 7; var opts = $.extend({}, $.infinitescroll.defaults, options), props = $.infinitescroll, // shorthand box, frag; callback = callback || function(){}; if (!areSelectorsValid(opts)){ return false; } // we doing this on an overflow:auto div? props.container = opts.localMode ? this : document.documentElement; // contentSelector we'll use for our .load() opts.contentSelector = opts.contentSelector || this; // get the relative URL - everything past the domain name. var relurl = /(.*?\/\/).*?(\/.*)/, path = $(opts.nextSelector).attr('href'); if (!path) { debug('Navigation selector not found'); return; } // set the path to be a relative URL from root. path = determinePath(path); // reset scrollTop in case of page refresh: if (opts.localMode) $(props.container)[0].scrollTop = 0; // distance from nav links to bottom // computed as: height of the document + top offset of container - top offset of nav link props.pixelsFromNavToBottom = getDocumentHeight() + (props.container == document.documentElement ? 0 : $(props.container).offset().top )- $(opts.navSelector).offset().top; // define loading msg props.loadingMsg = $('#infscr-loading'); // preload the image (new Image()).src = opts.loadingImg; // set up our bindings $(document).ajaxError(function(e,xhr,opt){ debug('Page not found. Self-destructing...'); // die if we're out of pages. if (xhr.status == 404){ showDoneMsg(); props.isDone = true; $(opts.localMode ? this : window).unbind('scroll.infscr'); } }); // bind scroll handler to element (if its a local scroll) or window $(opts.localMode ? this : window) .bind('scroll.infscr', infscrSetup) .trigger('scroll.infscr'); // trigger the event, in case it's a short page $(document).bind('retrieve.infscr',kickOffAjax); return this; } // end of $.fn.infinitescroll() // options and read-only properties object $.infinitescroll = { defaults : { debug : false, preload : false, nextSelector : "div.navigation a:first", loadingImg : "http://www.infinite-scroll.com/loading.gif", loadingText : "Loading the next set of posts...", navSelector : "div.navigation", contentSelector : null, // not really a selector. :) it's whatever the method was called on.. extraScrollPx : 150, itemSelector : "div.post", animate : false, localMode : false, bufferPx : 40, errorCallback : function(){} }, loadingImg : undefined, loadingMsg : undefined, container : undefined, currPage : 1, currDOMChunk : null, // defined in setup()'s load() isDuringAjax : false, isInvalidPage : false, isDone : false // for when it goes all the way through the archive. }; })(jQuery);