Plugin Directory

Changeset 1467555


Ignore:
Timestamp:
08/04/2016 09:47:31 AM (10 years ago)
Author:
bortpress
Message:

0.0.5.2

Location:
cactus-masonry-plus
Files:
14 added
4 edited

Legend:

Unmodified
Added
Removed
  • cactus-masonry-plus/trunk/cactusGallery.js

    r1451804 r1467555  
    9797    b.initWidth = initWidth;
    9898    b.initHeight = initHeight;
    99     this.brickQueue.push(b);
     99    this.brickQueue.unshift(b);
    100100    if(!window.requestAnimationFrame) this.internalProcessQueue();
    101101    else if(!this.additionRequested) {
  • cactus-masonry-plus/trunk/cactusGallery.min.js

    r1451804 r1467555  
    11/*!@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")})};
     2function 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  
    22/**
    33 * @package Cactus Masonry Plus
    4  * @version 0.0.5.1
     4 * @version 0.0.5.2
    55 */
    66/*
     
    88 * Plugin URI: cactus.cloud
    99 * Description: A highly customizable gallery of post thumbnails.
    10  * Version: 0.0.5.1
     10 * Version: 0.0.5.2
    1111 * Author: cactus.cloud
    1212 * Author URI: http://cactus.cloud/masonryplus
     
    3232   
    3333    private static $a = null;
    34     private static $VERSION = "0.0.5.1";
     34    private static $VERSION = "0.0.5.2";
    3535   
    3636    static public function init() {
     
    205205        $order = self::parse_query_order(self::$a['orderby']);
    206206        if($order != "") $args['orderby'] = $order;
    207        
     207               
    208208        //Add gallery search
    209209        if(self::$a['gallerymode']) $args['s'] = "[gallery"; //The start of a WP gallery shortcode
     
    403403       
    404404        //Separate and iterate through each comma separated term
    405         $os = explode(",", $o);
     405        $os = explode(",", strtolower($o));
    406406        for($x = 0, $y = count($os); $x < $y; $x++) {
    407407            $order = explode(" ", trim($os[$x]));
     
    409409            $s = count($order);
    410410            //Set default order
    411             if($s == 1) $out[trim($order[0])] = "DESC";
     411            if($s == 1) $out[trim($order[0])] = "desc";
    412412            else if($s == 2) {//Attempt to use user-specified order
    413                 $d = strtoupper(trim($order[1]));
     413                $d = trim($order[1]);
    414414                //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;
    416416                else $errors[] = trim($os[$x]);
    417417            } else $errors[] = trim($os[$x]);           
  • cactus-masonry-plus/trunk/readme.txt

    r1453805 r1467555  
    55Requires at least: 4.4.2
    66Tested up to: 4.5.3
    7 Stable tag: 0.0.5.1
     7Stable tag: 0.0.5.2
    88License: GNU AGPLv3
    99License URI: http://cactus.cloud/licenses/agpl-3.0.txt
     
    3030
    3131== 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
    3236= 0.0.5.1 =
    3337* Fixed a bug where pretty pagination permalinks would break the pagination
Note: See TracChangeset for help on using the changeset viewer.