Changeset 1467555
- Timestamp:
- 08/04/2016 09:47:31 AM (10 years ago)
- Location:
- cactus-masonry-plus
- Files:
-
- 14 added
- 4 edited
-
assets/zips/0.0.5.2.zip (added)
-
tags/0.0.5.2 (added)
-
tags/0.0.5.2/cactusBrick.js (added)
-
tags/0.0.5.2/cactusBrick.min.js (added)
-
tags/0.0.5.2/cactusGallery.js (added)
-
tags/0.0.5.2/cactusGallery.min.js (added)
-
tags/0.0.5.2/cactusMasonry.php (added)
-
tags/0.0.5.2/cactusMasonryGettingStarted.php (added)
-
tags/0.0.5.2/cactusMasonryPlus.js (added)
-
tags/0.0.5.2/cactusMasonryPlus.min.js (added)
-
tags/0.0.5.2/license.txt (added)
-
tags/0.0.5.2/readme.txt (added)
-
tags/0.0.5.2/style.css (added)
-
tags/0.0.5.2/style.scss (added)
-
trunk/cactusGallery.js (modified) (1 diff)
-
trunk/cactusGallery.min.js (modified) (1 diff)
-
trunk/cactusMasonry.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cactus-masonry-plus/trunk/cactusGallery.js
r1451804 r1467555 97 97 b.initWidth = initWidth; 98 98 b.initHeight = initHeight; 99 this.brickQueue. push(b);99 this.brickQueue.unshift(b); 100 100 if(!window.requestAnimationFrame) this.internalProcessQueue(); 101 101 else if(!this.additionRequested) { -
cactus-masonry-plus/trunk/cactusGallery.min.js
r1451804 r1467555 1 1 /*!@preserve Copyright 2016 cactus.cloud - Licensed under GNU AGPLv3. See <license.txt> or <http://www.gnu.org/licenses/>.*/ 2 function CactusGallery(){this.container,this.outerContainer,this.h,this.w,this.countW,this.bricks,this.additionRequested,this.count,this.resizeTimer,this.scrollBarListener,this.margin=0,this.tolerance,this.evalMeta=!1,this.infiniteScroll=!1,this.lazyLoad=!1,this.lazyLoadQueue,this.lazyLoadImage=null,this.lazyLoadBusy=!1,this.lazyLoadBrick,this.lazyLoadIndex}CactusGallery.prototype.init=function(i,t,e,s){this.container=t,this.outerContainer=i,this.margin=e,this.tolerance=0>=s||s>1||this.evalMeta?1:s,this.w=jQuery(i).outerWidth(!1)+e,this.h=0,this.countW=0,"object"==typeof this.bricks&&(this.bricks.length=0),"object"==typeof this.brickQueue&&(this.brickQueue.length=0),"object"==typeof this.lazyLoadQueue&&(this.lazyLoadQueue.length=0),this.bricks=new Array,this.brickQueue=new Array,this.lazyLoadQueue=new Array,this.additionRequested=!1,this.infiniteScroll&&(this.lazyLoadBusy=!1,jQuery(window).on("scroll.cactusGallery",this.infiniteScrollListener.bind(this)),window.top!=window&&jQuery(window.top).on("scroll.cactusGallery",this.infiniteScrollListener.bind(this))),this.lazyLoad&&(jQuery(window).on("scroll.cactusGallery resize.cactusGallery orientationchange.cactusGallery",this.lazyLoadListener.bind(this)),window.top!=window&&jQuery(window.top).on("scroll.cactusGallery",this.lazyLoadListener.bind(this))),jQuery(window).on("resize.cactusGallery orientchange.cactusGallery",this.scheduleRefresh.bind(this)),this.count=0;var r=document.createElement("iframe");r.id="cacsds",r.style.cssText="height: 0; background-color: transparent; margin: 0; padding: 0; overflow: hidden; border-width: 0; position: absolute; width: 100%;",this.scrollBarListener=r,jQuery(r).on("load",this.internalScrollListenerReady.bind(this)),document.body.appendChild(r)},CactusGallery.prototype.scheduleRefresh=function(){clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(this.redrawGallery.bind(this),25)},CactusGallery.prototype.redrawGallery=function(){window.requestAnimationFrame?this.additionRequested||(this.additionRequested=!0,window.requestAnimationFrame(this.internalRedrawGallery.bind(this))):this.internalRedrawGallery()},CactusGallery.prototype.addBrick=function(i,t,e){i.initWidth=t,i.initHeight=e,this.brickQueue. push(i),window.requestAnimationFrame?this.additionRequested||(this.additionRequested=!0,window.requestAnimationFrame(this.internalProcessQueue.bind(this))):this.internalProcessQueue()},CactusGallery.prototype.destroy=function(){jQuery(window).off("resize.cactusGallery orientchange.cactusGallery"),clearTimeout(this.resizeTimer),jQuery(this.scrollBarListener).remove(),this.scrollBarListener=null,this.resizeTimer=null,this.container.innerHTML="",this.container=null,this.bricks.length=0,this.brickQueue.length=0,this.additionRequested=!1},CactusGallery.prototype.internalProcessQueue=function(){for(;this.brickQueue.length>0&&(!this.infiniteScroll||this.infiniteScrollReady(-2e3));){var i=this.brickQueue.pop();i.style.visibility="hidden",this.container.appendChild(i);var t=new CactusBrick;t.init(i,this.count,this.tolerance,this.evalMeta,this.w,i.initHeight,i.initWidth),this.bricks.push(t),this.count++,this.internalPositionBrick(t),this.lazyLoad&&t.DOM.loadPending&&this.lazyLoadQueue.push(t)}this.additionRequested=!1,jQuery(this.container).css({height:this.h+"px",width:this.countW+"px"}),this.lazyLoad&&this.processLazyLoad()},CactusGallery.prototype.infiniteScrollReady=function(i){if(!this.infiniteScroll)return!0;var t,e=window.top;if(window!=e){var t=jQuery(window).scrollTop()+jQuery(e).scrollTop()+jQuery(e).height();t-=jQuery(window.frameElement).offset().top+jQuery(this.container).offset().top+this.h}else{var t=jQuery(window).scrollTop()+jQuery(window).height();t-=jQuery(this.container).offset().top+this.h}return t>i},CactusGallery.prototype.infiniteScrollListener=function(){this.infiniteScrollReady(-500)&&this.internalProcessQueue()},CactusGallery.prototype.processLazyLoad=function(){if(!this.lazyLoadBusy){var i=0,t=this.lazyLoadQueue.length;if(0==t)return this.lazyLoadBrick=null,jQuery(this.lazyLoadImage).off("error load"),void(this.lazyLoadImage=null);var e,s,r,o=window.top;if(window!=o)var s=jQuery(window).scrollTop()+jQuery(o).scrollTop()-jQuery(this.container).position().top-jQuery(window.frameElement).offset().top,r=s+jQuery(o).height()+1e3;else var s=jQuery(window).scrollTop()-jQuery(this.container).position().top,r=s+jQuery(window).height()+1e3;for(;t>i;i++)if(e=this.lazyLoadQueue[i],e.y+e.h>=s&&e.y<=r){this.lazyLoadBusy=!0,this.lazyLoadBrick=e,jQuery(this.lazyLoadImage).off("error load"),this.lazyLoadImage=null,this.lazyLoadImage=new Image,this.lazyLoadIndex=i,jQuery(this.lazyLoadImage).one("error",this.imageLoadError.bind(this)),jQuery(this.lazyLoadImage).one("load",this.imageLoaded.bind(this));var a=e.DOM;return jQuery(a).addClass("loading"),void(this.lazyLoadImage.src=a.firstElementChild.dataSource)}}},CactusGallery.prototype.imageLoadError=function(){jQuery(this.lazyLoadBrick.DOM).removeClass("loading"),this.lazyLoadBusy=!1,console.log("image load error"),this.processLazyLoad()},CactusGallery.prototype.imageLoaded=function(){var i=this.lazyLoadBrick.DOM;jQuery(i).removeClass("loading"),i.loadPending=!1;var t=i.firstElementChild;t.style.backgroundImage="url('"+t.dataSource+"')",t.style.opacity=1,this.lazyLoadQueue.splice(this.lazyLoadIndex,1),this.lazyLoadBusy=!1,this.processLazyLoad()},CactusGallery.prototype.lazyLoadListener=function(){this.lazyLoadBusy||this.processLazyLoad()},CactusGallery.prototype.internalRedrawGallery=function(){var i=jQuery(this.outerContainer).outerWidth(!1)+this.margin;if(this.w!==i){this.w=i,this.h=0,this.countW=0;for(var t=0,e=this.bricks.length;e>t;t++)this.bricks[t].updateWidth(this.w);for(t=0;e>t;t++)this.internalPositionBrick(this.bricks[t])}this.additionRequested=!1,jQuery(this.container).css({height:this.h+"px",width:this.countW+"px"})},CactusGallery.prototype.internalPositionBrick=function(i){var t,e,s=this.bricks.length,r=new CactusBrick,o=9999999;r.clone(i),r.x=0,r.y=0;for(var a=!1;!a;)for(a=!0,t=0;s>t;t++){if(e=this.bricks[t],e.rendered&&e.id!==r.id&&e.intersects(r)){t===s-1&&(a=!1),a=!1,o=Math.min(o,e.y+e.h+e.metaH),r.x+r.minW>this.w+1&&(r.y=o,o=9999999,r.x=0);break}this.countW=Math.max(this.countW,r.x+r.w-1)}this.h=Math.max(this.h,r.y+r.h+r.metaH),r.scalable&&r.x+r.w>this.w?r.w=this.w-r.x:r.w>this.w&&(r.w=this.w),i.clone(r),i.update()},CactusGallery.prototype.internalScrollListenerReady=function(){this.scrollBarListener.contentWindow.addEventListener("resize",function(){jQuery(window).trigger("resize")})};2 function CactusGallery(){this.container,this.outerContainer,this.h,this.w,this.countW,this.bricks,this.additionRequested,this.count,this.resizeTimer,this.scrollBarListener,this.margin=0,this.tolerance,this.evalMeta=!1,this.infiniteScroll=!1,this.lazyLoad=!1,this.lazyLoadQueue,this.lazyLoadImage=null,this.lazyLoadBusy=!1,this.lazyLoadBrick,this.lazyLoadIndex}CactusGallery.prototype.init=function(i,t,e,s){this.container=t,this.outerContainer=i,this.margin=e,this.tolerance=0>=s||s>1||this.evalMeta?1:s,this.w=jQuery(i).outerWidth(!1)+e,this.h=0,this.countW=0,"object"==typeof this.bricks&&(this.bricks.length=0),"object"==typeof this.brickQueue&&(this.brickQueue.length=0),"object"==typeof this.lazyLoadQueue&&(this.lazyLoadQueue.length=0),this.bricks=new Array,this.brickQueue=new Array,this.lazyLoadQueue=new Array,this.additionRequested=!1,this.infiniteScroll&&(this.lazyLoadBusy=!1,jQuery(window).on("scroll.cactusGallery",this.infiniteScrollListener.bind(this)),window.top!=window&&jQuery(window.top).on("scroll.cactusGallery",this.infiniteScrollListener.bind(this))),this.lazyLoad&&(jQuery(window).on("scroll.cactusGallery resize.cactusGallery orientationchange.cactusGallery",this.lazyLoadListener.bind(this)),window.top!=window&&jQuery(window.top).on("scroll.cactusGallery",this.lazyLoadListener.bind(this))),jQuery(window).on("resize.cactusGallery orientchange.cactusGallery",this.scheduleRefresh.bind(this)),this.count=0;var r=document.createElement("iframe");r.id="cacsds",r.style.cssText="height: 0; background-color: transparent; margin: 0; padding: 0; overflow: hidden; border-width: 0; position: absolute; width: 100%;",this.scrollBarListener=r,jQuery(r).on("load",this.internalScrollListenerReady.bind(this)),document.body.appendChild(r)},CactusGallery.prototype.scheduleRefresh=function(){clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(this.redrawGallery.bind(this),25)},CactusGallery.prototype.redrawGallery=function(){window.requestAnimationFrame?this.additionRequested||(this.additionRequested=!0,window.requestAnimationFrame(this.internalRedrawGallery.bind(this))):this.internalRedrawGallery()},CactusGallery.prototype.addBrick=function(i,t,e){i.initWidth=t,i.initHeight=e,this.brickQueue.unshift(i),window.requestAnimationFrame?this.additionRequested||(this.additionRequested=!0,window.requestAnimationFrame(this.internalProcessQueue.bind(this))):this.internalProcessQueue()},CactusGallery.prototype.destroy=function(){jQuery(window).off("resize.cactusGallery orientchange.cactusGallery"),clearTimeout(this.resizeTimer),jQuery(this.scrollBarListener).remove(),this.scrollBarListener=null,this.resizeTimer=null,this.container.innerHTML="",this.container=null,this.bricks.length=0,this.brickQueue.length=0,this.additionRequested=!1},CactusGallery.prototype.internalProcessQueue=function(){for(;this.brickQueue.length>0&&(!this.infiniteScroll||this.infiniteScrollReady(-2e3));){var i=this.brickQueue.pop();i.style.visibility="hidden",this.container.appendChild(i);var t=new CactusBrick;t.init(i,this.count,this.tolerance,this.evalMeta,this.w,i.initHeight,i.initWidth),this.bricks.push(t),this.count++,this.internalPositionBrick(t),this.lazyLoad&&t.DOM.loadPending&&this.lazyLoadQueue.push(t)}this.additionRequested=!1,jQuery(this.container).css({height:this.h+"px",width:this.countW+"px"}),this.lazyLoad&&this.processLazyLoad()},CactusGallery.prototype.infiniteScrollReady=function(i){if(!this.infiniteScroll)return!0;var t,e=window.top;if(window!=e){var t=jQuery(window).scrollTop()+jQuery(e).scrollTop()+jQuery(e).height();t-=jQuery(window.frameElement).offset().top+jQuery(this.container).offset().top+this.h}else{var t=jQuery(window).scrollTop()+jQuery(window).height();t-=jQuery(this.container).offset().top+this.h}return t>i},CactusGallery.prototype.infiniteScrollListener=function(){this.infiniteScrollReady(-500)&&this.internalProcessQueue()},CactusGallery.prototype.processLazyLoad=function(){if(!this.lazyLoadBusy){var i=0,t=this.lazyLoadQueue.length;if(0==t)return this.lazyLoadBrick=null,jQuery(this.lazyLoadImage).off("error load"),void(this.lazyLoadImage=null);var e,s,r,o=window.top;if(window!=o)var s=jQuery(window).scrollTop()+jQuery(o).scrollTop()-jQuery(this.container).position().top-jQuery(window.frameElement).offset().top,r=s+jQuery(o).height()+1e3;else var s=jQuery(window).scrollTop()-jQuery(this.container).position().top,r=s+jQuery(window).height()+1e3;for(;t>i;i++)if(e=this.lazyLoadQueue[i],e.y+e.h>=s&&e.y<=r){this.lazyLoadBusy=!0,this.lazyLoadBrick=e,jQuery(this.lazyLoadImage).off("error load"),this.lazyLoadImage=null,this.lazyLoadImage=new Image,this.lazyLoadIndex=i,jQuery(this.lazyLoadImage).one("error",this.imageLoadError.bind(this)),jQuery(this.lazyLoadImage).one("load",this.imageLoaded.bind(this));var a=e.DOM;return jQuery(a).addClass("loading"),void(this.lazyLoadImage.src=a.firstElementChild.dataSource)}}},CactusGallery.prototype.imageLoadError=function(){jQuery(this.lazyLoadBrick.DOM).removeClass("loading"),this.lazyLoadBusy=!1,console.log("image load error"),this.processLazyLoad()},CactusGallery.prototype.imageLoaded=function(){var i=this.lazyLoadBrick.DOM;jQuery(i).removeClass("loading"),i.loadPending=!1;var t=i.firstElementChild;t.style.backgroundImage="url('"+t.dataSource+"')",t.style.opacity=1,this.lazyLoadQueue.splice(this.lazyLoadIndex,1),this.lazyLoadBusy=!1,this.processLazyLoad()},CactusGallery.prototype.lazyLoadListener=function(){this.lazyLoadBusy||this.processLazyLoad()},CactusGallery.prototype.internalRedrawGallery=function(){var i=jQuery(this.outerContainer).outerWidth(!1)+this.margin;if(this.w!==i){this.w=i,this.h=0,this.countW=0;for(var t=0,e=this.bricks.length;e>t;t++)this.bricks[t].updateWidth(this.w);for(t=0;e>t;t++)this.internalPositionBrick(this.bricks[t])}this.additionRequested=!1,jQuery(this.container).css({height:this.h+"px",width:this.countW+"px"})},CactusGallery.prototype.internalPositionBrick=function(i){var t,e,s=this.bricks.length,r=new CactusBrick,o=9999999;r.clone(i),r.x=0,r.y=0;for(var a=!1;!a;)for(a=!0,t=0;s>t;t++){if(e=this.bricks[t],e.rendered&&e.id!==r.id&&e.intersects(r)){t===s-1&&(a=!1),a=!1,o=Math.min(o,e.y+e.h+e.metaH),r.x+r.minW>this.w+1&&(r.y=o,o=9999999,r.x=0);break}this.countW=Math.max(this.countW,r.x+r.w-1)}this.h=Math.max(this.h,r.y+r.h+r.metaH),r.scalable&&r.x+r.w>this.w?r.w=this.w-r.x:r.w>this.w&&(r.w=this.w),i.clone(r),i.update()},CactusGallery.prototype.internalScrollListenerReady=function(){this.scrollBarListener.contentWindow.addEventListener("resize",function(){jQuery(window).trigger("resize")})}; -
cactus-masonry-plus/trunk/cactusMasonry.php
r1453805 r1467555 2 2 /** 3 3 * @package Cactus Masonry Plus 4 * @version 0.0.5. 14 * @version 0.0.5.2 5 5 */ 6 6 /* … … 8 8 * Plugin URI: cactus.cloud 9 9 * Description: A highly customizable gallery of post thumbnails. 10 * Version: 0.0.5. 110 * Version: 0.0.5.2 11 11 * Author: cactus.cloud 12 12 * Author URI: http://cactus.cloud/masonryplus … … 32 32 33 33 private static $a = null; 34 private static $VERSION = "0.0.5. 1";34 private static $VERSION = "0.0.5.2"; 35 35 36 36 static public function init() { … … 205 205 $order = self::parse_query_order(self::$a['orderby']); 206 206 if($order != "") $args['orderby'] = $order; 207 207 208 208 //Add gallery search 209 209 if(self::$a['gallerymode']) $args['s'] = "[gallery"; //The start of a WP gallery shortcode … … 403 403 404 404 //Separate and iterate through each comma separated term 405 $os = explode(",", $o);405 $os = explode(",", strtolower($o)); 406 406 for($x = 0, $y = count($os); $x < $y; $x++) { 407 407 $order = explode(" ", trim($os[$x])); … … 409 409 $s = count($order); 410 410 //Set default order 411 if($s == 1) $out[trim($order[0])] = " DESC";411 if($s == 1) $out[trim($order[0])] = "desc"; 412 412 else if($s == 2) {//Attempt to use user-specified order 413 $d = strtoupper(trim($order[1]));413 $d = trim($order[1]); 414 414 //Check valid order has been specified - otherwise, report error 415 if($d == " DESC" || $d == "ASC") $out[trim($order[0])] = $d;415 if($d == "desc" || $d == "asc") $out[trim($order[0])] = $d; 416 416 else $errors[] = trim($os[$x]); 417 417 } else $errors[] = trim($os[$x]); -
cactus-masonry-plus/trunk/readme.txt
r1453805 r1467555 5 5 Requires at least: 4.4.2 6 6 Tested up to: 4.5.3 7 Stable tag: 0.0.5. 17 Stable tag: 0.0.5.2 8 8 License: GNU AGPLv3 9 9 License URI: http://cactus.cloud/licenses/agpl-3.0.txt … … 30 30 31 31 == Changelog == 32 = 0.0.5.2 = 33 * Fixed a bug that caused some lowercase orderby parameters to fail 34 * Fixed a bug that caused results to be returned in reverse order on each page 35 32 36 = 0.0.5.1 = 33 37 * Fixed a bug where pretty pagination permalinks would break the pagination
Note: See TracChangeset
for help on using the changeset viewer.