diff --git a/.travis.yml b/.travis.yml index 7ae1052..591b789 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,3 +9,5 @@ install: script: - tox -e $TOXENV + +os: linux diff --git a/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/css/unite-gallery.css b/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/css/unite-gallery.css index caf2ca2..ebc41c8 100644 --- a/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/css/unite-gallery.css +++ b/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/css/unite-gallery.css @@ -17,8 +17,17 @@ .ug-item-wrapper img{ width:auto; max-width:none; + margin:0px; + padding:0px; +} + +.ug-videoplayer-wrapper video{ + height:100%; + width:100%; + visibility: visible !important; } + .---------General_Styles--------{} .ug-rtl{ @@ -398,12 +407,10 @@ /* bw desaturate effect lightweight */ img.ug-bw-effect{ - -webkit-filter: grayscale(1); - -webkit-filter: grayscale(100%); - -moz-filter: grayscale(100%); - filter: gray; filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,#grayscale"); /* Firefox 10+, Firefox on Android */ + -moz-filter: grayscale(100%); + -webkit-filter: grayscale(100%); } /* blur effect desaturate effect lightweight */ @@ -875,6 +882,36 @@ img.ug-sepia-effect{ font-size: 16px; } +.------------------LOADMORE_BUTTON---------------------{} + +.ug-loadmore-wrapper{ + margin-top:20px; + text-align:center; +} + +.ug-loadmore-wrapper .ug-loadmore-button{ + display:inline-block; + padding:5px; + border:1px solid #939393; + text-decoration:none; + color: #4F4F4F; +} + +.ug-loadmore-wrapper .ug-loadmore-error{ + color:red; +} + +.ug-loadmore-wrapper .ug-loadmore-button:hover{ + background-color:#F0F0F0; + color:#515151; +} + +.ug-loadmore-wrapper .ug-loadmore-loader{ + color: #515151; +} + + + .------------------CATEGORY_TABS---------------------{} .ug-tabs-wrapper{ diff --git a/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/js/unitegallery.js b/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/js/unitegallery.js index 2bf38ed..962d842 100644 --- a/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/js/unitegallery.js +++ b/djangocms_unitegallery/static/djangocms_unitegallery/unitegallery/js/unitegallery.js @@ -1,4 +1,4 @@ -// Unite Gallery, Version: 1.7.14, released 03 Mar 2016 +// Unite Gallery, Version: 1.7.45, released 27 Feb 2017 @@ -86,6 +86,8 @@ function UGFunctions(){ dataCache:{}, lastEventType:"", //for validate touchstart click lastEventTime:0, + lastTouchStartElement:null, + touchThreshold:700, handle: null //interval handle }; @@ -100,7 +102,7 @@ function UGFunctions(){ * fullscreen ID - the ID of current fullscreen */ this.toFullscreen = function(element, fullscreenID) { - + if(element.requestFullscreen) { element.requestFullscreen(); } else if(element.mozRequestFullScreen) { @@ -216,7 +218,6 @@ function UGFunctions(){ } - this.z__________END_FULL_SCREEN___________ = function(){} this.z__________GET_PROPS___________ = function(){} @@ -698,9 +699,7 @@ function UGFunctions(){ return(pos); } - - this.z__________END_GET_PROPS___________ = function(){} - + this.z_________SET_ELEMENT_PROPS_______ = function(){} @@ -1006,15 +1005,18 @@ function UGFunctions(){ if(obj.imageLeft !== null){ obj.style += "left:"+obj.imageLeft+"px;"; } - + + urlImage = t.escapeDoubleSlash(urlImage); + htmlImage += " style='"+obj.style+"'"; - htmlImage += " src='"+urlImage+"'"; + htmlImage += " src=\""+urlImage+"\""; htmlImage += ">"; objParent.html(htmlImage); //return the image just created var objImage = objParent.children("img"); + return(objImage); } @@ -1103,7 +1105,7 @@ function UGFunctions(){ updateCss = true; objCss.left = obj.imageLeft+"px"; } - + if(updateCss == true){ objCss.position = "absolute"; @@ -1111,7 +1113,9 @@ function UGFunctions(){ objImage.css(objCss); } - + + + return(obj); } @@ -1204,6 +1208,12 @@ function UGFunctions(){ objImage.css(objCss); + //return size object + + var objReturn = {}; + objReturn["imageWidth"] = imageWidth; + objReturn["imageHeight"] = imageHeight; + return(objReturn); } @@ -1222,9 +1232,7 @@ function UGFunctions(){ } - - this.z_________END_SET_ELEMENT_PROPS_______ = function(){} - + this.z_________GALLERY_RELATED_FUNCTIONS_______ = function(){} /** @@ -1292,7 +1300,6 @@ function UGFunctions(){ } - this.z_________END_GALLERY_RELATED_FUNCTIONS_______ = function(){} this.z_________MATH_FUNCTIONS_______ = function(){} @@ -1706,15 +1713,6 @@ function UGFunctions(){ } - /** - * check if it's a desctop devide - */ - this.isDesktopDevice = function(){ - - var isDesktop = typeof window.screenX !== undefined && !t.isTouchDevice() ? true : false; - - return(isDesktop); - } /** * check if @@ -1739,6 +1737,7 @@ function UGFunctions(){ this.z_________GENERAL_FUNCTIONS_______ = function(){} + /** * check if current jquery version is more then minimal version * version can be "1.8.0" for example @@ -2054,6 +2053,7 @@ function UGFunctions(){ element.off("touchstart"); element.off("touchend"); element.off("mousedown"); + element.off("tap"); } /** @@ -2078,6 +2078,64 @@ function UGFunctions(){ } + + /** + * set button on tap + */ + this.setButtonOnTap = function(objButton, onClickFunction){ + + //set the event + objButton.on("tap",onClickFunction); + + //set tap event trigger + if(t.isTouchDevice() == false){ + + objButton.on("click", function(event){ + var objElement = jQuery(this); + + if(t.validateClickTouchstartEvent(event.type) == false) + return(true); + + objElement.trigger("tap"); + }); + + }else{ + + //set tap event + objButton.on("touchstart",function(event){ + + var objElement = jQuery(this); + + objElement.addClass("ug-nohover"); + + g_temp.lastTouchStartElement = jQuery(this); + g_temp.lastEventTime = jQuery.now(); + }); + + objButton.on("touchend", function(event){ + var objElement = jQuery(this); + + //validate same element + if(objElement.is(g_temp.lastTouchStartElement) == false) + return(true); + + //validate time passed + if(!g_temp.lastEventTime) + return(true); + + var timePassed = jQuery.now() - g_temp.lastEventTime; + if(timePassed > g_temp.touchThreshold) + return(true); + + objElement.trigger("tap"); + }); + + } + + + } + + /** * load javascript dynamically */ @@ -2261,6 +2319,15 @@ function UGFunctions(){ } + /** + * escape double slash + */ + this.escapeDoubleSlash = function(str){ + + return str.replace('"','\"'); + } + + /** * html entitles */ @@ -2289,13 +2356,7 @@ var g_ugFunctions = new UGFunctions(); /** -------------- EASING FUNCTIONS ---------------------*/ -// swing, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, -// easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInSine, -// easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, -// easeInElastic, easeOutElastic, easeInOutElastic, easeInBack, easeOutBack, easeInOutBack, easeInBounce, easeOutBounce, easeInOutBounce - -jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(n,e,t,u,a){return jQuery.easing[jQuery.easing.def](n,e,t,u,a)},easeInQuad:function(n,e,t,u,a){return u*(e/=a)*e+t},easeOutQuad:function(n,e,t,u,a){return-u*(e/=a)*(e-2)+t},easeInOutQuad:function(n,e,t,u,a){return(e/=a/2)<1?u/2*e*e+t:-u/2*(--e*(e-2)-1)+t},easeInCubic:function(n,e,t,u,a){return u*(e/=a)*e*e+t},easeOutCubic:function(n,e,t,u,a){return u*((e=e/a-1)*e*e+1)+t},easeInOutCubic:function(n,e,t,u,a){return(e/=a/2)<1?u/2*e*e*e+t:u/2*((e-=2)*e*e+2)+t},easeInQuart:function(n,e,t,u,a){return u*(e/=a)*e*e*e+t},easeOutQuart:function(n,e,t,u,a){return-u*((e=e/a-1)*e*e*e-1)+t},easeInOutQuart:function(n,e,t,u,a){return(e/=a/2)<1?u/2*e*e*e*e+t:-u/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(n,e,t,u,a){return u*(e/=a)*e*e*e*e+t},easeOutQuint:function(n,e,t,u,a){return u*((e=e/a-1)*e*e*e*e+1)+t},easeInOutQuint:function(n,e,t,u,a){return(e/=a/2)<1?u/2*e*e*e*e*e+t:u/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(n,e,t,u,a){return-u*Math.cos(e/a*(Math.PI/2))+u+t},easeOutSine:function(n,e,t,u,a){return u*Math.sin(e/a*(Math.PI/2))+t},easeInOutSine:function(n,e,t,u,a){return-u/2*(Math.cos(Math.PI*e/a)-1)+t},easeInExpo:function(n,e,t,u,a){return 0==e?t:u*Math.pow(2,10*(e/a-1))+t},easeOutExpo:function(n,e,t,u,a){return e==a?t+u:u*(-Math.pow(2,-10*e/a)+1)+t},easeInOutExpo:function(n,e,t,u,a){return 0==e?t:e==a?t+u:(e/=a/2)<1?u/2*Math.pow(2,10*(e-1))+t:u/2*(-Math.pow(2,-10*--e)+2)+t},easeInCirc:function(n,e,t,u,a){return-u*(Math.sqrt(1-(e/=a)*e)-1)+t},easeOutCirc:function(n,e,t,u,a){return u*Math.sqrt(1-(e=e/a-1)*e)+t},easeInOutCirc:function(n,e,t,u,a){return(e/=a/2)<1?-u/2*(Math.sqrt(1-e*e)-1)+t:u/2*(Math.sqrt(1-(e-=2)*e)+1)+t},easeInElastic:function(n,e,t,u,a){var r=1.70158,i=0,s=u;if(0==e)return t;if(1==(e/=a))return t+u;if(i||(i=.3*a),se?-.5*s*Math.pow(2,10*(e-=1))*Math.sin(2*(e*a-r)*Math.PI/i)+t:s*Math.pow(2,-10*(e-=1))*Math.sin(2*(e*a-r)*Math.PI/i)*.5+u+t},easeInBack:function(n,e,t,u,a,r){return void 0==r&&(r=1.70158),u*(e/=a)*e*((r+1)*e-r)+t},easeOutBack:function(n,e,t,u,a,r){return void 0==r&&(r=1.70158),u*((e=e/a-1)*e*((r+1)*e+r)+1)+t},easeInOutBack:function(n,e,t,u,a,r){return void 0==r&&(r=1.70158),(e/=a/2)<1?u/2*e*e*(((r*=1.525)+1)*e-r)+t:u/2*((e-=2)*e*(((r*=1.525)+1)*e+r)+2)+t},easeInBounce:function(n,e,t,u,a){return u-jQuery.easing.easeOutBounce(n,a-e,0,u,a)+t},easeOutBounce:function(n,e,t,u,a){return(e/=a)<1/2.75?7.5625*u*e*e+t:2/2.75>e?u*(7.5625*(e-=1.5/2.75)*e+.75)+t:2.5/2.75>e?u*(7.5625*(e-=2.25/2.75)*e+.9375)+t:u*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(n,e,t,u,a){return a/2>e?.5*jQuery.easing.easeInBounce(n,2*e,0,u,a)+t:.5*jQuery.easing.easeOutBounce(n,2*e-a,0,u,a)+.5*u+t}}); - +(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],function($){return factory($)})}else if(typeof module==="object"&&typeof module.exports==="object"){exports=factory(require("jquery"))}else{factory(jQuery)}})(function($){$.easing["jswing"]=$.easing["swing"];var pow=Math.pow,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,PI=Math.PI,c1=1.70158,c2=c1*1.525,c3=c1+1,c4=2*PI/3,c5=2*PI/4.5;function bounceOut(x){var n1=7.5625,d1=2.75;if(x<1/d1){return n1*x*x}else if(x<2/d1){return n1*(x-=1.5/d1)*x+.75}else if(x<2.5/d1){return n1*(x-=2.25/d1)*x+.9375}else{return n1*(x-=2.625/d1)*x+.984375}}$.extend($.easing,{def:"easeOutQuad",swing:function(x){return $.easing[$.easing.def](x)},easeInQuad:function(x){return x*x},easeOutQuad:function(x){return 1-(1-x)*(1-x)},easeInOutQuad:function(x){return x<.5?2*x*x:1-pow(-2*x+2,2)/2},easeInCubic:function(x){return x*x*x},easeOutCubic:function(x){return 1-pow(1-x,3)},easeInOutCubic:function(x){return x<.5?4*x*x*x:1-pow(-2*x+2,3)/2},easeInQuart:function(x){return x*x*x*x},easeOutQuart:function(x){return 1-pow(1-x,4)},easeInOutQuart:function(x){return x<.5?8*x*x*x*x:1-pow(-2*x+2,4)/2},easeInQuint:function(x){return x*x*x*x*x},easeOutQuint:function(x){return 1-pow(1-x,5)},easeInOutQuint:function(x){return x<.5?16*x*x*x*x*x:1-pow(-2*x+2,5)/2},easeInSine:function(x){return 1-cos(x*PI/2)},easeOutSine:function(x){return sin(x*PI/2)},easeInOutSine:function(x){return-(cos(PI*x)-1)/2},easeInExpo:function(x){return x===0?0:pow(2,10*x-10)},easeOutExpo:function(x){return x===1?1:1-pow(2,-10*x)},easeInOutExpo:function(x){return x===0?0:x===1?1:x<.5?pow(2,20*x-10)/2:(2-pow(2,-20*x+10))/2},easeInCirc:function(x){return 1-sqrt(1-pow(x,2))},easeOutCirc:function(x){return sqrt(1-pow(x-1,2))},easeInOutCirc:function(x){return x<.5?(1-sqrt(1-pow(2*x,2)))/2:(sqrt(1-pow(-2*x+2,2))+1)/2},easeInElastic:function(x){return x===0?0:x===1?1:-pow(2,10*x-10)*sin((x*10-10.75)*c4)},easeOutElastic:function(x){return x===0?0:x===1?1:pow(2,-10*x)*sin((x*10-.75)*c4)+1},easeInOutElastic:function(x){return x===0?0:x===1?1:x<.5?-(pow(2,20*x-10)*sin((20*x-11.125)*c5))/2:pow(2,-20*x+10)*sin((20*x-11.125)*c5)/2+1},easeInBack:function(x){return c3*x*x*x-c1*x*x},easeOutBack:function(x){return 1+c3*pow(x-1,3)+c1*pow(x-1,2)},easeInOutBack:function(x){return x<.5?pow(2*x,2)*((c2+1)*2*x-c2)/2:(pow(2*x-2,2)*((c2+1)*(x*2-2)+c2)+2)/2},easeInBounce:function(x){return 1-bounceOut(1-x)},easeOutBounce:bounceOut,easeInOutBounce:function(x){return x<.5?(1-bounceOut(1-2*x))/2:(1+bounceOut(2*x-1))/2}})}); /** -------------- JQuery Color Animations ---------------------*/ @@ -2310,7 +2371,8 @@ jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeO /** * ismouseover function - check if the mouse over some object */ -!function(t){function e(){var i=this===document?t(this):t(this).contents();i.mousemove(function(e){t.mlp={x:e.pageX,y:e.pageY}}),i.find("iframe").load(e)}t.mlp={x:0,y:0},t(e),t.fn.ismouseover=function(){var e=!1;return this.eq(0).each(function(){var i=t(this).is("iframe")?t(this).contents().find("body"):t(this),n=i.offset();e=n.left<=t.mlp.x&&n.left+i.outerWidth()>t.mlp.x&&n.top<=t.mlp.y&&n.top+i.outerHeight()>t.mlp.y}),e}}(jQuery); +!function(t){function e(){try{var i=this===document?t(this):t(this).contents();}catch(error){return(false);}i.mousemove(function(e){t.mlp={x:e.pageX,y:e.pageY}}),i.find("iframe").on("load",e)}t.mlp={x:0,y:0},t(e),t.fn.ismouseover=function(){var e=!1;return this.eq(0).each(function(){var i=t(this).is("iframe")?t(this).contents().find("body"):t(this),n=i.offset();e=n.left<=t.mlp.x&&n.left+i.outerWidth()>t.mlp.x&&n.top<=t.mlp.y&&n.top+i.outerHeight()>t.mlp.y}),e}}(jQuery); + function UGThumbsGeneral(){ @@ -2322,7 +2384,14 @@ function UGThumbsGeneral(){ var g_functions = new UGFunctions(); var g_strip; var outer_options; - + + this.type = { + GET_THUMBS_ALL: "all", + GET_THUMBS_RATIO: "ratio", + GET_THUMBS_NO_RATIO: "no_ratio", + GET_THUMBS_NEW:"new" + }; + this.events = { SETOVERSTYLE: "thumbmouseover", SETNORMALSTYLE: "thumbmouseout", @@ -2378,7 +2447,8 @@ function UGThumbsGeneral(){ isEffectImage: false, colorOverlayOpacity: 1, thumbInnerReduce: 0, - allowOnResize: true //allow onresize event + allowOnResize: true, //allow onresize event + classNewThumb: "ug-new-thumb" }; @@ -2409,98 +2479,128 @@ function UGThumbsGeneral(){ this._____________EXTERNAL_SETTERS__________ = function(){}; + /** - * append the thumbs html to some parent + * append html from item */ - this.setHtmlThumbs = function(objParent){ - - g_objParent = objParent; + function appendHtmlThumbFromItem(itemIndex, imageEffectClass){ - var numItems = g_gallery.getNumItems(); - - //set image effect class - if(g_temp.isEffectImage == true){ - var imageEffectClass = getImageEffectsClass(); - } + var objItem = g_arrItems[itemIndex]; + + var classAddition = ""; + if(g_temp.customThumbs == false) + classAddition = " ug-thumb-generated"; - //append thumbs to strip - for(var i=0;i"; + var zIndex = objItem.index + 1; + var thumbStyle = "style='z-index:"+zIndex+";'"; + + var htmlThumb = "
"; - if(g_options.thumb_wrapper_as_link == true){ - var urlLink = objItem.link; - if(objItem.link == "") - urlLink = "javascript:void(0)"; - - var linkTarget = ""; - if(g_options.thumb_link_newpage == true && objItem.link) - linkTarget = " target='_blank'"; - - var htmlThumb = ""; - } - - var objThumbWrapper = jQuery(htmlThumb); + if(g_options.thumb_wrapper_as_link == true){ + var urlLink = objItem.link; + if(objItem.link == "") + urlLink = "javascript:void(0)"; + + var linkTarget = ""; + if(g_options.thumb_link_newpage == true && objItem.link) + linkTarget = " target='_blank'"; - var objImage = objItem.objThumbImage; + var htmlThumb = ""; + } + + var objThumbWrapper = jQuery(htmlThumb); + + var objImage = objItem.objThumbImage; + + if(g_temp.customThumbs == false){ - if(g_temp.customThumbs == false){ - - if(g_options.thumb_show_loader == true && objImage){ - - var loaderClass = "ug-thumb-loader-dark"; - if(g_options.thumb_loader_type == "bright") - loaderClass = "ug-thumb-loader-bright"; - - objThumbWrapper.append("
"); - objThumbWrapper.append(""); - } - - if(objImage){ - objImage.addClass("ug-thumb-image"); - - //if image overlay effects active, clone the image, and set the effects class on it - if(g_options.thumb_image_overlay_effect == true){ - var objImageOverlay = objImage.clone().appendTo(objThumbWrapper); - - objImageOverlay.addClass("ug-thumb-image-overlay " + imageEffectClass).removeClass("ug-thumb-image"); - objImageOverlay.fadeTo(0,0); - objItem.objImageOverlay = objImageOverlay; - } - - objThumbWrapper.append(objImage); - } + if(g_options.thumb_show_loader == true && objImage){ - }//end if not custom thumb - - if(g_temp.isEffectBorder) - objThumbWrapper.append("
"); - - if(g_temp.isEffectOverlay) - objThumbWrapper.append("
"); - - g_objParent.append(objThumbWrapper); - - //only custom thumbs function - if(g_temp.customThumbs){ + var loaderClass = "ug-thumb-loader-dark"; + if(g_options.thumb_loader_type == "bright") + loaderClass = "ug-thumb-loader-bright"; - g_temp.funcSetCustomThumbHtml(objThumbWrapper, objItem); + objThumbWrapper.append("
"); + objThumbWrapper.append(""); + } + + if(objImage){ + objImage.addClass("ug-thumb-image"); + //if image overlay effects active, clone the image, and set the effects class on it + if(g_options.thumb_image_overlay_effect == true){ + var objImageOverlay = objImage.clone().appendTo(objThumbWrapper); + + objImageOverlay.addClass("ug-thumb-image-overlay " + imageEffectClass).removeClass("ug-thumb-image"); + objImageOverlay.fadeTo(0,0); + objItem.objImageOverlay = objImageOverlay; + } + + objThumbWrapper.append(objImage); } - //add thumb wrapper object to items array - g_arrItems[i].objThumbWrapper = objThumbWrapper; + }//end if not custom thumb + + if(g_temp.isEffectBorder) + objThumbWrapper.append("
"); + + if(g_temp.isEffectOverlay) + objThumbWrapper.append("
"); + + g_objParent.append(objThumbWrapper); + + //only custom thumbs function + if(g_temp.customThumbs){ + + g_temp.funcSetCustomThumbHtml(objThumbWrapper, objItem); } + + //add thumb wrapper object to items array + g_arrItems[itemIndex].objThumbWrapper = objThumbWrapper; + + return(objThumbWrapper); + } + + + /** + * append the thumbs html to some parent + */ + this.setHtmlThumbs = function(objParent, isAppend){ + + g_objParent = objParent; + + //set image effect class + if(g_temp.isEffectImage == true){ + var imageEffectClass = getImageEffectsClass(); + } + + if(isAppend !== true){ //set all thumbs + var numItems = g_gallery.getNumItems(); + + //append thumbs to strip + for(var i=0;i= limits.maxPos) { g_functions.disableButton(g_objButtonPrev); } else { @@ -5893,7 +6035,7 @@ function UGStripPanel() { return (false); g_temp.isEventsInited = true; - + // buttons events if (g_objButtonNext) { @@ -5907,14 +6049,17 @@ function UGStripPanel() { // add disable / enable buttons on strip move event if (g_options.strippanel_buttons_role != "advance_item") { - jQuery(g_objStrip) - .on(g_objStrip.events.STRIP_MOVE, onStripMove); + + jQuery(g_objStrip).on(g_objStrip.events.STRIP_MOVE, onStripMove); + + jQuery(g_objStrip).on(g_objStrip.events.INNER_SIZE_CHANGE, checkSideButtons); + g_objGallery.on(g_gallery.events.SIZE_CHANGE, checkSideButtons); + } else { var galleryOptions = g_gallery.getOptions(); if (galleryOptions.gallery_carousel == false) - jQuery(g_gallery).on(g_gallery.events.ITEM_CHANGE, - onItemChange); + jQuery(g_gallery).on(g_gallery.events.ITEM_CHANGE, onItemChange); } } @@ -7013,9 +7158,11 @@ function UGThumbsGrid(){ var g_options = { grid_panes_direction: "left", //where panes will move -> left, bottom grid_num_cols: 2, //number of grid columns + grid_min_cols: 2, //minimum number of columns (for horizontal type) - the tile size is dynamic grid_num_rows: 2, //number of grid rows (for horizontal type) grid_space_between_cols: 10, //space between columns grid_space_between_rows: 10, //space between rows + grid_space_between_mobile: 10, //space between rows and cols mobile grid_transition_duration: 300, //transition of the panes change duration grid_transition_easing: "easeInOutQuad", //transition of the panes change easing function grid_carousel: false, //next pane goes to first when last @@ -7046,7 +7193,11 @@ function UGThumbsGrid(){ startScrollPos:0, isFirstTimeRun:true, isTilesMode: false, - storedEventID: "thumbsgrid" + storedEventID: "thumbsgrid", + tileMaxWidth:null, + tileMaxHeight:null, + spaceBetweenCols: null, + spaceBetweenRows: null }; @@ -7065,7 +7216,7 @@ function UGThumbsGrid(){ g_objGallery = jQuery(gallery); g_objWrapper = g_objects.g_objWrapper; g_arrItems = g_objects.g_arrItems; - + if(isTilesMode === true) g_temp.isTilesMode = true; @@ -7073,15 +7224,16 @@ function UGThumbsGrid(){ setOptions(customOptions); - //set vertical or horizon - g_temp.isNavigationVertical = (g_options.grid_panes_direction == "top" || g_options.grid_panes_direction == "bottom") - if(g_temp.isTilesMode == true){ g_tilesDesign.setFixedMode(); g_tilesDesign.setApproveClickFunction(isApproveTileClick); g_tilesDesign.init(gallery, g_options); + var options_td = g_tilesDesign.getOptions(); + g_temp.tileMaxHeight = options_td.tile_height; + g_temp.tileMaxWidth = options_td.tile_width; + g_thumbs = g_tilesDesign.getObjThumbs(); }else{ @@ -7149,7 +7301,8 @@ function UGThumbsGrid(){ if(g_temp.isTilesMode == true){ - initSizeParams(); + initGridDynamicSize(); + initSizeParams(); g_tilesDesign.run(); }else{ @@ -7158,6 +7311,19 @@ function UGThumbsGrid(){ g_thumbs.loadThumbsImages(); } + }else{ + + if(g_temp.isTilesMode == true){ + + //check if dynamic size changed. If do, run the thumbs again + var isChanged = initGridDynamicSize(); + + if(isChanged == true){ + initSizeParams(); + g_tilesDesign.run(); + } + } + } positionThumbs(); @@ -7196,24 +7362,71 @@ function UGThumbsGrid(){ return(objThumbSize); } + + /** + * init grid dynamic size (tiles mode) + */ + function initGridDynamicSize(){ + + if(g_temp.isTilesMode == false) + throw new Error("Dynamic size can be set only in tiles mode"); + + var isChanged = false; + var isMobile = g_gallery.isMobileMode(); + + //--- set space between cols and rows + + var spaceOld = g_temp.spaceBetweenCols; + + if(isMobile == true){ + g_temp.spaceBetweenCols = g_options.grid_space_between_mobile; + g_temp.spaceBetweenRows = g_options.grid_space_between_mobile; + }else{ + g_temp.spaceBetweenCols = g_options.grid_space_between_cols; + g_temp.spaceBetweenRows = g_options.grid_space_between_rows; + } + + if(g_temp.spaceBetweenCols != spaceOld) + isChanged = true; + + //set tile size + + var lastThumbSize = getThumbsSize(); + var lastThumbWidth = lastThumbSize.width; + + var tileWidth = g_temp.tileMaxWidth; + var numCols = g_functions.getNumItemsInSpace(g_temp.gridWidth, g_temp.tileMaxWidth, g_temp.spaceBetweenCols); + + if(numCols < g_options.grid_min_cols){ + tileWidth = g_functions.getItemSizeInSpace(g_temp.gridWidth, g_options.grid_min_cols, g_temp.spaceBetweenCols); + } + + g_tilesDesign.setTileSizeOptions(tileWidth); + + if(tileWidth != lastThumbWidth) + isChanged = true; + + + return(isChanged); + } + + /** * init grid size horizontal * get height param */ function initSizeParamsHor(){ - + var objThumbSize = getThumbsSize(); var thumbsHeight = objThumbSize.height; - //set grid size var gridWidth = g_temp.gridWidth; - var gridHeight = g_options.grid_num_rows * thumbsHeight + (g_options.grid_num_rows-1) * g_options.grid_space_between_rows + g_options.grid_padding*2; + var gridHeight = g_options.grid_num_rows * thumbsHeight + (g_options.grid_num_rows-1) * g_temp.spaceBetweenRows + g_options.grid_padding*2; g_temp.gridHeight = gridHeight; - g_functions.setElementSize(g_objGrid, gridWidth, gridHeight); //set inner size (as grid size, will be corrected after placing thumbs @@ -7235,7 +7448,7 @@ function UGThumbsGrid(){ var thumbsWidth = objThumbSize.width; //set grid size - var gridWidth = g_options.grid_num_cols * thumbsWidth + (g_options.grid_num_cols-1) * g_options.grid_space_between_cols + g_options.grid_padding*2; + var gridWidth = g_options.grid_num_cols * thumbsWidth + (g_options.grid_num_cols-1) * g_temp.spaceBetweenCols + g_options.grid_padding*2; var gridHeight = g_temp.gridHeight; g_temp.gridWidth = gridWidth; @@ -7278,6 +7491,7 @@ function UGThumbsGrid(){ } + /** * set the options of the strip */ @@ -7286,6 +7500,13 @@ function UGThumbsGrid(){ g_options = jQuery.extend(g_options, objOptions); g_thumbs.setOptions(objOptions); + + //set vertical or horizon + g_temp.isNavigationVertical = (g_options.grid_panes_direction == "top" || g_options.grid_panes_direction == "bottom") + + g_temp.spaceBetweenCols = g_options.grid_space_between_cols; + g_temp.spaceBetweenRows = g_options.grid_space_between_rows; + } @@ -7332,12 +7553,12 @@ function UGThumbsGrid(){ if(endX > g_temp.innerWidth) g_temp.innerWidth = endX; - posx += thumbWidth + g_options.grid_space_between_cols; + posx += thumbWidth + g_temp.spaceBetweenCols; //next row counter++; if(counter >= g_options.grid_num_cols){ - posy += thumbHeight + g_options.grid_space_between_rows; + posy += thumbHeight + g_temp.spaceBetweenRows; posx = baseX; counter = 0; } @@ -7349,7 +7570,7 @@ function UGThumbsGrid(){ //prepare next pane if((posy + thumbHeight) > g_temp.gridHeight){ posy = 0; - baseX = g_temp.innerWidth + g_options.grid_space_between_cols; + baseX = g_temp.innerWidth + g_temp.spaceBetweenCols; posx = baseX; counter = 0; @@ -7370,6 +7591,7 @@ function UGThumbsGrid(){ } } + //set inner strip width and height g_objInner.width(g_temp.innerWidth); @@ -7412,7 +7634,7 @@ function UGThumbsGrid(){ var thumbWidth = objThumb.outerWidth(); var thumbHeight = objThumb.outerHeight(); - posx += thumbWidth + g_options.grid_space_between_cols; + posx += thumbWidth + g_temp.spaceBetweenCols; var endy = (posy + thumbHeight); if(endy > maxy) @@ -7421,7 +7643,7 @@ function UGThumbsGrid(){ //next row counter++; if(counter >= g_options.grid_num_cols){ - posy += thumbHeight + g_options.grid_space_between_rows; + posy += thumbHeight + g_temp.spaceBetweenRows; posx = baseX; counter = 0; } @@ -7444,7 +7666,7 @@ function UGThumbsGrid(){ paneMaxY = g_temp.gridHeight; } - posy = paneMaxY + g_options.grid_space_between_rows; + posy = paneMaxY + g_temp.spaceBetweenRows; paneStartY = posy; baseX = 0; posx = baseX; @@ -7474,6 +7696,7 @@ function UGThumbsGrid(){ } + /** * position the thumbs horizontal type */ @@ -7485,7 +7708,7 @@ function UGThumbsGrid(){ var baseY = g_options.grid_padding; var posy = baseY; var posx = baseX; - var maxx = 0, maxy = 0, paneMaxY = 0; + var maxx = 0, maxy = 0, paneMaxY = 0, gridMaxY = 0; var rowsCounter = 0; g_temp.innerWidth = 0; @@ -7514,13 +7737,17 @@ function UGThumbsGrid(){ //change to a new pane rowsCounter = 0; baseX = posx; - paneMaxY = 0; posy = baseY; + paneMaxY = 0; //change grid width to max width if(g_temp.numPanes == 1){ g_temp.gridWidth = maxx+g_options.grid_padding; g_objGrid.width(g_temp.gridWidth); + + g_temp.gridHeight = gridMaxY + g_options.grid_padding; + g_objGrid.height(g_temp.gridHeight); + } g_temp.numPanes++; @@ -7528,7 +7755,7 @@ function UGThumbsGrid(){ }else{ //start new line in existing pane posx = baseX; - posy = paneMaxY + g_options.grid_space_between_rows; + posy = paneMaxY + g_temp.spaceBetweenRows; } } @@ -7543,9 +7770,12 @@ function UGThumbsGrid(){ //count maxy var endY = posy + thumbHeight; - if(endY > paneMaxY) + if(endY > paneMaxY) //pane height paneMaxY = endY; - + + if(endY > gridMaxY) //total height + gridMaxY = endY; + if(endY > maxy) maxy = endY; @@ -7554,7 +7784,7 @@ function UGThumbsGrid(){ if(endX > g_temp.innerWidth) g_temp.innerWidth = endX; - posx += thumbWidth + g_options.grid_space_between_cols; + posx += thumbWidth + g_temp.spaceBetweenCols; //count number thumbs in pane if(g_temp.numPanes == 1) @@ -7564,20 +7794,23 @@ function UGThumbsGrid(){ }//end for //set inner strip width and height - g_temp.innerWidth = maxx; - g_temp.innerHeight = paneMaxY; + g_temp.innerWidth = maxx + g_options.grid_padding; + g_temp.innerHeight = gridMaxY + g_options.grid_padding; g_objInner.width(g_temp.innerWidth); g_objInner.height(g_temp.innerHeight); - + + //set grid height if(g_temp.numPanes == 1){ g_temp.gridWidth = maxx + g_options.grid_padding; - g_temp.gridHeight = maxy + g_options.grid_padding; + g_temp.gridHeight = gridMaxY + g_options.grid_padding; g_objGrid.width(g_temp.gridWidth); g_objGrid.height(g_temp.gridHeight); + } + } @@ -8127,7 +8360,7 @@ function UGThumbsGrid(){ var numThumbs = g_thumbs.getNumThumbs(); var numRows = Math.ceil(numThumbs / g_options.grid_num_cols); - var totalHeight = numRows * thumbHeight + (numRows-1) * g_options.grid_space_between_rows; + var totalHeight = numRows * thumbHeight + (numRows-1) * g_temp.spaceBetweenRows; var numPanes = Math.ceil(totalHeight / gridHeight); @@ -8149,7 +8382,7 @@ function UGThumbsGrid(){ var numThumbs = g_thumbs.getNumThumbs(); var numCols = Math.ceil(numThumbs / g_options.grid_num_rows); - var totalWidth = numCols * thumbWidth + (numCols-1) * g_options.grid_space_between_cols; + var totalWidth = numCols * thumbWidth + (numCols-1) * g_temp.spaceBetweenCols; var numPanes = Math.ceil(totalWidth / gridWidth); @@ -8166,13 +8399,13 @@ function UGThumbsGrid(){ throw new Error("This function works only with tiles mode"); var numThumbs = g_thumbs.getNumThumbs(); - var numCols = g_functions.getNumItemsInSpace(width, g_options.tile_width, g_options.grid_space_between_cols); + var numCols = g_functions.getNumItemsInSpace(width, g_options.tile_width, g_temp.spaceBetweenCols); var numRows = Math.ceil(numThumbs / numCols); if(numRows > g_options.grid_num_rows) numRows = g_options.grid_num_rows; - var gridHeight = g_functions.getSpaceByNumItems(numRows, g_options.tile_height, g_options.grid_space_between_rows); + var gridHeight = g_functions.getSpaceByNumItems(numRows, g_options.tile_height, g_temp.spaceBetweenRows); gridHeight += g_options.grid_padding * 2; return(gridHeight); @@ -8493,15 +8726,17 @@ function UGTiles(){ this.events = { THUMB_SIZE_CHANGE: "thumb_size_change", - TILES_FIRST_PLACED: "tiles_first_placed" //only in case of justified + TILES_FIRST_PLACED: "tiles_first_placed", //only in case of justified + ALL_TILES_LOADED: "all_tiles_loaded" }; var g_temp = { - isFixedMode: false, //is tiles is custom sized, not related to the images that inside isFirstTimeRun:true, //if run once handle:null, //interval handle isTransActive: false, //is transition active - isTransInited: false //if the transition function is set + isTransInited: false, //if the transition function is set + isFirstPlaced: true, //is first time placed + isAllLoaded: false }; var g_nestedWork = { @@ -8564,8 +8799,12 @@ function UGTiles(){ */ function setHtml(objParent){ - if(!objParent) - var objParent = g_objWrapper; + if(!objParent){ + if(g_objParent) + objParent = g_objParent; + else + var objParent = g_objWrapper; + } g_objParent = objParent; @@ -8708,7 +8947,7 @@ function UGTiles(){ * fill common tiles vars */ function fillTilesVars(){ - + g_vars.colWidth = g_options.tiles_col_width; g_vars.minCols = g_options.tiles_min_columns; g_vars.maxCols = g_options.tiles_max_columns; @@ -8776,9 +9015,7 @@ function UGTiles(){ g_vars.addX = g_vars.galleryWidth - g_vars.totalWidth; break; } - - g_vars.maxColHeight = 0; - + //get posx array (constact to all columns) g_vars.arrPosx = []; for(col = 0; col < g_vars.numCols; col++){ @@ -8786,12 +9023,20 @@ function UGTiles(){ g_vars.arrPosx[col] = colX + g_vars.addX; } - //empty heights array - g_vars.colHeights = [0]; - } + /** + * init col heights + */ + function initColHeights(){ + + g_vars.maxColHeight = 0; + + //empty heights array + g_vars.colHeights = [0]; + + } @@ -8853,7 +9098,7 @@ function UGTiles(){ //set max height if(g_vars.maxColHeight < realHeight) g_vars.maxColHeight = realHeight; - + if(toShow == true) objTile.show().fadeTo(0,1); @@ -8873,14 +9118,15 @@ function UGTiles(){ toShow = false; fillTilesVars(); + initColHeights(); - var objThumbs = g_thumbs.getThumbs(); - + var objThumbs = g_thumbs.getThumbs(g_thumbs.type.GET_THUMBS_RATIO); + //do some operation before the transition doBeforeTransition(); - + //resize all thumbs - g_objTileDesign.resizeAllTiles(g_vars.colWidth, g_objTileDesign.resizemode.VISIBLE_ELEMENTS); + g_objTileDesign.resizeAllTiles(g_vars.colWidth, g_objTileDesign.resizemode.VISIBLE_ELEMENTS, objThumbs); //place elements for(var index = 0; index < objThumbs.length; index++){ @@ -8994,7 +9240,7 @@ function UGTiles(){ placeOrderedTile(objTile); }else{ - + g_objTileDesign.resizeTile(objTile, g_vars.colWidth); placeTile(objTile, true, true); } @@ -9002,73 +9248,67 @@ function UGTiles(){ } - /** - * run columns type + * run columns type - place tiles that are not loaded yet */ function runColumnsType(){ - - var objThumbs = g_thumbs.getThumbs(); - fillTilesVars(); + //get thumbs only when the ratio not set + var objThumbs = g_thumbs.getThumbs(g_thumbs.type.GET_THUMBS_NO_RATIO); - var diffWidth = Math.abs(g_vars.galleryWidth - g_vars.totalWidth); - - //set initial height of the parent by estimation - if(g_options.tiles_set_initial_height == true && g_functions.isScrollbarExists() == false && diffWidth < 25){ - - var numThumbs = objThumbs.length; - var numRows = Math.ceil(objThumbs.length / g_vars.numCols); - var estimateHeight = numRows * g_options.tiles_col_width * 0.75; + if(!objThumbs || objThumbs.length == 0) + return(false); + + g_temp.isAllLoaded = false; + + if(g_temp.isFirstPlaced == true){ - g_objParent.height(estimateHeight); fillTilesVars(); + initColHeights(); + + var diffWidth = Math.abs(g_vars.galleryWidth - g_vars.totalWidth); + + //set initial height of the parent by estimation + if(g_options.tiles_set_initial_height == true && g_functions.isScrollbarExists() == false && diffWidth < 25){ + + var numThumbs = objThumbs.length; + var numRows = Math.ceil(objThumbs.length / g_vars.numCols); + var estimateHeight = numRows * g_options.tiles_col_width * 0.75; + + g_objParent.height(estimateHeight); + fillTilesVars(); + } + } objThumbs.fadeTo(0,0); - var objImages = jQuery(g_objParent).find("img.ug-thumb-image"); + var objImages = objThumbs.find("img.ug-thumb-image"); - if(g_temp.isFixedMode == true){ //fixed mode type - just place tiles before images loaded - - g_objThis.trigger(t.events.TILES_FIRST_PLACED); - - placeTiles(true); - - g_functions.checkImagesLoaded(objImages, function(){ - setTransition(); - }); + var initNumCols = g_vars.numCols; + var initWidth = g_vars.galleryWidth; + + //on place the tile as it loads. After all tiles loaded,check position again. + g_functions.checkImagesLoaded(objImages, function(){ + + fillTilesVars(); - }else{ //dynamic size type + if(initNumCols != g_vars.numCols || initWidth != g_vars.galleryWidth){ + placeTiles(false); + } - var initNumCols = g_vars.numCols; - var initWidth = g_vars.galleryWidth; - var isFirstPlace = false; + setTransition(); + g_objThis.trigger(t.events.ALL_TILES_LOADED); - //on place the tile as it loads. After all tiles loaded,check position again. - g_functions.checkImagesLoaded(objImages, function(){ - - fillTilesVars(); - - if(initNumCols != g_vars.numCols || initWidth != g_vars.galleryWidth){ - placeTiles(false); - } - - setTransition(); - - } ,function(objImage, isError){ - - if(isFirstPlace == false) - g_objThis.trigger(t.events.TILES_FIRST_PLACED); - - isFirstPlace = true; - - onSingleImageLoad(objImage, isError); + } ,function(objImage, isError){ - }); + if(g_temp.isFirstPlaced == true) + g_gallery.triggerEvent(t.events.TILES_FIRST_PLACED); //set to false - }//end dynamic mode type + onSingleImageLoad(objImage, isError); + }); + } @@ -9083,7 +9323,7 @@ function UGTiles(){ var galleryWidth = getParentWidth(); - var objTiles = g_thumbs.getThumbs(); + var objTiles = g_thumbs.getThumbs(true); var rowHeightOpt = g_options.tiles_justified_row_height; var arrWidths = []; var totalWidth = 0; @@ -9288,6 +9528,8 @@ function UGTiles(){ var objImages = jQuery(g_objWrapper).find("img.ug-thumb-image"); var objTiles = g_thumbs.getThumbs(); + g_temp.isAllLoaded = false; + objTiles.fadeTo(0,0); g_functions.checkImagesLoaded(objImages, function(){ @@ -9295,8 +9537,11 @@ function UGTiles(){ setTimeout(function(){ placeJustified(true); objTiles.fadeTo(0,1); - g_objThis.trigger(t.events.TILES_FIRST_PLACED); + g_gallery.triggerEvent(t.events.TILES_FIRST_PLACED); setTransition(); + + g_objThis.trigger(t.events.ALL_TILES_LOADED); + }); }, function(objImage, isError){ @@ -9323,8 +9568,10 @@ function UGTiles(){ var objImages = jQuery(g_objWrapper).find("img.ug-thumb-image"); var objTiles = g_thumbs.getThumbs(); + g_temp.isAllLoaded = false; + objTiles.fadeTo(0, 0); - + g_functions.checkImagesLoaded(objImages, function () { if(g_gallery.isMobileMode() == true){ @@ -9333,8 +9580,9 @@ function UGTiles(){ else placeNestedImages(true); - g_objThis.trigger(t.events.TILES_FIRST_PLACED); + g_gallery.triggerEvent(t.events.TILES_FIRST_PLACED); setTransition(); + g_objThis.trigger(t.events.ALL_TILES_LOADED); }, function (objImage, isError) { @@ -9380,9 +9628,7 @@ function UGTiles(){ g_nestedWork.gridY = 0; g_arrNestedItems = [] - trace(g_nestedWork); - - var objTiles = g_thumbs.getThumbs(); + var objTiles = g_thumbs.getThumbs(true); objTiles.each(function(){ var objTile = jQuery(this); var sizes = setNestedSize(objTile); @@ -10100,7 +10346,10 @@ function UGTiles(){ if(g_temp.isFirstTimeRun == true) return(true); - + + if(g_temp.isAllLoaded == false) + return(false); + switch(g_options.tiles_type){ case "columns": placeTiles(false); @@ -10128,8 +10377,18 @@ function UGTiles(){ */ function initEvents(){ + g_objThis.on(t.events.ALL_TILES_LOADED, function(){ + + g_temp.isAllLoaded = true; + + }); + g_objGallery.on(g_gallery.events.SIZE_CHANGE, onResize); + g_objGallery.on(t.events.TILES_FIRST_PLACED,function(){ + g_temp.isFirstPlaced = false; + }); + g_objTileDesign.initEvents(); } @@ -10139,7 +10398,7 @@ function UGTiles(){ * run the gallery after init and set html */ function run(){ - + //show tiles g_objWrapper.children(".ug-tile").show(); @@ -10148,7 +10407,7 @@ function UGTiles(){ } g_objTileDesign.run(); - + switch(g_options.tiles_type){ default: case "columns": @@ -10174,17 +10433,11 @@ function UGTiles(){ g_objGallery.off(g_gallery.events.SIZE_CHANGE); g_objTileDesign.destroy(); + g_objGallery.off(t.events.TILES_FIRST_PLACED); + } - /** - * set the custom size mode. - * set it before the init - */ - this.setFixedSizeMode = function(){ - g_temp.isFixedMode = true; - g_objTileDesign.setFixedMode(); - } - + /** * init function for avia controls @@ -10217,6 +10470,34 @@ function UGTiles(){ } + /** + * run the new items + */ + this.runNewItems = function(){ + + if(!g_objParent) + throw new Error("Can't run new items - parent not set"); + + g_objTileDesign.setHtml(g_objParent, true); + + g_objTileDesign.run(true); + + + switch(g_options.tiles_type){ + case "columns": + + runColumnsType(); + + break; + default: + case "justified": + case "nested": + throw new Error("Tiles type: "+g_options.tiles_type+" not support load more yet"); + break; + } + + } + } @@ -10283,7 +10564,7 @@ function UGTileDesign(){ tile_enable_icons: true, //enable icons in mouseover mode tile_show_link_icon: false, //show link icon (if the tile has a link). In case of tile_as_link this option not enabled - tile_videoplay_icon_always_on: false, //always show video play icon + tile_videoplay_icon_always_on: 'never', //'always', 'never', 'mobile_only', 'desktop_only' always show video play icon tile_space_between_icons: 26, //initial space between icons, (on small tiles it may change) tile_enable_image_effect:false, //enable tile image effect @@ -10319,7 +10600,9 @@ function UGTileDesign(){ isSaparateIcons: false, tileInnerReduce: 0, //how much reduce from the tile inner elements from border mostly isTextpanelOutside: false, //is the textpanel is out of tile image border - hasImageContainer:false + hasImageContainer:false, + isVideoplayIconAlwaysOn:false, + isTextPanelHidden:false }; @@ -10410,6 +10693,7 @@ function UGTileDesign(){ //set if the textpanel is enabled and outside if(g_options.tile_enable_textpanel == true){ + //optimize for touch device switch(g_options.tile_textpanel_position){ case "top": g_options.tile_textpanel_align = "top"; @@ -10433,6 +10717,7 @@ function UGTileDesign(){ } + //if the textpanel offset is not from the border, it's always fade. if(g_options.tile_textpanel_offset != 0){ g_options.tile_textpanel_appear_type = "fade"; @@ -10447,6 +10732,43 @@ function UGTileDesign(){ } + + /** + * set options before render + */ + function modifyOptionsBeforeRender(){ + + var isMobile = g_gallery.isMobileMode(); + + //set text panel show / hide + + g_temp.isTextPanelHidden = false; + if(isMobile == true && g_options.tile_textpanel_always_on == false) + g_temp.isTextPanelHidden = true; + + + //set video icon always on true / false + + g_temp.isVideoplayIconAlwaysOn = g_options.tile_videoplay_icon_always_on; + + switch(g_options.tile_videoplay_icon_always_on){ + case "always": + g_temp.isVideoplayIconAlwaysOn = true; + break; + case "never": + g_temp.isVideoplayIconAlwaysOn = false; + break; + case "mobile_only": + g_temp.isVideoplayIconAlwaysOn = (isMobile == true)?true:false; + break; + case "desktop_only": + g_temp.isVideoplayIconAlwaysOn = (isMobile == false)?true:false; + break; + } + + + } + /** * set thumb html @@ -10476,7 +10798,7 @@ function UGTileDesign(){ var imageAlt = g_functions.stripTags(objItem.title); imageAlt = g_functions.htmlentitles(imageAlt); - html += ""+imageAlt+""; + html += ""+imageAlt+""; if(g_temp.hasImageContainer == true){ html += ""; @@ -10557,7 +10879,7 @@ function UGTileDesign(){ } var toSaparateIcon = g_temp.isSaparateIcons; - if(toSaparateIcon == false && objItem.type != "image" && g_options.tile_videoplay_icon_always_on == true) + if(toSaparateIcon == false && objItem.type != "image" && g_temp.isVideoplayIconAlwaysOn == true) toSaparateIcon = true; if(toSaparateIcon) //put the icons on the thumb @@ -10603,7 +10925,7 @@ function UGTileDesign(){ var imageOverlayHtml = "
"; var imageEffectClass = " ug-"+g_options.tile_image_effect_type+"-effect"; - imageOverlayHtml += ""+objItem.title+""; + imageOverlayHtml += ""+objItem.title+""; imageOverlayHtml += "
"; objThumbWrapper.append(imageOverlayHtml); @@ -10819,13 +11141,13 @@ function UGTileDesign(){ * get tile ratio */ function getTileRatio(objTile){ - + //global ratio var ratio = g_temp.ratioByHeight; switch(g_options.tile_size_by){ default: //global ratio - ratio = g_temp.ratioByHeight + ratio = g_temp.ratioByHeight; break; case t.sizeby.IMAGE_RATIO: @@ -10888,6 +11210,18 @@ function UGTileDesign(){ } + /** + * return if the items icon always on + */ + function isItemIconAlwaysOn(objItem){ + + if(g_options.tile_enable_icons == true && g_temp.isVideoplayIconAlwaysOn == true && objItem.type != "image") + return(true); + + return(false); + } + + function _________________SETTERS________________(){}; @@ -11021,7 +11355,6 @@ function UGTileDesign(){ if(g_temp.isTextpanelOutside == true) panelHeight = getTextPanelHeight(objTile); - objTextPanel.refresh(false, true, panelWidth, panelHeight); var isPosition = (g_options.tile_textpanel_always_on == true || g_options.tile_textpanel_appear_type == "fade"); @@ -11074,7 +11407,7 @@ function UGTileDesign(){ if(objButtonZoom || objButtonLink){ var gapVert = 0; - if(g_options.tile_enable_textpanel == true && g_temp.isTextpanelOutside == false){ + if( g_options.tile_enable_textpanel == true && g_temp.isTextPanelHidden == false && g_temp.isTextpanelOutside == false){ var objTextPanelElement = getTextPanelElement(objTile); var texPanelSize = g_functions.getElementSize(objTextPanelElement); if(texPanelSize.height > 0) @@ -11083,7 +11416,6 @@ function UGTileDesign(){ } - if(objButtonZoom && objButtonLink){ var sizeZoom = g_functions.getElementSize(objButtonZoom); var sizeLink = g_functions.getElementSize(objButtonLink); @@ -11125,12 +11457,17 @@ function UGTileDesign(){ /** * set tiles htmls */ - this.setHtml = function(objParent){ + this.setHtml = function(objParent, isAppend){ g_objParentWrapper = objParent; - g_thumbs.setHtmlThumbs(objParent); + + if(isAppend !== true) + modifyOptionsBeforeRender(); + + g_thumbs.setHtmlThumbs(objParent, isAppend); } + /** * set the overlay effect */ @@ -11146,7 +11483,7 @@ function UGTileDesign(){ var objThumbImage = t.getTileImage(objTile); if(isActive){ - objThumbImage.fadeTo(1,1); + objThumbImage.fadeTo(0,1); objOverlayImage.stop(true).fadeTo(animationDuration, 0); } else @@ -11175,7 +11512,7 @@ function UGTileDesign(){ var objTextPanel = getTextPanelElement(objTile); if(!objTextPanel) return(true); - + if(g_options.tile_textpanel_appear_type == "slide"){ var panelSize = g_functions.getElementSize(objTextPanel); @@ -11192,13 +11529,15 @@ function UGTileDesign(){ startClass[posName] = startPos+"px"; endClass[posName] = endPos+"px"; - + if(isActive == true){ objTextPanel.fadeTo(0,1); - + if(objTextPanel.is(":animated") == false) objTextPanel.css(startClass); + + endClass["opacity"] = 1; objTextPanel.stop(true).animate(endClass, animationDuration); @@ -11236,23 +11575,25 @@ function UGTileDesign(){ if(g_objIconZoom) g_objIconZoom.stop(true).fadeTo(animationDuration, opacity); + if(g_objIconLink) g_objIconLink.stop(true).fadeTo(animationDuration, opacity); } + /** * set tile over style */ function setOverStyle(data, objTile){ - + objTile = jQuery(objTile); if(g_options.tile_enable_image_effect) setImageOverlayEffect(objTile, true); - if(g_options.tile_enable_textpanel == true && g_options.tile_textpanel_always_on == false) + if(g_options.tile_enable_textpanel == true && g_options.tile_textpanel_always_on == false && g_temp.isTextPanelHidden == false) setTextpanelEffect(objTile, true); //show/hide icons - if saparate (if not, they are part of the overlay) @@ -11261,8 +11602,9 @@ function UGTileDesign(){ var isSet = (g_options.thumb_overlay_reverse == true); var objItem = t.getItemByTile(objTile); - if( !(g_options.tile_videoplay_icon_always_on == true && objItem.type != "image")) + if(isItemIconAlwaysOn(objItem) == false) setIconsEffect(objTile, isSet, false); + } } @@ -11273,19 +11615,26 @@ function UGTileDesign(){ */ function setNormalStyle(data, objTile){ - objTile = jQuery(objTile); if(g_options.tile_enable_image_effect) setImageOverlayEffect(objTile, false); - + if(g_options.tile_enable_textpanel == true && g_options.tile_textpanel_always_on == false) setTextpanelEffect(objTile, false); //show/hide icons - if saparate (if not, they are part of the overlay) if(g_temp.isSaparateIcons == true && g_options.tile_enable_icons == true){ + var isSet = (g_options.thumb_overlay_reverse == true)?false:true; - setIconsEffect(objTile, isSet, false); + + var objItem = t.getItemByTile(objTile); + if(isItemIconAlwaysOn(objItem) == false) + setIconsEffect(objTile, isSet, false); + else{ //make icon always appear + setIconsEffect(objTile, true, true); + } + } } @@ -11319,6 +11668,8 @@ function UGTileDesign(){ return(true); positionElements(objTile); + + g_thumbs.setThumbNormalStyle(objTile); } @@ -11450,11 +11801,11 @@ function UGTileDesign(){ g_objWrapper.on(g_temp.eventSizeChange, onSizeChange); - g_objParentWrapper.delegate(".ug-tile .ug-button-play", "click", onZoomButtonClick); + g_objParentWrapper.on("click", ".ug-tile", onTileClick); - g_objParentWrapper.delegate(".ug-tile", "click", onTileClick); + g_objParentWrapper.on("click", ".ug-tile .ug-button-play", onZoomButtonClick); - g_objParentWrapper.delegate(".ug-tile .ug-icon-link", "click", onLinkButtonClick); + g_objParentWrapper.on("click", ".ug-tile .ug-icon-link", onLinkButtonClick); } @@ -11462,7 +11813,11 @@ function UGTileDesign(){ * destroy the element events */ this.destroy = function(){ - + + g_objParentWrapper.off("click", ".ug-tile"); + g_objParentWrapper.off("click", ".ug-tile .ug-button-play"); + g_objParentWrapper.off("click", ".ug-tile .ug-icon-link"); + jQuery(g_thumbs).off(g_thumbs.events.SETOVERSTYLE); jQuery(g_thumbs).off(g_thumbs.events.SETNORMALSTYLE); jQuery(g_thumbs).off(g_thumbs.events.PLACEIMAGE); @@ -11514,7 +11869,7 @@ function UGTileDesign(){ * the resize mode taken from resize modes constants, default is full */ this.resizeTile = function(objTile, newWidth, newHeight, resizeMode){ - + //if textpanel outside - refresh the textpanel first if(g_temp.isTextpanelOutside == true) positionElements_textpanel(objTile, "clone", newWidth); @@ -11565,14 +11920,18 @@ function UGTileDesign(){ /** * resize all tiles */ - this.resizeAllTiles = function(newWidth, resizeMode){ - + this.resizeAllTiles = function(newWidth, resizeMode, objTiles){ + + modifyOptionsBeforeRender(); + var newHeight = null; if(g_options.tile_size_by == t.sizeby.GLOBAL_RATIO) newHeight = t.getTileHeightByWidth(newWidth); - - var objTiles = g_thumbs.getThumbs(); + + if(!objTiles) + var objTiles = g_thumbs.getThumbs(); + objTiles.each(function(index, objTile){ t.resizeTile(jQuery(objTile), newWidth, newHeight, resizeMode); }); @@ -11635,6 +11994,7 @@ function UGTileDesign(){ objThumbs.css("pointer-events", "auto"); } + /** * set new options */ @@ -11644,6 +12004,21 @@ function UGTileDesign(){ } + /** + * set new tile size, this function will not resize, and keep ratio + */ + this.setTileSizeOptions = function(newTileWidth){ + + if(g_options.tile_size_by !== t.sizeby.GLOBAL_RATIO) + throw new Error("setNewTileOptions works with global ration only"); + + g_options.tile_width = newTileWidth; + g_options.tile_height = Math.floor(newTileWidth * g_temp.ratioByHeight); + + + } + + /** * set custom tile html function */ @@ -11656,19 +12031,24 @@ function UGTileDesign(){ /** * run the tile design */ - this.run = function(){ - - var objThumbs = g_thumbs.getThumbs(); + this.run = function(newOnly){ + + //resize all tiles + var getMode = g_thumbs.type.GET_THUMBS_ALL; + if(newOnly === true) + getMode = g_thumbs.type.GET_THUMBS_NEW; + + var objThumbs = g_thumbs.getThumbs(getMode); if(g_options.tile_size_by == t.sizeby.GLOBAL_RATIO){ - t.resizeAllTiles(g_options.tile_width, t.resizemode.WRAPPER_ONLY); + t.resizeAllTiles(g_options.tile_width, t.resizemode.WRAPPER_ONLY, objThumbs); } - + //hide original image if image effect active if(g_options.tile_enable_image_effect == true && g_options.tile_image_effect_reverse == false) objThumbs.children(".ug-thumb-image").fadeTo(0,0); - g_thumbs.setHtmlProperties(); + g_thumbs.setHtmlProperties(objThumbs); if(g_options.tile_visible_before_image == true){ @@ -11762,7 +12142,7 @@ function UGTileDesign(){ width: g_options.tile_width, height: g_options.tile_height }; - + return(objSize); } @@ -12129,6 +12509,7 @@ function UGSlider(){ slider_image_border_width: 10, //image border width slider_image_border_color: "#ffffff", //image border color slider_image_border_radius: 0, //image border radius + slider_image_border_maxratio: 0.35, //max ratio that the border can take from the image slider_image_shadow: false, //enable border shadow the image slider_video_constantsize: false, //constant video size mode for video items @@ -12245,7 +12626,7 @@ function UGSlider(){ */ function initSlider(objGallery, objOptions, optionsPrefix){ g_gallery = objGallery; - + //change options by prefix if(optionsPrefix){ g_optionsPrefix = optionsPrefix; @@ -12265,7 +12646,7 @@ function UGSlider(){ if(g_options.slider_progress_indicator_type == "bar"){ g_options = jQuery.extend(g_options, g_defaultsProgressBar); } - + if(objOptions) t.setOptions(objOptions); @@ -12711,16 +13092,64 @@ function UGSlider(){ objPreloader.stop(true).hide(100); } + /** + * get proper image border width + */ + function getImageBorderWidth(objImage, imageData){ + + var borderWidth = g_options.slider_image_border_width; + + if(borderWidth <= 10) + return(borderWidth); + + //set image size + var imageSize = g_functions.getElementSize(objImage); + var imageWidth = imageSize.width; + var imageHeight = imageSize.height; + + if(imageData){ + if(imageData.hasOwnProperty("imageWidth")) + imageWidth = imageData.imageWidth; + + if(imageData.hasOwnProperty("imageHeight")) + imageHeight = imageData.imageHeight; + + } + + if(imageWidth <= 0) + return(borderWidth); + + //take the less size + var totalSize = (imageWidth < imageHeight)?imageWidth:imageHeight; + var borderSize = borderWidth * 2; + + var borderRatio = borderSize / totalSize; + + if(borderRatio < g_options.slider_image_border_maxratio) + return(borderWidth); + + //change border width + var borderWidth = (totalSize * g_options.slider_image_border_maxratio)/2; + + borderWidth = Math.round(borderWidth); + + return(borderWidth); + + } + /** * set slider image css design according the settings */ - function setImageDesign(objImage, slideType){ + function setImageDesign(objImage, slideType, imageData){ var css = {}; if(g_options.slider_image_border == true){ css["border-style"] = "solid"; - css["border-width"] = g_options.slider_image_border_width+"px"; + + var borderWidth = getImageBorderWidth(objImage, imageData); + + css["border-width"] = borderWidth+"px"; css["border-color"] = g_options.slider_image_border_color; css["border-radius"] = g_options.slider_image_border_radius; } @@ -12735,6 +13164,7 @@ function UGSlider(){ objImage.css(css); } + /** * scale image constant size (for video items) */ @@ -12744,7 +13174,10 @@ function UGSlider(){ var constantHeight = g_options.slider_video_constantsize_height; var scaleMode = g_options.slider_video_constantsize_scalemode; - g_functions.scaleImageExactSizeInParent(objImage, objItem.imageWidth, objItem.imageHeight, constantWidth, constantHeight, scaleMode); + var objSize = g_functions.scaleImageExactSizeInParent(objImage, objItem.imageWidth, objItem.imageHeight, constantWidth, constantHeight, scaleMode); + + + return(objSize); } @@ -12782,26 +13215,37 @@ function UGSlider(){ g_gallery.checkFillImageSize(objImage, objItem); } - if(slideType != "image" && g_options.slider_video_constantsize == true) - scaleImageConstantSize(objImage, objItem); - else - g_functions.scaleImageFitParent(objImage, objItem.imageWidth, objItem.imageHeight, scaleMode, objPadding); - + var objImageData = {}; + if(slideType != "image" && g_options.slider_video_constantsize == true){ + objImageData = scaleImageConstantSize(objImage, objItem); + } + else{ + objImageData = g_functions.scaleImageFitParent(objImage, objItem.imageWidth, objItem.imageHeight, scaleMode, objPadding); + } + + setImageDesign(objImage, slideType, objImageData); g_objThis.trigger(t.events.AFTER_PUT_IMAGE, objSlide); } else{ //place the image inside parent first time - + objImage = g_functions.placeImageInsideParent(urlImage, objItemWrapper, objItem.imageWidth, objItem.imageHeight, scaleMode, objPadding); - + //set image loaded on load: if(objItem.isBigImageLoaded == true){ objImage.fadeTo(0,1); hidePreloader(objPreloader); if(slideType != "image" && g_options.slider_video_constantsize == true) - scaleImageConstantSize(objImage, objItem); + var objImageData = scaleImageConstantSize(objImage, objItem); + else + var objImageData = g_functions.getImageInsideParentData(objItemWrapper, objItem.imageWidth, objItem.imageHeight, scaleMode, objPadding); + + //set missing css width + objImage.css("width",objImageData.imageWidth+"px"); + + setImageDesign(objImage, slideType, objImageData); g_objThis.trigger(t.events.AFTER_PUT_IMAGE, objSlide); } @@ -12838,23 +13282,25 @@ function UGSlider(){ g_gallery.onItemBigImageLoaded(null, objImage); var objItem = g_gallery.getItem(itemIndex); - + + var objImageData = {}; + if(slideType != "image" && g_options.slider_video_constantsize == true) scaleImageConstantSize(objImage, objItem); - else - g_functions.scaleImageFitParent(objImage, objItem.imageWidth, objItem.imageHeight, scaleMode, objPadding); + else{ + objImageData = g_functions.scaleImageFitParent(objImage, objItem.imageWidth, objItem.imageHeight, scaleMode, objPadding); + } objImage.fadeTo(0,1); + setImageDesign(objImage, slideType, objImageData); + g_objThis.trigger(t.events.AFTER_PUT_IMAGE, objSlide); }); } } - - if(objImage) - setImageDesign(objImage, slideType); } @@ -13021,7 +13467,7 @@ function UGSlider(){ var slideSize = g_functions.getElementSize(objCurrentSlide); var left = slideSize.left; var top = slideSize.top; - + //set by image position if(g_options.slider_video_constantsize == true){ @@ -13030,10 +13476,11 @@ function UGSlider(){ top += imageSize.top; }else{ //set video padding + left += g_options.slider_video_padding_left; top += g_options.slider_video_padding_top; - } + } g_objVideoPlayer.setPosition(left, top); } @@ -13052,7 +13499,7 @@ function UGSlider(){ //set video design var videoElement = g_objVideoPlayer.getObject(); - setImageDesign(videoElement); + setImageDesign(videoElement, "video"); } @@ -13743,11 +14190,11 @@ function UGSlider(){ //image mouseenter / mouseleave event //set mouseover events on the images - g_objSlider.delegate(".ug-item-wrapper img","mouseenter",function(event){ + g_objSlider.on("mouseenter",".ug-item-wrapper img",function(event){ g_objThis.trigger(t.events.IMAGE_MOUSEENTER); }); - - g_objSlider.delegate(".ug-item-wrapper img","mouseleave",function(event){ + + g_objSlider.on("mouseleave",".ug-item-wrapper img",function(event){ var isMouseOver = t.isMouseInsideSlideImage(event); if(isMouseOver == false) @@ -13786,8 +14233,8 @@ function UGSlider(){ g_objVideoPlayer.destroy(); - g_objSlider.undelegate(".ug-item-wrapper img","mouseenter"); - g_objSlider.undelegate(".ug-item-wrapper img","mouseleave"); + g_objSlider.off("mouseenter",".ug-item-wrapper img"); + g_objSlider.off("mouseleave",".ug-item-wrapper img"); } @@ -13918,7 +14365,7 @@ function UGSlider(){ * options: width / height */ this.init = function(objGallery, objOptions, optionsPrefix){ - + initSlider(objGallery, objOptions, optionsPrefix); } @@ -14379,11 +14826,13 @@ function UGSlider(){ var objFitSize = g_functions.getImageInsideParentData(objParent, objItem.imageWidth, objItem.imageHeight, scaleMode, objPadding); var objSize = g_functions.getElementSize(objImage); + + var output = false; if(objFitSize.imageWidth == objSize.width) - return(true); - - return(false); + output = true; + + return(output); } @@ -14476,6 +14925,7 @@ function UGSlider(){ g_objSlider.find(".ug-item-wrapper").css(objCssItemWrapper); + //set text panel size if(g_objTextPanel){ g_objTextPanel.setSizeByParent(); @@ -14626,7 +15076,9 @@ function UGTextPanel(){ var g_temp = { isFirstTime: true, - setInternalHeight: true //flag if set internal height or not + setInternalHeight: true, //flag if set internal height or not + lastTitleBottom: 0, + lastDescHeight: 0 }; @@ -14646,11 +15098,23 @@ function UGTextPanel(){ var titleY = maxy; g_functions.placeElement(g_objTitle, 0, titleY); - var objTitleSize = g_functions.getElementSize(g_objTitle); - - var maxy = objTitleSize.bottom; + var isTitleVisible = g_objTitle.is(":visible"); + if(isTitleVisible == true){ + var objTitleSize = g_functions.getElementSize(g_objTitle); + + var maxy = objTitleSize.bottom; + if(maxy > 0) + g_temp.lastTitleBottom = maxy; + }else{ + var maxy = 20; //get last or assumed maxy + + if(g_temp.lastTitleBottom > 0) + maxy = g_temp.lastTitleBottom; + } + } + //place description var textDesc = ""; if(g_objDesc) @@ -14664,10 +15128,27 @@ function UGTextPanel(){ descY += g_options.textpanel_padding_title_description; g_functions.placeElement(g_objDesc, 0, descY); - var objDescSize = g_functions.getElementSize(g_objDesc); - maxy = objDescSize.bottom; + + var isVisible = jQuery(g_objDesc).is(":visible"); + + if(isVisible == true){ + var objDescSize = g_functions.getElementSize(g_objDesc); + maxy = objDescSize.bottom; + + if(objDescSize.height > 0) + g_temp.lastDescHeight = objDescSize.height; + + }else{ + var descHeight = 16; //take from last saved + if(g_temp.lastDescHeight > 0) + descHeight = g_temp.lastDescHeight; + + maxy = descY + descHeight; + } + } + //change panel height if(!g_options.textpanel_height && g_temp.setInternalHeight == true){ @@ -15124,7 +15605,7 @@ function UGTextPanel(){ if(customLeft !== undefined && customLeft !== null) objCss.left = customLeft; - + g_objPanel.css(objCss); } @@ -17327,10 +17808,11 @@ function UGWistiaAPI(){ this.events = { START_PLAYING: "start_playing", - STOP_PLAYING: "stop_playing" + STOP_PLAYING: "stop_playing", + VIDEO_ENDED: "video_ended" }; - + /** * check if sound cloud active */ @@ -17404,9 +17886,9 @@ function UGWistiaAPI(){ g_player.bind('end', function(){ g_objThis.trigger(t.events.STOP_PLAYING); + g_objThis.trigger(t.events.VIDEO_ENDED); }); - } @@ -17496,7 +17978,8 @@ function UGSoundCloudAPI(){ this.events = { START_PLAYING: "start_playing", - STOP_PLAYING: "stop_playing" + STOP_PLAYING: "stop_playing", + VIDEO_ENDED: "video_ended" }; /** @@ -17581,9 +18064,9 @@ function UGSoundCloudAPI(){ g_player.bind(SC.Widget.Events.FINISH, function(){ g_objThis.trigger(t.events.STOP_PLAYING); + g_objThis.trigger(t.events.VIDEO_ENDED); }); - } @@ -17654,6 +18137,7 @@ function UGSoundCloudAPI(){ * destroy the player */ this.destroy = function(){ + g_isPlayerReady = false; g_player = null; @@ -17676,7 +18160,8 @@ function UGHtml5MediaAPI(){ this.events = { START_PLAYING: "start_playing", - STOP_PLAYING: "stop_playing" + STOP_PLAYING: "stop_playing", + VIDEO_ENDED: "video_ended" }; /** @@ -17784,8 +18269,8 @@ function UGHtml5MediaAPI(){ g_ugFunctions.addEvent(g_player, "ended", function(){ g_objThis.trigger(t.events.STOP_PLAYING); + g_objThis.trigger(t.events.VIDEO_ENDED); }); - } @@ -17867,7 +18352,8 @@ function UGVimeoAPI(){ this.events = { START_PLAYING: "start_playing", - STOP_PLAYING: "stop_playing" + STOP_PLAYING: "stop_playing", + VIDEO_ENDED: "video_ended" }; /** @@ -17961,9 +18447,9 @@ function UGVimeoAPI(){ g_player.addEvent('finish', function(){ g_objThis.trigger(t.events.STOP_PLAYING); + g_objThis.trigger(t.events.VIDEO_ENDED); }); - } @@ -18099,7 +18585,8 @@ function UGYoutubeAPI(){ this.events = { START_PLAYING: "start_playing", - STOP_PLAYING: "stop_playing" + STOP_PLAYING: "stop_playing", + VIDEO_ENDED: "video_ended" }; @@ -18187,7 +18674,6 @@ function UGYoutubeAPI(){ */ function onPlayerReady(){ g_isPlayerReady = true; - } @@ -18203,11 +18689,15 @@ function UGYoutubeAPI(){ } var state = g_player.getPlayerState(); - + switch(state){ case YT.PlayerState.PLAYING: g_objThis.trigger(t.events.START_PLAYING); break; + case YT.PlayerState.ENDED: + g_objThis.trigger(t.events.STOP_PLAYING); + g_objThis.trigger(t.events.VIDEO_ENDED); + break; default: if(g_prevState == YT.PlayerState.PLAYING) g_objThis.trigger(t.events.STOP_PLAYING); @@ -18231,8 +18721,8 @@ function UGYoutubeAPI(){ return(true); } - g_ugFunctions.loadJs("www.youtube.com/player_api", true); - + g_ugFunctions.loadJs("https://www.youtube.com/player_api", false); + g_ugYoutubeAPI.isAPILoaded = true; } @@ -18302,10 +18792,20 @@ function UGYoutubeAPI(){ * destroy player */ this.destroy = function(){ - if(g_player){ - g_isPlayerReady = false; - g_player.destroy(); + try{ + + if(g_player){ + g_isPlayerReady = false; + g_player.clearVideo(); + g_player.destroy(); + } + + }catch(objError){ + + jQuery("#"+g_lastContainerID).html(""); + } + } /** @@ -18375,7 +18875,8 @@ function UGVideoPlayer(){ SHOW: "video_show", HIDE: "video_hide", PLAY_START: "video_play_start", - PLAY_STOP: "video_play_stop" + PLAY_STOP: "video_play_stop", + VIDEO_ENDED: "video_ended" }; var g_temp = { @@ -18477,6 +18978,15 @@ function UGVideoPlayer(){ g_objButtonClose.show(); } + /** + * on video ended + */ + function onVideoEnded(){ + + g_objThis.trigger(t.events.VIDEO_ENDED); + + } + /** * init events @@ -18492,20 +19002,25 @@ function UGVideoPlayer(){ //youtube events jQuery(g_youtubeAPI).on(g_youtubeAPI.events.START_PLAYING, onPlayStart); jQuery(g_youtubeAPI).on(g_youtubeAPI.events.STOP_PLAYING, onPlayStop); + jQuery(g_youtubeAPI).on(g_youtubeAPI.events.VIDEO_ENDED, onVideoEnded); //vimeo events jQuery(g_vimeoAPI).on(g_vimeoAPI.events.START_PLAYING, onPlayStart); jQuery(g_vimeoAPI).on(g_vimeoAPI.events.STOP_PLAYING, onPlayStop); + jQuery(g_vimeoAPI).on(g_vimeoAPI.events.VIDEO_ENDED, onVideoEnded); //html5 video events jQuery(g_html5API).on(g_html5API.events.START_PLAYING, onPlayStart); jQuery(g_html5API).on(g_html5API.events.STOP_PLAYING, onPlayStop); + jQuery(g_html5API).on(g_html5API.events.VIDEO_ENDED, onVideoEnded); jQuery(g_soundCloudAPI).on(g_soundCloudAPI.events.START_PLAYING, onPlayStart); jQuery(g_soundCloudAPI).on(g_soundCloudAPI.events.STOP_PLAYING, onPlayStop); + jQuery(g_soundCloudAPI).on(g_soundCloudAPI.events.VIDEO_ENDED, onVideoEnded); jQuery(g_wistiaAPI).on(g_wistiaAPI.events.START_PLAYING, onPlayStart); jQuery(g_wistiaAPI).on(g_wistiaAPI.events.STOP_PLAYING, onPlayStop); + jQuery(g_wistiaAPI).on(g_wistiaAPI.events.VIDEO_ENDED, onVideoEnded); } @@ -18680,7 +19195,7 @@ function UGVideoPlayer(){ if(player == except) continue; switch(player){ - case "youtube": + case "youtube": g_youtubeAPI.pause(); g_youtubeAPI.destroy(); g_objYoutube.hide(); @@ -18721,7 +19236,6 @@ function UGVideoPlayer(){ g_objYoutube.show(); - var objYoutubeInner = g_objYoutube.children("#"+g_temp.youtubeInnerID); if(objYoutubeInner.length == 0) g_objYoutube.append("
"); @@ -18847,7 +19361,7 @@ var g_ugWistiaAPI = new UGWistiaAPI(); if(!options) var options = {}; - + var objGallery = new UniteGalleryMain(); objGallery.run(galleryID, options); @@ -18939,7 +19453,7 @@ function UniteGalleryMain(){ var t = this; var g_galleryID; var g_objGallery = jQuery(t), g_objWrapper, g_objParent; - var g_objThumbs, g_objSlider, g_functions = new UGFunctions(), g_objTabs; + var g_objThumbs, g_objSlider, g_functions = new UGFunctions(), g_objTabs, g_objLoadMore; var g_arrItems = [], g_numItems, g_selectedItem = null, g_selectedItemIndex = -1; var g_objTheme, g_objCache = {}; @@ -18956,7 +19470,9 @@ function UniteGalleryMain(){ SLIDER_ACTION_END: "slider_action_end", ITEM_IMAGE_UPDATED: "item_image_updated", GALLERY_KEYPRESS: "gallery_keypress", - GALLERY_BEFORE_REQUEST_ITEMS: "gallery_before_request_items" //before ajax load items + GALLERY_BEFORE_REQUEST_ITEMS: "gallery_before_request_items", //before ajax load items + OPEN_LIGHTBOX:"open_lightbox", + CLOSE_LIGHTBOX:"close_lightbox" }; @@ -18990,6 +19506,7 @@ function UniteGalleryMain(){ gallery_shuffle:false, //randomise position of items at start. gallery_urlajax:null, //ajax url for requesting new items etc. gallery_enable_tabs: false, //enable/disable category tabs + gallery_enable_loadmore: false, //enable / disable loadmore button gallery_enable_cache: true, //enable caching items gallery_initial_catid: "" //initial category id (for caching) }; @@ -19020,7 +19537,8 @@ function UniteGalleryMain(){ isWistiaPresent: false, //flag if some wistia movie present resizeDelay: 100, isRunFirstTime: true, - originalOptions: {} + originalOptions: {}, + funcCustomHeight: null //custom height function, set by the theme if needed }; @@ -19138,6 +19656,9 @@ function UniteGalleryMain(){ //cache items if(g_options.gallery_enable_cache == true && g_options.gallery_initial_catid) cacheItems(g_options.gallery_initial_catid); + + //set size class + t.setSizeClass(); //fill arrItems var objItems = g_objWrapper.children(); @@ -19191,6 +19712,12 @@ function UniteGalleryMain(){ g_objTabs.init(t, g_options); } + //init loadmore button + if(g_temp.isRunFirstTime == true && g_options.gallery_enable_loadmore == true){ + g_objLoadMore = new UGLoadMore(); + g_objLoadMore.init(t, g_options); + } + //modify and verify the params if(isCustomOptions) modifyInitParams(g_temp.objCustomOptions); @@ -19200,7 +19727,7 @@ function UniteGalleryMain(){ //shuffle items if(g_options.gallery_shuffle == true) t.shuffleItems(); - + //init the theme initTheme(g_temp.objCustomOptions); @@ -19238,6 +19765,7 @@ function UniteGalleryMain(){ if(g_objTabs && g_temp.isRunFirstTime) g_objTabs.run(); + preloadBigImages(); initEvents(); @@ -19263,8 +19791,10 @@ function UniteGalleryMain(){ function showErrorMessage(message, prefix){ if(typeof prefix == "undefined") - var prefix = "Unite Gallery Error: "; - + var prefix = "Unite Gallery Error: "; + else + prefix = ""+prefix+": "; + message = prefix + message; var html = "
" + message + "
"; @@ -19420,186 +19950,250 @@ function UniteGalleryMain(){ /** - * fill items array from images object + * fill item by html child */ - function fillItemsArray(arrChildren){ + function fillItemByChild(objChild){ - g_arrItems = []; + var isMobile = t.isMobileMode(); - var numIndex = 0; + var tagname = objChild.prop("tagName").toLowerCase(); - for(var i=0;i