Web Analytics Made Easy -
StatCounter

Copyright © 2018 Pompeii Gentlemen’s Club. Tutti i diritti riservati. I servizi offerti attraverso questo sito web sono destinati esclusivamente alla Svizzera. Le persone raffigurate sono modelle e la loro somiglianza viene utilizzata solo a scopo illustrativo. Locale autorizzato all’esercizio secondo la LProst.

(function($,window,document,undefined){'use strict';var defaults={mode:'qq-slide',cssEasing:'cubic-bezier(0.25, 0, 0.25, 1)',easing:'linear',speed:600,height:'100%',width:'100%',addClass:'',startClass:'qq-start-zoom',backdropDuration:150,hideBarsDelay:6000,useLeft:false,closable:true,loop:true,escKey:true,keyPress:true,controls:true,slideEndAnimatoin:true,hideControlOnEnd:false,mousewheel:true,appendSubHtmlTo:'.qq-sub-html',preload:1,showAfterLoad:true,selector:'',nextHtml:'',prevHtml:'',index:false,iframeMaxWidth:'100%',download:true,counter:true,appendCounterTo:'.qq-toolbar',swipeThreshold:50,enableSwipe:true,enableDrag:true,dynamic:false,dynamicEl:[],galleryId:1};function Plugin(element,options){this.el=element;this.$el=$(element);this.s=$.extend({},defaults,options);this.modules={};this.lGalleryOn=false;this.lgBusy=false;this.hideBartimeout=false;this.isTouch=('ontouchstart'in document.documentElement);if(this.s.slideEndAnimatoin){this.s.hideControlOnEnd=false}if(this.s.dynamic){this.$items=this.s.dynamicEl}else{if(this.s.selector==='this'){this.$items=this.$el}else if(this.s.selector!==''){this.$items=this.$el.find($(this.s.selector))}else{this.$items=this.$el.children()}}this.$slide='';this.$outer='';this.init();return this}Plugin.prototype.init=function(){var _this=this;if(_this.s.preload>_this.$items.length){_this.s.preload=_this.$items.length}var _hash=window.location.hash;if(_hash.indexOf('QQ='+this.s.galleryId)>0){_this.index=parseInt(_hash.split('&slide=')[1],10);$('body').addClass('qq-from-hash');if(!$('body').hasClass('qq-on')){setTimeout(function(){_this.build(_this.index);$('body').addClass('qq-on')})}}if(_this.s.dynamic){_this.$el.trigger('onBeforeOpen.lg');_this.index=_this.s.index||0;if(!$('body').hasClass('qq-on')){setTimeout(function(){_this.build(_this.index);$('body').addClass('qq-on')})}}else{_this.$items.on('click.lgcustom',function(event){try{event.preventDefault();event.preventDefault()}catch(er){event.returnValue=false}_this.$el.trigger('onBeforeOpen.lg');_this.index=_this.s.index||_this.$items.index(this);if(!$('body').hasClass('qq-on')){_this.build(_this.index);$('body').addClass('qq-on')}})}};Plugin.prototype.build=function(index){var _this=this;_this.structure();$.each($.fn.QQ.modules,function(key){_this.modules[key]=new $.fn.QQ.modules[key](_this.el)});_this.slide(index,false,false);if(_this.s.keyPress){_this.keyPress()}if(_this.$items.length>1){_this.arrow();setTimeout(function(){_this.enableDrag();_this.enableSwipe()},50);if(_this.s.mousewheel){_this.mousewheel()}}_this.counter();_this.closeGallery();_this.$el.trigger('onAfterOpen.lg');_this.$outer.on('mousemove.lg click.lg touchstart.lg',function(){_this.$outer.removeClass('qq-hide-items'); clearTimeout(_this.hideBartimeout);_this.hideBartimeout=setTimeout(function(){_this.$outer.addClass('qq-hide-items'); },_this.s.hideBarsDelay)})};Plugin.prototype.structure=function(){var list='';var controls='';var i=0;var subHtmlCont='';var template;var _this=this;$('body').append('
');$('.qq-backdrop').css('transition-duration',this.s.backdropDuration+'ms');for(i=0;i'}if(this.s.controls&&this.$items.length>1){controls='
'+'
'+this.s.prevHtml+'
'+'
'+this.s.nextHtml+'
'+'
'}if(this.s.appendSubHtmlTo==='.qq-sub-html'){subHtmlCont='
'}template='
'+'
'+'
'+list+'
'+'
'+''+'
'+controls+subHtmlCont+'
'+'
';$('body').append(template);this.$outer=$('.qq-outer');this.$slide=this.$outer.find('.qq-item');if(this.s.useLeft){this.$outer.addClass('qq-use-left')}else{this.$outer.addClass('qq-use-css3')}_this.setTop();$(window).on('resize.lg orientationchange.lg',function(){setTimeout(function(){_this.setTop()},100)});this.$slide.eq(this.index).addClass('qq-current');if(this.doCss()){this.$outer.addClass('qq-css3')}else{this.$outer.addClass('qq-css')}this.$outer.addClass(this.s.mode);if(this.s.enableDrag&&this.$items.length>1){this.$outer.addClass('qq-grab')}if(this.s.showAfterLoad){this.$outer.addClass('qq-show-after-load')}if(this.doCss()){var $inner=this.$outer.find('.qq-inner');$inner.css('transition-timing-function',this.s.cssEasing);$inner.css('transition-duration',this.s.speed+'ms')}$('.qq-backdrop').addClass('in');setTimeout(function(){_this.$outer.addClass('qq-visible')},this.s.backdropDuration);if(this.s.download){this.$outer.find('.qq-toolbar').append('')}};Plugin.prototype.setTop=function(){if(this.s.height!=='100%'){var wH=$(window).height();var top=(wH-parseInt(this.s.height,10))/2;var $lGallery=this.$outer.find('.lg');if(wH>=parseInt(this.s.height,10)){$lGallery.css('top',top+'px')}else{$lGallery.css('top','0px')}}};Plugin.prototype.doCss=function(){var support=function(){var transition=['transition','MozTransition','WebkitTransition','OTransition','msTransition','KhtmlTransition'];var root=document.documentElement;var i=0;for(i=0;i'+(parseInt(this.index,10)+1)+' / '+this.$items.length+'')}};Plugin.prototype.addHtml=function(index){var subHtml=null;if(this.s.dynamic){subHtml=this.s.dynamicEl[index].subHtml}else{subHtml=this.$items.eq(index).attr('data-sub-html')}if(typeof subHtml!=='undefined'&&subHtml!==null){var fL=subHtml.substring(0,1);if(fL==='.'||fL==='#'){subHtml=$(subHtml).html()}else{subHtml=subHtml}}else{subHtml=''}if(this.s.appendSubHtmlTo==='.qq-sub-html'){this.$outer.find(this.s.appendSubHtmlTo).html(subHtml);if(subHtml===''){this.$outer.find(this.s.appendSubHtmlTo).addClass('qq-empty-html')}else{this.$outer.find(this.s.appendSubHtmlTo).removeClass('qq-empty-html')}}else{this.$slide.eq(index).append(subHtml)}this.$el.trigger('onAfterAppendSubHtml.lg',[index])};Plugin.prototype.preload=function(index){var i=1;var j=1;for(i=1;i<=this.s.preload;i++){if(i>=this.$items.length-index){break}this.loadContent(index+i,false,0)}for(j=1;j<=this.s.preload;j++){if(index-j<0){break}this.loadContent(index-j,false,0)}};Plugin.prototype.loadContent=function(index,rec,delay){var _this=this;var _hasPoster=false;var _$img;var _src;var _poster;var _srcset;var _sizes;var _html;var getResponsiveSrc=function(srcItms){var rsWidth=[];var rsSrc=[];for(var i=0;iwWidth){_src=rsSrc[j];break}}};if(_this.s.dynamic){if(_this.s.dynamicEl[index].poster){_hasPoster=true;_poster=_this.s.dynamicEl[index].poster}_html=_this.s.dynamicEl[index].html;_src=_this.s.dynamicEl[index].src;if(_this.s.dynamicEl[index].responsive){var srcDyItms=_this.s.dynamicEl[index].responsive.split(',');getResponsiveSrc(srcDyItms)}_srcset=_this.s.dynamicEl[index].srcset;_sizes=_this.s.dynamicEl[index].sizes}else{if(_this.$items.eq(index).attr('data-poster')){_hasPoster=true;_poster=_this.$items.eq(index).attr('data-poster')}_html=_this.$items.eq(index).attr('data-html');_src=_this.$items.eq(index).attr('href')||_this.$items.eq(index).attr('data-src');if(_this.$items.eq(index).attr('data-responsive')){var srcItms=_this.$items.eq(index).attr('data-responsive').split(',');getResponsiveSrc(srcItms)}_srcset=_this.$items.eq(index).attr('data-srcset');_sizes=_this.$items.eq(index).attr('data-sizes')}var iframe=false;if(_this.s.dynamic){if(_this.s.dynamicEl[index].iframe){iframe=true}}else{if(_this.$items.eq(index).attr('data-iframe')==='true'){iframe=true}}var _isVideo=_this.isVideo(_src,index);if(!_this.$slide.eq(index).hasClass('qq-loaded')){if(iframe){_this.$slide.eq(index).prepend('
')}else if(_hasPoster){var videoClass='';if(_isVideo&&_isVideo.youtube){videoClass='qq-has-youtube'}else if(_isVideo&&_isVideo.vimeo){videoClass='qq-has-vimeo'}else{videoClass='qq-has-html5'}_this.$slide.eq(index).prepend('
')}else if(_isVideo){_this.$slide.eq(index).prepend('
');_this.$el.trigger('hasVideo.lg',[index,_src,_html])}else{_this.$slide.eq(index).prepend('
')}_this.$el.trigger('onAferAppendSlide.lg',[index]);_$img=_this.$slide.eq(index).find('.qq-object');if(_sizes){_$img.attr('sizes',_sizes)}if(_srcset){_$img.attr('srcset',_srcset);try{picturefill({elements:[_$img[0]]})}catch(e){console.error('Make sure you have included Picturefill version 2')}}if(this.s.appendSubHtmlTo!=='.qq-sub-html'){_this.addHtml(index)}_this.$slide.eq(index).addClass('qq-loaded')}_this.$slide.eq(index).find('.qq-object').on('load.lg error.lg',function(){var _speed=0;if(delay&&!$('body').hasClass('qq-from-hash')){_speed=delay}setTimeout(function(){_this.$slide.eq(index).addClass('qq-complete');_this.$el.trigger('onSlideItemLoad.lg',[index,delay||0])},_speed)});if(_isVideo&&_isVideo.html5&&!_hasPoster){_this.$slide.eq(index).addClass('qq-complete')}if(rec===true){if(!_this.$slide.eq(index).hasClass('qq-complete')){_this.$slide.eq(index).find('.qq-object').on('load.lg error.lg',function(){_this.preload(index)})}else{_this.preload(index)}}};Plugin.prototype.slide=function(index,fromTouch,fromThumb){var _prevIndex=this.$outer.find('.qq-current').index();var _this=this;if(_this.lGalleryOn&&(_prevIndex===index)){return}var _length=this.$slide.length;var _time=_this.lGalleryOn?this.s.speed:0;var _next=false;var _prev=false;if(!_this.lgBusy){this.$el.trigger('onBeforeSlide.lg',[_prevIndex,index,fromTouch,fromThumb]);_this.lgBusy=true;clearTimeout(_this.hideBartimeout);if(this.s.appendSubHtmlTo==='.qq-sub-html'){setTimeout(function(){_this.addHtml(index)},_time)}this.arrowDisable(index);if(!fromTouch){_this.$outer.addClass('qq-no-trans');this.$slide.removeClass('qq-prev-slide qq-next-slide');if(index<_prevIndex){_prev=true;if((index===0)&&(_prevIndex===_length-1)&&!fromThumb){_prev=false;_next=true}}else if(index>_prevIndex){_next=true;if((index===_length-1)&&(_prevIndex===0)&&!fromThumb){_prev=true;_next=false}}if(_prev){this.$slide.eq(index).addClass('qq-prev-slide');this.$slide.eq(_prevIndex).addClass('qq-next-slide')}else if(_next){this.$slide.eq(index).addClass('qq-next-slide');this.$slide.eq(_prevIndex).addClass('qq-prev-slide')}setTimeout(function(){_this.$slide.removeClass('qq-current');_this.$slide.eq(index).addClass('qq-current');_this.$outer.removeClass('qq-no-trans')},50)}else{var touchPrev=index-1;var touchNext=index+1;if((index===0)&&(_prevIndex===_length-1)){touchNext=0;touchPrev=_length-1}else if((index===_length-1)&&(_prevIndex===0)){touchNext=0;touchPrev=_length-1}this.$slide.removeClass('qq-prev-slide qq-current qq-next-slide');_this.$slide.eq(touchPrev).addClass('qq-prev-slide');_this.$slide.eq(touchNext).addClass('qq-next-slide');_this.$slide.eq(index).addClass('qq-current')}if(_this.lGalleryOn){setTimeout(function(){_this.loadContent(index,true,0)},this.s.speed+50);setTimeout(function(){_this.lgBusy=false;_this.$el.trigger('onAfterSlide.lg',[_prevIndex,index,fromTouch,fromThumb])},this.s.speed);if(!_this.doCss()){_this.$slide.fadeOut(_this.s.speed);_this.$slide.eq(index).fadeIn(_this.s.speed)}}else{_this.loadContent(index,true,_this.s.backdropDuration);_this.lgBusy=false;_this.$el.trigger('onAfterSlide.lg',[_prevIndex,index,fromTouch,fromThumb]);if(!_this.doCss()){_this.$slide.fadeOut(50);_this.$slide.eq(index).fadeIn(50)}}if(this.s.download){var _src;if(_this.s.dynamic){_src=_this.s.dynamicEl[index].downloadUrl||_this.s.dynamicEl[index].src}else{_src=_this.$items.eq(index).attr('data-download-url')||_this.$items.eq(index).attr('href')||_this.$items.eq(index).attr('data-src')}$('#qq-download').attr('href',_src)}_this.lGalleryOn=true;if(this.s.counter){$('#qq-counter-current').text(index+1)}}};Plugin.prototype.goToNextSlide=function(fromTouch){var _this=this;if(!_this.lgBusy){if((_this.index+1)<_this.$slide.length){_this.index++;_this.$el.trigger('onBeforeNextSlide.lg',[_this.index]);_this.slide(_this.index,fromTouch,false)}else{if(_this.s.loop){_this.index=0;_this.$el.trigger('onBeforeNextSlide.lg',[_this.index]);_this.slide(_this.index,fromTouch,false)}else if(_this.s.slideEndAnimatoin){_this.$outer.addClass('qq-right-end');setTimeout(function(){_this.$outer.removeClass('qq-right-end')},400)}}}};Plugin.prototype.goToPrevSlide=function(fromTouch){var _this=this;if(!_this.lgBusy){if(_this.index>0){_this.index--;_this.$el.trigger('onBeforePrevSlide.lg',[_this.index,fromTouch]);_this.slide(_this.index,fromTouch,false)}else{if(_this.s.loop){_this.index=_this.$items.length-1;_this.$el.trigger('onBeforePrevSlide.lg',[_this.index,fromTouch]);_this.slide(_this.index,fromTouch,false)}else if(_this.s.slideEndAnimatoin){_this.$outer.addClass('qq-left-end');setTimeout(function(){_this.$outer.removeClass('qq-left-end')},400)}}}};Plugin.prototype.keyPress=function(){var _this=this;if(this.$items.length>1){$(window).on('keyup.lg',function(e){if(_this.$items.length>1){if(e.keyCode===37){e.preventDefault();_this.goToPrevSlide()}if(e.keyCode===39){e.preventDefault();_this.goToNextSlide()}}})}$(window).on('keydown.lg',function(e){if(_this.s.escKey===true&&e.keyCode===27){e.preventDefault();if(!_this.$outer.hasClass('qq-thumb-open')){_this.destroy()}else{_this.$outer.removeClass('qq-thumb-open')}}})};Plugin.prototype.arrow=function(){var _this=this;this.$outer.find('.qq-prev').on('click.lg',function(){_this.goToPrevSlide()});this.$outer.find('.qq-next').on('click.lg',function(){_this.goToNextSlide()})};Plugin.prototype.arrowDisable=function(index){if(!this.s.loop&&this.s.hideControlOnEnd){if((index+1)0){this.$outer.find('.qq-prev').removeAttr('disabled').removeClass('disabled')}else{this.$outer.find('.qq-prev').attr('disabled','disabled').addClass('disabled')}}};Plugin.prototype.setTranslate=function($el,xValue,yValue){if(this.s.useLeft){$el.css('left',xValue)}else{$el.css({transform:'translate3d('+(xValue)+'px, '+yValue+'px, 0px)'})}};Plugin.prototype.touchMove=function(startCoords,endCoords){var distance=endCoords-startCoords;this.$outer.addClass('qq-dragging');this.setTranslate(this.$slide.eq(this.index),distance,0);this.setTranslate($('.qq-prev-slide'),-this.$slide.eq(this.index).width()+distance,0);this.setTranslate($('.qq-next-slide'),this.$slide.eq(this.index).width()+distance,0)};Plugin.prototype.touchEnd=function(distance){var _this=this;if(_this.s.mode!=='qq-slide'){_this.$outer.addClass('qq-slide')}this.$slide.not('.qq-current, .qq-prev-slide, .qq-next-slide').css('opacity','0');setTimeout(function(){_this.$outer.removeClass('qq-dragging');if((distance<0)&&(Math.abs(distance)>_this.s.swipeThreshold)){_this.goToNextSlide(true)}else if((distance>0)&&(Math.abs(distance)>_this.s.swipeThreshold)){_this.goToPrevSlide(true)}else if(Math.abs(distance)<5){_this.$el.trigger('onSlideClick.lg')}_this.$slide.removeAttr('style')});setTimeout(function(){if(!_this.$outer.hasClass('qq-dragging')&&_this.s.mode!=='qq-slide'){_this.$outer.removeClass('qq-slide')}},_this.s.speed+100)};Plugin.prototype.enableSwipe=function(){var _this=this;var startCoords=0;var endCoords=0;var isMoved=false;if(_this.s.enableSwipe&&_this.isTouch&&_this.doCss()){_this.$slide.on('touchstart.lg',function(e){if(!_this.$outer.hasClass('qq-zoomed')&&!_this.lgBusy){e.preventDefault();_this.manageSwipeClass();startCoords=e.originalEvent.targetTouches[0].pageX}});_this.$slide.on('touchmove.lg',function(e){if(!_this.$outer.hasClass('qq-zoomed')){e.preventDefault();endCoords=e.originalEvent.targetTouches[0].pageX;_this.touchMove(startCoords,endCoords);isMoved=true}});_this.$slide.on('touchend.lg',function(){if(!_this.$outer.hasClass('qq-zoomed')){if(isMoved){isMoved=false;_this.touchEnd(endCoords-startCoords)}else{_this.$el.trigger('onSlideClick.lg')}}})}};Plugin.prototype.enableDrag=function(){var _this=this;var startCoords=0;var endCoords=0;var isDraging=false;var isMoved=false;if(_this.s.enableDrag&&!_this.isTouch&&_this.doCss()){_this.$slide.on('mousedown.lg',function(e){if(!_this.$outer.hasClass('qq-zoomed')){if($(e.target).hasClass('qq-object')||$(e.target).hasClass('qq-video-play')){e.preventDefault();if(!_this.lgBusy){_this.manageSwipeClass();startCoords=e.pageX;isDraging=true;_this.$outer.scrollLeft+=1;_this.$outer.scrollLeft-=1;_this.$outer.removeClass('qq-grab').addClass('qq-grabbing');_this.$el.trigger('onDragstart.lg')}}}});$(window).on('mousemove.lg',function(e){if(isDraging){isMoved=true;endCoords=e.pageX;_this.touchMove(startCoords,endCoords);_this.$el.trigger('onDragmove.lg')}});$(window).on('mouseup.lg',function(e){if(isMoved){isMoved=false;_this.touchEnd(endCoords-startCoords);_this.$el.trigger('onDragend.lg')}else if($(e.target).hasClass('qq-object')||$(e.target).hasClass('qq-video-play')){_this.$el.trigger('onSlideClick.lg')}if(isDraging){isDraging=false;_this.$outer.removeClass('qq-grabbing').addClass('qq-grab')}})}};Plugin.prototype.manageSwipeClass=function(){var touchNext=this.index+1;var touchPrev=this.index-1;var length=this.$slide.length;if(this.s.loop){if(this.index===0){touchPrev=length-1}else if(this.index===length-1){touchNext=0}}this.$slide.removeClass('qq-next-slide qq-prev-slide');if(touchPrev>-1){this.$slide.eq(touchPrev).addClass('qq-prev-slide')}this.$slide.eq(touchNext).addClass('qq-next-slide')};Plugin.prototype.mousewheel=function(){var _this=this;_this.$outer.on('mousewheel.lg',function(e){if(e.deltaY>0){_this.goToPrevSlide()}else{_this.goToNextSlide()}e.preventDefault()})};Plugin.prototype.closeGallery=function(){var _this=this;var mousedown=false;this.$outer.find('.qq-close').on('click.lg',function(){_this.destroy()});if(_this.s.closable){_this.$outer.on('mousedown.lg',function(e){if($(e.target).is('.qq-outer')||$(e.target).is('.qq-item ')||$(e.target).is('.qq-img-wrap')){mousedown=true}else{mousedown=false}});_this.$outer.on('mouseup.lg',function(e){if($(e.target).is('.qq-outer')||$(e.target).is('.qq-item ')||$(e.target).is('.qq-img-wrap')&&mousedown){if(!_this.$outer.hasClass('qq-dragging')){_this.destroy()}}})}};Plugin.prototype.destroy=function(d){var _this=this;_this.$el.trigger('onBeforeClose.lg');if(d){this.$items.off('click.lg click.lgcustom');$.removeData(_this.el,'QQ')}this.$el.off('.lg.tm');$.each($.fn.QQ.modules,function(key){if(_this.modules[key]){_this.modules[key].destroy()}});this.lGalleryOn=false;clearTimeout(_this.hideBartimeout);this.hideBartimeout=false;$(window).off('.lg');$('body').removeClass('qq-on qq-from-hash');if(_this.$outer){_this.$outer.removeClass('qq-visible')}$('.qq-backdrop').removeClass('in');setTimeout(function(){if(_this.$outer){_this.$outer.remove()}$('.qq-backdrop').remove();_this.$el.trigger('onCloseAfter.lg')},_this.s.backdropDuration+50)};$.fn.QQ=function(options){return this.each(function(){if(!$.data(this,'QQ')){$.data(this,'QQ',new Plugin(this,options))}else{try{$(this).data('QQ').init()}catch(err){console.error('QQ has not initiated properly')}}})};$.fn.QQ.modules={}})(jQuery,window,document);(function($,window,document,undefined){'use strict';var defaults={scale:1,zoom:true,enableZoomAfter:300};var Zoom=function(element){this.core=$(element).data('QQ');this.core.s=$.extend({},defaults,this.core.s);if(this.core.s.zoom&&this.core.doCss()){this.init();this.zoomabletimeout=false;this.pageX=$(window).width()/2;this.pageY=($(window).height()/2)+$(window).scrollTop()}return this};Zoom.prototype.init=function(){var _this=this;var zoomIcons='';this.core.$outer.find('.qq-toolbar').append(zoomIcons);_this.core.$el.on('onSlideItemLoad.lg.tm.zoom',function(event,index,delay){var _speed=_this.core.s.enableZoomAfter+delay;if($('body').hasClass('qq-from-hash')&&delay){_speed=0}else{$('body').removeClass('qq-from-hash')}_this.zoomabletimeout=setTimeout(function(){_this.core.$slide.eq(index).addClass('qq-zoomable')},_speed+30)});var scale=1;var zoom=function(scaleVal){var $image=_this.core.$outer.find('.qq-current .qq-image');var _x;var _y;var offsetX=($(window).width()-$image.width())/2;var offsetY=(($(window).height()-$image.height())/2)+$(window).scrollTop();_x=_this.pageX-offsetX;_y=_this.pageY-offsetY;var x=(scaleVal-1)*(_x);var y=(scaleVal-1)*(_y);$image.css('transform','scale3d('+scaleVal+', '+scaleVal+', 1)').attr('data-scale',scaleVal);$image.parent().css('transform','translate3d(-'+x+'px, -'+y+'px, 0)').attr('data-x',x).attr('data-y',y)};var callScale=function(){if(scale>1){_this.core.$outer.addClass('qq-zoomed')}else{_this.resetZoom()}if(scale<1){scale=1}zoom(scale)};_this.core.$el.on('onAferAppendSlide.lg.tm.zoom',function(event,index){var $image=_this.core.$slide.eq(index).find('.qq-image');$image.dblclick(function(event){var w=$image.width();var nw=_this.core.$items.eq(index).attr('data-width')||$image[0].naturalWidth||w;var _scale;if(_this.core.$outer.hasClass('qq-zoomed')){scale=1}else{if(nw>w){_scale=nw/w;scale=_scale||2}}_this.pageX=event.pageX;_this.pageY=event.pageY;callScale();setTimeout(function(){_this.core.$outer.removeClass('qq-grabbing').addClass('qq-grab')},10)})});$(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom',function(){_this.pageX=$(window).width()/2;_this.pageY=($(window).height()/2)+$(window).scrollTop();zoom(scale)});$('#qq-zoom-out').on('click.lg',function(){if(_this.core.$outer.find('.qq-current .qq-image').length){scale-=_this.core.s.scale;callScale()}});$('#qq-zoom-in').on('click.lg',function(){if(_this.core.$outer.find('.qq-current .qq-image').length){scale+=_this.core.s.scale;callScale()}});_this.core.$el.on('onBeforeSlide.lg.tm',function(){_this.resetZoom()});if(!_this.core.isTouch){_this.zoomDrag()}if(_this.core.isTouch){_this.zoomSwipe()}};Zoom.prototype.resetZoom=function(){this.core.$outer.removeClass('qq-zoomed');this.core.$slide.find('.qq-img-wrap').removeAttr('style data-x data-y');this.core.$slide.find('.qq-image').removeAttr('style data-scale');this.pageX=$(window).width()/2;this.pageY=($(window).height()/2)+$(window).scrollTop()};Zoom.prototype.zoomSwipe=function(){var _this=this;var startCoords={};var endCoords={};var isMoved=false;var allowX=false;var allowY=false;_this.core.$slide.on('touchstart.lg',function(e){if(_this.core.$outer.hasClass('qq-zoomed')){var $image=_this.core.$slide.eq(_this.core.index).find('.qq-object');allowY=$image.outerHeight()*$image.attr('data-scale')>_this.core.$outer.find('.lg').height();allowX=$image.outerWidth()*$image.attr('data-scale')>_this.core.$outer.find('.lg').width();if((allowX||allowY)){e.preventDefault();startCoords={x:e.originalEvent.targetTouches[0].pageX,y:e.originalEvent.targetTouches[0].pageY}}}});_this.core.$slide.on('touchmove.lg',function(e){if(_this.core.$outer.hasClass('qq-zoomed')){var _$el=_this.core.$slide.eq(_this.core.index).find('.qq-img-wrap');var distanceX;var distanceY;e.preventDefault();isMoved=true;endCoords=e.originalEvent.targetTouches[0].pageX;endCoords={x:e.originalEvent.targetTouches[0].pageX,y:e.originalEvent.targetTouches[0].pageY};_this.core.$outer.addClass('qq-zoom-dragging');if(allowY){distanceY=(-Math.abs(_$el.attr('data-y')))+(endCoords.y-startCoords.y)}else{distanceY=-Math.abs(_$el.attr('data-y'))}if(allowX){distanceX=(-Math.abs(_$el.attr('data-x')))+(endCoords.x-startCoords.x)}else{distanceX=-Math.abs(_$el.attr('data-x'))}_$el.css('transform','translate3d('+distanceX+'px, '+distanceY+'px, 0)')}});_this.core.$slide.on('touchend.lg',function(){if(_this.core.$outer.hasClass('qq-zoomed')){if(isMoved){isMoved=false;_this.core.$outer.removeClass('qq-zoom-dragging');_this.touchendZoom(startCoords,endCoords,allowX,allowY)}}})};Zoom.prototype.zoomDrag=function(){var _this=this;var startCoords={};var endCoords={};var isDraging=false;var isMoved=false;var allowX=false;var allowY=false;_this.core.$slide.on('mousedown.lg.zoom',function(e){var $image=_this.core.$slide.eq(_this.core.index).find('.qq-object');allowY=$image.outerHeight()*$image.attr('data-scale')>_this.core.$outer.find('.lg').height();allowX=$image.outerWidth()*$image.attr('data-scale')>_this.core.$outer.find('.lg').width();if(_this.core.$outer.hasClass('qq-zoomed')){if($(e.target).hasClass('qq-object')&&(allowX||allowY)){e.preventDefault();startCoords={x:e.pageX,y:e.pageY};isDraging=true;_this.core.$outer.scrollLeft+=1;_this.core.$outer.scrollLeft-=1;_this.core.$outer.removeClass('qq-grab').addClass('qq-grabbing')}}});$(window).on('mousemove.lg.zoom',function(e){if(isDraging){var _$el=_this.core.$slide.eq(_this.core.index).find('.qq-img-wrap');var distanceX;var distanceY;isMoved=true;endCoords={x:e.pageX,y:e.pageY};_this.core.$outer.addClass('qq-zoom-dragging');if(allowY){distanceY=(-Math.abs(_$el.attr('data-y')))+(endCoords.y-startCoords.y)}else{distanceY=-Math.abs(_$el.attr('data-y'))}if(allowX){distanceX=(-Math.abs(_$el.attr('data-x')))+(endCoords.x-startCoords.x)}else{distanceX=-Math.abs(_$el.attr('data-x'))}_$el.css('transform','translate3d('+distanceX+'px, '+distanceY+'px, 0)')}});$(window).on('mouseup.lg.zoom',function(e){if(isDraging){isDraging=false;_this.core.$outer.removeClass('qq-zoom-dragging');if(isMoved&&((startCoords.x!==endCoords.x)||(startCoords.y!==endCoords.y))){endCoords={x:e.pageX,y:e.pageY};_this.touchendZoom(startCoords,endCoords,allowX,allowY)}isMoved=false}_this.core.$outer.removeClass('qq-grabbing').addClass('qq-grab')})};Zoom.prototype.touchendZoom=function(startCoords,endCoords,allowX,allowY){var _this=this;var _$el=_this.core.$slide.eq(_this.core.index).find('.qq-img-wrap');var $image=_this.core.$slide.eq(_this.core.index).find('.qq-object');var distanceX=(-Math.abs(_$el.attr('data-x')))+(endCoords.x-startCoords.x);var distanceY=(-Math.abs(_$el.attr('data-y')))+(endCoords.y-startCoords.y);var minY=(_this.core.$outer.find('.lg').height()-$image.outerHeight())/2;var maxY=Math.abs(($image.outerHeight()*Math.abs($image.attr('data-scale')))-_this.core.$outer.find('.lg').height()+minY);var minX=(_this.core.$outer.find('.lg').width()-$image.outerWidth())/2;var maxX=Math.abs(($image.outerWidth()*Math.abs($image.attr('data-scale')))-_this.core.$outer.find('.lg').width()+minX);if(allowY){if(distanceY<=-maxY){distanceY=-maxY}else if(distanceY>=-minY){distanceY=-minY}}if(allowX){if(distanceX<=-maxX){distanceX=-maxX}else if(distanceX>=-minX){distanceX=-minX}}if(allowY){_$el.attr('data-y',Math.abs(distanceY))}else{distanceY=-Math.abs(_$el.attr('data-y'))}if(allowX){_$el.attr('data-x',Math.abs(distanceX))}else{distanceX=-Math.abs(_$el.attr('data-x'))}_$el.css('transform','translate3d('+distanceX+'px, '+distanceY+'px, 0)')};Zoom.prototype.destroy=function(){var _this=this;_this.core.$el.off('.lg.zoom');$(window).off('.lg.zoom');_this.core.$slide.off('.lg.zoom');_this.core.$el.off('.lg.tm.zoom');_this.resetZoom();clearTimeout(_this.zoomabletimeout);_this.zoomabletimeout=false};$.fn.QQ.modules.zoom=Zoom})(jQuery,window,document);(function($,window,document,undefined){'use strict';var defaults={fullScreen:true};var Fullscreen=function(element){this.core=$(element).data('QQ');this.$el=$(element);this.core.s=$.extend({},defaults,this.core.s);this.init();return this};Fullscreen.prototype.init=function(){var fullScreen='';if(this.core.s.fullScreen){if(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled&&!document.mozFullScreenEnabled&&!document.msFullscreenEnabled){return}else{fullScreen='';this.core.$outer.find('.qq-toolbar').append(fullScreen);this.fullScreen()}}};Fullscreen.prototype.reuestFullscreen=function(){var el=document.documentElement;if(el.requestFullscreen){el.requestFullscreen()}else if(el.msRequestFullscreen){el.msRequestFullscreen()}else if(el.mozRequestFullScreen){el.mozRequestFullScreen()}else if(el.webkitRequestFullscreen){el.webkitRequestFullscreen()}};Fullscreen.prototype.exitFullscreen=function(){if(document.exitFullscreen){document.exitFullscreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}};Fullscreen.prototype.fullScreen=function(){var _this=this;$(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg',function(){_this.core.$outer.toggleClass('qq-fullscreen-on')});this.core.$outer.find('.qq-fullscreen').on('click.lg',function(){if(!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement){_this.reuestFullscreen()}else{_this.exitFullscreen()}})};Fullscreen.prototype.destroy=function(){this.exitFullscreen();$(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg')};$.fn.QQ.modules.fullscreen=Fullscreen})(jQuery,window,document);(function($,window,document,undefined){'use strict';var defaults={autoplay:false,pause:5000,progressBar:true,fourceAutoplay:false,autoplayControls:true,appendAutoplayControlsTo:'.qq-toolbar'};var Autoplay=function(element){this.core=$(element).data('QQ');this.$el=$(element);if(this.core.$items.length<2){return false}this.core.s=$.extend({},defaults,this.core.s);this.interval=false;this.fromAuto=true;this.canceledOnTouch=false;this.fourceAutoplayTemp=this.core.s.fourceAutoplay;if(!this.core.doCss()){this.core.s.progressBar=false}this.init();return this};Autoplay.prototype.init=function(){var _this=this;if(_this.core.s.autoplayControls){_this.controls()}if(_this.core.s.progressBar){_this.core.$outer.find('.lg').append('
')}_this.progress();if(_this.core.s.autoplay){_this.startlAuto()}_this.$el.on('onDragstart.lg.tm touchstart.lg.tm',function(){if(_this.interval){_this.cancelAuto();_this.canceledOnTouch=true}});_this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm',function(){if(!_this.interval&&_this.canceledOnTouch){_this.startlAuto();_this.canceledOnTouch=false}})};Autoplay.prototype.progress=function(){var _this=this;var _$progressBar;var _$progress;_this.$el.on('onBeforeSlide.lg.tm',function(){if(_this.core.s.progressBar&&_this.fromAuto){_$progressBar=_this.core.$outer.find('.qq-progress-bar');_$progress=_this.core.$outer.find('.qq-progress');if(_this.interval){_$progress.removeAttr('style');_$progressBar.removeClass('qq-start');setTimeout(function(){_$progress.css('transition','width '+(_this.core.s.speed+_this.core.s.pause)+'ms ease 0s');_$progressBar.addClass('qq-start')},20)}}if(!_this.fromAuto&&!_this.core.s.fourceAutoplay){_this.cancelAuto()}_this.fromAuto=false})};Autoplay.prototype.controls=function(){var _this=this;var _html='';$(this.core.s.appendAutoplayControlsTo).append(_html);_this.core.$outer.find('.qq-autoplay-button').on('click.lg',function(){if($(_this.core.$outer).hasClass('qq-show-autoplay')){_this.cancelAuto();_this.core.s.fourceAutoplay=false}else{if(!_this.interval){_this.startlAuto();_this.core.s.fourceAutoplay=_this.fourceAutoplayTemp}}})};Autoplay.prototype.startlAuto=function(){var _this=this;_this.core.$outer.find('.qq-progress').css('transition','width '+(_this.core.s.speed+_this.core.s.pause)+'ms ease 0s');_this.core.$outer.addClass('qq-show-autoplay');_this.core.$outer.find('.qq-progress-bar').addClass('qq-start');_this.interval=setInterval(function(){if(_this.core.index+1<_this.core.$items.length){_this.core.index=_this.core.index}else{_this.core.index=-1}_this.core.index++;_this.fromAuto=true;_this.core.slide(_this.core.index,false,false)},_this.core.s.speed+_this.core.s.pause)};Autoplay.prototype.cancelAuto=function(){clearInterval(this.interval);this.interval=false;this.core.$outer.find('.qq-progress').removeAttr('style');this.core.$outer.removeClass('qq-show-autoplay');this.core.$outer.find('.qq-progress-bar').removeClass('qq-start')};Autoplay.prototype.destroy=function(){this.cancelAuto();this.core.$outer.find('.qq-progress-bar').remove()};$.fn.QQ.modules.autoplay=Autoplay})(jQuery,window,document);(function($,window,document,undefined){'use strict';var defaults={thumbnail:true,animateThumb:true,currentPagerPosition:'middle',thumbWidth:100,thumbContHeight:100,thumbMargin:5,exThumbImage:false,showThumbByDefault:true,toogleThumb:true,pullCaptionUp:true,enableThumbDrag:true,enableThumbSwipe:true,swipeThreshold:50,loadYoutubeThumbnail:true,youtubeThumbSize:1,loadVimeoThumbnail:true,vimeoThumbSize:'thumbnail_small',loadDailymotionThumbnail:true};var Thumbnail=function(element){this.core=$(element).data('QQ');this.core.s=$.extend({},defaults,this.core.s);this.$el=$(element);this.$thumbOuter=null;this.thumbOuterWidth=0;this.thumbTotalWidth=(this.core.$items.length*(this.core.s.thumbWidth+this.core.s.thumbMargin));this.thumbIndex=this.core.index;this.left=0;this.init();return this};Thumbnail.prototype.init=function(){if(this.core.s.thumbnail&&this.core.$items.length>1){if(this.core.s.showThumbByDefault){this.core.$outer.addClass('qq-thumb-open')}if(this.core.s.pullCaptionUp){this.core.$outer.addClass('qq-pull-caption-up')}this.build();if(this.core.s.animateThumb){if(this.core.s.enableThumbDrag&&!this.core.isTouch&&this.core.doCss()){this.enableThumbDrag()}if(this.core.s.enableThumbSwipe&&this.core.isTouch&&this.core.doCss()){this.enableThumbSwipe()}this.thumbClickable=false}else{this.thumbClickable=true}this.toogle();this.thumbkeyPress()}};Thumbnail.prototype.build=function(){var _this=this;var thumbList='';var vimeoErrorThumbSize='';var $thumb;var html='
'+'
'+'
'+'
';switch(this.core.s.vimeoThumbSize){case'thumbnail_large':vimeoErrorThumbSize='640';break;case'thumbnail_medium':vimeoErrorThumbSize='200x150';break;case'thumbnail_small':vimeoErrorThumbSize='100x75'}_this.core.$outer.addClass('qq-has-thumb');_this.core.$outer.find('.lg').append(html);_this.$thumbOuter=_this.core.$outer.find('.qq-thumb-outer');_this.thumbOuterWidth=_this.$thumbOuter.width();if(_this.core.s.animateThumb){_this.core.$outer.find('.qq-thumb').css({width:_this.thumbTotalWidth+'px',position:'relative'})}if(this.core.s.animateThumb){_this.$thumbOuter.css('height',_this.core.s.thumbContHeight+'px')}function getThumb(src,thumb,index){var isVideo=_this.core.isVideo(src,index)||{};var thumbImg;var vimeoId='';if(isVideo.youtube||isVideo.vimeo||isVideo.dailymotion){if(isVideo.youtube){if(_this.core.s.loadYoutubeThumbnail){thumbImg='//img.youtube.com/vi/'+isVideo.youtube[1]+'/'+_this.core.s.youtubeThumbSize+'.jpg'}else{thumbImg=thumb}}else if(isVideo.vimeo){if(_this.core.s.loadVimeoThumbnail){thumbImg='//i.vimeocdn.com/video/error_'+vimeoErrorThumbSize+'.jpg';vimeoId=isVideo.vimeo[1]}else{thumbImg=thumb}}else if(isVideo.dailymotion){if(_this.core.s.loadDailymotionThumbnail){thumbImg='//www.dailymotion.com/thumbnail/video/'+isVideo.dailymotion[1]}else{thumbImg=thumb}}}else{thumbImg=thumb}thumbList+='
';vimeoId=''}if(_this.core.s.dynamic){for(var i=0;i<_this.core.s.dynamicEl.length;i++){getThumb(_this.core.s.dynamicEl[i].src,_this.core.s.dynamicEl[i].thumb,i)}}else{_this.core.$items.each(function(i){if(!_this.core.s.exThumbImage){getThumb($(this).attr('href')||$(this).attr('data-src'),$(this).find('img').attr('src'),i)}else{getThumb($(this).attr('href')||$(this).attr('data-src'),$(this).attr(_this.core.s.exThumbImage),i)}})}_this.core.$outer.find('.qq-thumb').html(thumbList);$thumb=_this.core.$outer.find('.qq-thumb-item');$thumb.each(function(){var $this=$(this);var vimeoVideoId=$this.attr('data-vimeo-id');if(vimeoVideoId){$.getJSON('http://www.vimeo.com/api/v2/video/'+vimeoVideoId+'.json?callback=?',{format:'json'},function(data){$this.find('img').attr('src',data[0][_this.core.s.vimeoThumbSize])})}});$thumb.eq(_this.core.index).addClass('active');_this.core.$el.on('onBeforeSlide.lg.tm',function(){$thumb.removeClass('active');$thumb.eq(_this.core.index).addClass('active')});$thumb.on('click.lg touchend.lg',function(){var _$this=$(this);setTimeout(function(){if((_this.thumbClickable&&!_this.core.lgBusy)||!_this.core.doCss()){_this.core.index=_$this.index();_this.core.slide(_this.core.index,false,true)}},50)});_this.core.$el.on('onBeforeSlide.lg.tm',function(){_this.animateThumb(_this.core.index)});$(window).on('resize.lg.thumb orientationchange.lg.thumb',function(){setTimeout(function(){_this.animateThumb(_this.core.index);_this.thumbOuterWidth=_this.$thumbOuter.width()},200)})};Thumbnail.prototype.setTranslate=function(value){this.core.$outer.find('.qq-thumb').css({transform:'translate3d(-'+(value)+'px, 0px, 0px)'})};Thumbnail.prototype.animateThumb=function(index){var $thumb=this.core.$outer.find('.qq-thumb');if(this.core.s.animateThumb){var position;switch(this.core.s.currentPagerPosition){case'left':position=0;break;case'middle':position=(this.thumbOuterWidth/2)-(this.core.s.thumbWidth/2);break;case'right':position=this.thumbOuterWidth-this.core.s.thumbWidth}this.left=((this.core.s.thumbWidth+this.core.s.thumbMargin)*index-1)-position;if(this.left>(this.thumbTotalWidth-this.thumbOuterWidth)){this.left=this.thumbTotalWidth-this.thumbOuterWidth}if(this.left<0){this.left=0}if(this.core.lGalleryOn){if(!$thumb.hasClass('on')){this.core.$outer.find('.qq-thumb').css('transition-duration',this.core.s.speed+'ms')}if(!this.core.doCss()){$thumb.animate({left:-this.left+'px'},this.core.s.speed)}}else{if(!this.core.doCss()){$thumb.css('left',-this.left+'px')}}this.setTranslate(this.left)}};Thumbnail.prototype.enableThumbDrag=function(){var _this=this;var startCoords=0;var endCoords=0;var isDraging=false;var isMoved=false;var tempLeft=0;_this.$thumbOuter.addClass('qq-grab');_this.core.$outer.find('.qq-thumb').on('mousedown.lg.thumb',function(e){if(_this.thumbTotalWidth>_this.thumbOuterWidth){e.preventDefault();startCoords=e.pageX;isDraging=true;_this.core.$outer.scrollLeft+=1;_this.core.$outer.scrollLeft-=1;_this.thumbClickable=false;_this.$thumbOuter.removeClass('qq-grab').addClass('qq-grabbing')}});$(window).on('mousemove.lg.thumb',function(e){if(isDraging){tempLeft=_this.left;isMoved=true;endCoords=e.pageX;_this.$thumbOuter.addClass('qq-dragging');tempLeft=tempLeft-(endCoords-startCoords);if(tempLeft>(_this.thumbTotalWidth-_this.thumbOuterWidth)){tempLeft=_this.thumbTotalWidth-_this.thumbOuterWidth}if(tempLeft<0){tempLeft=0}_this.setTranslate(tempLeft)}});$(window).on('mouseup.lg.thumb',function(){if(isMoved){isMoved=false;_this.$thumbOuter.removeClass('qq-dragging');_this.left=tempLeft;if(Math.abs(endCoords-startCoords)<_this.core.s.swipeThreshold){_this.thumbClickable=true}}else{_this.thumbClickable=true}if(isDraging){isDraging=false;_this.$thumbOuter.removeClass('qq-grabbing').addClass('qq-grab')}})};Thumbnail.prototype.enableThumbSwipe=function(){var _this=this;var startCoords=0;var endCoords=0;var isMoved=false;var tempLeft=0;_this.core.$outer.find('.qq-thumb').on('touchstart.lg',function(e){if(_this.thumbTotalWidth>_this.thumbOuterWidth){e.preventDefault();startCoords=e.originalEvent.targetTouches[0].pageX;_this.thumbClickable=false}});_this.core.$outer.find('.qq-thumb').on('touchmove.lg',function(e){if(_this.thumbTotalWidth>_this.thumbOuterWidth){e.preventDefault();endCoords=e.originalEvent.targetTouches[0].pageX;isMoved=true;_this.$thumbOuter.addClass('qq-dragging');tempLeft=_this.left;tempLeft=tempLeft-(endCoords-startCoords);if(tempLeft>(_this.thumbTotalWidth-_this.thumbOuterWidth)){tempLeft=_this.thumbTotalWidth-_this.thumbOuterWidth}if(tempLeft<0){tempLeft=0}_this.setTranslate(tempLeft)}});_this.core.$outer.find('.qq-thumb').on('touchend.lg',function(){if(_this.thumbTotalWidth>_this.thumbOuterWidth){if(isMoved){isMoved=false;_this.$thumbOuter.removeClass('qq-dragging');if(Math.abs(endCoords-startCoords)<_this.core.s.swipeThreshold){_this.thumbClickable=true}_this.left=tempLeft}else{_this.thumbClickable=true}}else{_this.thumbClickable=true}})};Thumbnail.prototype.toogle=function(){var _this=this;if(_this.core.s.toogleThumb){_this.core.$outer.addClass('qq-can-toggle');_this.$thumbOuter.append('');_this.core.$outer.find('.qq-toogle-thumb').on('click.lg',function(){_this.core.$outer.toggleClass('qq-thumb-open')})}};Thumbnail.prototype.thumbkeyPress=function(){var _this=this;$(window).on('keydown.lg.thumb',function(e){if(e.keyCode===38){e.preventDefault();_this.core.$outer.addClass('qq-thumb-open')}else if(e.keyCode===40){e.preventDefault();_this.core.$outer.removeClass('qq-thumb-open')}})};Thumbnail.prototype.destroy=function(){if(this.core.s.thumbnail&&this.core.$items.length>1){$(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb');this.$thumbOuter.remove();this.core.$outer.removeClass('qq-has-thumb')}};$.fn.QQ.modules.Thumbnail=Thumbnail})(jQuery,window,document);(function($,window,document,undefined){'use strict';var defaults={hash:true};var Hash=function(element){this.core=$(element).data('QQ');this.core.s=$.extend({},defaults,this.core.s);if(this.core.s.hash){this.oldHash=window.location.hash;this.init()}return this};Hash.prototype.init=function(){var _this=this;var _hash;_this.core.$el.on('onAfterSlide.lg.tm',function(event,prevIndex,index){window.location.hash='QQ='+_this.core.s.galleryId+'&slide='+index});$(window).on('hashchange',function(){_hash=window.location.hash;var _idx=parseInt(_hash.split('&slide=')[1],10);if((_hash.indexOf('QQ='+_this.core.s.galleryId)>-1)){_this.core.slide(_idx)}else if(_this.core.lGalleryOn){_this.core.destroy()}})};Hash.prototype.destroy=function(){if(this.oldHash&&this.oldHash.indexOf('QQ='+this.core.s.galleryId)<0){window.location.hash=this.oldHash}else{if(history.pushState){history.pushState('',document.title,window.location.pathname+window.location.search)}else{window.location.hash=''}}};$.fn.QQ.modules.hash=Hash})(jQuery,window,document);(function($,window,document,undefined){'use strict';var defaults={videoMaxWidth:'855px',youtubePlayerParams:false,vimeoPlayerParams:false,dailymotionPlayerParams:false,videojs:false};var Video=function(element){this.core=$(element).data('QQ');this.$el=$(element);this.core.s=$.extend({},defaults,this.core.s);this.videoLoaded=false;this.init();return this};Video.prototype.init=function(){var _this=this;_this.core.$el.on('hasVideo.lg.tm',function(event,index,src,html){_this.core.$slide.eq(index).find('.qq-video').append(_this.loadVideo(src,'qq-object',true,index,html));if(html){if(_this.core.s.videojs){try{videojs(_this.core.$slide.eq(index).find('.qq-html5').get(0),{},function(){if(!_this.videoLoaded){this.play()}})}catch(e){console.error('Make sure you have included videojs')}}else{_this.core.$slide.eq(index).find('.qq-html5').get(0).play()}}});_this.core.$el.on('onAferAppendSlide.lg.tm',function(event,index){_this.core.$slide.eq(index).find('.qq-video-cont').css('max-width',_this.core.s.videoMaxWidth);_this.videoLoaded=true});var loadOnClick=function($el){if($el.find('.qq-object').hasClass('qq-has-poster')){if(!$el.hasClass('qq-has-video')){$el.addClass('qq-video-palying qq-has-video');var _src;var _html;var _loadVideo=function(_src,_html){$el.find('.qq-video').append(_this.loadVideo(_src,'',false,_this.core.index,_html));if(_html){if(_this.core.s.videojs){try{videojs(_this.core.$slide.eq(_this.core.index).find('.qq-html5').get(0),{},function(){this.play()})}catch(e){console.error('Make sure you have included videojs')}}else{_this.core.$slide.eq(_this.core.index).find('.qq-html5').get(0).play()}}};if(_this.core.s.dynamic){_src=_this.core.s.dynamicEl[_this.core.index].src;_html=_this.core.s.dynamicEl[_this.core.index].html;_loadVideo(_src,_html)}else{_src=_this.core.$items.eq(_this.core.index).attr('href')||_this.core.$items.eq(_this.core.index).attr('data-src');_html=_this.core.$items.eq(_this.core.index).attr('data-html');_loadVideo(_src,_html)}var $tempImg=$el.find('.qq-object');$el.find('.qq-video').append($tempImg);if(!$el.find('.qq-video-object').hasClass('qq-html5')){$el.removeClass('qq-complete');$el.find('.qq-video-object').on('load.lg error.lg',function(){$el.addClass('qq-complete')})}}else{var youtubePlayer=$el.find('.qq-youtube').get(0);var vimeoPlayer=$el.find('.qq-vimeo').get(0);var dailymotionPlayer=$el.find('.qq-dailymotion').get(0);var html5Player=$el.find('.qq-html5').get(0);if(youtubePlayer){youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}','*')}else if(vimeoPlayer){try{$f(vimeoPlayer).api('play')}catch(e){console.error('Make sure you have included froogaloop2 js')}}else if(dailymotionPlayer){dailymotionPlayer.contentWindow.postMessage('play','*')}else if(html5Player){if(_this.core.s.videojs){try{videojs(html5Player).play()}catch(e){console.error('Make sure you have included videojs')}}else{html5Player.play()}}$el.addClass('qq-video-palying')}}};if(_this.core.doCss()&&_this.core.$items.length>1&&((_this.core.s.enableSwipe&&_this.core.isTouch)||(_this.core.s.enableDrag&&!_this.core.isTouch))){_this.core.$el.on('onSlideClick.lg.tm',function(){var $el=_this.core.$slide.eq(_this.core.index);loadOnClick($el)})}else{_this.core.$slide.on('click.lg',function(){loadOnClick($(this))})}_this.core.$el.on('onBeforeSlide.lg.tm',function(event,prevIndex){var $videoSlide=_this.core.$slide.eq(prevIndex);var youtubePlayer=$videoSlide.find('.qq-youtube').get(0);var vimeoPlayer=$videoSlide.find('.qq-vimeo').get(0);var dailymotionPlayer=$videoSlide.find('.qq-dailymotion').get(0);var html5Player=$videoSlide.find('.qq-html5').get(0);if(youtubePlayer){youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}','*')}else if(vimeoPlayer){try{$f(vimeoPlayer).api('pause')}catch(e){console.error('Make sure you have included froogaloop2 js')}}else if(dailymotionPlayer){dailymotionPlayer.contentWindow.postMessage('pause','*')}else if(html5Player){if(_this.core.s.videojs){try{videojs(html5Player).pause()}catch(e){console.error('Make sure you have included videojs')}}else{html5Player.pause()}}});_this.core.$el.on('onAfterSlide.lg.tm',function(event,prevIndex){_this.core.$slide.eq(prevIndex).removeClass('qq-video-palying')})};Video.prototype.loadVideo=function(src,addClass,noposter,index,html){var video='';var autoplay=1;var a='';var isVideo=this.core.isVideo(src,index)||{};if(noposter){if(this.videoLoaded){autoplay=0}else{autoplay=1}}if(isVideo.youtube){a='?wmode=opaque&autoplay='+autoplay+'&enablejsapi=1';if(this.core.s.youtubePlayerParams){a=a+'&'+$.param(this.core.s.youtubePlayerParams)}video=''}else if(isVideo.vimeo){a='?autoplay='+autoplay+'&api=1';if(this.core.s.vimeoPlayerParams){a=a+'&'+$.param(this.core.s.vimeoPlayerParams)}video=''}else if(isVideo.dailymotion){a='?wmode=opaque&autoplay='+autoplay+'&api=postMessage';if(this.core.s.dailymotionPlayerParams){a=a+'&'+$.param(this.core.s.dailymotionPlayerParams)}video=''}else if(isVideo.html5){var fL=html.substring(0,1);if(fL==='.'||fL==='#'){html=$(html).html()}video=html}return video};Video.prototype.destroy=function(){this.videoLoaded=false};$.fn.QQ.modules.video=Video})(jQuery,window,document);(function($,window,document,undefined){'use strict';var defaults={pager:false};var Pager=function(element){this.core=$(element).data('QQ');this.$el=$(element);this.core.s=$.extend({},defaults,this.core.s);if(this.core.s.pager&&this.core.$items.length>1){this.init()}return this};Pager.prototype.init=function(){var _this=this;var pagerList='';var $pagerCont;var $pagerOuter;var timeout;_this.core.$outer.find('.lg').append('
');if(_this.core.s.dynamic){for(var i=0;i<_this.core.s.dynamicEl.length;i++){pagerList+='
'}}else{_this.core.$items.each(function(){if(!_this.core.s.exThumbImage){pagerList+='
'}else{pagerList+='
'}})}$pagerOuter=_this.core.$outer.find('.qq-pager-outer');$pagerOuter.html(pagerList);$pagerCont=_this.core.$outer.find('.qq-pager-cont');$pagerCont.on('click.lg touchend.lg',function(){var _$this=$(this);_this.core.index=_$this.index();_this.core.slide(_this.core.index,false,false)});$pagerOuter.on('mouseover.lg',function(){clearTimeout(timeout);$pagerOuter.addClass('qq-pager-hover')});$pagerOuter.on('mouseout.lg',function(){timeout=setTimeout(function(){$pagerOuter.removeClass('qq-pager-hover')})});_this.core.$el.on('onBeforeSlide.lg.tm',function(e,prevIndex,index){$pagerCont.removeClass('qq-pager-active');$pagerCont.eq(index).addClass('qq-pager-active')})};Pager.prototype.destroy=function(){};$.fn.QQ.modules.pager=Pager})(jQuery,window,document);window.matchMedia||(window.matchMedia=function(){"use strict";var a=window.styleMedia||window.media;if(!a){var b=document.createElement("style"),c=document.getElementsByTagName("script")[0],d=null;b.type="text/css",b.id="matchmediajs-test",c.parentNode.insertBefore(b,c),d="getComputedStyle"in window&&window.getComputedStyle(b,null)||b.currentStyle,a={matchMedium:function(a){var c="@media "+a+"{ #matchmediajs-test { width: 1px; } }";return b.styleSheet?b.styleSheet.cssText=c:b.textContent=c,"1px"===d.width}}}return function(b){return{matches:a.matchMedium(b||"all"),media:b||"all"}}}()),function(a,b,c){"use strict";function d(b){"object"==typeof module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd&&define("picturefill",function(){return b}),"object"==typeof a&&(a.picturefill=b)}function e(a){var b,c,d,e,f,i=a||{};b=i.elements||g.getAllElements();for(var j=0,k=b.length;k>j;j++)if(c=b[j],d=c.parentNode,e=void 0,f=void 0,"IMG"===c.nodeName.toUpperCase()&&(c[g.ns]||(c[g.ns]={}),i.reevaluate||!c[g.ns].evaluated)){if(d&&"PICTURE"===d.nodeName.toUpperCase()){if(g.removeVideoShim(d),e=g.getMatch(c,d),e===!1)continue}else e=void 0;(d&&"PICTURE"===d.nodeName.toUpperCase()||!g.sizesSupported&&c.srcset&&h.test(c.srcset))&&g.dodgeSrcset(c),e?(f=g.processSourceSet(e),g.applyBestCandidate(f,c)):(f=g.processSourceSet(c),(void 0===c.srcset||c[g.ns].srcset)&&g.applyBestCandidate(f,c)),c[g.ns].evaluated=!0}}function f(){function c(){clearTimeout(d),d=setTimeout(h,60)}g.initTypeDetects(),e();var d,f=setInterval(function(){return e(),/^loaded|^i|^c/.test(b.readyState)?void clearInterval(f):void 0},250),h=function(){e({reevaluate:!0})};a.addEventListener?a.addEventListener("resize",c,!1):a.attachEvent&&a.attachEvent("onresize",c)}if(a.HTMLPictureElement)return void d(function(){});b.createElement("picture");var g=a.picturefill||{},h=/\s+\+?\d+(e\d+)?w/;g.ns="picturefill",function(){g.srcsetSupported="srcset"in c,g.sizesSupported="sizes"in c,g.curSrcSupported="currentSrc"in c}(),g.trim=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},g.makeUrl=function(){var a=b.createElement("a");return function(b){return a.href=b,a.href}}(),g.restrictsMixedContent=function(){return"https:"===a.location.protocol},g.matchesMedia=function(b){return a.matchMedia&&a.matchMedia(b).matches},g.getDpr=function(){return a.devicePixelRatio||1},g.getWidthFromLength=function(a){var c;if(!a||a.indexOf("%")>-1!=!1||!(parseFloat(a)>0||a.indexOf("calc(")>-1))return!1;a=a.replace("vw","%"),g.lengthEl||(g.lengthEl=b.createElement("div"),g.lengthEl.style.cssText="border:0;display:block;font-size:1em;left:0;margin:0;padding:0;position:absolute;visibility:hidden",g.lengthEl.className="helper-from-picturefill-js"),g.lengthEl.style.width="0px";try{g.lengthEl.style.width=a}catch(d){}return b.body.appendChild(g.lengthEl),c=g.lengthEl.offsetWidth,0>=c&&(c=!1),b.body.removeChild(g.lengthEl),c},g.detectTypeSupport=function(b,c){var d=new a.Image;return d.onerror=function(){g.types[b]=!1,e()},d.onload=function(){g.types[b]=1===d.width,e()},d.src=c,"pending"},g.types=g.types||{},g.initTypeDetects=function(){g.types["image/jpeg"]=!0,g.types["image/gif"]=!0,g.types["image/png"]=!0,g.types["image/svg+xml"]=b.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1"),g.types["image/webp"]=g.detectTypeSupport("image/webp","data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=")},g.verifyTypeSupport=function(a){var b=a.getAttribute("type");if(null===b||""===b)return!0;var c=g.types[b];return"string"==typeof c&&"pending"!==c?(g.types[b]=g.detectTypeSupport(b,c),"pending"):"function"==typeof c?(c(),"pending"):c},g.parseSize=function(a){var b=/(\([^)]+\))?\s*(.+)/g.exec(a);return{media:b&&b[1],length:b&&b[2]}},g.findWidthFromSourceSize=function(c){for(var d,e=g.trim(c).split(/\s*,\s*/),f=0,h=e.length;h>f;f++){var i=e[f],j=g.parseSize(i),k=j.length,l=j.media;if(k&&(!l||g.matchesMedia(l))&&(d=g.getWidthFromLength(k)))break}return d||Math.max(a.innerWidth||0,b.documentElement.clientWidth)},g.parseSrcset=function(a){for(var b=[];""!==a;){a=a.replace(/^\s+/g,"");var c,d=a.search(/\s/g),e=null;if(-1!==d){c=a.slice(0,d);var f=c.slice(-1);if((","===f||""===c)&&(c=c.replace(/,+$/,""),e=""),a=a.slice(d+1),null===e){var g=a.indexOf(",");-1!==g?(e=a.slice(0,g),a=a.slice(g+1)):(e=a,a="")}}else c=a,a="";(c||e)&&b.push({url:c,descriptor:e})}return b},g.parseDescriptor=function(a,b){var c,d=b||"100vw",e=a&&a.replace(/(^\s+|\s+$)/g,""),f=g.findWidthFromSourceSize(d);if(e)for(var h=e.split(" "),i=h.length-1;i>=0;i--){var j=h[i],k=j&&j.slice(j.length-1);if("h"!==k&&"w"!==k||g.sizesSupported){if("x"===k){var l=j&&parseFloat(j,10);c=l&&!isNaN(l)?l:1}}else c=parseFloat(parseInt(j,10)/f)}return c||1},g.getCandidatesFromSourceSet=function(a,b){for(var c=g.parseSrcset(a),d=[],e=0,f=c.length;f>e;e++){var h=c[e];d.push({url:h.url,resolution:g.parseDescriptor(h.descriptor,b)})}return d},g.dodgeSrcset=function(a){a.srcset&&(a[g.ns].srcset=a.srcset,a.srcset="",a.setAttribute("data-pfsrcset",a[g.ns].srcset))},g.processSourceSet=function(a){var b=a.getAttribute("srcset"),c=a.getAttribute("sizes"),d=[];return"IMG"===a.nodeName.toUpperCase()&&a[g.ns]&&a[g.ns].srcset&&(b=a[g.ns].srcset),b&&(d=g.getCandidatesFromSourceSet(b,c)),d},g.backfaceVisibilityFix=function(a){var b=a.style||{},c="webkitBackfaceVisibility"in b,d=b.zoom;c&&(b.zoom=".999",c=a.offsetWidth,b.zoom=d)},g.setIntrinsicSize=function(){var c={},d=function(a,b,c){b&&a.setAttribute("width",parseInt(b/c,10))};return function(e,f){var h;e[g.ns]&&!a.pfStopIntrinsicSize&&(void 0===e[g.ns].dims&&(e[g.ns].dims=e.getAttribute("width")||e.getAttribute("height")),e[g.ns].dims||(f.url in c?d(e,c[f.url],f.resolution):(h=b.createElement("img"),h.onload=function(){if(c[f.url]=h.width,!c[f.url])try{b.body.appendChild(h),c[f.url]=h.width||h.offsetWidth,b.body.removeChild(h)}catch(a){}e.src===f.url&&d(e,c[f.url],f.resolution),e=null,h.onload=null,h=null},h.src=f.url)))}}(),g.applyBestCandidate=function(a,b){var c,d,e;a.sort(g.ascendingSort),d=a.length,e=a[d-1];for(var f=0;d>f;f++)if(c=a[f],c.resolution>=g.getDpr()){e=c;break}e&&(e.url=g.makeUrl(e.url),b.src!==e.url&&(g.restrictsMixedContent()&&"http:"===e.url.substr(0,"http:".length).toLowerCase()?void 0!==window.console&&console.warn("Blocked mixed content image "+e.url):(b.src=e.url,g.curSrcSupported||(b.currentSrc=b.src),g.backfaceVisibilityFix(b))),g.setIntrinsicSize(b,e))},g.ascendingSort=function(a,b){return a.resolution-b.resolution},g.removeVideoShim=function(a){var b=a.getElementsByTagName("video");if(b.length){for(var c=b[0],d=c.getElementsByTagName("source");d.length;)a.insertBefore(d[0],c);c.parentNode.removeChild(c)}},g.getAllElements=function(){for(var a=[],c=b.getElementsByTagName("img"),d=0,e=c.length;e>d;d++){var f=c[d];("PICTURE"===f.parentNode.nodeName.toUpperCase()||null!==f.getAttribute("srcset")||f[g.ns]&&null!==f[g.ns].srcset)&&a.push(f)}return a},g.getMatch=function(a,b){for(var c,d=b.childNodes,e=0,f=d.length;f>e;e++){var h=d[e];if(1===h.nodeType){if(h===a)return c;if("SOURCE"===h.nodeName.toUpperCase()){null!==h.getAttribute("src")&&void 0!==typeof console&&console.warn("The `src` attribute is invalid on `picture` `source` element; instead, use `srcset`.");var i=h.getAttribute("media");if(h.getAttribute("srcset")&&(!i||g.matchesMedia(i))){var j=g.verifyTypeSupport(h);if(j===!0){c=h;break}if("pending"===j)return!1}}}}return c},f(),e._=g,d(e)}(window,window.document,new window.Image); // vimeo thingie var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f); return 0 -1){ var dataName = self._helpers._camelCase(name.substring(5,name.length)); target.dataset[dataName] = val; } } } if(target.mixParent === undfu229822){ target.mixParent = self._id; } } if( (self._$targets.length && init) || (!self._origOrder.length && self._$targets.length) ){ self._origOrder = []; for(var i = 0; i < self._$targets.length; i++){ var target = self._$targets[i]; self._origOrder.push(target); } } self._execAction('_refresh', 1, arguments); }, /** * Bind Handlers * @since 2.0.0 */ _bindHandlers: function(){ var self = this, filters = $.QFluidPu94u229822 .prototype._bound._filter, sorts = $.QFluidPu94u229822 .prototype._bound._sort; self._execAction('_bindHandlers', 0); if(self.controls.live){ self._$body .on('click.QooQeeFPRu229822.'+self._id, self.selectors.sort, function(){ self._processClick($(this), 'sort'); }) .on('click.QooQeeFPRu229822.'+self._id, self.selectors.filter, function(){ self._processClick($(this), 'filter'); }); } else { self._$sortButtons = $(self.selectors.sort); self._$filterButtons = $(self.selectors.filter); self._$sortButtons.on('click.QooQeeFPRu229822.'+self._id, function(){ self._processClick($(this), 'sort'); }); self._$filterButtons.on('click.QooQeeFPRu229822.'+self._id, function(){ self._processClick($(this), 'filter'); }); } filters[self.selectors.filter] = (filters[self.selectors.filter] === undfu229822) ? 1 : filters[self.selectors.filter] + 1; sorts[self.selectors.sort] = (sorts[self.selectors.sort] === undfu229822) ? 1 : sorts[self.selectors.sort] + 1; self._execAction('_bindHandlers', 1); }, /** * Process Click * @since 2.0.0 * @param {object} $button * @param {string} type */ _processClick: function($button, type){ var self = this, trackClick = function($button, type, off){ var proto = $.QFluidPu94u229822 .prototype; proto._handled['_'+type][self.selectors[type]] = (proto._handled['_'+type][self.selectors[type]] === undfu229822) ? 1 : proto._handled['_'+type][self.selectors[type]] + 1; if(proto._handled['_'+type][self.selectors[type]] === proto._bound['_'+type][self.selectors[type]]){ $button[(off ? 'remove' : 'add')+'Class'](self.controls.activeClass); delete proto._handled['_'+type][self.selectors[type]]; } }; self._execAction('_processClick', 0, arguments); if(!self._mixing || (self.animation.queue && self._queue.length < self.animation.queueLimit)){ self._clicking = true; if(type === 'sort'){ var sort = $button.attr('data-sort'); if(!$button.hasClass(self.controls.activeClass) || sort.indexOf('random') > -1){ $(self.selectors.sort).removeClass(self.controls.activeClass); trackClick($button, type); self.sort(sort); } } if(type === 'filter') { var filter = $button.attr('data-filter'), ndx, seperator = self.controls.toggleLogic === 'or' ? ',' : ''; if(!self.controls.toggleFilterButtons){ if(!$button.hasClass(self.controls.activeClass)){ $(self.selectors.filter).removeClass(self.controls.activeClass); trackClick($button, type); self.filter(filter); } } else { self._buildToggleArray(); if(!$button.hasClass(self.controls.activeClass)){ trackClick($button, type); self._toggleArray.push(filter); } else { trackClick($button, type, true); ndx = self._toggleArray.indexOf(filter); self._toggleArray.splice(ndx, 1); } self._toggleArray = $.grep(self._toggleArray,function(n){return(n);}); self._toggleString = self._toggleArray.join(seperator); self.filter(self._toggleString); } } self._execAction('_processClick', 1, arguments); } else { if(typeof self.callbacks.onMixBusy === 'function'){ self.callbacks.onMixBusy.call(self._domNode, self._state, self); } self._execAction('_processClickBusy', 1, arguments); } }, /** * Build Toggle Array * @since 2.0.0 */ _buildToggleArray: function(){ var self = this, activeFilter = self._activeFilter.replace(/\s/g, ''); self._execAction('_buildToggleArray', 0, arguments); if(self.controls.toggleLogic === 'or'){ self._toggleArray = activeFilter.split(','); } else { self._toggleArray = activeFilter.split('.'); !self._toggleArray[0] && self._toggleArray.shift(); for(var i = 0, filter; filter = self._toggleArray[i]; i++){ self._toggleArray[i] = '.'+filter; } } self._execAction('_buildToggleArray', 1, arguments); }, /** * Update Controls * @since 2.0.0 * @param {object} command * @param {boolean} multi */ _updateControls: function(command, multi){ var self = this, output = { filter: command.filter, sort: command.sort }, update = function($el, filter){ try { (multi && type === 'filter' && !(output.filter === 'none' || output.filter === '')) ? $el.filter(filter).addClass(self.controls.activeClass) : $el.removeClass(self.controls.activeClass).filter(filter).addClass(self.controls.activeClass); } catch(e) {} }, type = 'filter', $el = null; self._execAction('_updateControls', 0, arguments); (command.filter === undfu229822) && (output.filter = self._activeFilter); (command.sort === undfu229822) && (output.sort = self._activeSort); (output.filter === self.selectors.target) && (output.filter = 'all'); for(var i = 0; i < 2; i++){ $el = self.controls.live ? $(self.selectors[type]) : self['_$'+type+'Buttons']; $el && update($el, '[data-'+type+'="'+output[type]+'"]'); type = 'sort'; } self._execAction('_updateControls', 1, arguments); }, /** * Filter (private) * @since 2.0.0 */ _filter: function(){ var self = this; self._execAction('_filter', 0); for(var i = 0; i < self._$targets.length; i++){ var $target = $(self._$targets[i]); if($target.is(self._activeFilter)){ self._$show = self._$show.add($target); } else { self._$hide = self._$hide.add($target); } } self._execAction('_filter', 1); }, /** * Sort (private) * @since 2.0.0 */ _sort: function(){ var self = this, arrayShuffle = function(oldArray){ var newArray = oldArray.slice(), len = newArray.length, i = len; while(i--){ var p = parseInt(Math.random()*len); var t = newArray[i]; newArray[i] = newArray[p]; newArray[p] = t; }; return newArray; }; self._execAction('_sort', 0); self._startOrder = []; for(var i = 0; i < self._$targets.length; i++){ var target = self._$targets[i]; self._startOrder.push(target); } switch(self._newSort[0].sortBy){ case 'default': self._newOrder = self._origOrder; break; case 'random': self._newOrder = arrayShuffle(self._startOrder); break; case 'custom': self._newOrder = self._newSort[0].order; break; default: self._newOrder = self._startOrder.concat().sort(function(a, b){ return self._compare(a, b); }); } self._execAction('_sort', 1); }, /** * Compare Algorithm * @since 2.0.0 * @param {string|number} a * @param {string|number} b * @param {number} depth (recursion) * @return {number} */ _compare: function(a, b, depth){ depth = depth ? depth : 0; var self = this, order = self._newSort[depth].order, getData = function(el){ return el.dataset[self._newSort[depth].sortBy] || 0; }, attrA = isNaN(getData(a) * 1) ? getData(a).toLowerCase() : getData(a) * 1, attrB = isNaN(getData(b) * 1) ? getData(b).toLowerCase() : getData(b) * 1; if(attrA < attrB) return order === 'asc' ? -1 : 1; if(attrA > attrB) return order === 'asc' ? 1 : -1; if(attrA === attrB && self._newSort.length > depth+1) return self._compare(a, b, depth+1); return 0; }, /** * Print Sort * @since 2.0.0 * @param {boolean} reset */ _printSort: function(reset){ var self = this, order = reset ? self._startOrder : self._newOrder, targets = self._$parent[0].querySelectorAll(self.selectors.target), nextSibling = targets.length ? targets[targets.length -1].nextElementSibling : null, frag = document.createDocumentFragment(); self._execAction('_printSort', 0, arguments); for(var i = 0; i < targets.length; i++){ var target = targets[i], whiteSpace = target.nextSibling; if(target.style.position === 'absolute') continue; if(whiteSpace && whiteSpace.nodeName === '#text'){ self._$parent[0].removeChild(whiteSpace); } self._$parent[0].removeChild(target); } for(var i = 0; i < order.length; i++){ var el = order[i]; if(self._newSort[0].sortBy === 'default' && self._newSort[0].order === 'desc' && !reset){ var firstChild = frag.firstChild; frag.insertBefore(el, firstChild); frag.insertBefore(document.createTextNode(' '), el); } else { frag.appendChild(el); frag.appendChild(document.createTextNode(' ')); } } nextSibling ? self._$parent[0].insertBefore(frag, nextSibling) : self._$parent[0].appendChild(frag); self._execAction('_printSort', 1, arguments); }, /** * Parse Sort * @since 2.0.0 * @param {string} sortString * @return {array} newSort */ _parseSort: function(sortString){ var self = this, rules = typeof sortString === 'string' ? sortString.split(' ') : [sortString], newSort = []; for(var i = 0; i < rules.length; i++){ var rule = typeof sortString === 'string' ? rules[i].split(':') : ['custom', rules[i]], ruleObj = { sortBy: self._helpers._camelCase(rule[0]), order: rule[1] || 'asc' }; newSort.push(ruleObj); if(ruleObj.sortBy === 'default' || ruleObj.sortBy === 'random') break; } return self._execFilter('_parseSort', newSort, arguments); }, /** * Parse Effects * @since 2.0.0 * @return {object} effects */ _parseEffects: function(){ var self = this, effects = { opacity: '', transformIn: '', transformOut: '', filter: '' }, parse = function(effect, extract, reverse){ if(self.animation.effects.indexOf(effect) > -1){ if(extract){ var propIndex = self.animation.effects.indexOf(effect+'('); if(propIndex > -1){ var str = self.animation.effects.substring(propIndex), match = /\(([^)]+)\)/.exec(str), val = match[1]; return {val: val}; } } return true; } else { return false; } }, negate = function(value, invert){ if(invert){ return value.charAt(0) === '-' ? value.substr(1, value.length) : '-'+value; } else { return value; } }, buildTransform = function(key, invert){ var transforms = [ ['scale', '.01'], ['translateX', '20px'], ['translateY', '20px'], ['translateZ', '20px'], ['rotateX', '90deg'], ['rotateY', '90deg'], ['rotateZ', '180deg'], ]; for(var i = 0; i < transforms.length; i++){ var prop = transforms[i][0], def = transforms[i][1], inverted = invert && prop !== 'scale'; effects[key] += parse(prop) ? prop+'('+negate(parse(prop, true).val || def, inverted)+') ' : ''; } }; effects.opacity = parse('fade') ? parse('fade',true).val || '0' : '1'; buildTransform('transformIn'); self.animation.reverseOut ? buildTransform('transformOut', true) : (effects.transformOut = effects.transformIn); effects.transition = {}; effects.transition = self._getPrefixedCSS('transition','all '+self.animation.duration+'ms '+self.animation.easing+', opacity '+self.animation.duration+'ms linear'); self.animation.stagger = parse('stagger') ? true : false; self.animation.staggerDuration = parseInt(parse('stagger') ? (parse('stagger',true).val ? parse('stagger',true).val : 100) : 100); return self._execFilter('_parseEffects', effects); }, /** * Build State * @since 2.0.0 * @param {boolean} future * @return {object} futureState */ _buildState: function(future){ var self = this, state = {}; self._execAction('_buildState', 0); state = { activeFilter: self._activeFilter === '' ? 'none' : self._activeFilter, activeSort: future && self._newSortString ? self._newSortString : self._activeSort, fail: !self._$show.length && self._activeFilter !== '', $targets: self._$targets, $show: self._$show, $hide: self._$hide, totalTargets: self._$targets.length, totalShow: self._$show.length, totalHide: self._$hide.length, display: future && self._newDisplay ? self._newDisplay : self.layout.display }; if(future){ return self._execFilter('_buildState', state); } else { self._state = state; self._execAction('_buildState', 1); } }, /** * Go Mix * @since 2.0.0 * @param {boolean} animate */ _goMix: function(animate){ var self = this, phase1 = function(){ if(self._chrome && (self._chrome === 31)){ chromeFix(self._$parent[0]); } self._setInter(); phase2(); }, phase2 = function(){ var scrollTop = window.pageYOffset, scrollLeft = window.pageXOffset, docHeight = document.documentElement.scrollHeight; self._getInterMixData(); self._setFinal(); self._getFinalMixData(); (window.pageYOffset !== scrollTop) && window.scrollTo(scrollLeft, scrollTop); self._prepTargets(); if(window.requestAnimationFrame){ requestAnimationFrame(phase3); } else { setTimeout(function(){ phase3(); },20); } }, phase3 = function(){ self._animateTargets(); if(self._targetsBound === 0){ self._cleanUp(); } }, chromeFix = function(grid){ var parent = grid.parentElement, placeholder = document.createElement('div'), frag = document.createDocumentFragment(); parent.insertBefore(placeholder, grid); frag.appendChild(grid); parent.replaceChild(grid, placeholder); }, futureState = self._buildState(true); self._execAction('_goMix', 0, arguments); !self.animation.duration && (animate = false); self._mixing = true; self._$container.removeClass(self.layout.containerClassFail); if(typeof self.callbacks.onMixStart === 'function'){ self.callbacks.onMixStart.call(self._domNode, self._state, futureState, self); } self._$container.trigger('mixStart', [self._state, futureState, self]); self._getOrigMixData(); if(animate && !self._suckMode){ window.requestAnimationFrame ? requestAnimationFrame(phase1) : phase1(); } else { self._cleanUp(); } self._execAction('_goMix', 1, arguments); }, /** * Get Target Data * @since 2.0.0 */ _getTargetData: function(el, stage){ var self = this, elStyle; el.dataset[stage+'PosX'] = el.offsetLeft; el.dataset[stage+'PosY'] = el.offsetTop; if(self.animation.animateResizeTargets){ elStyle = !self._suckMode ? window.getComputedStyle(el) : { marginBottom: '', marginRight: '' }; el.dataset[stage+'MarginBottom'] = parseInt(elStyle.marginBottom); el.dataset[stage+'MarginRight'] = parseInt(elStyle.marginRight); el.dataset[stage+'Width'] = el.offsetWidth; el.dataset[stage+'Height'] = el.offsetHeight; } }, /** * Get Original Mix Data * @since 2.0.0 */ _getOrigMixData: function(){ var self = this, parentStyle = !self._suckMode ? window.getComputedStyle(self._$parent[0]) : {boxSizing: ''}, parentBS = parentStyle.boxSizing || parentStyle[self._vendor+'BoxSizing']; self._incPadding = (parentBS === 'border-box'); self._execAction('_getOrigMixData', 0); !self._suckMode && (self.effects = self._parseEffects()); self._$toHide = self._$hide.filter(':visible'); self._$toShow = self._$show.filter(':hidden'); self._$pre = self._$targets.filter(':visible'); self._startHeight = self._incPadding ? self._$parent.outerHeight() : self._$parent.height(); for(var i = 0; i < self._$pre.length; i++){ var el = self._$pre[i]; self._getTargetData(el, 'orig'); } self._execAction('_getOrigMixData', 1); }, /** * Set Intermediate Positions * @since 2.0.0 */ _setInter: function(){ var self = this; self._execAction('_setInter', 0); if(self._changingLayout && self.animation.animateChangeLayout){ self._$toShow.css('display',self._newDisplay); if(self._changingClass){ self._$container .removeClass(self.layout.containerClass) .addClass(self._newClass); } } else { self._$toShow.css('display', self.layout.display); } self._execAction('_setInter', 1); }, /** * Get Intermediate Mix Data * @since 2.0.0 */ _getInterMixData: function(){ var self = this; self._execAction('_getInterMixData', 0); for(var i = 0; i < self._$toShow.length; i++){ var el = self._$toShow[i]; self._getTargetData(el, 'inter'); } for(var i = 0; i < self._$pre.length; i++){ var el = self._$pre[i]; self._getTargetData(el, 'inter'); } self._execAction('_getInterMixData', 1); }, /** * Set Final Positions * @since 2.0.0 */ _setFinal: function(){ var self = this; self._execAction('_setFinal', 0); self._sorting && self._printSort(); self._$toHide.removeStyle('display'); if(self._changingLayout && self.animation.animateChangeLayout){ self._$pre.css('display',self._newDisplay); } self._execAction('_setFinal', 1); }, /** * Get Final Mix Data * @since 2.0.0 */ _getFinalMixData: function(){ var self = this; self._execAction('_getFinalMixData', 0); for(var i = 0; i < self._$toShow.length; i++){ var el = self._$toShow[i]; self._getTargetData(el, 'final'); } for(var i = 0; i < self._$pre.length; i++){ var el = self._$pre[i]; self._getTargetData(el, 'final'); } self._newHeight = self._incPadding ? self._$parent.outerHeight() : self._$parent.height(); self._sorting && self._printSort(true); self._$toShow.removeStyle('display'); self._$pre.css('display',self.layout.display); if(self._changingClass && self.animation.animateChangeLayout){ self._$container .removeClass(self._newClass) .addClass(self.layout.containerClass); } self._execAction('_getFinalMixData', 1); }, /** * Prepare Targets * @since 2.0.0 */ _prepTargets: function(){ var self = this, transformCSS = { _in: self._getPrefixedCSS('transform', self.effects.transformIn), _out: self._getPrefixedCSS('transform', self.effects.transformOut) }; self._execAction('_prepTargets', 0); if(self.animation.animateResizeContainer){ self._$parent.css('height',self._startHeight+'px'); } for(var i = 0; i < self._$toShow.length; i++){ var el = self._$toShow[i], $el = $(el); el.style.opacity = self.effects.opacity; el.style.display = (self._changingLayout && self.animation.animateChangeLayout) ? self._newDisplay : self.layout.display; $el.css(transformCSS._in); if(self.animation.animateResizeTargets){ el.style.width = el.dataset.finalWidth+'px'; el.style.height = el.dataset.finalHeight+'px'; el.style.marginRight = -(el.dataset.finalWidth - el.dataset.interWidth) + (el.dataset.finalMarginRight * 1)+'px'; el.style.marginBottom = -(el.dataset.finalHeight - el.dataset.interHeight) + (el.dataset.finalMarginBottom * 1)+'px'; } } for(var i = 0; i < self._$pre.length; i++){ var el = self._$pre[i], $el = $(el), translate = { x: el.dataset.origPosX - el.dataset.interPosX, y: el.dataset.origPosY - el.dataset.interPosY }, transformCSS = self._getPrefixedCSS('transform','translate('+translate.x+'px,'+translate.y+'px)'); $el.css(transformCSS); if(self.animation.animateResizeTargets){ el.style.width = el.dataset.origWidth+'px'; el.style.height = el.dataset.origHeight+'px'; if(el.dataset.origWidth - el.dataset.finalWidth){ el.style.marginRight = -(el.dataset.origWidth - el.dataset.interWidth) + (el.dataset.origMarginRight * 1)+'px'; } if(el.dataset.origHeight - el.dataset.finalHeight){ el.style.marginBottom = -(el.dataset.origHeight - el.dataset.interHeight) + (el.dataset.origMarginBottom * 1) +'px'; } } } self._execAction('_prepTargets', 1); }, /** * Animate Targets * @since 2.0.0 */ _animateTargets: function(){ var self = this; self._execAction('_animateTargets', 0); self._targetsDone = 0; self._targetsBound = 0; self._$parent .css(self._getPrefixedCSS('perspective', self.animation.perspectiveDistance+'px')) .css(self._getPrefixedCSS('perspective-origin', self.animation.perspectiveOrigin)); if(self.animation.animateResizeContainer){ self._$parent .css(self._getPrefixedCSS('transition','height '+self.animation.duration+'ms ease')) .css('height',self._newHeight+'px'); } for(var i = 0; i < self._$toShow.length; i++){ var el = self._$toShow[i], $el = $(el), translate = { x: el.dataset.finalPosX - el.dataset.interPosX, y: el.dataset.finalPosY - el.dataset.interPosY }, delay = self._getDelay(i), toShowCSS = {}; el.style.opacity = ''; for(var j = 0; j < 2; j++){ var a = j === 0 ? a = self._prefix : ''; if(self._ff && self._ff <= 20){ toShowCSS[a+'transition-property'] = 'all'; toShowCSS[a+'transition-timing-function'] = self.animation.easing+'ms'; toShowCSS[a+'transition-duration'] = self.animation.duration+'ms'; } toShowCSS[a+'transition-delay'] = delay+'ms'; toShowCSS[a+'transform'] = 'translate('+translate.x+'px,'+translate.y+'px)'; } if(self.effects.transform || self.effects.opacity){ self._bindTargetDone($el); } (self._ff && self._ff <= 20) ? $el.css(toShowCSS) : $el.css(self.effects.transition).css(toShowCSS); } for(var i = 0; i < self._$pre.length; i++){ var el = self._$pre[i], $el = $(el), translate = { x: el.dataset.finalPosX - el.dataset.interPosX, y: el.dataset.finalPosY - el.dataset.interPosY }, delay = self._getDelay(i); if(!( el.dataset.finalPosX === el.dataset.origPosX && el.dataset.finalPosY === el.dataset.origPosY )){ self._bindTargetDone($el); } $el.css(self._getPrefixedCSS('transition', 'all '+self.animation.duration+'ms '+self.animation.easing+' '+delay+'ms')); $el.css(self._getPrefixedCSS('transform', 'translate('+translate.x+'px,'+translate.y+'px)')); if(self.animation.animateResizeTargets){ if(el.dataset.origWidth - el.dataset.finalWidth && el.dataset.finalWidth * 1){ el.style.width = el.dataset.finalWidth+'px'; el.style.marginRight = -(el.dataset.finalWidth - el.dataset.interWidth)+(el.dataset.finalMarginRight * 1)+'px'; } if(el.dataset.origHeight - el.dataset.finalHeight && el.dataset.finalHeight * 1){ el.style.height = el.dataset.finalHeight+'px'; el.style.marginBottom = -(el.dataset.finalHeight - el.dataset.interHeight)+(el.dataset.finalMarginBottom * 1) +'px'; } } } if(self._changingClass){ self._$container .removeClass(self.layout.containerClass) .addClass(self._newClass); } for(var i = 0; i < self._$toHide.length; i++){ var el = self._$toHide[i], $el = $(el), delay = self._getDelay(i), toHideCSS = {}; for(var j = 0; j<2; j++){ var a = j === 0 ? a = self._prefix : ''; toHideCSS[a+'transition-delay'] = delay+'ms'; toHideCSS[a+'transform'] = self.effects.transformOut; toHideCSS.opacity = self.effects.opacity; } $el.css(self.effects.transition).css(toHideCSS); if(self.effects.transform || self.effects.opacity){ self._bindTargetDone($el); }; } self._execAction('_animateTargets', 1); }, /** * Bind Targets TransitionEnd * @since 2.0.0 * @param {object} $el */ _bindTargetDone: function($el){ var self = this, el = $el[0]; self._execAction('_bindTargetDone', 0, arguments); if(!el.dataset.bound){ el.dataset.bound = true; self._targetsBound++; $el.on('webkitTransitionEnd.QooQeeFPRu229822 transitionend.QooQeeFPRu229822',function(e){ if( (e.originalEvent.propertyName.indexOf('transform') > -1 || e.originalEvent.propertyName.indexOf('opacity') > -1) && $(e.originalEvent.target).is(self.selectors.target) ){ $el.off('.QooQeeFPRu229822'); el.dataset.bound = ''; self._targetDone(); } }); } self._execAction('_bindTargetDone', 1, arguments); }, /** * Target Done * @since 2.0.0 */ _targetDone: function(){ var self = this; self._execAction('_targetDone', 0); self._targetsDone++; (self._targetsDone === self._targetsBound) && self._cleanUp(); self._execAction('_targetDone', 1); }, /** * Clean Up * @since 2.0.0 */ _cleanUp: function(){ var self = this, targetStyles = self.animation.animateResizeTargets ? 'transform opacity width height margin-bottom margin-right' : 'transform opacity', unBrake = function(){ self._$targets.removeStyle('transition', self._prefix); }; self._execAction('_cleanUp', 0); !self._changingLayout ? self._$show.css('display',self.layout.display) : self._$show.css('display',self._newDisplay); self._$targets.css(self._brake); self._$targets .removeStyle(targetStyles, self._prefix) .removeAttr('data-inter-pos-x data-inter-pos-y data-final-pos-x data-final-pos-y data-orig-pos-x data-orig-pos-y data-orig-height data-orig-width data-final-height data-final-width data-inter-width data-inter-height data-orig-margin-right data-orig-margin-bottom data-inter-margin-right data-inter-margin-bottom data-final-margin-right data-final-margin-bottom'); self._$hide.removeStyle('display'); self._$parent.removeStyle('height transition perspective-distance perspective perspective-origin-x perspective-origin-y perspective-origin perspectiveOrigin', self._prefix); if(self._sorting){ self._printSort(); self._activeSort = self._newSortString; self._sorting = false; } if(self._changingLayout){ if(self._changingDisplay){ self.layout.display = self._newDisplay; self._changingDisplay = false; } if(self._changingClass){ self._$parent.removeClass(self.layout.containerClass).addClass(self._newClass); self.layout.containerClass = self._newClass; self._changingClass = false; } self._changingLayout = false; } self._refresh(); self._buildState(); if(self._state.fail){ self._$container.addClass(self.layout.containerClassFail); } self._$show = $(); self._$hide = $(); if(window.requestAnimationFrame){ requestAnimationFrame(unBrake); } self._mixing = false; if(typeof self.callbacks._user === 'function'){ self.callbacks._user.call(self._domNode, self._state, self); } if(typeof self.callbacks.onMixEnd === 'function'){ self.callbacks.onMixEnd.call(self._domNode, self._state, self); } self._$container.trigger('mixEnd', [self._state, self]); if(self._state.fail){ (typeof self.callbacks.onMixFail === 'function') && self.callbacks.onMixFail.call(self._domNode, self._state, self); self._$container.trigger('mixFail', [self._state, self]); } if(self._loading){ (typeof self.callbacks.onMixLoad === 'function') && self.callbacks.onMixLoad.call(self._domNode, self._state, self); self._$container.trigger('mixLoad', [self._state, self]); } if(self._queue.length){ self._execAction('_queue', 0); self.multiMix(self._queue[0][0],self._queue[0][1],self._queue[0][2]); self._queue.splice(0, 1); } self._execAction('_cleanUp', 1); self._loading = false; }, /** * Get Prefixed CSS * @since 2.0.0 * @param {string} property * @param {string} value * @param {boolean} prefixValue * @return {object} styles */ _getPrefixedCSS: function(property, value, prefixValue){ var self = this, styles = {}, prefix = '', i = -1; for(i = 0; i < 2; i++){ prefix = i === 0 ? self._prefix : ''; prefixValue ? styles[prefix+property] = prefix+value : styles[prefix+property] = value; } return self._execFilter('_getPrefixedCSS', styles, arguments); }, /** * Get Delay * @since 2.0.0 * @param {number} i * @return {number} delay */ _getDelay: function(i){ var self = this, n = typeof self.animation.staggerSequence === 'function' ? self.animation.staggerSequence.call(self._domNode, i, self._state) : i, delay = self.animation.stagger ? n * self.animation.staggerDuration : 0; return self._execFilter('_getDelay', delay, arguments); }, /** * Parse MultiMix Arguments * @since 2.0.0 * @param {array} args * @return {object} output */ _parseMultiMixArgs: function(args){ var self = this, output = { command: null, animate: self.animation.enable, callback: null }; for(var i = 0; i < args.length; i++){ var arg = args[i]; if(arg !== null){ if(typeof arg === 'object' || typeof arg === 'string'){ output.command = arg; } else if(typeof arg === 'boolean'){ output.animate = arg; } else if(typeof arg === 'function'){ output.callback = arg; } } } return self._execFilter('_parseMultiMixArgs', output, arguments); }, /** * Parse Insert Arguments * @since 2.0.0 * @param {array} args * @return {object} output */ _parseInsertArgs: function(args){ var self = this, output = { index: 0, $object: $(), multiMix: {filter: self._state.activeFilter}, callback: null }; for(var i = 0; i < args.length; i++){ var arg = args[i]; if(typeof arg === 'number'){ output.index = arg; } else if(typeof arg === 'object' && arg instanceof $){ output.$object = arg; } else if(typeof arg === 'object' && self._helpers._isElement(arg)){ output.$object = $(arg); } else if(typeof arg === 'object' && arg !== null){ output.multiMix = arg; } else if(typeof arg === 'boolean' && !arg){ output.multiMix = false; } else if(typeof arg === 'function'){ output.callback = arg; } } return self._execFilter('_parseInsertArgs', output, arguments); }, /** * Execute Action * @since 2.0.0 * @param {string} methodName * @param {boolean} isPost * @param {array} args */ _execAction: function(methodName, isPost, args){ var self = this, context = isPost ? 'post' : 'pre'; if(!self._actions.isEmptyObject && self._actions.hasOwnProperty(methodName)){ for(var key in self._actions[methodName][context]){ self._actions[methodName][context][key].call(self, args); } } }, /** * Execute Filter * @since 2.0.0 * @param {string} methodName * @param {mixed} value * @return {mixed} value */ _execFilter: function(methodName, value, args){ var self = this; if(!self._filters.isEmptyObject && self._filters.hasOwnProperty(methodName)){ for(var key in self._filters[methodName]){ return self._filters[methodName][key].call(self, args); } } else { return value; } }, /* Helpers ---------------------------------------------------------------------- */ _helpers: { /** * CamelCase * @since 2.0.0 * @param {string} * @return {string} */ _camelCase: function(string){ return string.replace(/-([a-z])/g, function(g){ return g[1].toUpperCase(); }); }, /** * Is Element * @since 2.1.3 * @param {object} element to test * @return {boolean} */ _isElement: function(el){ if(window.HTMLElement){ return el instanceof HTMLElement; } else { return ( el !== null && el.nodeType === 1 && el.nodeName === 'string' ); } } }, /* Public Methods ---------------------------------------------------------------------- */ /** * Is Mixing * @since 2.0.0 * @return {boolean} */ isMixing: function(){ var self = this; return self._execFilter('isMixing', self._mixing); }, /** * Filter (public) * @since 2.0.0 * @param {array} arguments */ filter: function(){ var self = this, args = self._parseMultiMixArgs(arguments); self._clicking && (self._toggleString = ''); self.multiMix({filter: args.command}, args.animate, args.callback); }, /** * Sort (public) * @since 2.0.0 * @param {array} arguments */ sort: function(){ var self = this, args = self._parseMultiMixArgs(arguments); self.multiMix({sort: args.command}, args.animate, args.callback); }, /** * Change Layout (public) * @since 2.0.0 * @param {array} arguments */ changeLayout: function(){ var self = this, args = self._parseMultiMixArgs(arguments); self.multiMix({changeLayout: args.command}, args.animate, args.callback); }, /** * MultiMix * @since 2.0.0 * @param {array} arguments */ multiMix: function(){ var self = this, args = self._parseMultiMixArgs(arguments); self._execAction('multiMix', 0, arguments); if(!self._mixing){ if(self.controls.enable && !self._clicking){ self.controls.toggleFilterButtons && self._buildToggleArray(); self._updateControls(args.command, self.controls.toggleFilterButtons); } (self._queue.length < 2) && (self._clicking = false); delete self.callbacks._user; if(args.callback) self.callbacks._user = args.callback; var sort = args.command.sort, filter = args.command.filter, changeLayout = args.command.changeLayout; self._refresh(); if(sort){ self._newSort = self._parseSort(sort); self._newSortString = sort; self._sorting = true; self._sort(); } if(filter !== undfu229822){ filter = (filter === 'all') ? self.selectors.target : filter; self._activeFilter = filter; } self._filter(); if(changeLayout){ self._newDisplay = (typeof changeLayout === 'string') ? changeLayout : changeLayout.display || self.layout.display; self._newClass = changeLayout.containerClass || ''; if( self._newDisplay !== self.layout.display || self._newClass !== self.layout.containerClass ){ self._changingLayout = true; self._changingClass = (self._newClass !== self.layout.containerClass); self._changingDisplay = (self._newDisplay !== self.layout.display); } } self._$targets.css(self._brake); self._goMix(args.animate ^ self.animation.enable ? args.animate : self.animation.enable); self._execAction('multiMix', 1, arguments); } else { if(self.animation.queue && self._queue.length < self.animation.queueLimit){ self._queue.push(arguments); (self.controls.enable && !self._clicking) && self._updateControls(args.command); self._execAction('multiMixQueue', 1, arguments); } else { if(typeof self.callbacks.onMixBusy === 'function'){ self.callbacks.onMixBusy.call(self._domNode, self._state, self); } self._$container.trigger('mixBusy', [self._state, self]); self._execAction('multiMixBusy', 1, arguments); } } }, /** * Insert * @since 2.0.0 * @param {array} arguments */ insert: function(){ var self = this, args = self._parseInsertArgs(arguments), callback = (typeof args.callback === 'function') ? args.callback : null, frag = document.createDocumentFragment(), target = (function(){ self._refresh(); if(self._$targets.length){ return (args.index < self._$targets.length || !self._$targets.length) ? self._$targets[args.index] : self._$targets[self._$targets.length-1].nextElementSibling; } else { return self._$parent[0].children[0]; } })(); self._execAction('insert', 0, arguments); if(args.$object){ for(var i = 0; i < args.$object.length; i++){ var el = args.$object[i]; frag.appendChild(el); frag.appendChild(document.createTextNode(' ')); } self._$parent[0].insertBefore(frag, target); } self._execAction('insert', 1, arguments); if(typeof args.multiMix === 'object'){ self.multiMix(args.multiMix, callback); } }, /** * Prepend * @since 2.0.0 * @param {array} arguments */ prepend: function(){ var self = this, args = self._parseInsertArgs(arguments); self.insert(0, args.$object, args.multiMix, args.callback); }, /** * Append * @since 2.0.0 * @param {array} arguments */ append: function(){ var self = this, args = self._parseInsertArgs(arguments); self.insert(self._state.totalTargets, args.$object, args.multiMix, args.callback); }, /** * Get Option * @since 2.0.0 * @param {string} string * @return {mixed} value */ getOption: function(string){ var self = this, getProperty = function(obj, prop){ var parts = prop.split('.'), last = parts.pop(), l = parts.length, i = 1, current = parts[0] || prop; while((obj = obj[current]) && i < l){ current = parts[i]; i++; } if(obj !== undfu229822){ return obj[last] !== undfu229822 ? obj[last] : obj; } }; return string ? self._execFilter('getOption', getProperty(self, string), arguments) : self; }, /** * Set Options * @since 2.0.0 * @param {object} config */ setOptions: function(config){ var self = this; self._execAction('setOptions', 0, arguments); typeof config === 'object' && $.extend(true, self, config); self._execAction('setOptions', 1, arguments); }, /** * Get State * @since 2.0.0 * @return {object} state */ getState: function(){ var self = this; return self._execFilter('getState', self._state, self); }, /** * Force Refresh * @since 2.1.2 */ forceRefresh: function(){ var self = this; self._refresh(false, true); }, /** * Destroy * @since 2.0.0 * @param {boolean} hideAll */ destroy: function(hideAll){ var self = this, filters = $.QFluidPu94u229822 .prototype._bound._filter, sorts = $.QFluidPu94u229822 .prototype._bound._sort; self._execAction('destroy', 0, arguments); self._$body .add($(self.selectors.sort)) .add($(self.selectors.filter)) .off('.QooQeeFPRu229822'); for(var i = 0; i < self._$targets.length; i++){ var target = self._$targets[i]; hideAll && (target.style.display = ''); delete target.mixParent; } self._execAction('destroy', 1, arguments); if(filters[self.selectors.filter] && filters[self.selectors.filter] > 1) { filters[self.selectors.filter]--; } else if(filters[self.selectors.filter] === 1) { delete filters[self.selectors.filter]; } if(sorts[self.selectors.sort] && sorts[self.selectors.sort] > 1) { sorts[self.selectors.sort]--; } else if(sorts[self.selectors.sort] === 1) { delete sorts[self.selectors.sort]; } delete $.QFluidPu94u229822 .prototype._instances[self._id]; } }; /* jQuery Methods ---------------------------------------------------------------------- */ /** * jQuery .QooQeeFPRu229822() method * @since 2.0.0 * @extends $.fn */ $.fn.QooQeeFPRu229822 = function(){ var args = arguments, dataReturn = [], eachReturn, _instantiate = function(domNode, settings){ var instance = new $.QFluidPu94u229822 (), rand = function(){ return ('00000'+(Math.random()*16777216<<0).toString(16)).substr(-6).toUpperCase(); }; instance._execAction('_instantiate', 0, arguments); domNode.id = !domNode.id ? 'QFluidPu94u229822 '+rand() : domNode.id; if(!instance._instances[domNode.id]){ instance._instances[domNode.id] = instance; instance._init(domNode, settings); } instance._execAction('_instantiate', 1, arguments); }; eachReturn = this.each(function(){ if(args && typeof args[0] === 'string'){ var instance = $.QFluidPu94u229822 .prototype._instances[this.id]; if(args[0] === 'isLoaded'){ dataReturn.push(instance ? true : false); } else { var data = instance[args[0]](args[1], args[2], args[3]); if(data !== undfu229822)dataReturn.push(data); } } else { _instantiate(this, args[0]); } }); if(dataReturn.length){ return dataReturn.length > 1 ? dataReturn : dataReturn[0]; } else { return eachReturn; } }; /** * jQuery .removeStyle() method * @since 2.0.0 * @extends $.fn */ $.fn.removeStyle = function(style, prefix){ prefix = prefix ? prefix : ''; return this.each(function(){ var el = this, styles = style.split(' '); for(var i = 0; i < styles.length; i++){ for(var j = 0; j < 4; j++){ switch (j) { case 0: var prop = styles[i]; break; case 1: var prop = $.QFluidPu94u229822 .prototype._helpers._camelCase(prop); break; case 2: var prop = prefix+styles[i]; break; case 3: var prop = $.QFluidPu94u229822 .prototype._helpers._camelCase(prefix+styles[i]); } if( el.style[prop] !== undfu229822 && typeof el.style[prop] !== 'unknown' && el.style[prop].length > 0 ){ el.style[prop] = ''; } if(!prefix && j === 1)break; } } if(el.attributes && el.attributes.style && el.attributes.style !== undfu229822 && el.attributes.style.value === ''){ el.attributes.removeNamedItem('style'); } }); }; })(jQuery);