linaro-jekyll-theme 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/_includes/_theme-includes/_blog/pagination.html +39 -0
- data/_includes/_theme-includes/_footer/backup.html +71 -0
- data/_includes/_theme-includes/_footer/footer.html +54 -0
- data/_includes/_theme-includes/_head/ascii-art.html +11 -0
- data/_includes/_theme-includes/_head/head.html +24 -0
- data/_includes/_theme-includes/_navigation/_sub-navigation/tabbed-nav.html +150 -0
- data/_includes/_theme-includes/_navigation/nav.html +55 -0
- data/_includes/_theme-includes/_page-structure/breadcrumb.html +51 -0
- data/_includes/_theme-includes/_page-structure/old-breadcrumb.html +139 -0
- data/_includes/_theme-includes/_script-includes/css.html +1 -0
- data/_includes/_theme-includes/_script-includes/gtm/gtm-noscript.html +4 -0
- data/_includes/_theme-includes/_script-includes/gtm/gtm-script.html +7 -0
- data/_includes/_theme-includes/_script-includes/javascript.html +2 -0
- data/_includes/_theme-includes/_third-party/disqus.html +14 -0
- data/_includes/_theme-includes/_third-party/mailchimp-homepage.html +38 -0
- data/_includes/_theme-includes/_third-party/mailchimp-sub-footer.html +40 -0
- data/_includes/_theme-includes/members.html +63 -0
- data/_includes/base.html +14 -0
- data/_includes/image.html +1 -0
- data/_includes/media.html +3 -0
- data/_includes/owl-carousel-homepage.html +103 -0
- data/_layouts/empty-container-page.html +13 -0
- data/_layouts/plain-page.html +11 -0
- data/_sass/_bootstrap-compass.scss +9 -0
- data/_sass/_bootstrap-mincer.scss +19 -0
- data/_sass/_bootstrap-sprockets.scss +9 -0
- data/_sass/_bootstrap.scss +56 -0
- data/_sass/animations.scss +125 -0
- data/_sass/blog.scss +188 -0
- data/_sass/bootstrap/_alerts.scss +73 -0
- data/_sass/bootstrap/_badges.scss +68 -0
- data/_sass/bootstrap/_breadcrumbs.scss +28 -0
- data/_sass/bootstrap/_button-groups.scss +244 -0
- data/_sass/bootstrap/_buttons.scss +168 -0
- data/_sass/bootstrap/_carousel.scss +270 -0
- data/_sass/bootstrap/_close.scss +36 -0
- data/_sass/bootstrap/_code.scss +69 -0
- data/_sass/bootstrap/_component-animations.scss +37 -0
- data/_sass/bootstrap/_dropdowns.scss +216 -0
- data/_sass/bootstrap/_forms.scss +617 -0
- data/_sass/bootstrap/_glyphicons.scss +307 -0
- data/_sass/bootstrap/_grid.scss +84 -0
- data/_sass/bootstrap/_input-groups.scss +171 -0
- data/_sass/bootstrap/_jumbotron.scss +54 -0
- data/_sass/bootstrap/_labels.scss +66 -0
- data/_sass/bootstrap/_list-group.scss +130 -0
- data/_sass/bootstrap/_media.scss +66 -0
- data/_sass/bootstrap/_mixins.scss +40 -0
- data/_sass/bootstrap/_modals.scss +150 -0
- data/_sass/bootstrap/_navbar.scss +662 -0
- data/_sass/bootstrap/_navs.scss +242 -0
- data/_sass/bootstrap/_normalize.scss +424 -0
- data/_sass/bootstrap/_pager.scss +54 -0
- data/_sass/bootstrap/_pagination.scss +89 -0
- data/_sass/bootstrap/_panels.scss +271 -0
- data/_sass/bootstrap/_popovers.scss +131 -0
- data/_sass/bootstrap/_print.scss +101 -0
- data/_sass/bootstrap/_progress-bars.scss +87 -0
- data/_sass/bootstrap/_responsive-embed.scss +35 -0
- data/_sass/bootstrap/_responsive-utilities.scss +179 -0
- data/_sass/bootstrap/_scaffolding.scss +161 -0
- data/_sass/bootstrap/_tables.scss +234 -0
- data/_sass/bootstrap/_theme.scss +291 -0
- data/_sass/bootstrap/_thumbnails.scss +38 -0
- data/_sass/bootstrap/_tooltip.scss +101 -0
- data/_sass/bootstrap/_type.scss +298 -0
- data/_sass/bootstrap/_utilities.scss +55 -0
- data/_sass/bootstrap/_variables.scss +874 -0
- data/_sass/bootstrap/_wells.scss +29 -0
- data/_sass/bootstrap/mixins/_alerts.scss +14 -0
- data/_sass/bootstrap/mixins/_background-variant.scss +12 -0
- data/_sass/bootstrap/mixins/_border-radius.scss +18 -0
- data/_sass/bootstrap/mixins/_buttons.scss +65 -0
- data/_sass/bootstrap/mixins/_center-block.scss +7 -0
- data/_sass/bootstrap/mixins/_clearfix.scss +22 -0
- data/_sass/bootstrap/mixins/_forms.scss +88 -0
- data/_sass/bootstrap/mixins/_gradients.scss +58 -0
- data/_sass/bootstrap/mixins/_grid-framework.scss +81 -0
- data/_sass/bootstrap/mixins/_grid.scss +122 -0
- data/_sass/bootstrap/mixins/_hide-text.scss +21 -0
- data/_sass/bootstrap/mixins/_image.scss +33 -0
- data/_sass/bootstrap/mixins/_labels.scss +12 -0
- data/_sass/bootstrap/mixins/_list-group.scss +32 -0
- data/_sass/bootstrap/mixins/_nav-divider.scss +10 -0
- data/_sass/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/_sass/bootstrap/mixins/_opacity.scss +8 -0
- data/_sass/bootstrap/mixins/_pagination.scss +24 -0
- data/_sass/bootstrap/mixins/_panels.scss +24 -0
- data/_sass/bootstrap/mixins/_progress-bar.scss +10 -0
- data/_sass/bootstrap/mixins/_reset-filter.scss +8 -0
- data/_sass/bootstrap/mixins/_reset-text.scss +18 -0
- data/_sass/bootstrap/mixins/_resize.scss +6 -0
- data/_sass/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/_sass/bootstrap/mixins/_size.scss +10 -0
- data/_sass/bootstrap/mixins/_tab-focus.scss +9 -0
- data/_sass/bootstrap/mixins/_table-row.scss +28 -0
- data/_sass/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/_sass/bootstrap/mixins/_text-overflow.scss +8 -0
- data/_sass/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/_sass/breadcrumb.scss +48 -0
- data/_sass/carousel.scss +122 -0
- data/_sass/cookieconsent.scss +13 -0
- data/_sass/critical.scss +991 -0
- data/_sass/fa.scss +2331 -0
- data/_sass/flipclock.scss +435 -0
- data/_sass/font-awesome.min.scss +4 -0
- data/_sass/fonts.scss +7 -0
- data/_sass/footer.scss +76 -0
- data/_sass/lightbox.scss +213 -0
- data/_sass/members-sprite.scss +425 -0
- data/_sass/nav.scss +533 -0
- data/_sass/openhours.scss +51 -0
- data/_sass/owl.carousel.min.scss +6 -0
- data/_sass/owl.theme.default.min.scss +6 -0
- data/_sass/products.scss +214 -0
- data/_sass/projects.scss +34 -0
- data/_sass/social-media-icons.scss +71 -0
- data/_sass/syntax.scss +65 -0
- data/_sass/tables.scss +87 -0
- data/_sass/theme.scss +208 -0
- data/assets/js/app/main.js +116 -0
- data/assets/js/app/mixitup.js +23 -0
- data/assets/js/app/search-page.js +41 -0
- data/assets/js/app/sticky-navbar.js +65 -0
- data/assets/js/vendor/bootstrap.min.js +7 -0
- data/assets/js/vendor/cookieconsent.min.js +15 -0
- data/assets/js/vendor/flipclock.min.js +2 -0
- data/assets/js/vendor/jquery.min.js +4 -0
- data/assets/js/vendor/lazysizes.min.js +2 -0
- data/assets/js/vendor/lightbox.js +519 -0
- data/assets/js/vendor/mc-validate.js +14 -0
- data/assets/js/vendor/owl.carousel.min.js +27 -0
- data/assets/js/vendor/picturefill.min.js +5 -0
- data/assets/js/vendor/shuffle.js +2004 -0
- data/assets/vendor.js +0 -0
- metadata +377 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Form Plugin
|
3
|
+
* version: 3.51.0-2014.06.20
|
4
|
+
* Requires jQuery v1.5 or later
|
5
|
+
* Copyright (c) 2014 M. Alsup
|
6
|
+
* Examples and documentation at: http://malsup.com/jquery/form/
|
7
|
+
* Project repository: https://github.com/malsup/form
|
8
|
+
* Dual licensed under the MIT and GPL licenses.
|
9
|
+
* https://github.com/malsup/form#copyright-and-license
|
10
|
+
*/
|
11
|
+
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,i=e(r);if(!i.is("[type=submit],[type=image]")){var a=i.closest("[type=submit]");if(0===a.length)return;r=a[0]}var n=this;if(n.clk=r,"image"==r.type)if(void 0!==t.offsetX)n.clk_x=t.offsetX,n.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var s=i.offset();n.clk_x=t.pageX-s.left,n.clk_y=t.pageY-s.top}else n.clk_x=t.pageX-r.offsetLeft,n.clk_y=t.pageY-r.offsetTop;setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function i(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var a={};a.fileapi=void 0!==e("<input type='file'/>").get(0).files,a.formdata=void 0!==window.FormData;var n=!!e.fn.prop;e.fn.attr2=function(){if(!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var i,a,n=e.param(r,t.traditional).split("&"),s=n.length,o=[];for(i=0;s>i;i++)n[i]=n[i].replace(/\+/g," "),a=n[i].split("="),o.push([decodeURIComponent(a[0]),decodeURIComponent(a[1])]);return o}function s(i){for(var a=new FormData,n=0;n<i.length;n++)a.append(i[n].name,i[n].value);if(t.extraData){var s=r(t.extraData);for(n=0;n<s.length;n++)s[n]&&a.append(s[n][0],s[n][1])}t.data=null;var o=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(o.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,i=e.loaded||e.position,a=e.total;e.lengthComputable&&(r=Math.ceil(i/a*100)),t.uploadProgress(e,i,a,r)},!1),r}),o.data=null;var l=o.beforeSend;return o.beforeSend=function(e,r){r.data=t.formData?t.formData:a,l&&l.call(this,e,r)},e.ajax(o)}function o(r){function a(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(r){i("cannot get iframe.contentWindow document: "+r)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){i("cannot get iframe.contentDocument: "+r),t=e.document}return t}function s(){function t(){try{var e=a(v).readyState;i("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(r){i("Server abort: ",r," (",r.name,")"),o(S),w&&clearTimeout(w),w=void 0}}var r=c.attr2("target"),n=c.attr2("action"),s="multipart/form-data",l=c.attr("enctype")||c.attr("encoding")||s;D.setAttribute("target",f),(!u||/post/i.test(u))&&D.setAttribute("method","POST"),n!=h.url&&D.setAttribute("action",h.url),h.skipEncodingOverride||u&&!/post/i.test(u)||c.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),h.timeout&&(w=setTimeout(function(){F=!0,o(C)},h.timeout));var d=[];try{if(h.extraData)for(var m in h.extraData)h.extraData.hasOwnProperty(m)&&d.push(e.isPlainObject(h.extraData[m])&&h.extraData[m].hasOwnProperty("name")&&h.extraData[m].hasOwnProperty("value")?e('<input type="hidden" name="'+h.extraData[m].name+'">').val(h.extraData[m].value).appendTo(D)[0]:e('<input type="hidden" name="'+m+'">').val(h.extraData[m]).appendTo(D)[0]);h.iframeTarget||g.appendTo("body"),v.attachEvent?v.attachEvent("onload",o):v.addEventListener("load",o,!1),setTimeout(t,15);try{D.submit()}catch(p){var b=document.createElement("form").submit;b.apply(D)}}finally{D.setAttribute("action",n),D.setAttribute("enctype",l),r?D.setAttribute("target",r):c.removeAttr("target"),e(d).remove()}}function o(t){if(!b.aborted&&!A){if(_=a(v),_||(i("cannot access response document"),t=S),t===C&&b)return b.abort("timeout"),void k.reject(b,"timeout");if(t==S&&b)return b.abort("server abort"),void k.reject(b,"error","server abort");if(_&&_.location.href!=h.iframeSrc||F){v.detachEvent?v.detachEvent("onload",o):v.removeEventListener("load",o,!1);var r,n="success";try{if(F)throw"timeout";var s="xml"==h.dataType||_.XMLDocument||e.isXMLDoc(_);if(i("isXml="+s),!s&&window.opera&&(null===_.body||!_.body.innerHTML)&&--L)return i("requeing onLoad callback, DOM not available"),void setTimeout(o,250);var u=_.body?_.body:_.documentElement;b.responseText=u?u.innerHTML:null,b.responseXML=_.XMLDocument?_.XMLDocument:_,s&&(h.dataType="xml"),b.getResponseHeader=function(e){var t={"content-type":h.dataType};return t[e.toLowerCase()]},u&&(b.status=+u.getAttribute("status")||b.status,b.statusText=u.getAttribute("statusText")||b.statusText);var l=(h.dataType||"").toLowerCase(),d=/(json|script|text)/.test(l);if(d||h.textarea){var c=_.getElementsByTagName("textarea")[0];if(c)b.responseText=c.value,b.status=+c.getAttribute("status")||b.status,b.statusText=c.getAttribute("statusText")||b.statusText;else if(d){var f=_.getElementsByTagName("pre")[0],p=_.getElementsByTagName("body")[0];f?b.responseText=f.textContent?f.textContent:f.innerText:p&&(b.responseText=p.textContent?p.textContent:p.innerText)}}else"xml"==l&&!b.responseXML&&b.responseText&&(b.responseXML=q(b.responseText));try{j=P(b,l,h)}catch(y){n="parsererror",b.error=r=y||n}}catch(y){i("error caught: ",y),n="error",b.error=r=y||n}b.aborted&&(i("upload aborted"),n=null),b.status&&(n=b.status>=200&&b.status<300||304===b.status?"success":"error"),"success"===n?(h.success&&h.success.call(h.context,j,"success",b),k.resolve(b.responseText,"success",b),m&&e.event.trigger("ajaxSuccess",[b,h])):n&&(void 0===r&&(r=b.statusText),h.error&&h.error.call(h.context,b,n,r),k.reject(b,"error",r),m&&e.event.trigger("ajaxError",[b,h,r])),m&&e.event.trigger("ajaxComplete",[b,h]),m&&!--e.active&&e.event.trigger("ajaxStop"),h.complete&&h.complete.call(h.context,b,n),A=!0,h.timeout&&clearTimeout(w),setTimeout(function(){h.iframeTarget?g.attr("src",h.iframeSrc):g.remove(),b.responseXML=null},100)}}}var l,d,h,m,f,g,v,b,y,x,F,w,D=c[0],k=e.Deferred();if(k.abort=function(e){b.abort(e)},r)for(d=0;d<p.length;d++)l=e(p[d]),n?l.prop("disabled",!1):l.removeAttr("disabled");if(h=e.extend(!0,{},e.ajaxSettings,t),h.context=h.context||h,f="jqFormIO"+(new Date).getTime(),h.iframeTarget?(g=e(h.iframeTarget),x=g.attr2("name"),x?f=x:g.attr2("name",f)):(g=e('<iframe name="'+f+'" src="'+h.iframeSrc+'" />'),g.css({position:"absolute",top:"-1000px",left:"-1000px"})),v=g[0],b={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";i("aborting upload... "+r),this.aborted=1;try{v.contentWindow.document.execCommand&&v.contentWindow.document.execCommand("Stop")}catch(a){}g.attr("src",h.iframeSrc),b.error=r,h.error&&h.error.call(h.context,b,r,t),m&&e.event.trigger("ajaxError",[b,h,r]),h.complete&&h.complete.call(h.context,b,r)}},m=h.global,m&&0===e.active++&&e.event.trigger("ajaxStart"),m&&e.event.trigger("ajaxSend",[b,h]),h.beforeSend&&h.beforeSend.call(h.context,b,h)===!1)return h.global&&e.active--,k.reject(),k;if(b.aborted)return k.reject(),k;y=D.clk,y&&(x=y.name,x&&!y.disabled&&(h.extraData=h.extraData||{},h.extraData[x]=y.value,"image"==y.type&&(h.extraData[x+".x"]=D.clk_x,h.extraData[x+".y"]=D.clk_y)));var C=1,S=2,T=e("meta[name=csrf-token]").attr("content"),E=e("meta[name=csrf-param]").attr("content");E&&T&&(h.extraData=h.extraData||{},h.extraData[E]=T),h.forceSync?s():setTimeout(s,10);var j,_,A,L=50,q=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},M=e.parseJSON||function(e){return window.eval("("+e+")")},P=function(t,r,i){var a=t.getResponseHeader("content-type")||"",n="xml"===r||!r&&a.indexOf("xml")>=0,s=n?t.responseXML:t.responseText;return n&&"parsererror"===s.documentElement.nodeName&&e.error&&e.error("parsererror"),i&&i.dataFilter&&(s=i.dataFilter(s,r)),"string"==typeof s&&("json"===r||!r&&a.indexOf("json")>=0?s=M(s):("script"===r||!r&&a.indexOf("javascript")>=0)&&e.globalEval(s)),s};return k}if(!this.length)return i("ajaxSubmit: skipping submit process - no element selected"),this;var u,l,d,c=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),l=t.url||this.attr2("action"),d="string"==typeof l?e.trim(l):"",d=d||window.location.href||"",d&&(d=(d.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:d,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var h={};if(this.trigger("form-pre-serialize",[this,t,h]),h.veto)return i("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return i("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var m=t.traditional;void 0===m&&(m=e.ajaxSettings.traditional);var f,p=[],g=this.formToArray(t.semantic,p);if(t.data&&(t.extraData=t.data,f=e.param(t.data,m)),t.beforeSubmit&&t.beforeSubmit(g,this,t)===!1)return i("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[g,this,t,h]),h.veto)return i("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var v=e.param(g,m);f&&(v=v?v+"&"+f:f),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")<0?"?":"&")+v,t.data=null):t.data=v;var b=[];if(t.resetForm&&b.push(function(){c.resetForm()}),t.clearForm&&b.push(function(){c.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};b.push(function(r){var i=t.replaceTarget?"replaceWith":"html";e(t.target)[i](r).each(y,arguments)})}else t.success&&b.push(t.success);if(t.success=function(e,r,i){for(var a=t.context||this,n=0,s=b.length;s>n;n++)b[n].apply(a,[e,r,i||c,c])},t.error){var x=t.error;t.error=function(e,r,i){var a=t.context||this;x.apply(a,[e,r,i,c])}}if(t.complete){var F=t.complete;t.complete=function(e,r){var i=t.context||this;F.apply(i,[e,r,c])}}var w=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),D=w.length>0,k="multipart/form-data",C=c.attr("enctype")==k||c.attr("encoding")==k,S=a.fileapi&&a.formdata;i("fileAPI :"+S);var T,E=(D||C)&&!S;t.iframe!==!1&&(t.iframe||E)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){T=o(g)}):T=o(g):T=(D||C)&&S?s(g):e.ajax(t),c.removeData("jqxhr").data("jqxhr",T);for(var j=0;j<p.length;j++)p[j]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(a){if(a=a||{},a.delegation=a.delegation&&e.isFunction(e.fn.on),!a.delegation&&0===this.length){var n={s:this.selector,c:this.context};return!e.isReady&&n.s?(i("DOM not ready, queuing ajaxForm"),e(function(){e(n.s,n.c).ajaxForm(a)}),this):(i("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return a.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,a,t).on("click.form-plugin",this.selector,a,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",a,t).bind("click.form-plugin",a,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var i=[];if(0===this.length)return i;var n,s=this[0],o=this.attr("id"),u=t?s.getElementsByTagName("*"):s.elements;if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),o&&(n=e(':input[form="'+o+'"]').get(),n.length&&(u=(u||[]).concat(n))),!u||!u.length)return i;var l,d,c,h,m,f,p;for(l=0,f=u.length;f>l;l++)if(m=u[l],c=m.name,c&&!m.disabled)if(t&&s.clk&&"image"==m.type)s.clk==m&&(i.push({name:c,value:e(m).val(),type:m.type}),i.push({name:c+".x",value:s.clk_x},{name:c+".y",value:s.clk_y}));else if(h=e.fieldValue(m,!0),h&&h.constructor==Array)for(r&&r.push(m),d=0,p=h.length;p>d;d++)i.push({name:c,value:h[d]});else if(a.fileapi&&"file"==m.type){r&&r.push(m);var g=m.files;if(g.length)for(d=0;d<g.length;d++)i.push({name:c,value:g[d],type:m.type});else i.push({name:c,value:"",type:m.type})}else null!==h&&void 0!==h&&(r&&r.push(m),i.push({name:c,value:h,type:m.type,required:m.required}));if(!t&&s.clk){var v=e(s.clk),b=v[0];c=b.name,c&&!b.disabled&&"image"==b.type&&(i.push({name:c,value:v.val()}),i.push({name:c+".x",value:s.clk_x},{name:c+".y",value:s.clk_y}))}return i},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var i=this.name;if(i){var a=e.fieldValue(this,t);if(a&&a.constructor==Array)for(var n=0,s=a.length;s>n;n++)r.push({name:i,value:a[n]});else null!==a&&void 0!==a&&r.push({name:this.name,value:a})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],i=0,a=this.length;a>i;i++){var n=this[i],s=e.fieldValue(n,t);null===s||void 0===s||s.constructor==Array&&!s.length||(s.constructor==Array?e.merge(r,s):r.push(s))}return r},e.fieldValue=function(t,r){var i=t.name,a=t.type,n=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!i||t.disabled||"reset"==a||"button"==a||("checkbox"==a||"radio"==a)&&!t.checked||("submit"==a||"image"==a)&&t.form&&t.form.clk!=t||"select"==n&&-1==t.selectedIndex))return null;if("select"==n){var s=t.selectedIndex;if(0>s)return null;for(var o=[],u=t.options,l="select-one"==a,d=l?s+1:u.length,c=l?s:0;d>c;c++){var h=u[c];if(h.selected){var m=h.value;if(m||(m=h.attributes&&h.attributes.value&&!h.attributes.value.specified?h.text:h.value),l)return m;o.push(m)}}return o}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var i=this.type,a=this.tagName.toLowerCase();r.test(i)||"textarea"==a?this.value="":"checkbox"==i||"radio"==i?this.checked=!1:"select"==a?this.selectedIndex=-1:"file"==i?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(i)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var i=e(this).parent("select");t&&i[0]&&"select-one"==i[0].type&&i.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),/*! jQuery Validation Plugin - v1.12.0 - 4/1/2014
|
12
|
+
* http://jqueryvalidation.org/
|
13
|
+
* Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
|
14
|
+
!function(e){e.extend(e.fn,{validate:function(t){if(!this.length)return void(t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var r=e.data(this[0],"validator");return r?r:(this.attr("novalidate","novalidate"),r=new e.validator(t,this[0]),e.data(this[0],"validator",r),r.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){r.settings.submitHandler&&(r.submitButton=t.target),e(t.target).hasClass("cancel")&&(r.cancelSubmit=!0),void 0!==e(t.target).attr("formnovalidate")&&(r.cancelSubmit=!0)}),this.submit(function(t){function i(){var i;return r.settings.submitHandler?(r.submitButton&&(i=e("<input type='hidden'/>").attr("name",r.submitButton.name).val(e(r.submitButton).val()).appendTo(r.currentForm)),r.settings.submitHandler.call(r,r.currentForm,t),r.submitButton&&i.remove(),!1):!0}return r.settings.debug&&t.preventDefault(),r.cancelSubmit?(r.cancelSubmit=!1,i()):r.form()?r.pendingRequest?(r.formSubmitted=!0,!1):i():(r.focusInvalid(),!1)})),r)},valid:function(){var t,r;return e(this[0]).is("form")?t=this.validate().form():(t=!0,r=e(this[0].form).validate(),this.each(function(){t=r.element(this)&&t})),t},removeAttrs:function(t){var r={},i=this;return e.each(t.split(/\s/),function(e,t){r[t]=i.attr(t),i.removeAttr(t)}),r},rules:function(t,r){var i,a,n,s,o,u,l=this[0];if(t)switch(i=e.data(l.form,"validator").settings,a=i.rules,n=e.validator.staticRules(l),t){case"add":e.extend(n,e.validator.normalizeRule(r)),delete n.messages,a[l.name]=n,r.messages&&(i.messages[l.name]=e.extend(i.messages[l.name],r.messages));break;case"remove":return r?(u={},e.each(r.split(/\s/),function(t,r){u[r]=n[r],delete n[r],"required"===r&&e(l).removeAttr("aria-required")}),u):(delete a[l.name],n)}return s=e.validator.normalizeRules(e.extend({},e.validator.classRules(l),e.validator.attributeRules(l),e.validator.dataRules(l),e.validator.staticRules(l)),l),s.required&&(o=s.required,delete s.required,s=e.extend({required:o},s),e(l).attr("aria-required","true")),s.remote&&(o=s.remote,delete s.remote,s=e.extend(s,{remote:o})),s}}),e.extend(e.expr[":"],{blank:function(t){return!e.trim(""+e(t).val())},filled:function(t){return!!e.trim(""+e(t).val())},unchecked:function(t){return!e(t).prop("checked")}}),e.validator=function(t,r){this.settings=e.extend(!0,{},e.validator.defaults,t),this.currentForm=r,this.init()},e.validator.format=function(t,r){return 1===arguments.length?function(){var r=e.makeArray(arguments);return r.unshift(t),e.validator.format.apply(this,r)}:(arguments.length>2&&r.constructor!==Array&&(r=e.makeArray(arguments).slice(1)),r.constructor!==Array&&(r=[r]),e.each(r,function(e,r){t=t.replace(RegExp("\\{"+e+"\\}","g"),function(){return r})}),t)},e.extend(e.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:e([]),errorLabelContainer:e([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e){this.lastActive=e,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(e)).hide())},onfocusout:function(e){this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||this.element(e)},onkeyup:function(e,t){(9!==t.which||""!==this.elementValue(e))&&(e.name in this.submitted||e===this.lastElement)&&this.element(e)},onclick:function(e){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(t,r,i){"radio"===t.type?this.findByName(t.name).addClass(r).removeClass(i):e(t).addClass(r).removeClass(i)},unhighlight:function(t,r,i){"radio"===t.type?this.findByName(t.name).removeClass(r).addClass(i):e(t).removeClass(r).addClass(i)}},setDefaults:function(t){e.extend(e.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:e.validator.format("Please enter no more than {0} characters."),minlength:e.validator.format("Please enter at least {0} characters."),rangelength:e.validator.format("Please enter a value between {0} and {1} characters long."),range:e.validator.format("Please enter a value between {0} and {1}."),max:e.validator.format("Please enter a value less than or equal to {0}."),min:e.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function t(t){var r=e.data(this[0].form,"validator"),i="on"+t.type.replace(/^validate/,""),a=r.settings;a[i]&&!this.is(a.ignore)&&a[i].call(r,this[0],t)}this.labelContainer=e(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||e(this.currentForm),this.containers=e(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var r,i=this.groups={};e.each(this.settings.groups,function(t,r){"string"==typeof r&&(r=r.split(/\s/)),e.each(r,function(e,r){i[r]=t})}),r=this.settings.rules,e.each(r,function(t,i){r[t]=e.validator.normalizeRule(i)}),e(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",t).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",t),this.settings.invalidHandler&&e(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),e(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),e.extend(this.submitted,this.errorMap),this.invalid=e.extend({},this.errorMap),this.valid()||e(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(t){var r=this.clean(t),i=this.validationTargetFor(r),a=!0;return this.lastElement=i,void 0===i?delete this.invalid[r.name]:(this.prepareElement(i),this.currentElements=e(i),a=this.check(i)!==!1,a?delete this.invalid[i.name]:this.invalid[i.name]=!0),e(t).attr("aria-invalid",!a),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a},showErrors:function(t){if(t){e.extend(this.errorMap,t),this.errorList=[];for(var r in t)this.errorList.push({message:t[r],element:this.findByName(r)[0]});this.successList=e.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){e.fn.resetForm&&e(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t,r=0;for(t in e)r++;return r},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{e(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&1===e.grep(this.errorList,function(e){return e.element.name===t.name}).length&&t},elements:function(){var t=this,r={};return e(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in r||!t.objectLength(e(this).rules())?!1:(r[this.name]=!0,!0)})},clean:function(t){return e(t)[0]},errors:function(){var t=this.settings.errorClass.split(" ").join(".");return e(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=e([]),this.toHide=e([]),this.currentElements=e([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(t){var r,i=e(t),a=i.attr("type");return"radio"===a||"checkbox"===a?e("input[name='"+i.attr("name")+"']:checked").val():(r=i.val(),"string"==typeof r?r.replace(/\r/g,""):r)},check:function(t){t=this.validationTargetFor(this.clean(t));var r,i,a,n=e(t).rules(),s=e.map(n,function(e,t){return t}).length,o=!1,u=this.elementValue(t);for(i in n){a={method:i,parameters:n[i]};try{if(r=e.validator.methods[i].call(this,u,t,a.parameters),"dependency-mismatch"===r&&1===s){o=!0;continue}if(o=!1,"pending"===r)return void(this.toHide=this.toHide.not(this.errorsFor(t)));if(!r)return this.formatAndAdd(t,a),!1}catch(l){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+t.id+", check the '"+a.method+"' method.",l),l}}return o?void 0:(this.objectLength(n)&&this.successList.push(t),!0)},customDataMessage:function(t,r){return e(t).data("msg"+r[0].toUpperCase()+r.substring(1).toLowerCase())||e(t).data("msg")},customMessage:function(e,t){var r=this.settings.messages[e];return r&&(r.constructor===String?r:r[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e];return void 0},defaultMessage:function(t,r){return this.findDefined(this.customMessage(t.name,r),this.customDataMessage(t,r),!this.settings.ignoreTitle&&t.title||void 0,e.validator.messages[r],"<strong>Warning: No message defined for "+t.name+"</strong>")},formatAndAdd:function(t,r){var i=this.defaultMessage(t,r.method),a=/\$?\{(\d+)\}/g;"function"==typeof i?i=i.call(this,r.parameters,t):a.test(i)&&(i=e.validator.format(i.replace(a,"{$1}"),r.parameters)),this.errorList.push({message:i,element:t,method:r.method}),this.errorMap[t.name]=i,this.submitted[t.name]=i},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t,r;for(e=0;this.errorList[e];e++)r=this.errorList[e],this.settings.highlight&&this.settings.highlight.call(this,r.element,this.settings.errorClass,this.settings.validClass),this.showLabel(r.element,r.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return e(this.errorList).map(function(){return this.element})},showLabel:function(t,r){var i=this.errorsFor(t);i.length?(i.removeClass(this.settings.validClass).addClass(this.settings.errorClass),i.html(r)):(i=e("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(r||""),this.settings.wrapper&&(i=i.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(i).length||(this.settings.errorPlacement?this.settings.errorPlacement(i,e(t)):i.insertAfter(t))),!r&&this.settings.success&&(i.text(""),"string"==typeof this.settings.success?i.addClass(this.settings.success):this.settings.success(i,t)),this.toShow=this.toShow.add(i)},errorsFor:function(t){var r=this.idOrName(t);return this.errors().filter(function(){return e(this).attr("for")===r})},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name).not(this.settings.ignore)[0]),e},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(t){return e(this.currentForm).find("[name='"+t+"']")},getLength:function(t,r){switch(r.nodeName.toLowerCase()){case"select":return e("option:selected",r).length;case"input":if(this.checkable(r))return this.findByName(r.name).filter(":checked").length}return t.length},depend:function(e,t){return this.dependTypes[typeof e]?this.dependTypes[typeof e](e,t):!0},dependTypes:{"boolean":function(e){return e},string:function(t,r){return!!e(t,r.form).length},"function":function(e,t){return e(t)}},optional:function(t){var r=this.elementValue(t);return!e.validator.methods.required.call(this,r,t)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(t,r){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[t.name],r&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(e(this.currentForm).submit(),this.formSubmitted=!1):!r&&0===this.pendingRequest&&this.formSubmitted&&(e(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return e.data(t,"previousValue")||e.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,r){t.constructor===String?this.classRuleSettings[t]=r:e.extend(this.classRuleSettings,t)},classRules:function(t){var r={},i=e(t).attr("class");return i&&e.each(i.split(" "),function(){this in e.validator.classRuleSettings&&e.extend(r,e.validator.classRuleSettings[this])}),r},attributeRules:function(t){var r,i,a={},n=e(t),s=t.getAttribute("type");for(r in e.validator.methods)"required"===r?(i=t.getAttribute(r),""===i&&(i=!0),i=!!i):i=n.attr(r),/min|max/.test(r)&&(null===s||/number|range|text/.test(s))&&(i=+i),i||0===i?a[r]=i:s===r&&"range"!==s&&(a[r]=!0);return a.maxlength&&/-1|2147483647|524288/.test(a.maxlength)&&delete a.maxlength,a},dataRules:function(t){var r,i,a={},n=e(t);for(r in e.validator.methods)i=n.data("rule"+r[0].toUpperCase()+r.substring(1).toLowerCase()),void 0!==i&&(a[r]=i);return a},staticRules:function(t){var r={},i=e.data(t.form,"validator");return i.settings.rules&&(r=e.validator.normalizeRule(i.settings.rules[t.name])||{}),r},normalizeRules:function(t,r){return e.each(t,function(i,a){if(a===!1)return void delete t[i];if(a.param||a.depends){var n=!0;switch(typeof a.depends){case"string":n=!!e(a.depends,r.form).length;break;case"function":n=a.depends.call(r,r)}n?t[i]=void 0!==a.param?a.param:!0:delete t[i]}}),e.each(t,function(i,a){t[i]=e.isFunction(a)?a(r):a}),e.each(["minlength","maxlength"],function(){t[this]&&(t[this]=+t[this])}),e.each(["rangelength","range"],function(){var r;t[this]&&(e.isArray(t[this])?t[this]=[+t[this][0],+t[this][1]]:"string"==typeof t[this]&&(r=t[this].split(/[\s,]+/),t[this]=[+r[0],+r[1]]))}),e.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if("string"==typeof t){var r={};e.each(t.split(/\s/),function(){r[this]=!0}),t=r}return t},addMethod:function(t,r,i){e.validator.methods[t]=r,e.validator.messages[t]=void 0!==i?i:e.validator.messages[t],r.length<3&&e.validator.addClassRules(t,e.validator.normalizeRule(t))},methods:{required:function(t,r,i){if(!this.depend(i,r))return"dependency-mismatch";if("select"===r.nodeName.toLowerCase()){var a=e(r).val();return a&&a.length>0}return this.checkable(r)?this.getLength(t,r)>0:e.trim(t).length>0},email:function(e,t){return this.optional(t)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)},url:function(e,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test(""+new Date(e))},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;var r,i,a=0,n=0,s=!1;if(e=e.replace(/\D/g,""),e.length<13||e.length>19)return!1;for(r=e.length-1;r>=0;r--)i=e.charAt(r),n=parseInt(i,10),s&&(n*=2)>9&&(n-=9),a+=n,s=!s;return a%10===0},minlength:function(t,r,i){var a=e.isArray(t)?t.length:this.getLength(e.trim(t),r);return this.optional(r)||a>=i},maxlength:function(t,r,i){var a=e.isArray(t)?t.length:this.getLength(e.trim(t),r);return this.optional(r)||i>=a},rangelength:function(t,r,i){var a=e.isArray(t)?t.length:this.getLength(e.trim(t),r);return this.optional(r)||a>=i[0]&&a<=i[1]},min:function(e,t,r){return this.optional(t)||e>=r},max:function(e,t,r){return this.optional(t)||r>=e},range:function(e,t,r){return this.optional(t)||e>=r[0]&&e<=r[1]},equalTo:function(t,r,i){var a=e(i);return this.settings.onfocusout&&a.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){e(r).valid()}),t===a.val()},remote:function(t,r,i){if(this.optional(r))return"dependency-mismatch";var a,n,s=this.previousValue(r);return this.settings.messages[r.name]||(this.settings.messages[r.name]={}),s.originalMessage=this.settings.messages[r.name].remote,this.settings.messages[r.name].remote=s.message,i="string"==typeof i&&{url:i}||i,s.old===t?s.valid:(s.old=t,a=this,this.startRequest(r),n={},n[r.name]=t,e.ajax(e.extend(!0,{url:i,mode:"abort",port:"validate"+r.name,dataType:"json",data:n,context:a.currentForm,success:function(i){var n,o,u,l=i===!0||"true"===i;a.settings.messages[r.name].remote=s.originalMessage,l?(u=a.formSubmitted,a.prepareElement(r),a.formSubmitted=u,a.successList.push(r),delete a.invalid[r.name],a.showErrors()):(n={},o=i||a.defaultMessage(r,"remote"),n[r.name]=s.message=e.isFunction(o)?o(t):o,a.invalid[r.name]=!0,a.showErrors(n)),s.valid=l,a.stopRequest(r,l)}},i)),"pending")}}}),e.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."}}(jQuery),function(e){var t,r={};e.ajaxPrefilter?e.ajaxPrefilter(function(e,t,i){var a=e.port;"abort"===e.mode&&(r[a]&&r[a].abort(),r[a]=i)}):(t=e.ajax,e.ajax=function(i){var a=("mode"in i?i:e.ajaxSettings).mode,n=("port"in i?i:e.ajaxSettings).port;return"abort"===a?(r[n]&&r[n].abort(),r[n]=t.apply(this,arguments),r[n]):t.apply(this,arguments)})}(jQuery),function(e){e.extend(e.fn,{validateDelegate:function(t,r,i){return this.bind(r,function(r){var a=e(r.target);return a.is(t)?i.apply(a,arguments):void 0})}})}(jQuery),function(e){e.validator.addMethod("mc_birthday",function(t,r,i){var a=!1,n=e("input:not(:hidden)",e(r).closest(i));if(0==n.filter(":filled").length&&this.optional(r))a=!0;else{var s=[];s.month=n.filter("input[name*='[month]']").val(),s.day=n.filter("input[name*='[day]']").val(),s.month=s.month-1;var o=new Date(1970,s.month,s.day);a=o.getDate()!=s.day||o.getMonth()!=s.month?!1:!0}return a},"Please enter a valid month and day."),e.validator.addMethod("mc_date",function(t,r,i){var a=!1,n=e("input:not(:hidden)",e(r).closest(i));if(0==n.filter(":filled").length&&this.optional(r))a=!0;else{var s=[];s.month=n.filter("input[name*='[month]']").val(),s.day=n.filter("input[name*='[day]']").val(),s.year=n.filter("input[name*='[year]']").val(),s.month=s.month-1,s.year.length<4&&(s.year=parseInt(s.year)<50?2e3+parseInt(s.year):1900+parseInt(s.year));var o=new Date(s.year,s.month,s.day);a=o.getDate()!=s.day||o.getMonth()!=s.month||o.getFullYear()!=s.year?!1:!0}return a},"Please enter a valid date"),e.validator.addMethod("mc_phone",function(t,r,i){var a=!1,n=e("input:filled:not(:hidden)",e(r).closest(i));return 0==n.length&&this.optional(r)?a=!0:(t=n.eq(0).val()+n.eq(1).val()+n.eq(2).val(),a=10==t.length&&t.match(/[0-9]{9}/)),a},"Please specify a valid phone number"),e.validator.addMethod("skip_or_complete_group",function(t,r,i){var a=e("input:not(:hidden)",e(r).closest(i)),n=a.eq(0),s=n.data("valid_skip")?n.data("valid_skip"):e.extend({},this),o=a.filter(function(){return s.elementValue(this)}).length,u=0===o||o===a.length;return n.data("valid_skip",s),e(r).data("being_validated")||(a.data("being_validated",!0),a.each(function(){s.element(this)}),a.data("being_validated",!1)),u},e.validator.format("Please supply missing fields.")),e.validator.addMethod("skip_or_fill_minimum",function(t,r,i){var a=e(i[1],r.form),n=a.eq(0),s=n.data("valid_skip")?n.data("valid_skip"):e.extend({},this),o=a.filter(function(){return s.elementValue(this)}).length,u=0===o||o>=i[0];return console.log(a.eq(0)),n.data("valid_skip",s),e(r).data("being_validated")||(a.data("being_validated",!0),a.each(function(){s.element(this)}),a.data("being_validated",!1)),u},e.validator.format("Please either skip these fields or fill at least {0} of them.")),e.validator.addMethod("zipcodeUS",function(e,t){return this.optional(t)||/^\d{5}-\d{4}$|^\d{5}$/.test(e)},"The specified US ZIP Code is invalid")}(jQuery),function(e){var t="";try{t=mc_custom_error_style}catch(r){t="#mc_embed_signup input.mce_inline_error { border-color:#6B0505; } #mc_embed_signup div.mce_inline_error { margin: 0 0 1em 0; padding: 5px 10px; background-color:#6B0505; font-weight: bold; z-index: 1; color:#fff; }"}var a=document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t)),a.appendChild(n),window.mc={openPopup:function(){e("#mc_embed_signup a.mc_embed_close").show(),setTimeout(function(){e("#mc_embed_signup").fadeIn()},mc.delayPopup)},closePopup:function(){e("#mc_embed_signup").hide();var t=new Date,r=new Date(t.getTime()+31536e6);document.cookie="MCEvilPopupClosed=yes;expires="+r.toGMTString()+";path=/"},evalPopup:function(){for(e("#mc_embed_signup").hide(),cks=document.cookie.split(";"),i=0;i<cks.length;i++)parts=cks[i].split("="),-1!=parts[0].indexOf("MCEvilPopupClosed")&&(mc.showPopup=!1);mc.showPopup&&mc.openPopup()},getAjaxSubmitUrl:function(){var t=e("form#mc-embedded-subscribe-form").attr("action");return t=t.replace("/post?u=","/post-json?u="),t+="&c=?"},getGroups:function(){var t={};return e(".mc-field-group").each(function(){var r=e(this).find("input:text:not(:hidden)");if(r.length>1){var i=r.first().attr("name"),a=e.map(r,function(e){return e.name});t[i.substring(0,i.indexOf("["))]=a.join(" ")}}),t},isMultiPartField:function(t){return e("input:not(:hidden)",e(t).closest(".mc-field-group")).length>1},isTooEarly:function(t){var r=e("input:not(:hidden)",e(t).closest(".mc-field-group"));return e(r).eq(-1).attr("id")!=e(t).attr("id")},mce_success_cb:function(t){if(e("#mce-success-response").hide(),e("#mce-error-response").hide(),"success"==t.result)e("#mce-"+t.result+"-response").show(),e("#mce-"+t.result+"-response").html(t.msg),e("#mc-embedded-subscribe-form").each(function(){this.reset()});else{var r,a=-1;try{var n=t.msg.split(" - ",2);void 0==n[1]?r=t.msg:(i=parseInt(n[0]),""+i==n[0]?(a=n[0],r=n[1]):(a=-1,r=t.msg))}catch(s){a=-1,r=t.msg}try{if(-1==a)e("#mce-"+t.result+"-response").show(),e("#mce-"+t.result+"-response").html(r);else{var o=e("input[name*='"+fnames[a]+"']").attr("name"),u={};u[o]=r,mc.mce_validator.showErrors(u)}}catch(s){e("#mce-"+t.result+"-response").show(),e("#mce-"+t.result+"-response").html(r)}}}},window.mc.mce_validator=e("#mc-embedded-subscribe-form").validate({errorClass:"mce_inline_error",errorElement:"div",onkeyup:!1,onfocusout:function(t){mc.isTooEarly(t)||e(t).valid()},onblur:function(t){mc.isTooEarly(t)||e(t).valid()},groups:mc.getGroups(),errorPlacement:function(e,t){t.closest(".mc-field-group").append(e)},submitHandler:function(t){e(t).ajaxSubmit(mc.ajaxOptions)}}),window.mc.ajaxOptions={url:mc.getAjaxSubmitUrl(),type:"GET",dataType:"json",contentType:"application/json; charset=utf-8",success:mc.mce_success_cb},e.validator.addClassRules("birthday",{digits:!0,mc_birthday:".datefield"}),e.validator.addClassRules("datepart",{digits:!0,mc_date:".datefield"}),e.validator.addClassRules("phonepart",{digits:!0,mc_phone:".phonefield"}),e("#mc_embed_signup a.mc_embed_close").click(function(){mc.closePopup()}),e(document).keydown(function(e){keycode=null==e?event.keyCode:e.which,27==keycode&&void 0!==mc.showPopup&&mc.closePopup()})}(jQuery);
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Owl Carousel v2.2.1
|
3
|
+
* Copyright 2013-2017 David Deutsch
|
4
|
+
* Licensed under ()
|
5
|
+
*/
|
6
|
+
!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},a.each(["onResize","onThrottledResize"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Type={Event:"event",State:"state"},e.Plugins={},e.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(a){var b=this.settings.margin||"",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:"auto","margin-left":d?b:"","margin-right":d?"":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:["width","items","settings"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:["items","settings"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h="",i="";for(g/=2;g--;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i;this._clones=b,a(h).addClass("cloned").appendTo(this.$stage),a(i).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:["width","items","settings"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,"padding-left":a||"","padding-right":a||""};this.$stage.css(c)}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;c<d;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass("active"),this.settings.center&&(this.$stage.children(".center").removeClass("center"),this.$stage.children().eq(this.current()).addClass("center"))}}],e.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading")){var b,c,e;b=this.$element.find("img"),c=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,e=this.$element.children(c).width(),b.length&&e<=0&&this.preloadAutoWidthImages(b)}this.$element.addClass(this.options.loadingClass),this.$stage=a("<"+this.settings.stageElement+' class="'+this.settings.stageClass+'"/>').wrap('<div class="'+this.settings.stageOuterClass+'"/>'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this.$element.is(":visible")?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){a<=b&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),"function"==typeof e.stagePadding&&(e.stagePadding=e.stagePadding()),delete e.responsive,e.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+d))):e=a.extend({},this.options),this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},e.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};b<c;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={},!this.is("valid")&&this.enter("valid")},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.$element.is(":visible")&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},e.prototype.registerEventHandlers=function(){a.support.transition&&this.$stage.on(a.support.transition.end+".owl.core",a.proxy(this.onTransitionEnd,this)),this.settings.responsive!==!1&&this.on(b,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",a.proxy(this.onDragEnd,this)))},e.prototype.onDragStart=function(b){var d=null;3!==b.which&&(a.support.transform?(d=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","),d={x:d[16===d.length?12:4],y:d[16===d.length?13:5]}):(d=this.$stage.position(),d={x:this.settings.rtl?d.left+this.$stage.width()-this.width()+this.settings.margin:d.left,y:d.top}),this.is("animating")&&(a.support.transform?this.animate(d.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===b.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=a(b.target),this._drag.stage.start=d,this._drag.stage.current=d,this._drag.pointer=this.pointer(b),a(c).on("mouseup.owl.core touchend.owl.core",a.proxy(this.onDragEnd,this)),a(c).one("mousemove.owl.core touchmove.owl.core",a.proxy(function(b){var d=this.difference(this._drag.pointer,this.pointer(b));a(c).on("mousemove.owl.core touchmove.owl.core",a.proxy(this.onDragMove,this)),Math.abs(d.x)<Math.abs(d.y)&&this.is("valid")||(b.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},e.prototype.onDragMove=function(a){var b=null,c=null,d=null,e=this.difference(this._drag.pointer,this.pointer(a)),f=this.difference(this._drag.stage.start,e);this.is("dragging")&&(a.preventDefault(),this.settings.loop?(b=this.coordinates(this.minimum()),c=this.coordinates(this.maximum()+1)-b,f.x=((f.x-b)%c+c)%c+b):(b=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),c=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),d=this.settings.pullDrag?-1*e.x/5:0,f.x=Math.max(Math.min(f.x,b+d),c+d)),this._drag.stage.current=f,this.animate(f.x))},e.prototype.onDragEnd=function(b){var d=this.difference(this._drag.pointer,this.pointer(b)),e=this._drag.stage.current,f=d.x>0^this.settings.rtl?"left":"right";a(c).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==d.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==d.x?f:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=f,(Math.abs(d.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},e.prototype.closest=function(b,c){var d=-1,e=30,f=this.width(),g=this.coordinates();return this.settings.freeDrag||a.each(g,a.proxy(function(a,h){return"left"===c&&b>h-e&&b<h+e?d=a:"right"===c&&b>h-f-e&&b<h-f+e?d=a+1:this.op(b,"<",h)&&this.op(b,">",g[a+1]||h-f)&&(d="left"===c?a+1:a),d===-1},this)),this.settings.loop||(this.op(b,">",g[this.minimum()])?d=b=this.minimum():this.op(b,"<",g[this.maximum()])&&(d=b=this.maximum())),d},e.prototype.animate=function(b){var c=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),c&&(this.enter("animating"),this.trigger("translate")),a.support.transform3d&&a.support.transition?this.$stage.css({transform:"translate3d("+b+"px,0px,0px)",transition:this.speed()/1e3+"s"}):c?this.$stage.animate({left:b+"px"},this.speed(),this.settings.fallbackEasing,a.proxy(this.onTransitionEnd,this)):this.$stage.css({left:b+"px"})},e.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(b){return"string"===a.type(b)&&(this._invalidated[b]=!0,this.is("valid")&&this.leave("valid")),a.map(this._invalidated,function(a,b){return b})},e.prototype.reset=function(a){a=this.normalize(a),a!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(a,b){var c=this._items.length,e=b?0:this._clones.length;return!this.isNumeric(a)||c<1?a=d:(a<0||a>=c+e)&&(a=((a-e/2)%c+c)%c+e/2),a},e.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=this.settings,f=this._coordinates.length;if(e.loop)f=this._clones.length/2+this._items.length-1;else if(e.autoWidth||e.merge){for(b=this._items.length,c=this._items[--b].width(),d=this.$element.width();b--&&(c+=this._items[b].width()+this.settings.margin,!(c>d)););f=b+1}else f=e.center?this._items.length-1:this._items.length-e.items;return a&&(f-=this._clones.length/2),Math.max(f,0)},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2===0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c,e=1,f=b-1;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(this.settings.rtl&&(e=-1,f=b+1),c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[f]||0))/2*e):c=this._coordinates[f]||0,c=Math.ceil(c))},e.prototype.duration=function(a,b,c){return 0===c?0:Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(a,b){var c=this.current(),d=null,e=a-this.relative(c),f=(e>0)-(e<0),g=this._items.length,h=this.minimum(),i=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(e)>g/2&&(e+=f*-1*g),a=c+e,d=((a-h)%g+g)%g+h,d!==a&&d-e<=i&&d-e>0&&(c=d-e,a=d,this.reset(c))):this.settings.rewind?(i+=1,a=(a%i+i)%i):a=Math.max(h,Math.min(i,a)),this.speed(this.duration(c,a,b)),this.current(a),this.$element.is(":visible")&&this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.onTransitionEnd=function(a){if(a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},e.prototype.viewport=function(){var d;return this.options.responsiveBaseElement!==b?d=a(this.options.responsiveBaseElement).width():b.innerWidth?d=b.innerWidth:c.documentElement&&c.documentElement.clientWidth?d=c.documentElement.clientWidth:console.warn("Can not detect viewport width."),d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(b,c){var e=this.relative(this._current);c=c===d?this._items.length:this.normalize(c,!0),b=b instanceof jQuery?b:a(b),this.trigger("add",{content:b,position:c}),b=this.prepare(b),0===this._items.length||c===this._items.length?(0===this._items.length&&this.$stage.append(b),0!==this._items.length&&this._items[c-1].after(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[c].before(b),this._items.splice(c,0,b),this._mergers.splice(c,0,1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[e]&&this.reset(this._items[e].index()),this.invalidate("items"),this.trigger("added",{content:b,position:c})},e.prototype.remove=function(a){a=this.normalize(a,!0),a!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.preloadAutoWidthImages=function(b){b.each(a.proxy(function(b,c){this.enter("pre-loading"),c=a(c),a(new Image).one("load",a.proxy(function(a){c.attr("src",a.target.src),c.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",c.attr("src")||c.attr("data-src")||c.attr("data-src-retina"))},this))},e.prototype.destroy=function(){this.$element.off(".owl.core"),this.$stage.off(".owl.core"),a(c).off(".owl.core"),this.settings.responsive!==!1&&(b.clearTimeout(this.resizeTimer),this.off(b,"resize",this._handlers.onThrottledResize));for(var d in this._plugins)this._plugins[d].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:a<c;case">":return d?a<c:a>c;case">=":return d?a<=c:a>=c;case"<=":return d?a>=c:a<=c}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d,f,g){var h={item:{count:this._items.length,index:this.current()}},i=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),j=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},h,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(j)}),this.register({type:e.Type.Event,name:b}),this.$element.trigger(j),this.settings&&"function"==typeof this.settings[i]&&this.settings[i].call(this,j)),j},e.prototype.enter=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]===d&&(this._states.current[b]=0),this._states.current[b]++},this))},e.prototype.leave=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]--},this))},e.prototype.register=function(b){if(b.type===e.Type.Event){if(a.event.special[b.name]||(a.event.special[b.name]={}),!a.event.special[b.name].owl){var c=a.event.special[b.name]._default;a.event.special[b.name]._default=function(a){return!c||!c.apply||a.namespace&&a.namespace.indexOf("owl")!==-1?a.namespace&&a.namespace.indexOf("owl")>-1:c.apply(this,arguments)},a.event.special[b.name].owl=!0}}else b.type===e.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=a.grep(this._states.tags[b.name],a.proxy(function(c,d){return a.inArray(c,this._states.tags[b.name])===d},this)))},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.pointer=function(a){var c={x:null,y:null};return a=a.originalEvent||a||b.event,a=a.touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,a.pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},e.prototype.isNumeric=function(a){return!isNaN(parseFloat(a))},e.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},a.fn.owlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),f=d.data("owl.carousel");f||(f=new e(this,"object"==typeof b&&b),d.data("owl.carousel",f),a.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(b,c){f.register({type:e.Type.Event,name:c}),f.$element.on(c+".owl.carousel.core",a.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([c]),f[c].apply(this,[].slice.call(arguments,1)),this.release([c]))},f))})),"string"==typeof b&&"_"!==b.charAt(0)&&f[b].apply(f,c)})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoRefresh:!0,autoRefreshInterval:500},e.prototype.watch=function(){this._interval||(this._visible=this._core.$element.is(":visible"),this._interval=b.setInterval(a.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},e.prototype.refresh=function(){this._core.$element.is(":visible")!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},e.prototype.destroy=function(){var a,c;b.clearInterval(this._interval);for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoRefresh=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type))for(var c=this._core.settings,e=c.center&&Math.ceil(c.items/2)||c.items,f=c.center&&e*-1||0,g=(b.property&&b.property.value!==d?b.property.value:this._core.current())+f,h=this._core.clones().length,i=a.proxy(function(a,b){this.load(b)},this);f++<e;)this.load(h/2+this._core.relative(g)),h&&a.each(this._core.clones(this._core.relative(g)),i),g++},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={lazyLoad:!1},e.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":'url("'+g+'")',opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&"position"==a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},e.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.$stage.children().toArray().slice(b,c),e=[],f=0;a.each(d,function(b,c){e.push(a(c).height())}),f=Math.max.apply(null,e),this._core.$stage.parent().height(f).addClass(this._core.settings.autoHeightClass)},e.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"===a.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(".owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};e.Defaults={video:!1,videoHeight:!1,videoWidth:!1},e.prototype.fetch=function(a,b){var c=function(){return a.attr("data-vimeo-id")?"vimeo":a.attr("data-vzaar-id")?"vzaar":"youtube"}(),d=a.attr("data-vimeo-id")||a.attr("data-youtube-id")||a.attr("data-vzaar-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else if(d[3].indexOf("vimeo")>-1)c="vimeo";else{if(!(d[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");c="vzaar"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},e.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?'style="width:'+c.width+"px;height:"+c.height+'px;"':"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(a){e='<div class="owl-video-play-icon"></div>',d=k.lazyLoad?'<div class="owl-video-tn '+j+'" '+i+'="'+a+'"></div>':'<div class="owl-video-tn" style="opacity:1;background-image:url('+a+')"></div>',b.after(d),b.after(e)};if(b.wrap('<div class="owl-video-wrapper"'+g+"></div>"),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length)return l(h.attr(i)),h.remove(),!1;"youtube"===c.type?(f="//img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type?a.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}):"vzaar"===c.type&&a.ajax({type:"GET",url:"//vzaar.com/api/videos/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a.framegrab_url,l(f)}})},e.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest("."+this._core.settings.itemClass),f=this._videos[e.attr("data-video")],g=f.width||"100%",h=f.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),"youtube"===f.type?c='<iframe width="'+g+'" height="'+h+'" src="//www.youtube.com/embed/'+f.id+"?autoplay=1&rel=0&v="+f.id+'" frameborder="0" allowfullscreen></iframe>':"vimeo"===f.type?c='<iframe src="//player.vimeo.com/video/'+f.id+'?autoplay=1" width="'+g+'" height="'+h+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>':"vzaar"===f.type&&(c='<iframe frameborder="0"height="'+h+'"width="'+g+'" allowfullscreen mozallowfullscreen webkitAllowFullScreen src="//view.vzaar.com/'+f.id+'/player?autoplay=true"></iframe>'),a('<div class="owl-video-frame">'+c+"</div>").insertAfter(e.find(".owl-video")),this._playing=e.addClass("owl-video-playing"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass("owl-video-frame")},e.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g)),f&&e.one(a.support.animation.end,c).addClass("animated owl-animated-in").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},
|
7
|
+
a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._timeout=null,this._paused=!1,this._handlers={"changed.owl.carousel":a.proxy(function(a){a.namespace&&"settings"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&"position"===a.property.name&&this._core.settings.autoplay&&this._setAutoPlayInterval()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype.play=function(a,b){this._paused=!1,this._core.is("rotating")||(this._core.enter("rotating"),this._setAutoPlayInterval())},e.prototype._getNextTimeout=function(d,e){return this._timeout&&b.clearTimeout(this._timeout),b.setTimeout(a.proxy(function(){this._paused||this._core.is("busy")||this._core.is("interacting")||c.hidden||this._core.next(e||this._core.settings.autoplaySpeed)},this),d||this._core.settings.autoplayTimeout)},e.prototype._setAutoPlayInterval=function(){this._timeout=this._getNextTimeout()},e.prototype.stop=function(){this._core.is("rotating")&&(b.clearTimeout(this._timeout),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&(this._paused=!0)},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=a("<"+c.navElement+">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a("<"+c.navElement+">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a("<div>").addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","div",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if("page"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||"page"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;a<e;a++){if(b>=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length<=c.items,e=this._core.relative(this._core.current()),f=c.loop||c.rewind;this._controls.$relative.toggleClass("disabled",!c.nav||d),c.nav&&(this._controls.$previous.toggleClass("disabled",!f&&e<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!f&&e>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b<0&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(a.inArray(this.current(),this._pages)).addClass("active"))},e.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotsData?1:c.dotsEach||c.items)}},e.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,a.proxy(function(a,c){return a.start<=b&&a.end>=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;!d&&this._pages.length?(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c)):a.proxy(this._overrides.to,this._core)(b,c)},a.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":a.proxy(function(c){c.namespace&&"URLHash"===this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!c)return;this._hashes[c]=b.content}},this),"changed.owl.carousel":a.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+" "+h.join(f+" ")+f).split(" "),function(a,b){if(g[b]!==d)return e=!c||b,!1}),e}function f(a){return e(a,!0)}var g=a("<support>").get(0).style,h="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},j={csstransforms:function(){return!!e("transform")},csstransforms3d:function(){return!!e("perspective")},csstransitions:function(){return!!e("transition")},cssanimations:function(){return!!e("animation")}};j.csstransitions()&&(a.support.transition=new String(f("transition")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f("animation")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f("transform")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document);
|
8
|
+
|
9
|
+
$('.owl-carousel').owlCarousel({
|
10
|
+
loop:true,
|
11
|
+
margin:10,
|
12
|
+
nav:false,
|
13
|
+
lazyLoad: true,
|
14
|
+
autoplay:true,
|
15
|
+
autoplayTimeout:3000,
|
16
|
+
responsive:{
|
17
|
+
0:{
|
18
|
+
items:1
|
19
|
+
},
|
20
|
+
600:{
|
21
|
+
items:1
|
22
|
+
},
|
23
|
+
1000:{
|
24
|
+
items:1
|
25
|
+
}
|
26
|
+
}
|
27
|
+
});
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*! picturefill - v3.0.2 - 2016-02-12
|
2
|
+
* https://scottjehl.github.io/picturefill/
|
3
|
+
* Copyright (c) 2016 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT
|
4
|
+
*/
|
5
|
+
!function(a){var b=navigator.userAgent;a.HTMLPictureElement&&/ecko/.test(b)&&b.match(/rv\:(\d+)/)&&RegExp.$1<45&&addEventListener("resize",function(){var b,c=document.createElement("source"),d=function(a){var b,d,e=a.parentNode;"PICTURE"===e.nodeName.toUpperCase()?(b=c.cloneNode(),e.insertBefore(b,e.firstElementChild),setTimeout(function(){e.removeChild(b)})):(!a._pfLastSize||a.offsetWidth>a._pfLastSize)&&(a._pfLastSize=a.offsetWidth,d=a.sizes,a.sizes+=",100vw",setTimeout(function(){a.sizes=d}))},e=function(){var a,b=document.querySelectorAll("picture > img, img[srcset][sizes]");for(a=0;a<b.length;a++)d(b[a])},f=function(){clearTimeout(b),b=setTimeout(e,99)},g=a.matchMedia&&matchMedia("(orientation: landscape)"),h=function(){f(),g&&g.addListener&&g.addListener(f)};return c.srcset="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",/^[c|i]|d$/.test(document.readyState||"")?h():document.addEventListener("DOMContentLoaded",h),f}())}(window),function(a,b,c){"use strict";function d(a){return" "===a||" "===a||"\n"===a||"\f"===a||"\r"===a}function e(b,c){var d=new a.Image;return d.onerror=function(){A[b]=!1,ba()},d.onload=function(){A[b]=1===d.width,ba()},d.src=c,"pending"}function f(){M=!1,P=a.devicePixelRatio,N={},O={},s.DPR=P||1,Q.width=Math.max(a.innerWidth||0,z.clientWidth),Q.height=Math.max(a.innerHeight||0,z.clientHeight),Q.vw=Q.width/100,Q.vh=Q.height/100,r=[Q.height,Q.width,P].join("-"),Q.em=s.getEmValue(),Q.rem=Q.em}function g(a,b,c,d){var e,f,g,h;return"saveData"===B.algorithm?a>2.7?h=c+1:(f=b-c,e=Math.pow(a-.6,1.5),g=f*e,d&&(g+=.1*e),h=a+g):h=c>1?Math.sqrt(a*b):a,h>c}function h(a){var b,c=s.getSet(a),d=!1;"pending"!==c&&(d=r,c&&(b=s.setRes(c),s.applySetCandidate(b,a))),a[s.ns].evaled=d}function i(a,b){return a.res-b.res}function j(a,b,c){var d;return!c&&b&&(c=a[s.ns].sets,c=c&&c[c.length-1]),d=k(b,c),d&&(b=s.makeUrl(b),a[s.ns].curSrc=b,a[s.ns].curCan=d,d.res||aa(d,d.set.sizes)),d}function k(a,b){var c,d,e;if(a&&b)for(e=s.parseSet(b),a=s.makeUrl(a),c=0;c<e.length;c++)if(a===s.makeUrl(e[c].url)){d=e[c];break}return d}function l(a,b){var c,d,e,f,g=a.getElementsByTagName("source");for(c=0,d=g.length;d>c;c++)e=g[c],e[s.ns]=!0,f=e.getAttribute("srcset"),f&&b.push({srcset:f,media:e.getAttribute("media"),type:e.getAttribute("type"),sizes:e.getAttribute("sizes")})}function m(a,b){function c(b){var c,d=b.exec(a.substring(m));return d?(c=d[0],m+=c.length,c):void 0}function e(){var a,c,d,e,f,i,j,k,l,m=!1,o={};for(e=0;e<h.length;e++)f=h[e],i=f[f.length-1],j=f.substring(0,f.length-1),k=parseInt(j,10),l=parseFloat(j),X.test(j)&&"w"===i?((a||c)&&(m=!0),0===k?m=!0:a=k):Y.test(j)&&"x"===i?((a||c||d)&&(m=!0),0>l?m=!0:c=l):X.test(j)&&"h"===i?((d||c)&&(m=!0),0===k?m=!0:d=k):m=!0;m||(o.url=g,a&&(o.w=a),c&&(o.d=c),d&&(o.h=d),d||c||a||(o.d=1),1===o.d&&(b.has1x=!0),o.set=b,n.push(o))}function f(){for(c(T),i="",j="in descriptor";;){if(k=a.charAt(m),"in descriptor"===j)if(d(k))i&&(h.push(i),i="",j="after descriptor");else{if(","===k)return m+=1,i&&h.push(i),void e();if("("===k)i+=k,j="in parens";else{if(""===k)return i&&h.push(i),void e();i+=k}}else if("in parens"===j)if(")"===k)i+=k,j="in descriptor";else{if(""===k)return h.push(i),void e();i+=k}else if("after descriptor"===j)if(d(k));else{if(""===k)return void e();j="in descriptor",m-=1}m+=1}}for(var g,h,i,j,k,l=a.length,m=0,n=[];;){if(c(U),m>=l)return n;g=c(V),h=[],","===g.slice(-1)?(g=g.replace(W,""),e()):f()}}function n(a){function b(a){function b(){f&&(g.push(f),f="")}function c(){g[0]&&(h.push(g),g=[])}for(var e,f="",g=[],h=[],i=0,j=0,k=!1;;){if(e=a.charAt(j),""===e)return b(),c(),h;if(k){if("*"===e&&"/"===a[j+1]){k=!1,j+=2,b();continue}j+=1}else{if(d(e)){if(a.charAt(j-1)&&d(a.charAt(j-1))||!f){j+=1;continue}if(0===i){b(),j+=1;continue}e=" "}else if("("===e)i+=1;else if(")"===e)i-=1;else{if(","===e){b(),c(),j+=1;continue}if("/"===e&&"*"===a.charAt(j+1)){k=!0,j+=2;continue}}f+=e,j+=1}}}function c(a){return k.test(a)&&parseFloat(a)>=0?!0:l.test(a)?!0:"0"===a||"-0"===a||"+0"===a?!0:!1}var e,f,g,h,i,j,k=/^(?:[+-]?[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?(?:ch|cm|em|ex|in|mm|pc|pt|px|rem|vh|vmin|vmax|vw)$/i,l=/^calc\((?:[0-9a-z \.\+\-\*\/\(\)]+)\)$/i;for(f=b(a),g=f.length,e=0;g>e;e++)if(h=f[e],i=h[h.length-1],c(i)){if(j=i,h.pop(),0===h.length)return j;if(h=h.join(" "),s.matchesMedia(h))return j}return"100vw"}b.createElement("picture");var o,p,q,r,s={},t=!1,u=function(){},v=b.createElement("img"),w=v.getAttribute,x=v.setAttribute,y=v.removeAttribute,z=b.documentElement,A={},B={algorithm:""},C="data-pfsrc",D=C+"set",E=navigator.userAgent,F=/rident/.test(E)||/ecko/.test(E)&&E.match(/rv\:(\d+)/)&&RegExp.$1>35,G="currentSrc",H=/\s+\+?\d+(e\d+)?w/,I=/(\([^)]+\))?\s*(.+)/,J=a.picturefillCFG,K="position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)",L="font-size:100%!important;",M=!0,N={},O={},P=a.devicePixelRatio,Q={px:1,"in":96},R=b.createElement("a"),S=!1,T=/^[ \t\n\r\u000c]+/,U=/^[, \t\n\r\u000c]+/,V=/^[^ \t\n\r\u000c]+/,W=/[,]+$/,X=/^\d+$/,Y=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,Z=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d||!1):a.attachEvent&&a.attachEvent("on"+b,c)},$=function(a){var b={};return function(c){return c in b||(b[c]=a(c)),b[c]}},_=function(){var a=/^([\d\.]+)(em|vw|px)$/,b=function(){for(var a=arguments,b=0,c=a[0];++b in a;)c=c.replace(a[b],a[++b]);return c},c=$(function(a){return"return "+b((a||"").toLowerCase(),/\band\b/g,"&&",/,/g,"||",/min-([a-z-\s]+):/g,"e.$1>=",/max-([a-z-\s]+):/g,"e.$1<=",/calc([^)]+)/g,"($1)",/(\d+[\.]*[\d]*)([a-z]+)/g,"($1 * e.$2)",/^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi,"")+";"});return function(b,d){var e;if(!(b in N))if(N[b]=!1,d&&(e=b.match(a)))N[b]=e[1]*Q[e[2]];else try{N[b]=new Function("e",c(b))(Q)}catch(f){}return N[b]}}(),aa=function(a,b){return a.w?(a.cWidth=s.calcListLength(b||"100vw"),a.res=a.w/a.cWidth):a.res=a.d,a},ba=function(a){if(t){var c,d,e,f=a||{};if(f.elements&&1===f.elements.nodeType&&("IMG"===f.elements.nodeName.toUpperCase()?f.elements=[f.elements]:(f.context=f.elements,f.elements=null)),c=f.elements||s.qsa(f.context||b,f.reevaluate||f.reselect?s.sel:s.selShort),e=c.length){for(s.setupRun(f),S=!0,d=0;e>d;d++)s.fillImg(c[d],f);s.teardownRun(f)}}};o=a.console&&console.warn?function(a){console.warn(a)}:u,G in v||(G="src"),A["image/jpeg"]=!0,A["image/gif"]=!0,A["image/png"]=!0,A["image/svg+xml"]=b.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1"),s.ns=("pf"+(new Date).getTime()).substr(0,9),s.supSrcset="srcset"in v,s.supSizes="sizes"in v,s.supPicture=!!a.HTMLPictureElement,s.supSrcset&&s.supPicture&&!s.supSizes&&!function(a){v.srcset="data:,a",a.src="data:,a",s.supSrcset=v.complete===a.complete,s.supPicture=s.supSrcset&&s.supPicture}(b.createElement("img")),s.supSrcset&&!s.supSizes?!function(){var a="data:image/gif;base64,R0lGODlhAgABAPAAAP///wAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw==",c="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d=b.createElement("img"),e=function(){var a=d.width;2===a&&(s.supSizes=!0),q=s.supSrcset&&!s.supSizes,t=!0,setTimeout(ba)};d.onload=e,d.onerror=e,d.setAttribute("sizes","9px"),d.srcset=c+" 1w,"+a+" 9w",d.src=c}():t=!0,s.selShort="picture>img,img[srcset]",s.sel=s.selShort,s.cfg=B,s.DPR=P||1,s.u=Q,s.types=A,s.setSize=u,s.makeUrl=$(function(a){return R.href=a,R.href}),s.qsa=function(a,b){return"querySelector"in a?a.querySelectorAll(b):[]},s.matchesMedia=function(){return a.matchMedia&&(matchMedia("(min-width: 0.1em)")||{}).matches?s.matchesMedia=function(a){return!a||matchMedia(a).matches}:s.matchesMedia=s.mMQ,s.matchesMedia.apply(this,arguments)},s.mMQ=function(a){return a?_(a):!0},s.calcLength=function(a){var b=_(a,!0)||!1;return 0>b&&(b=!1),b},s.supportsType=function(a){return a?A[a]:!0},s.parseSize=$(function(a){var b=(a||"").match(I);return{media:b&&b[1],length:b&&b[2]}}),s.parseSet=function(a){return a.cands||(a.cands=m(a.srcset,a)),a.cands},s.getEmValue=function(){var a;if(!p&&(a=b.body)){var c=b.createElement("div"),d=z.style.cssText,e=a.style.cssText;c.style.cssText=K,z.style.cssText=L,a.style.cssText=L,a.appendChild(c),p=c.offsetWidth,a.removeChild(c),p=parseFloat(p,10),z.style.cssText=d,a.style.cssText=e}return p||16},s.calcListLength=function(a){if(!(a in O)||B.uT){var b=s.calcLength(n(a));O[a]=b?b:Q.width}return O[a]},s.setRes=function(a){var b;if(a){b=s.parseSet(a);for(var c=0,d=b.length;d>c;c++)aa(b[c],a.sizes)}return b},s.setRes.res=aa,s.applySetCandidate=function(a,b){if(a.length){var c,d,e,f,h,k,l,m,n,o=b[s.ns],p=s.DPR;if(k=o.curSrc||b[G],l=o.curCan||j(b,k,a[0].set),l&&l.set===a[0].set&&(n=F&&!b.complete&&l.res-.1>p,n||(l.cached=!0,l.res>=p&&(h=l))),!h)for(a.sort(i),f=a.length,h=a[f-1],d=0;f>d;d++)if(c=a[d],c.res>=p){e=d-1,h=a[e]&&(n||k!==s.makeUrl(c.url))&&g(a[e].res,c.res,p,a[e].cached)?a[e]:c;break}h&&(m=s.makeUrl(h.url),o.curSrc=m,o.curCan=h,m!==k&&s.setSrc(b,h),s.setSize(b))}},s.setSrc=function(a,b){var c;a.src=b.url,"image/svg+xml"===b.set.type&&(c=a.style.width,a.style.width=a.offsetWidth+1+"px",a.offsetWidth+1&&(a.style.width=c))},s.getSet=function(a){var b,c,d,e=!1,f=a[s.ns].sets;for(b=0;b<f.length&&!e;b++)if(c=f[b],c.srcset&&s.matchesMedia(c.media)&&(d=s.supportsType(c.type))){"pending"===d&&(c=d),e=c;break}return e},s.parseSets=function(a,b,d){var e,f,g,h,i=b&&"PICTURE"===b.nodeName.toUpperCase(),j=a[s.ns];(j.src===c||d.src)&&(j.src=w.call(a,"src"),j.src?x.call(a,C,j.src):y.call(a,C)),(j.srcset===c||d.srcset||!s.supSrcset||a.srcset)&&(e=w.call(a,"srcset"),j.srcset=e,h=!0),j.sets=[],i&&(j.pic=!0,l(b,j.sets)),j.srcset?(f={srcset:j.srcset,sizes:w.call(a,"sizes")},j.sets.push(f),g=(q||j.src)&&H.test(j.srcset||""),g||!j.src||k(j.src,f)||f.has1x||(f.srcset+=", "+j.src,f.cands.push({url:j.src,d:1,set:f}))):j.src&&j.sets.push({srcset:j.src,sizes:null}),j.curCan=null,j.curSrc=c,j.supported=!(i||f&&!s.supSrcset||g&&!s.supSizes),h&&s.supSrcset&&!j.supported&&(e?(x.call(a,D,e),a.srcset=""):y.call(a,D)),j.supported&&!j.srcset&&(!j.src&&a.src||a.src!==s.makeUrl(j.src))&&(null===j.src?a.removeAttribute("src"):a.src=j.src),j.parsed=!0},s.fillImg=function(a,b){var c,d=b.reselect||b.reevaluate;a[s.ns]||(a[s.ns]={}),c=a[s.ns],(d||c.evaled!==r)&&((!c.parsed||b.reevaluate)&&s.parseSets(a,a.parentNode,b),c.supported?c.evaled=r:h(a))},s.setupRun=function(){(!S||M||P!==a.devicePixelRatio)&&f()},s.supPicture?(ba=u,s.fillImg=u):!function(){var c,d=a.attachEvent?/d$|^c/:/d$|^c|^i/,e=function(){var a=b.readyState||"";f=setTimeout(e,"loading"===a?200:999),b.body&&(s.fillImgs(),c=c||d.test(a),c&&clearTimeout(f))},f=setTimeout(e,b.body?9:99),g=function(a,b){var c,d,e=function(){var f=new Date-d;b>f?c=setTimeout(e,b-f):(c=null,a())};return function(){d=new Date,c||(c=setTimeout(e,b))}},h=z.clientHeight,i=function(){M=Math.max(a.innerWidth||0,z.clientWidth)!==Q.width||z.clientHeight!==h,h=z.clientHeight,M&&s.fillImgs()};Z(a,"resize",g(i,99)),Z(b,"readystatechange",e)}(),s.picturefill=ba,s.fillImgs=ba,s.teardownRun=u,ba._=s,a.picturefillCFG={pf:s,push:function(a){var b=a.shift();"function"==typeof s[b]?s[b].apply(s,a):(B[b]=a[0],S&&s.fillImgs({reselect:!0}))}};for(;J&&J.length;)a.picturefillCFG.push(J.shift());a.picturefill=ba,"object"==typeof module&&"object"==typeof module.exports?module.exports=ba:"function"==typeof define&&define.amd&&define("picturefill",function(){return ba}),s.supPicture||(A["image/webp"]=e("image/webp","data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA=="))}(window,document);
|
@@ -0,0 +1,2004 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
4
|
+
(global.shuffle = factory());
|
5
|
+
}(this, (function () { 'use strict';
|
6
|
+
|
7
|
+
// Polyfill for creating CustomEvents on IE9/10/11
|
8
|
+
|
9
|
+
// code pulled from:
|
10
|
+
// https://github.com/d4tocchini/customevent-polyfill
|
11
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill
|
12
|
+
|
13
|
+
try {
|
14
|
+
var ce = new window.CustomEvent('test');
|
15
|
+
ce.preventDefault();
|
16
|
+
if (ce.defaultPrevented !== true) {
|
17
|
+
// IE has problems with .preventDefault() on custom events
|
18
|
+
// http://stackoverflow.com/questions/23349191
|
19
|
+
throw new Error('Could not prevent default');
|
20
|
+
}
|
21
|
+
} catch(e) {
|
22
|
+
var CustomEvent$1 = function(event, params) {
|
23
|
+
var evt, origPrevent;
|
24
|
+
params = params || {
|
25
|
+
bubbles: false,
|
26
|
+
cancelable: false,
|
27
|
+
detail: undefined
|
28
|
+
};
|
29
|
+
|
30
|
+
evt = document.createEvent("CustomEvent");
|
31
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
32
|
+
origPrevent = evt.preventDefault;
|
33
|
+
evt.preventDefault = function () {
|
34
|
+
origPrevent.call(this);
|
35
|
+
try {
|
36
|
+
Object.defineProperty(this, 'defaultPrevented', {
|
37
|
+
get: function () {
|
38
|
+
return true;
|
39
|
+
}
|
40
|
+
});
|
41
|
+
} catch(e) {
|
42
|
+
this.defaultPrevented = true;
|
43
|
+
}
|
44
|
+
};
|
45
|
+
return evt;
|
46
|
+
};
|
47
|
+
|
48
|
+
CustomEvent$1.prototype = window.Event.prototype;
|
49
|
+
window.CustomEvent = CustomEvent$1; // expose definition to window
|
50
|
+
}
|
51
|
+
|
52
|
+
var proto = Element.prototype;
|
53
|
+
var vendor = proto.matches
|
54
|
+
|| proto.matchesSelector
|
55
|
+
|| proto.webkitMatchesSelector
|
56
|
+
|| proto.mozMatchesSelector
|
57
|
+
|| proto.msMatchesSelector
|
58
|
+
|| proto.oMatchesSelector;
|
59
|
+
|
60
|
+
var index = match;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Match `el` to `selector`.
|
64
|
+
*
|
65
|
+
* @param {Element} el
|
66
|
+
* @param {String} selector
|
67
|
+
* @return {Boolean}
|
68
|
+
* @api public
|
69
|
+
*/
|
70
|
+
|
71
|
+
function match(el, selector) {
|
72
|
+
if (vendor) return vendor.call(el, selector);
|
73
|
+
var nodes = el.parentNode.querySelectorAll(selector);
|
74
|
+
for (var i = 0; i < nodes.length; i++) {
|
75
|
+
if (nodes[i] == el) return true;
|
76
|
+
}
|
77
|
+
return false;
|
78
|
+
}
|
79
|
+
|
80
|
+
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
function createCommonjsModule(fn, module) {
|
87
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
88
|
+
}
|
89
|
+
|
90
|
+
var index$1 = createCommonjsModule(function (module) {
|
91
|
+
'use strict';
|
92
|
+
|
93
|
+
// there's 3 implementations written in increasing order of efficiency
|
94
|
+
|
95
|
+
// 1 - no Set type is defined
|
96
|
+
function uniqNoSet(arr) {
|
97
|
+
var ret = [];
|
98
|
+
|
99
|
+
for (var i = 0; i < arr.length; i++) {
|
100
|
+
if (ret.indexOf(arr[i]) === -1) {
|
101
|
+
ret.push(arr[i]);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
return ret;
|
106
|
+
}
|
107
|
+
|
108
|
+
// 2 - a simple Set type is defined
|
109
|
+
function uniqSet(arr) {
|
110
|
+
var seen = new Set();
|
111
|
+
return arr.filter(function (el) {
|
112
|
+
if (!seen.has(el)) {
|
113
|
+
seen.add(el);
|
114
|
+
return true;
|
115
|
+
}
|
116
|
+
|
117
|
+
return false;
|
118
|
+
});
|
119
|
+
}
|
120
|
+
|
121
|
+
// 3 - a standard Set type is defined and it has a forEach method
|
122
|
+
function uniqSetWithForEach(arr) {
|
123
|
+
var ret = [];
|
124
|
+
|
125
|
+
(new Set(arr)).forEach(function (el) {
|
126
|
+
ret.push(el);
|
127
|
+
});
|
128
|
+
|
129
|
+
return ret;
|
130
|
+
}
|
131
|
+
|
132
|
+
// V8 currently has a broken implementation
|
133
|
+
// https://github.com/joyent/node/issues/8449
|
134
|
+
function doesForEachActuallyWork() {
|
135
|
+
var ret = false;
|
136
|
+
|
137
|
+
(new Set([true])).forEach(function (el) {
|
138
|
+
ret = el;
|
139
|
+
});
|
140
|
+
|
141
|
+
return ret === true;
|
142
|
+
}
|
143
|
+
|
144
|
+
if ('Set' in commonjsGlobal) {
|
145
|
+
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
|
146
|
+
module.exports = uniqSetWithForEach;
|
147
|
+
} else {
|
148
|
+
module.exports = uniqSet;
|
149
|
+
}
|
150
|
+
} else {
|
151
|
+
module.exports = uniqNoSet;
|
152
|
+
}
|
153
|
+
});
|
154
|
+
|
155
|
+
var immutable = extend;
|
156
|
+
|
157
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
158
|
+
|
159
|
+
function extend() {
|
160
|
+
var target = {};
|
161
|
+
|
162
|
+
for (var i = 0; i < arguments.length; i++) {
|
163
|
+
var source = arguments[i];
|
164
|
+
|
165
|
+
for (var key in source) {
|
166
|
+
if (hasOwnProperty.call(source, key)) {
|
167
|
+
target[key] = source[key];
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
return target
|
173
|
+
}
|
174
|
+
|
175
|
+
var index$2 = throttle;
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Returns a new function that, when invoked, invokes `func` at most once per `wait` milliseconds.
|
179
|
+
*
|
180
|
+
* @param {Function} func Function to wrap.
|
181
|
+
* @param {Number} wait Number of milliseconds that must elapse between `func` invocations.
|
182
|
+
* @return {Function} A new function that wraps the `func` function passed in.
|
183
|
+
*/
|
184
|
+
|
185
|
+
function throttle (func, wait) {
|
186
|
+
var ctx, args, rtn, timeoutID; // caching
|
187
|
+
var last = 0;
|
188
|
+
|
189
|
+
return function throttled () {
|
190
|
+
ctx = this;
|
191
|
+
args = arguments;
|
192
|
+
var delta = new Date() - last;
|
193
|
+
if (!timeoutID)
|
194
|
+
if (delta >= wait) call();
|
195
|
+
else timeoutID = setTimeout(call, wait - delta);
|
196
|
+
return rtn;
|
197
|
+
};
|
198
|
+
|
199
|
+
function call () {
|
200
|
+
timeoutID = 0;
|
201
|
+
last = +new Date();
|
202
|
+
rtn = func.apply(ctx, args);
|
203
|
+
ctx = null;
|
204
|
+
args = null;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
var index$3 = function parallel(fns, context, callback) {
|
209
|
+
if (!callback) {
|
210
|
+
if (typeof context === 'function') {
|
211
|
+
callback = context;
|
212
|
+
context = null;
|
213
|
+
} else {
|
214
|
+
callback = noop;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
var pending = fns && fns.length;
|
219
|
+
if (!pending) return callback(null, []);
|
220
|
+
|
221
|
+
var finished = false;
|
222
|
+
var results = new Array(pending);
|
223
|
+
|
224
|
+
fns.forEach(context ? function (fn, i) {
|
225
|
+
fn.call(context, maybeDone(i));
|
226
|
+
} : function (fn, i) {
|
227
|
+
fn(maybeDone(i));
|
228
|
+
});
|
229
|
+
|
230
|
+
function maybeDone(i) {
|
231
|
+
return function (err, result) {
|
232
|
+
if (finished) return;
|
233
|
+
|
234
|
+
if (err) {
|
235
|
+
callback(err, results);
|
236
|
+
finished = true;
|
237
|
+
return
|
238
|
+
}
|
239
|
+
|
240
|
+
results[i] = result;
|
241
|
+
|
242
|
+
if (!--pending) callback(null, results);
|
243
|
+
}
|
244
|
+
}
|
245
|
+
};
|
246
|
+
|
247
|
+
function noop() {}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Always returns a numeric value, given a value. Logic from jQuery's `isNumeric`.
|
251
|
+
* @param {*} value Possibly numeric value.
|
252
|
+
* @return {number} `value` or zero if `value` isn't numeric.
|
253
|
+
*/
|
254
|
+
function getNumber(value) {
|
255
|
+
return parseFloat(value) || 0;
|
256
|
+
}
|
257
|
+
|
258
|
+
var classCallCheck = function (instance, Constructor) {
|
259
|
+
if (!(instance instanceof Constructor)) {
|
260
|
+
throw new TypeError("Cannot call a class as a function");
|
261
|
+
}
|
262
|
+
};
|
263
|
+
|
264
|
+
var createClass = function () {
|
265
|
+
function defineProperties(target, props) {
|
266
|
+
for (var i = 0; i < props.length; i++) {
|
267
|
+
var descriptor = props[i];
|
268
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
269
|
+
descriptor.configurable = true;
|
270
|
+
if ("value" in descriptor) descriptor.writable = true;
|
271
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
return function (Constructor, protoProps, staticProps) {
|
276
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
277
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
278
|
+
return Constructor;
|
279
|
+
};
|
280
|
+
}();
|
281
|
+
|
282
|
+
var Point = function () {
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Represents a coordinate pair.
|
286
|
+
* @param {number} [x=0] X.
|
287
|
+
* @param {number} [y=0] Y.
|
288
|
+
*/
|
289
|
+
function Point(x, y) {
|
290
|
+
classCallCheck(this, Point);
|
291
|
+
|
292
|
+
this.x = getNumber(x);
|
293
|
+
this.y = getNumber(y);
|
294
|
+
}
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Whether two points are equal.
|
298
|
+
* @param {Point} a Point A.
|
299
|
+
* @param {Point} b Point B.
|
300
|
+
* @return {boolean}
|
301
|
+
*/
|
302
|
+
|
303
|
+
|
304
|
+
createClass(Point, null, [{
|
305
|
+
key: 'equals',
|
306
|
+
value: function equals(a, b) {
|
307
|
+
return a.x === b.x && a.y === b.y;
|
308
|
+
}
|
309
|
+
}]);
|
310
|
+
return Point;
|
311
|
+
}();
|
312
|
+
|
313
|
+
var Classes = {
|
314
|
+
BASE: 'shuffle',
|
315
|
+
SHUFFLE_ITEM: 'shuffle-item',
|
316
|
+
VISIBLE: 'shuffle-item--visible',
|
317
|
+
HIDDEN: 'shuffle-item--hidden'
|
318
|
+
};
|
319
|
+
|
320
|
+
var id$1 = 0;
|
321
|
+
|
322
|
+
var ShuffleItem = function () {
|
323
|
+
function ShuffleItem(element) {
|
324
|
+
classCallCheck(this, ShuffleItem);
|
325
|
+
|
326
|
+
id$1 += 1;
|
327
|
+
this.id = id$1;
|
328
|
+
this.element = element;
|
329
|
+
this.isVisible = true;
|
330
|
+
}
|
331
|
+
|
332
|
+
createClass(ShuffleItem, [{
|
333
|
+
key: 'show',
|
334
|
+
value: function show() {
|
335
|
+
this.isVisible = true;
|
336
|
+
this.element.classList.remove(Classes.HIDDEN);
|
337
|
+
this.element.classList.add(Classes.VISIBLE);
|
338
|
+
}
|
339
|
+
}, {
|
340
|
+
key: 'hide',
|
341
|
+
value: function hide() {
|
342
|
+
this.isVisible = false;
|
343
|
+
this.element.classList.remove(Classes.VISIBLE);
|
344
|
+
this.element.classList.add(Classes.HIDDEN);
|
345
|
+
}
|
346
|
+
}, {
|
347
|
+
key: 'init',
|
348
|
+
value: function init() {
|
349
|
+
this.addClasses([Classes.SHUFFLE_ITEM, Classes.VISIBLE]);
|
350
|
+
this.applyCss(ShuffleItem.Css.INITIAL);
|
351
|
+
this.scale = ShuffleItem.Scale.VISIBLE;
|
352
|
+
this.point = new Point();
|
353
|
+
}
|
354
|
+
}, {
|
355
|
+
key: 'addClasses',
|
356
|
+
value: function addClasses(classes) {
|
357
|
+
var _this = this;
|
358
|
+
|
359
|
+
classes.forEach(function (className) {
|
360
|
+
_this.element.classList.add(className);
|
361
|
+
});
|
362
|
+
}
|
363
|
+
}, {
|
364
|
+
key: 'removeClasses',
|
365
|
+
value: function removeClasses(classes) {
|
366
|
+
var _this2 = this;
|
367
|
+
|
368
|
+
classes.forEach(function (className) {
|
369
|
+
_this2.element.classList.remove(className);
|
370
|
+
});
|
371
|
+
}
|
372
|
+
}, {
|
373
|
+
key: 'applyCss',
|
374
|
+
value: function applyCss(obj) {
|
375
|
+
var _this3 = this;
|
376
|
+
|
377
|
+
Object.keys(obj).forEach(function (key) {
|
378
|
+
_this3.element.style[key] = obj[key];
|
379
|
+
});
|
380
|
+
}
|
381
|
+
}, {
|
382
|
+
key: 'dispose',
|
383
|
+
value: function dispose() {
|
384
|
+
this.removeClasses([Classes.HIDDEN, Classes.VISIBLE, Classes.SHUFFLE_ITEM]);
|
385
|
+
|
386
|
+
this.element.removeAttribute('style');
|
387
|
+
this.element = null;
|
388
|
+
}
|
389
|
+
}]);
|
390
|
+
return ShuffleItem;
|
391
|
+
}();
|
392
|
+
|
393
|
+
ShuffleItem.Css = {
|
394
|
+
INITIAL: {
|
395
|
+
position: 'absolute',
|
396
|
+
top: 0,
|
397
|
+
left: 0,
|
398
|
+
visibility: 'visible',
|
399
|
+
'will-change': 'transform'
|
400
|
+
},
|
401
|
+
VISIBLE: {
|
402
|
+
before: {
|
403
|
+
opacity: 1,
|
404
|
+
visibility: 'visible'
|
405
|
+
},
|
406
|
+
after: {}
|
407
|
+
},
|
408
|
+
HIDDEN: {
|
409
|
+
before: {
|
410
|
+
opacity: 0
|
411
|
+
},
|
412
|
+
after: {
|
413
|
+
visibility: 'hidden'
|
414
|
+
}
|
415
|
+
}
|
416
|
+
};
|
417
|
+
|
418
|
+
ShuffleItem.Scale = {
|
419
|
+
VISIBLE: 1,
|
420
|
+
HIDDEN: 0.001
|
421
|
+
};
|
422
|
+
|
423
|
+
var element = document.body || document.documentElement;
|
424
|
+
var e$1 = document.createElement('div');
|
425
|
+
e$1.style.cssText = 'width:10px;padding:2px;box-sizing:border-box;';
|
426
|
+
element.appendChild(e$1);
|
427
|
+
|
428
|
+
var width = window.getComputedStyle(e$1, null).width;
|
429
|
+
var ret = width === '10px';
|
430
|
+
|
431
|
+
element.removeChild(e$1);
|
432
|
+
|
433
|
+
/**
|
434
|
+
* Retrieve the computed style for an element, parsed as a float.
|
435
|
+
* @param {Element} element Element to get style for.
|
436
|
+
* @param {string} style Style property.
|
437
|
+
* @param {CSSStyleDeclaration} [styles] Optionally include clean styles to
|
438
|
+
* use instead of asking for them again.
|
439
|
+
* @return {number} The parsed computed value or zero if that fails because IE
|
440
|
+
* will return 'auto' when the element doesn't have margins instead of
|
441
|
+
* the computed style.
|
442
|
+
*/
|
443
|
+
function getNumberStyle(element, style) {
|
444
|
+
var styles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.getComputedStyle(element, null);
|
445
|
+
|
446
|
+
var value = getNumber(styles[style]);
|
447
|
+
|
448
|
+
// Support IE<=11 and W3C spec.
|
449
|
+
if (!ret && style === 'width') {
|
450
|
+
value += getNumber(styles.paddingLeft) + getNumber(styles.paddingRight) + getNumber(styles.borderLeftWidth) + getNumber(styles.borderRightWidth);
|
451
|
+
} else if (!ret && style === 'height') {
|
452
|
+
value += getNumber(styles.paddingTop) + getNumber(styles.paddingBottom) + getNumber(styles.borderTopWidth) + getNumber(styles.borderBottomWidth);
|
453
|
+
}
|
454
|
+
|
455
|
+
return value;
|
456
|
+
}
|
457
|
+
|
458
|
+
/**
|
459
|
+
* Fisher-Yates shuffle.
|
460
|
+
* http://stackoverflow.com/a/962890/373422
|
461
|
+
* https://bost.ocks.org/mike/shuffle/
|
462
|
+
* @param {Array} array Array to shuffle.
|
463
|
+
* @return {Array} Randomly sorted array.
|
464
|
+
*/
|
465
|
+
function randomize(array) {
|
466
|
+
var n = array.length;
|
467
|
+
|
468
|
+
while (n) {
|
469
|
+
n -= 1;
|
470
|
+
var i = Math.floor(Math.random() * (n + 1));
|
471
|
+
var temp = array[i];
|
472
|
+
array[i] = array[n];
|
473
|
+
array[n] = temp;
|
474
|
+
}
|
475
|
+
|
476
|
+
return array;
|
477
|
+
}
|
478
|
+
|
479
|
+
var defaults$1 = {
|
480
|
+
// Use array.reverse() to reverse the results
|
481
|
+
reverse: false,
|
482
|
+
|
483
|
+
// Sorting function
|
484
|
+
by: null,
|
485
|
+
|
486
|
+
// If true, this will skip the sorting and return a randomized order in the array
|
487
|
+
randomize: false,
|
488
|
+
|
489
|
+
// Determines which property of each item in the array is passed to the
|
490
|
+
// sorting method.
|
491
|
+
key: 'element'
|
492
|
+
};
|
493
|
+
|
494
|
+
// You can return `undefined` from the `by` function to revert to DOM order.
|
495
|
+
function sorter(arr, options) {
|
496
|
+
var opts = immutable(defaults$1, options);
|
497
|
+
var original = [].slice.call(arr);
|
498
|
+
var revert = false;
|
499
|
+
|
500
|
+
if (!arr.length) {
|
501
|
+
return [];
|
502
|
+
}
|
503
|
+
|
504
|
+
if (opts.randomize) {
|
505
|
+
return randomize(arr);
|
506
|
+
}
|
507
|
+
|
508
|
+
// Sort the elements by the opts.by function.
|
509
|
+
// If we don't have opts.by, default to DOM order
|
510
|
+
if (typeof opts.by === 'function') {
|
511
|
+
arr.sort(function (a, b) {
|
512
|
+
// Exit early if we already know we want to revert
|
513
|
+
if (revert) {
|
514
|
+
return 0;
|
515
|
+
}
|
516
|
+
|
517
|
+
var valA = opts.by(a[opts.key]);
|
518
|
+
var valB = opts.by(b[opts.key]);
|
519
|
+
|
520
|
+
// If both values are undefined, use the DOM order
|
521
|
+
if (valA === undefined && valB === undefined) {
|
522
|
+
revert = true;
|
523
|
+
return 0;
|
524
|
+
}
|
525
|
+
|
526
|
+
if (valA < valB || valA === 'sortFirst' || valB === 'sortLast') {
|
527
|
+
return -1;
|
528
|
+
}
|
529
|
+
|
530
|
+
if (valA > valB || valA === 'sortLast' || valB === 'sortFirst') {
|
531
|
+
return 1;
|
532
|
+
}
|
533
|
+
|
534
|
+
return 0;
|
535
|
+
});
|
536
|
+
}
|
537
|
+
|
538
|
+
// Revert to the original array if necessary
|
539
|
+
if (revert) {
|
540
|
+
return original;
|
541
|
+
}
|
542
|
+
|
543
|
+
if (opts.reverse) {
|
544
|
+
arr.reverse();
|
545
|
+
}
|
546
|
+
|
547
|
+
return arr;
|
548
|
+
}
|
549
|
+
|
550
|
+
var transitions = {};
|
551
|
+
var eventName = 'transitionend';
|
552
|
+
var count = 0;
|
553
|
+
|
554
|
+
function uniqueId() {
|
555
|
+
count += 1;
|
556
|
+
return eventName + count;
|
557
|
+
}
|
558
|
+
|
559
|
+
function cancelTransitionEnd(id) {
|
560
|
+
if (transitions[id]) {
|
561
|
+
transitions[id].element.removeEventListener(eventName, transitions[id].listener);
|
562
|
+
transitions[id] = null;
|
563
|
+
return true;
|
564
|
+
}
|
565
|
+
|
566
|
+
return false;
|
567
|
+
}
|
568
|
+
|
569
|
+
function onTransitionEnd(element, callback) {
|
570
|
+
var id = uniqueId();
|
571
|
+
var listener = function listener(evt) {
|
572
|
+
if (evt.currentTarget === evt.target) {
|
573
|
+
cancelTransitionEnd(id);
|
574
|
+
callback(evt);
|
575
|
+
}
|
576
|
+
};
|
577
|
+
|
578
|
+
element.addEventListener(eventName, listener);
|
579
|
+
|
580
|
+
transitions[id] = { element: element, listener: listener };
|
581
|
+
|
582
|
+
return id;
|
583
|
+
}
|
584
|
+
|
585
|
+
function arrayMax(array) {
|
586
|
+
return Math.max.apply(Math, array); // eslint-disable-line prefer-spread
|
587
|
+
}
|
588
|
+
|
589
|
+
function arrayMin(array) {
|
590
|
+
return Math.min.apply(Math, array); // eslint-disable-line prefer-spread
|
591
|
+
}
|
592
|
+
|
593
|
+
/**
|
594
|
+
* Determine the number of columns an items spans.
|
595
|
+
* @param {number} itemWidth Width of the item.
|
596
|
+
* @param {number} columnWidth Width of the column (includes gutter).
|
597
|
+
* @param {number} columns Total number of columns
|
598
|
+
* @param {number} threshold A buffer value for the size of the column to fit.
|
599
|
+
* @return {number}
|
600
|
+
*/
|
601
|
+
function getColumnSpan(itemWidth, columnWidth, columns, threshold) {
|
602
|
+
var columnSpan = itemWidth / columnWidth;
|
603
|
+
|
604
|
+
// If the difference between the rounded column span number and the
|
605
|
+
// calculated column span number is really small, round the number to
|
606
|
+
// make it fit.
|
607
|
+
if (Math.abs(Math.round(columnSpan) - columnSpan) < threshold) {
|
608
|
+
// e.g. columnSpan = 4.0089945390298745
|
609
|
+
columnSpan = Math.round(columnSpan);
|
610
|
+
}
|
611
|
+
|
612
|
+
// Ensure the column span is not more than the amount of columns in the whole layout.
|
613
|
+
return Math.min(Math.ceil(columnSpan), columns);
|
614
|
+
}
|
615
|
+
|
616
|
+
/**
|
617
|
+
* Retrieves the column set to use for placement.
|
618
|
+
* @param {number} columnSpan The number of columns this current item spans.
|
619
|
+
* @param {number} columns The total columns in the grid.
|
620
|
+
* @return {Array.<number>} An array of numbers represeting the column set.
|
621
|
+
*/
|
622
|
+
function getAvailablePositions(positions, columnSpan, columns) {
|
623
|
+
// The item spans only one column.
|
624
|
+
if (columnSpan === 1) {
|
625
|
+
return positions;
|
626
|
+
}
|
627
|
+
|
628
|
+
// The item spans more than one column, figure out how many different
|
629
|
+
// places it could fit horizontally.
|
630
|
+
// The group count is the number of places within the positions this block
|
631
|
+
// could fit, ignoring the current positions of items.
|
632
|
+
// Imagine a 2 column brick as the second item in a 4 column grid with
|
633
|
+
// 10px height each. Find the places it would fit:
|
634
|
+
// [20, 10, 10, 0]
|
635
|
+
// | | |
|
636
|
+
// * * *
|
637
|
+
//
|
638
|
+
// Then take the places which fit and get the bigger of the two:
|
639
|
+
// max([20, 10]), max([10, 10]), max([10, 0]) = [20, 10, 0]
|
640
|
+
//
|
641
|
+
// Next, find the first smallest number (the short column).
|
642
|
+
// [20, 10, 0]
|
643
|
+
// |
|
644
|
+
// *
|
645
|
+
//
|
646
|
+
// And that's where it should be placed!
|
647
|
+
//
|
648
|
+
// Another example where the second column's item extends past the first:
|
649
|
+
// [10, 20, 10, 0] => [20, 20, 10] => 10
|
650
|
+
var available = [];
|
651
|
+
|
652
|
+
// For how many possible positions for this item there are.
|
653
|
+
for (var i = 0; i <= columns - columnSpan; i++) {
|
654
|
+
// Find the bigger value for each place it could fit.
|
655
|
+
available.push(arrayMax(positions.slice(i, i + columnSpan)));
|
656
|
+
}
|
657
|
+
|
658
|
+
return available;
|
659
|
+
}
|
660
|
+
|
661
|
+
/**
|
662
|
+
* Find index of short column, the first from the left where this item will go.
|
663
|
+
*
|
664
|
+
* @param {Array.<number>} positions The array to search for the smallest number.
|
665
|
+
* @param {number} buffer Optional buffer which is very useful when the height
|
666
|
+
* is a percentage of the width.
|
667
|
+
* @return {number} Index of the short column.
|
668
|
+
*/
|
669
|
+
function getShortColumn(positions, buffer) {
|
670
|
+
var minPosition = arrayMin(positions);
|
671
|
+
for (var i = 0, len = positions.length; i < len; i++) {
|
672
|
+
if (positions[i] >= minPosition - buffer && positions[i] <= minPosition + buffer) {
|
673
|
+
return i;
|
674
|
+
}
|
675
|
+
}
|
676
|
+
|
677
|
+
return 0;
|
678
|
+
}
|
679
|
+
|
680
|
+
/**
|
681
|
+
* Determine the location of the next item, based on its size.
|
682
|
+
* @param {Object} itemSize Object with width and height.
|
683
|
+
* @param {Array.<number>} positions Positions of the other current items.
|
684
|
+
* @param {number} gridSize The column width or row height.
|
685
|
+
* @param {number} total The total number of columns or rows.
|
686
|
+
* @param {number} threshold Buffer value for the column to fit.
|
687
|
+
* @param {number} buffer Vertical buffer for the height of items.
|
688
|
+
* @return {Point}
|
689
|
+
*/
|
690
|
+
function getItemPosition(_ref) {
|
691
|
+
var itemSize = _ref.itemSize,
|
692
|
+
positions = _ref.positions,
|
693
|
+
gridSize = _ref.gridSize,
|
694
|
+
total = _ref.total,
|
695
|
+
threshold = _ref.threshold,
|
696
|
+
buffer = _ref.buffer;
|
697
|
+
|
698
|
+
var span = getColumnSpan(itemSize.width, gridSize, total, threshold);
|
699
|
+
var setY = getAvailablePositions(positions, span, total);
|
700
|
+
var shortColumnIndex = getShortColumn(setY, buffer);
|
701
|
+
|
702
|
+
// Position the item
|
703
|
+
var point = new Point(Math.round(gridSize * shortColumnIndex), Math.round(setY[shortColumnIndex]));
|
704
|
+
|
705
|
+
// Update the columns array with the new values for each column.
|
706
|
+
// e.g. before the update the columns could be [250, 0, 0, 0] for an item
|
707
|
+
// which spans 2 columns. After it would be [250, itemHeight, itemHeight, 0].
|
708
|
+
var setHeight = setY[shortColumnIndex] + itemSize.height;
|
709
|
+
for (var i = 0; i < span; i++) {
|
710
|
+
positions[shortColumnIndex + i] = setHeight;
|
711
|
+
}
|
712
|
+
|
713
|
+
return point;
|
714
|
+
}
|
715
|
+
|
716
|
+
function toArray(arrayLike) {
|
717
|
+
return Array.prototype.slice.call(arrayLike);
|
718
|
+
}
|
719
|
+
|
720
|
+
function arrayIncludes(array, obj) {
|
721
|
+
return array.indexOf(obj) > -1;
|
722
|
+
}
|
723
|
+
|
724
|
+
// Used for unique instance variables
|
725
|
+
var id = 0;
|
726
|
+
|
727
|
+
var Shuffle = function () {
|
728
|
+
|
729
|
+
/**
|
730
|
+
* Categorize, sort, and filter a responsive grid of items.
|
731
|
+
*
|
732
|
+
* @param {Element} element An element which is the parent container for the grid items.
|
733
|
+
* @param {Object} [options=Shuffle.options] Options object.
|
734
|
+
* @constructor
|
735
|
+
*/
|
736
|
+
function Shuffle(element) {
|
737
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
738
|
+
classCallCheck(this, Shuffle);
|
739
|
+
|
740
|
+
this.options = immutable(Shuffle.options, options);
|
741
|
+
|
742
|
+
this.useSizer = false;
|
743
|
+
this.lastSort = {};
|
744
|
+
this.group = Shuffle.ALL_ITEMS;
|
745
|
+
this.lastFilter = Shuffle.ALL_ITEMS;
|
746
|
+
this.isEnabled = true;
|
747
|
+
this.isDestroyed = false;
|
748
|
+
this.isInitialized = false;
|
749
|
+
this._transitions = [];
|
750
|
+
this.isTransitioning = false;
|
751
|
+
this._queue = [];
|
752
|
+
|
753
|
+
var el = this._getElementOption(element);
|
754
|
+
|
755
|
+
if (!el) {
|
756
|
+
throw new TypeError('Shuffle needs to be initialized with an element.');
|
757
|
+
}
|
758
|
+
|
759
|
+
this.element = el;
|
760
|
+
this.id = 'shuffle_' + id;
|
761
|
+
id += 1;
|
762
|
+
|
763
|
+
this._init();
|
764
|
+
this.isInitialized = true;
|
765
|
+
}
|
766
|
+
|
767
|
+
createClass(Shuffle, [{
|
768
|
+
key: '_init',
|
769
|
+
value: function _init() {
|
770
|
+
this.items = this._getItems();
|
771
|
+
|
772
|
+
this.options.sizer = this._getElementOption(this.options.sizer);
|
773
|
+
|
774
|
+
if (this.options.sizer) {
|
775
|
+
this.useSizer = true;
|
776
|
+
}
|
777
|
+
|
778
|
+
// Add class and invalidate styles
|
779
|
+
this.element.classList.add(Shuffle.Classes.BASE);
|
780
|
+
|
781
|
+
// Set initial css for each item
|
782
|
+
this._initItems();
|
783
|
+
|
784
|
+
// Bind resize events
|
785
|
+
this._onResize = this._getResizeFunction();
|
786
|
+
window.addEventListener('resize', this._onResize);
|
787
|
+
|
788
|
+
// Get container css all in one request. Causes reflow
|
789
|
+
var containerCss = window.getComputedStyle(this.element, null);
|
790
|
+
var containerWidth = Shuffle.getSize(this.element).width;
|
791
|
+
|
792
|
+
// Add styles to the container if it doesn't have them.
|
793
|
+
this._validateStyles(containerCss);
|
794
|
+
|
795
|
+
// We already got the container's width above, no need to cause another
|
796
|
+
// reflow getting it again... Calculate the number of columns there will be
|
797
|
+
this._setColumns(containerWidth);
|
798
|
+
|
799
|
+
// Kick off!
|
800
|
+
this.filter(this.options.group, this.options.initialSort);
|
801
|
+
|
802
|
+
// The shuffle items haven't had transitions set on them yet so the user
|
803
|
+
// doesn't see the first layout. Set them now that the first layout is done.
|
804
|
+
// First, however, a synchronous layout must be caused for the previous
|
805
|
+
// styles to be applied without transitions.
|
806
|
+
this.element.offsetWidth; // eslint-disable-line no-unused-expressions
|
807
|
+
this._setTransitions();
|
808
|
+
this.element.style.transition = 'height ' + this.options.speed + 'ms ' + this.options.easing;
|
809
|
+
}
|
810
|
+
|
811
|
+
/**
|
812
|
+
* Returns a throttled and proxied function for the resize handler.
|
813
|
+
* @return {Function}
|
814
|
+
* @private
|
815
|
+
*/
|
816
|
+
|
817
|
+
}, {
|
818
|
+
key: '_getResizeFunction',
|
819
|
+
value: function _getResizeFunction() {
|
820
|
+
var resizeFunction = this._handleResize.bind(this);
|
821
|
+
return this.options.throttle ? this.options.throttle(resizeFunction, this.options.throttleTime) : resizeFunction;
|
822
|
+
}
|
823
|
+
|
824
|
+
/**
|
825
|
+
* Retrieve an element from an option.
|
826
|
+
* @param {string|jQuery|Element} option The option to check.
|
827
|
+
* @return {?Element} The plain element or null.
|
828
|
+
* @private
|
829
|
+
*/
|
830
|
+
|
831
|
+
}, {
|
832
|
+
key: '_getElementOption',
|
833
|
+
value: function _getElementOption(option) {
|
834
|
+
// If column width is a string, treat is as a selector and search for the
|
835
|
+
// sizer element within the outermost container
|
836
|
+
if (typeof option === 'string') {
|
837
|
+
return this.element.querySelector(option);
|
838
|
+
|
839
|
+
// Check for an element
|
840
|
+
} else if (option && option.nodeType && option.nodeType === 1) {
|
841
|
+
return option;
|
842
|
+
|
843
|
+
// Check for jQuery object
|
844
|
+
} else if (option && option.jquery) {
|
845
|
+
return option[0];
|
846
|
+
}
|
847
|
+
|
848
|
+
return null;
|
849
|
+
}
|
850
|
+
|
851
|
+
/**
|
852
|
+
* Ensures the shuffle container has the css styles it needs applied to it.
|
853
|
+
* @param {Object} styles Key value pairs for position and overflow.
|
854
|
+
* @private
|
855
|
+
*/
|
856
|
+
|
857
|
+
}, {
|
858
|
+
key: '_validateStyles',
|
859
|
+
value: function _validateStyles(styles) {
|
860
|
+
// Position cannot be static.
|
861
|
+
if (styles.position === 'static') {
|
862
|
+
this.element.style.position = 'relative';
|
863
|
+
}
|
864
|
+
|
865
|
+
// Overflow has to be hidden.
|
866
|
+
if (styles.overflow !== 'hidden') {
|
867
|
+
this.element.style.overflow = 'hidden';
|
868
|
+
}
|
869
|
+
}
|
870
|
+
|
871
|
+
/**
|
872
|
+
* Filter the elements by a category.
|
873
|
+
* @param {string} [category] Category to filter by. If it's given, the last
|
874
|
+
* category will be used to filter the items.
|
875
|
+
* @param {Array} [collection] Optionally filter a collection. Defaults to
|
876
|
+
* all the items.
|
877
|
+
* @return {!{visible: Array, hidden: Array}}
|
878
|
+
* @private
|
879
|
+
*/
|
880
|
+
|
881
|
+
}, {
|
882
|
+
key: '_filter',
|
883
|
+
value: function _filter() {
|
884
|
+
var category = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.lastFilter;
|
885
|
+
var collection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.items;
|
886
|
+
|
887
|
+
var set$$1 = this._getFilteredSets(category, collection);
|
888
|
+
|
889
|
+
// Individually add/remove hidden/visible classes
|
890
|
+
this._toggleFilterClasses(set$$1);
|
891
|
+
|
892
|
+
// Save the last filter in case elements are appended.
|
893
|
+
this.lastFilter = category;
|
894
|
+
|
895
|
+
// This is saved mainly because providing a filter function (like searching)
|
896
|
+
// will overwrite the `lastFilter` property every time its called.
|
897
|
+
if (typeof category === 'string') {
|
898
|
+
this.group = category;
|
899
|
+
}
|
900
|
+
|
901
|
+
return set$$1;
|
902
|
+
}
|
903
|
+
|
904
|
+
/**
|
905
|
+
* Returns an object containing the visible and hidden elements.
|
906
|
+
* @param {string|Function} category Category or function to filter by.
|
907
|
+
* @param {Array.<Element>} items A collection of items to filter.
|
908
|
+
* @return {!{visible: Array, hidden: Array}}
|
909
|
+
* @private
|
910
|
+
*/
|
911
|
+
|
912
|
+
}, {
|
913
|
+
key: '_getFilteredSets',
|
914
|
+
value: function _getFilteredSets(category, items) {
|
915
|
+
var _this = this;
|
916
|
+
|
917
|
+
var visible = [];
|
918
|
+
var hidden = [];
|
919
|
+
|
920
|
+
// category === 'all', add visible class to everything
|
921
|
+
if (category === Shuffle.ALL_ITEMS) {
|
922
|
+
visible = items;
|
923
|
+
|
924
|
+
// Loop through each item and use provided function to determine
|
925
|
+
// whether to hide it or not.
|
926
|
+
} else {
|
927
|
+
items.forEach(function (item) {
|
928
|
+
if (_this._doesPassFilter(category, item.element)) {
|
929
|
+
visible.push(item);
|
930
|
+
} else {
|
931
|
+
hidden.push(item);
|
932
|
+
}
|
933
|
+
});
|
934
|
+
}
|
935
|
+
|
936
|
+
return {
|
937
|
+
visible: visible,
|
938
|
+
hidden: hidden
|
939
|
+
};
|
940
|
+
}
|
941
|
+
|
942
|
+
/**
|
943
|
+
* Test an item to see if it passes a category.
|
944
|
+
* @param {string|Function} category Category or function to filter by.
|
945
|
+
* @param {Element} element An element to test.
|
946
|
+
* @return {boolean} Whether it passes the category/filter.
|
947
|
+
* @private
|
948
|
+
*/
|
949
|
+
|
950
|
+
}, {
|
951
|
+
key: '_doesPassFilter',
|
952
|
+
value: function _doesPassFilter(category, element) {
|
953
|
+
if (typeof category === 'function') {
|
954
|
+
return category.call(element, element, this);
|
955
|
+
}
|
956
|
+
|
957
|
+
// Check each element's data-groups attribute against the given category.
|
958
|
+
var attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);
|
959
|
+
var keys = this.options.delimeter ? attr.split(this.options.delimeter) : JSON.parse(attr);
|
960
|
+
|
961
|
+
function testCategory(category) {
|
962
|
+
return arrayIncludes(keys, category);
|
963
|
+
}
|
964
|
+
|
965
|
+
if (Array.isArray(category)) {
|
966
|
+
if (this.options.filterMode === Shuffle.FilterMode.ANY) {
|
967
|
+
return category.some(testCategory);
|
968
|
+
}
|
969
|
+
return category.every(testCategory);
|
970
|
+
}
|
971
|
+
|
972
|
+
return arrayIncludes(keys, category);
|
973
|
+
}
|
974
|
+
|
975
|
+
/**
|
976
|
+
* Toggles the visible and hidden class names.
|
977
|
+
* @param {{visible, hidden}} Object with visible and hidden arrays.
|
978
|
+
* @private
|
979
|
+
*/
|
980
|
+
|
981
|
+
}, {
|
982
|
+
key: '_toggleFilterClasses',
|
983
|
+
value: function _toggleFilterClasses(_ref) {
|
984
|
+
var visible = _ref.visible,
|
985
|
+
hidden = _ref.hidden;
|
986
|
+
|
987
|
+
visible.forEach(function (item) {
|
988
|
+
item.show();
|
989
|
+
});
|
990
|
+
|
991
|
+
hidden.forEach(function (item) {
|
992
|
+
item.hide();
|
993
|
+
});
|
994
|
+
}
|
995
|
+
|
996
|
+
/**
|
997
|
+
* Set the initial css for each item
|
998
|
+
* @param {Array.<ShuffleItem>} [items] Optionally specifiy at set to initialize.
|
999
|
+
* @private
|
1000
|
+
*/
|
1001
|
+
|
1002
|
+
}, {
|
1003
|
+
key: '_initItems',
|
1004
|
+
value: function _initItems() {
|
1005
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.items;
|
1006
|
+
|
1007
|
+
items.forEach(function (item) {
|
1008
|
+
item.init();
|
1009
|
+
});
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
/**
|
1013
|
+
* Remove element reference and styles.
|
1014
|
+
* @private
|
1015
|
+
*/
|
1016
|
+
|
1017
|
+
}, {
|
1018
|
+
key: '_disposeItems',
|
1019
|
+
value: function _disposeItems() {
|
1020
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.items;
|
1021
|
+
|
1022
|
+
items.forEach(function (item) {
|
1023
|
+
item.dispose();
|
1024
|
+
});
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
/**
|
1028
|
+
* Updates the visible item count.
|
1029
|
+
* @private
|
1030
|
+
*/
|
1031
|
+
|
1032
|
+
}, {
|
1033
|
+
key: '_updateItemCount',
|
1034
|
+
value: function _updateItemCount() {
|
1035
|
+
this.visibleItems = this._getFilteredItems().length;
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
/**
|
1039
|
+
* Sets css transform transition on a group of elements. This is not executed
|
1040
|
+
* at the same time as `item.init` so that transitions don't occur upon
|
1041
|
+
* initialization of Shuffle.
|
1042
|
+
* @param {Array.<ShuffleItem>} items Shuffle items to set transitions on.
|
1043
|
+
* @private
|
1044
|
+
*/
|
1045
|
+
|
1046
|
+
}, {
|
1047
|
+
key: '_setTransitions',
|
1048
|
+
value: function _setTransitions() {
|
1049
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.items;
|
1050
|
+
|
1051
|
+
var speed = this.options.speed;
|
1052
|
+
var easing = this.options.easing;
|
1053
|
+
|
1054
|
+
var str = this.options.useTransforms ? 'transform ' + speed + 'ms ' + easing + ', opacity ' + speed + 'ms ' + easing : 'top ' + speed + 'ms ' + easing + ', left ' + speed + 'ms ' + easing + ', opacity ' + speed + 'ms ' + easing;
|
1055
|
+
|
1056
|
+
items.forEach(function (item) {
|
1057
|
+
item.element.style.transition = str;
|
1058
|
+
});
|
1059
|
+
}
|
1060
|
+
}, {
|
1061
|
+
key: '_getItems',
|
1062
|
+
value: function _getItems() {
|
1063
|
+
var _this2 = this;
|
1064
|
+
|
1065
|
+
return toArray(this.element.children).filter(function (el) {
|
1066
|
+
return index(el, _this2.options.itemSelector);
|
1067
|
+
}).map(function (el) {
|
1068
|
+
return new ShuffleItem(el);
|
1069
|
+
});
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
/**
|
1073
|
+
* When new elements are added to the shuffle container, update the array of
|
1074
|
+
* items because that is the order `_layout` calls them.
|
1075
|
+
*/
|
1076
|
+
|
1077
|
+
}, {
|
1078
|
+
key: '_updateItemsOrder',
|
1079
|
+
value: function _updateItemsOrder() {
|
1080
|
+
var children = this.element.children;
|
1081
|
+
this.items = sorter(this.items, {
|
1082
|
+
by: function by(element) {
|
1083
|
+
return Array.prototype.indexOf.call(children, element);
|
1084
|
+
}
|
1085
|
+
});
|
1086
|
+
}
|
1087
|
+
}, {
|
1088
|
+
key: '_getFilteredItems',
|
1089
|
+
value: function _getFilteredItems() {
|
1090
|
+
return this.items.filter(function (item) {
|
1091
|
+
return item.isVisible;
|
1092
|
+
});
|
1093
|
+
}
|
1094
|
+
}, {
|
1095
|
+
key: '_getConcealedItems',
|
1096
|
+
value: function _getConcealedItems() {
|
1097
|
+
return this.items.filter(function (item) {
|
1098
|
+
return !item.isVisible;
|
1099
|
+
});
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
/**
|
1103
|
+
* Returns the column size, based on column width and sizer options.
|
1104
|
+
* @param {number} containerWidth Size of the parent container.
|
1105
|
+
* @param {number} gutterSize Size of the gutters.
|
1106
|
+
* @return {number}
|
1107
|
+
* @private
|
1108
|
+
*/
|
1109
|
+
|
1110
|
+
}, {
|
1111
|
+
key: '_getColumnSize',
|
1112
|
+
value: function _getColumnSize(containerWidth, gutterSize) {
|
1113
|
+
var size = void 0;
|
1114
|
+
|
1115
|
+
// If the columnWidth property is a function, then the grid is fluid
|
1116
|
+
if (typeof this.options.columnWidth === 'function') {
|
1117
|
+
size = this.options.columnWidth(containerWidth);
|
1118
|
+
|
1119
|
+
// columnWidth option isn't a function, are they using a sizing element?
|
1120
|
+
} else if (this.useSizer) {
|
1121
|
+
size = Shuffle.getSize(this.options.sizer).width;
|
1122
|
+
|
1123
|
+
// if not, how about the explicitly set option?
|
1124
|
+
} else if (this.options.columnWidth) {
|
1125
|
+
size = this.options.columnWidth;
|
1126
|
+
|
1127
|
+
// or use the size of the first item
|
1128
|
+
} else if (this.items.length > 0) {
|
1129
|
+
size = Shuffle.getSize(this.items[0].element, true).width;
|
1130
|
+
|
1131
|
+
// if there's no items, use size of container
|
1132
|
+
} else {
|
1133
|
+
size = containerWidth;
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
// Don't let them set a column width of zero.
|
1137
|
+
if (size === 0) {
|
1138
|
+
size = containerWidth;
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
return size + gutterSize;
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
/**
|
1145
|
+
* Returns the gutter size, based on gutter width and sizer options.
|
1146
|
+
* @param {number} containerWidth Size of the parent container.
|
1147
|
+
* @return {number}
|
1148
|
+
* @private
|
1149
|
+
*/
|
1150
|
+
|
1151
|
+
}, {
|
1152
|
+
key: '_getGutterSize',
|
1153
|
+
value: function _getGutterSize(containerWidth) {
|
1154
|
+
var size = void 0;
|
1155
|
+
if (typeof this.options.gutterWidth === 'function') {
|
1156
|
+
size = this.options.gutterWidth(containerWidth);
|
1157
|
+
} else if (this.useSizer) {
|
1158
|
+
size = getNumberStyle(this.options.sizer, 'marginLeft');
|
1159
|
+
} else {
|
1160
|
+
size = this.options.gutterWidth;
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
return size;
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
/**
|
1167
|
+
* Calculate the number of columns to be used. Gets css if using sizer element.
|
1168
|
+
* @param {number} [containerWidth] Optionally specify a container width if
|
1169
|
+
* it's already available.
|
1170
|
+
*/
|
1171
|
+
|
1172
|
+
}, {
|
1173
|
+
key: '_setColumns',
|
1174
|
+
value: function _setColumns() {
|
1175
|
+
var containerWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Shuffle.getSize(this.element).width;
|
1176
|
+
|
1177
|
+
var gutter = this._getGutterSize(containerWidth);
|
1178
|
+
var columnWidth = this._getColumnSize(containerWidth, gutter);
|
1179
|
+
var calculatedColumns = (containerWidth + gutter) / columnWidth;
|
1180
|
+
|
1181
|
+
// Widths given from getStyles are not precise enough...
|
1182
|
+
if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) < this.options.columnThreshold) {
|
1183
|
+
// e.g. calculatedColumns = 11.998876
|
1184
|
+
calculatedColumns = Math.round(calculatedColumns);
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
this.cols = Math.max(Math.floor(calculatedColumns), 1);
|
1188
|
+
this.containerWidth = containerWidth;
|
1189
|
+
this.colWidth = columnWidth;
|
1190
|
+
}
|
1191
|
+
|
1192
|
+
/**
|
1193
|
+
* Adjust the height of the grid
|
1194
|
+
*/
|
1195
|
+
|
1196
|
+
}, {
|
1197
|
+
key: '_setContainerSize',
|
1198
|
+
value: function _setContainerSize() {
|
1199
|
+
this.element.style.height = this._getContainerSize() + 'px';
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
/**
|
1203
|
+
* Based on the column heights, it returns the biggest one.
|
1204
|
+
* @return {number}
|
1205
|
+
* @private
|
1206
|
+
*/
|
1207
|
+
|
1208
|
+
}, {
|
1209
|
+
key: '_getContainerSize',
|
1210
|
+
value: function _getContainerSize() {
|
1211
|
+
return arrayMax(this.positions);
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
/**
|
1215
|
+
* Get the clamped stagger amount.
|
1216
|
+
* @param {number} index Index of the item to be staggered.
|
1217
|
+
* @return {number}
|
1218
|
+
*/
|
1219
|
+
|
1220
|
+
}, {
|
1221
|
+
key: '_getStaggerAmount',
|
1222
|
+
value: function _getStaggerAmount(index$$1) {
|
1223
|
+
return Math.min(index$$1 * this.options.staggerAmount, this.options.staggerAmountMax);
|
1224
|
+
}
|
1225
|
+
|
1226
|
+
/**
|
1227
|
+
* @return {boolean} Whether the event was prevented or not.
|
1228
|
+
*/
|
1229
|
+
|
1230
|
+
}, {
|
1231
|
+
key: '_dispatch',
|
1232
|
+
value: function _dispatch(name) {
|
1233
|
+
var details = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1234
|
+
|
1235
|
+
if (this.isDestroyed) {
|
1236
|
+
return false;
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
details.shuffle = this;
|
1240
|
+
return !this.element.dispatchEvent(new CustomEvent(name, {
|
1241
|
+
bubbles: true,
|
1242
|
+
cancelable: false,
|
1243
|
+
detail: details
|
1244
|
+
}));
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
/**
|
1248
|
+
* Zeros out the y columns array, which is used to determine item placement.
|
1249
|
+
* @private
|
1250
|
+
*/
|
1251
|
+
|
1252
|
+
}, {
|
1253
|
+
key: '_resetCols',
|
1254
|
+
value: function _resetCols() {
|
1255
|
+
var i = this.cols;
|
1256
|
+
this.positions = [];
|
1257
|
+
while (i) {
|
1258
|
+
i -= 1;
|
1259
|
+
this.positions.push(0);
|
1260
|
+
}
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
/**
|
1264
|
+
* Loops through each item that should be shown and calculates the x, y position.
|
1265
|
+
* @param {Array.<ShuffleItem>} items Array of items that will be shown/layed
|
1266
|
+
* out in order in their array.
|
1267
|
+
*/
|
1268
|
+
|
1269
|
+
}, {
|
1270
|
+
key: '_layout',
|
1271
|
+
value: function _layout(items) {
|
1272
|
+
var _this3 = this;
|
1273
|
+
|
1274
|
+
var count = 0;
|
1275
|
+
items.forEach(function (item) {
|
1276
|
+
var currPos = item.point;
|
1277
|
+
var currScale = item.scale;
|
1278
|
+
var itemSize = Shuffle.getSize(item.element, true);
|
1279
|
+
var pos = _this3._getItemPosition(itemSize);
|
1280
|
+
|
1281
|
+
function callback() {
|
1282
|
+
item.element.style.transitionDelay = '';
|
1283
|
+
item.applyCss(ShuffleItem.Css.VISIBLE.after);
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
// If the item will not change its position, do not add it to the render
|
1287
|
+
// queue. Transitions don't fire when setting a property to the same value.
|
1288
|
+
if (Point.equals(currPos, pos) && currScale === ShuffleItem.Scale.VISIBLE) {
|
1289
|
+
item.applyCss(ShuffleItem.Css.VISIBLE.before);
|
1290
|
+
callback();
|
1291
|
+
return;
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
item.point = pos;
|
1295
|
+
item.scale = ShuffleItem.Scale.VISIBLE;
|
1296
|
+
|
1297
|
+
// Use xtend here to clone the object so that the `before` object isn't
|
1298
|
+
// modified when the transition delay is added.
|
1299
|
+
var styles = immutable(ShuffleItem.Css.VISIBLE.before);
|
1300
|
+
styles.transitionDelay = _this3._getStaggerAmount(count) + 'ms';
|
1301
|
+
|
1302
|
+
_this3._queue.push({
|
1303
|
+
item: item,
|
1304
|
+
styles: styles,
|
1305
|
+
callback: callback
|
1306
|
+
});
|
1307
|
+
|
1308
|
+
count += 1;
|
1309
|
+
});
|
1310
|
+
}
|
1311
|
+
|
1312
|
+
/**
|
1313
|
+
* Determine the location of the next item, based on its size.
|
1314
|
+
* @param {{width: number, height: number}} itemSize Object with width and height.
|
1315
|
+
* @return {Point}
|
1316
|
+
* @private
|
1317
|
+
*/
|
1318
|
+
|
1319
|
+
}, {
|
1320
|
+
key: '_getItemPosition',
|
1321
|
+
value: function _getItemPosition(itemSize) {
|
1322
|
+
return getItemPosition({
|
1323
|
+
itemSize: itemSize,
|
1324
|
+
positions: this.positions,
|
1325
|
+
gridSize: this.colWidth,
|
1326
|
+
total: this.cols,
|
1327
|
+
threshold: this.options.columnThreshold,
|
1328
|
+
buffer: this.options.buffer
|
1329
|
+
});
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
/**
|
1333
|
+
* Hides the elements that don't match our filter.
|
1334
|
+
* @param {Array.<ShuffleItem>} collection Collection to shrink.
|
1335
|
+
* @private
|
1336
|
+
*/
|
1337
|
+
|
1338
|
+
}, {
|
1339
|
+
key: '_shrink',
|
1340
|
+
value: function _shrink() {
|
1341
|
+
var _this4 = this;
|
1342
|
+
|
1343
|
+
var collection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getConcealedItems();
|
1344
|
+
|
1345
|
+
var count = 0;
|
1346
|
+
collection.forEach(function (item) {
|
1347
|
+
function callback() {
|
1348
|
+
item.applyCss(ShuffleItem.Css.HIDDEN.after);
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
// Continuing would add a transitionend event listener to the element, but
|
1352
|
+
// that listener would not execute because the transform and opacity would
|
1353
|
+
// stay the same.
|
1354
|
+
// The callback is executed here because it is not guaranteed to be called
|
1355
|
+
// after the transitionend event because the transitionend could be
|
1356
|
+
// canceled if another animation starts.
|
1357
|
+
if (item.scale === ShuffleItem.Scale.HIDDEN) {
|
1358
|
+
item.applyCss(ShuffleItem.Css.HIDDEN.before);
|
1359
|
+
callback();
|
1360
|
+
return;
|
1361
|
+
}
|
1362
|
+
|
1363
|
+
item.scale = ShuffleItem.Scale.HIDDEN;
|
1364
|
+
|
1365
|
+
var styles = immutable(ShuffleItem.Css.HIDDEN.before);
|
1366
|
+
styles.transitionDelay = _this4._getStaggerAmount(count) + 'ms';
|
1367
|
+
|
1368
|
+
_this4._queue.push({
|
1369
|
+
item: item,
|
1370
|
+
styles: styles,
|
1371
|
+
callback: callback
|
1372
|
+
});
|
1373
|
+
|
1374
|
+
count += 1;
|
1375
|
+
});
|
1376
|
+
}
|
1377
|
+
|
1378
|
+
/**
|
1379
|
+
* Resize handler.
|
1380
|
+
* @private
|
1381
|
+
*/
|
1382
|
+
|
1383
|
+
}, {
|
1384
|
+
key: '_handleResize',
|
1385
|
+
value: function _handleResize() {
|
1386
|
+
// If shuffle is disabled, destroyed, don't do anything
|
1387
|
+
if (!this.isEnabled || this.isDestroyed) {
|
1388
|
+
return;
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
// Will need to check height in the future if it's layed out horizontaly
|
1392
|
+
var containerWidth = Shuffle.getSize(this.element).width;
|
1393
|
+
|
1394
|
+
// containerWidth hasn't changed, don't do anything
|
1395
|
+
if (containerWidth === this.containerWidth) {
|
1396
|
+
return;
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
this.update();
|
1400
|
+
}
|
1401
|
+
|
1402
|
+
/**
|
1403
|
+
* Returns styles which will be applied to the an item for a transition.
|
1404
|
+
* @param {Object} obj Transition options.
|
1405
|
+
* @return {!Object} Transforms for transitions, left/top for animate.
|
1406
|
+
* @private
|
1407
|
+
*/
|
1408
|
+
|
1409
|
+
}, {
|
1410
|
+
key: '_getStylesForTransition',
|
1411
|
+
value: function _getStylesForTransition(_ref2) {
|
1412
|
+
var item = _ref2.item,
|
1413
|
+
styles = _ref2.styles;
|
1414
|
+
|
1415
|
+
if (!styles.transitionDelay) {
|
1416
|
+
styles.transitionDelay = '0ms';
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
var x = item.point.x;
|
1420
|
+
var y = item.point.y;
|
1421
|
+
|
1422
|
+
if (this.options.useTransforms) {
|
1423
|
+
styles.transform = 'translate(' + x + 'px, ' + y + 'px) scale(' + item.scale + ')';
|
1424
|
+
} else {
|
1425
|
+
styles.left = x + 'px';
|
1426
|
+
styles.top = y + 'px';
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
return styles;
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
/**
|
1433
|
+
* Listen for the transition end on an element and execute the itemCallback
|
1434
|
+
* when it finishes.
|
1435
|
+
* @param {Element} element Element to listen on.
|
1436
|
+
* @param {Function} itemCallback Callback for the item.
|
1437
|
+
* @param {Function} done Callback to notify `parallel` that this one is done.
|
1438
|
+
*/
|
1439
|
+
|
1440
|
+
}, {
|
1441
|
+
key: '_whenTransitionDone',
|
1442
|
+
value: function _whenTransitionDone(element, itemCallback, done) {
|
1443
|
+
var id = onTransitionEnd(element, function (evt) {
|
1444
|
+
itemCallback();
|
1445
|
+
done(null, evt);
|
1446
|
+
});
|
1447
|
+
|
1448
|
+
this._transitions.push(id);
|
1449
|
+
}
|
1450
|
+
|
1451
|
+
/**
|
1452
|
+
* Return a function which will set CSS styles and call the `done` function
|
1453
|
+
* when (if) the transition finishes.
|
1454
|
+
* @param {Object} opts Transition object.
|
1455
|
+
* @return {Function} A function to be called with a `done` function.
|
1456
|
+
*/
|
1457
|
+
|
1458
|
+
}, {
|
1459
|
+
key: '_getTransitionFunction',
|
1460
|
+
value: function _getTransitionFunction(opts) {
|
1461
|
+
var _this5 = this;
|
1462
|
+
|
1463
|
+
return function (done) {
|
1464
|
+
opts.item.applyCss(_this5._getStylesForTransition(opts));
|
1465
|
+
_this5._whenTransitionDone(opts.item.element, opts.callback, done);
|
1466
|
+
};
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
/**
|
1470
|
+
* Execute the styles gathered in the style queue. This applies styles to elements,
|
1471
|
+
* triggering transitions.
|
1472
|
+
* @private
|
1473
|
+
*/
|
1474
|
+
|
1475
|
+
}, {
|
1476
|
+
key: '_processQueue',
|
1477
|
+
value: function _processQueue() {
|
1478
|
+
if (this.isTransitioning) {
|
1479
|
+
this._cancelMovement();
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
var hasSpeed = this.options.speed > 0;
|
1483
|
+
var hasQueue = this._queue.length > 0;
|
1484
|
+
|
1485
|
+
if (hasQueue && hasSpeed && this.isInitialized) {
|
1486
|
+
this._startTransitions(this._queue);
|
1487
|
+
} else if (hasQueue) {
|
1488
|
+
this._styleImmediately(this._queue);
|
1489
|
+
this._dispatchLayout();
|
1490
|
+
|
1491
|
+
// A call to layout happened, but none of the newly visible items will
|
1492
|
+
// change position or the transition duration is zero, which will not trigger
|
1493
|
+
// the transitionend event.
|
1494
|
+
} else {
|
1495
|
+
this._dispatchLayout();
|
1496
|
+
}
|
1497
|
+
|
1498
|
+
// Remove everything in the style queue
|
1499
|
+
this._queue.length = 0;
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
/**
|
1503
|
+
* Wait for each transition to finish, the emit the layout event.
|
1504
|
+
* @param {Array.<Object>} transitions Array of transition objects.
|
1505
|
+
*/
|
1506
|
+
|
1507
|
+
}, {
|
1508
|
+
key: '_startTransitions',
|
1509
|
+
value: function _startTransitions(transitions) {
|
1510
|
+
var _this6 = this;
|
1511
|
+
|
1512
|
+
// Set flag that shuffle is currently in motion.
|
1513
|
+
this.isTransitioning = true;
|
1514
|
+
|
1515
|
+
// Create an array of functions to be called.
|
1516
|
+
var callbacks = transitions.map(function (obj) {
|
1517
|
+
return _this6._getTransitionFunction(obj);
|
1518
|
+
});
|
1519
|
+
|
1520
|
+
index$3(callbacks, this._movementFinished.bind(this));
|
1521
|
+
}
|
1522
|
+
}, {
|
1523
|
+
key: '_cancelMovement',
|
1524
|
+
value: function _cancelMovement() {
|
1525
|
+
// Remove the transition end event for each listener.
|
1526
|
+
this._transitions.forEach(cancelTransitionEnd);
|
1527
|
+
|
1528
|
+
// Reset the array.
|
1529
|
+
this._transitions.length = 0;
|
1530
|
+
|
1531
|
+
// Show it's no longer active.
|
1532
|
+
this.isTransitioning = false;
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
/**
|
1536
|
+
* Apply styles without a transition.
|
1537
|
+
* @param {Array.<Object>} objects Array of transition objects.
|
1538
|
+
* @private
|
1539
|
+
*/
|
1540
|
+
|
1541
|
+
}, {
|
1542
|
+
key: '_styleImmediately',
|
1543
|
+
value: function _styleImmediately(objects) {
|
1544
|
+
var _this7 = this;
|
1545
|
+
|
1546
|
+
if (objects.length) {
|
1547
|
+
var elements = objects.map(function (obj) {
|
1548
|
+
return obj.item.element;
|
1549
|
+
});
|
1550
|
+
|
1551
|
+
Shuffle._skipTransitions(elements, function () {
|
1552
|
+
objects.forEach(function (obj) {
|
1553
|
+
obj.item.applyCss(_this7._getStylesForTransition(obj));
|
1554
|
+
obj.callback();
|
1555
|
+
});
|
1556
|
+
});
|
1557
|
+
}
|
1558
|
+
}
|
1559
|
+
}, {
|
1560
|
+
key: '_movementFinished',
|
1561
|
+
value: function _movementFinished() {
|
1562
|
+
this._transitions.length = 0;
|
1563
|
+
this.isTransitioning = false;
|
1564
|
+
this._dispatchLayout();
|
1565
|
+
}
|
1566
|
+
}, {
|
1567
|
+
key: '_dispatchLayout',
|
1568
|
+
value: function _dispatchLayout() {
|
1569
|
+
this._dispatch(Shuffle.EventType.LAYOUT);
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
/**
|
1573
|
+
* The magic. This is what makes the plugin 'shuffle'
|
1574
|
+
* @param {string|Function|Array.<string>} [category] Category to filter by.
|
1575
|
+
* Can be a function, string, or array of strings.
|
1576
|
+
* @param {Object} [sortObj] A sort object which can sort the visible set
|
1577
|
+
*/
|
1578
|
+
|
1579
|
+
}, {
|
1580
|
+
key: 'filter',
|
1581
|
+
value: function filter(category, sortObj) {
|
1582
|
+
if (!this.isEnabled) {
|
1583
|
+
return;
|
1584
|
+
}
|
1585
|
+
|
1586
|
+
if (!category || category && category.length === 0) {
|
1587
|
+
category = Shuffle.ALL_ITEMS; // eslint-disable-line no-param-reassign
|
1588
|
+
}
|
1589
|
+
|
1590
|
+
this._filter(category);
|
1591
|
+
|
1592
|
+
// Shrink each hidden item
|
1593
|
+
this._shrink();
|
1594
|
+
|
1595
|
+
// How many visible elements?
|
1596
|
+
this._updateItemCount();
|
1597
|
+
|
1598
|
+
// Update transforms on visible elements so they will animate to their new positions.
|
1599
|
+
this.sort(sortObj);
|
1600
|
+
}
|
1601
|
+
|
1602
|
+
/**
|
1603
|
+
* Gets the visible elements, sorts them, and passes them to layout.
|
1604
|
+
* @param {Object} opts the options object for the sorted plugin
|
1605
|
+
*/
|
1606
|
+
|
1607
|
+
}, {
|
1608
|
+
key: 'sort',
|
1609
|
+
value: function sort() {
|
1610
|
+
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.lastSort;
|
1611
|
+
|
1612
|
+
if (!this.isEnabled) {
|
1613
|
+
return;
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
this._resetCols();
|
1617
|
+
|
1618
|
+
var items = this._getFilteredItems();
|
1619
|
+
items = sorter(items, opts);
|
1620
|
+
|
1621
|
+
this._layout(items);
|
1622
|
+
|
1623
|
+
// `_layout` always happens after `_shrink`, so it's safe to process the style
|
1624
|
+
// queue here with styles from the shrink method.
|
1625
|
+
this._processQueue();
|
1626
|
+
|
1627
|
+
// Adjust the height of the container.
|
1628
|
+
this._setContainerSize();
|
1629
|
+
|
1630
|
+
this.lastSort = opts;
|
1631
|
+
}
|
1632
|
+
|
1633
|
+
/**
|
1634
|
+
* Reposition everything.
|
1635
|
+
* @param {boolean} isOnlyLayout If true, column and gutter widths won't be
|
1636
|
+
* recalculated.
|
1637
|
+
*/
|
1638
|
+
|
1639
|
+
}, {
|
1640
|
+
key: 'update',
|
1641
|
+
value: function update(isOnlyLayout) {
|
1642
|
+
if (this.isEnabled) {
|
1643
|
+
if (!isOnlyLayout) {
|
1644
|
+
// Get updated colCount
|
1645
|
+
this._setColumns();
|
1646
|
+
}
|
1647
|
+
|
1648
|
+
// Layout items
|
1649
|
+
this.sort();
|
1650
|
+
}
|
1651
|
+
}
|
1652
|
+
|
1653
|
+
/**
|
1654
|
+
* Use this instead of `update()` if you don't need the columns and gutters updated
|
1655
|
+
* Maybe an image inside `shuffle` loaded (and now has a height), which means calculations
|
1656
|
+
* could be off.
|
1657
|
+
*/
|
1658
|
+
|
1659
|
+
}, {
|
1660
|
+
key: 'layout',
|
1661
|
+
value: function layout() {
|
1662
|
+
this.update(true);
|
1663
|
+
}
|
1664
|
+
|
1665
|
+
/**
|
1666
|
+
* New items have been appended to shuffle. Mix them in with the current
|
1667
|
+
* filter or sort status.
|
1668
|
+
* @param {Array.<Element>} newItems Collection of new items.
|
1669
|
+
*/
|
1670
|
+
|
1671
|
+
}, {
|
1672
|
+
key: 'add',
|
1673
|
+
value: function add(newItems) {
|
1674
|
+
var items = index$1(newItems).map(function (el) {
|
1675
|
+
return new ShuffleItem(el);
|
1676
|
+
});
|
1677
|
+
|
1678
|
+
// Add classes and set initial positions.
|
1679
|
+
this._initItems(items);
|
1680
|
+
|
1681
|
+
// Add transition to each item.
|
1682
|
+
this._setTransitions(items);
|
1683
|
+
|
1684
|
+
// Update the list of items.
|
1685
|
+
this.items = this.items.concat(items);
|
1686
|
+
this._updateItemsOrder();
|
1687
|
+
this.filter(this.lastFilter);
|
1688
|
+
}
|
1689
|
+
|
1690
|
+
/**
|
1691
|
+
* Disables shuffle from updating dimensions and layout on resize
|
1692
|
+
*/
|
1693
|
+
|
1694
|
+
}, {
|
1695
|
+
key: 'disable',
|
1696
|
+
value: function disable() {
|
1697
|
+
this.isEnabled = false;
|
1698
|
+
}
|
1699
|
+
|
1700
|
+
/**
|
1701
|
+
* Enables shuffle again
|
1702
|
+
* @param {boolean} [isUpdateLayout=true] if undefined, shuffle will update columns and gutters
|
1703
|
+
*/
|
1704
|
+
|
1705
|
+
}, {
|
1706
|
+
key: 'enable',
|
1707
|
+
value: function enable(isUpdateLayout) {
|
1708
|
+
this.isEnabled = true;
|
1709
|
+
if (isUpdateLayout !== false) {
|
1710
|
+
this.update();
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
/**
|
1715
|
+
* Remove 1 or more shuffle items
|
1716
|
+
* @param {Array.<Element>} elements An array containing one or more
|
1717
|
+
* elements in shuffle
|
1718
|
+
* @return {Shuffle} The shuffle object
|
1719
|
+
*/
|
1720
|
+
|
1721
|
+
}, {
|
1722
|
+
key: 'remove',
|
1723
|
+
value: function remove(elements) {
|
1724
|
+
var _this8 = this;
|
1725
|
+
|
1726
|
+
if (!elements.length) {
|
1727
|
+
return;
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
var collection = index$1(elements);
|
1731
|
+
|
1732
|
+
var oldItems = collection.map(function (element) {
|
1733
|
+
return _this8.getItemByElement(element);
|
1734
|
+
}).filter(function (item) {
|
1735
|
+
return !!item;
|
1736
|
+
});
|
1737
|
+
|
1738
|
+
var handleLayout = function handleLayout() {
|
1739
|
+
_this8.element.removeEventListener(Shuffle.EventType.LAYOUT, handleLayout);
|
1740
|
+
_this8._disposeItems(oldItems);
|
1741
|
+
|
1742
|
+
// Remove the collection in the callback
|
1743
|
+
collection.forEach(function (element) {
|
1744
|
+
element.parentNode.removeChild(element);
|
1745
|
+
});
|
1746
|
+
|
1747
|
+
_this8._dispatch(Shuffle.EventType.REMOVED, { collection: collection });
|
1748
|
+
};
|
1749
|
+
|
1750
|
+
// Hide collection first.
|
1751
|
+
this._toggleFilterClasses({
|
1752
|
+
visible: [],
|
1753
|
+
hidden: oldItems
|
1754
|
+
});
|
1755
|
+
|
1756
|
+
this._shrink(oldItems);
|
1757
|
+
|
1758
|
+
this.sort();
|
1759
|
+
|
1760
|
+
// Update the list of items here because `remove` could be called again
|
1761
|
+
// with an item that is in the process of being removed.
|
1762
|
+
this.items = this.items.filter(function (item) {
|
1763
|
+
return !arrayIncludes(oldItems, item);
|
1764
|
+
});
|
1765
|
+
this._updateItemCount();
|
1766
|
+
|
1767
|
+
this.element.addEventListener(Shuffle.EventType.LAYOUT, handleLayout);
|
1768
|
+
}
|
1769
|
+
|
1770
|
+
/**
|
1771
|
+
* Retrieve a shuffle item by its element.
|
1772
|
+
* @param {Element} element Element to look for.
|
1773
|
+
* @return {?ShuffleItem} A shuffle item or null if it's not found.
|
1774
|
+
*/
|
1775
|
+
|
1776
|
+
}, {
|
1777
|
+
key: 'getItemByElement',
|
1778
|
+
value: function getItemByElement(element) {
|
1779
|
+
for (var i = this.items.length - 1; i >= 0; i--) {
|
1780
|
+
if (this.items[i].element === element) {
|
1781
|
+
return this.items[i];
|
1782
|
+
}
|
1783
|
+
}
|
1784
|
+
|
1785
|
+
return null;
|
1786
|
+
}
|
1787
|
+
|
1788
|
+
/**
|
1789
|
+
* Destroys shuffle, removes events, styles, and classes
|
1790
|
+
*/
|
1791
|
+
|
1792
|
+
}, {
|
1793
|
+
key: 'destroy',
|
1794
|
+
value: function destroy() {
|
1795
|
+
this._cancelMovement();
|
1796
|
+
window.removeEventListener('resize', this._onResize);
|
1797
|
+
|
1798
|
+
// Reset container styles
|
1799
|
+
this.element.classList.remove('shuffle');
|
1800
|
+
this.element.removeAttribute('style');
|
1801
|
+
|
1802
|
+
// Reset individual item styles
|
1803
|
+
this._disposeItems();
|
1804
|
+
|
1805
|
+
// Null DOM references
|
1806
|
+
this.items = null;
|
1807
|
+
this.options.sizer = null;
|
1808
|
+
this.element = null;
|
1809
|
+
this._transitions = null;
|
1810
|
+
|
1811
|
+
// Set a flag so if a debounced resize has been triggered,
|
1812
|
+
// it can first check if it is actually isDestroyed and not doing anything
|
1813
|
+
this.isDestroyed = true;
|
1814
|
+
}
|
1815
|
+
|
1816
|
+
/**
|
1817
|
+
* Returns the outer width of an element, optionally including its margins.
|
1818
|
+
*
|
1819
|
+
* There are a few different methods for getting the width of an element, none of
|
1820
|
+
* which work perfectly for all Shuffle's use cases.
|
1821
|
+
*
|
1822
|
+
* 1. getBoundingClientRect() `left` and `right` properties.
|
1823
|
+
* - Accounts for transform scaled elements, making it useless for Shuffle
|
1824
|
+
* elements which have shrunk.
|
1825
|
+
* 2. The `offsetWidth` property.
|
1826
|
+
* - This value stays the same regardless of the elements transform property,
|
1827
|
+
* however, it does not return subpixel values.
|
1828
|
+
* 3. getComputedStyle()
|
1829
|
+
* - This works great Chrome, Firefox, Safari, but IE<=11 does not include
|
1830
|
+
* padding and border when box-sizing: border-box is set, requiring a feature
|
1831
|
+
* test and extra work to add the padding back for IE and other browsers which
|
1832
|
+
* follow the W3C spec here.
|
1833
|
+
*
|
1834
|
+
* @param {Element} element The element.
|
1835
|
+
* @param {boolean} [includeMargins] Whether to include margins. Default is false.
|
1836
|
+
* @return {{width: number, height: number}} The width and height.
|
1837
|
+
*/
|
1838
|
+
|
1839
|
+
}], [{
|
1840
|
+
key: 'getSize',
|
1841
|
+
value: function getSize(element, includeMargins) {
|
1842
|
+
// Store the styles so that they can be used by others without asking for it again.
|
1843
|
+
var styles = window.getComputedStyle(element, null);
|
1844
|
+
var width = getNumberStyle(element, 'width', styles);
|
1845
|
+
var height = getNumberStyle(element, 'height', styles);
|
1846
|
+
|
1847
|
+
if (includeMargins) {
|
1848
|
+
var marginLeft = getNumberStyle(element, 'marginLeft', styles);
|
1849
|
+
var marginRight = getNumberStyle(element, 'marginRight', styles);
|
1850
|
+
var marginTop = getNumberStyle(element, 'marginTop', styles);
|
1851
|
+
var marginBottom = getNumberStyle(element, 'marginBottom', styles);
|
1852
|
+
width += marginLeft + marginRight;
|
1853
|
+
height += marginTop + marginBottom;
|
1854
|
+
}
|
1855
|
+
|
1856
|
+
return {
|
1857
|
+
width: width,
|
1858
|
+
height: height
|
1859
|
+
};
|
1860
|
+
}
|
1861
|
+
|
1862
|
+
/**
|
1863
|
+
* Change a property or execute a function which will not have a transition
|
1864
|
+
* @param {Array.<Element>} elements DOM elements that won't be transitioned.
|
1865
|
+
* @param {Function} callback A function which will be called while transition
|
1866
|
+
* is set to 0ms.
|
1867
|
+
* @private
|
1868
|
+
*/
|
1869
|
+
|
1870
|
+
}, {
|
1871
|
+
key: '_skipTransitions',
|
1872
|
+
value: function _skipTransitions(elements, callback) {
|
1873
|
+
var zero = '0ms';
|
1874
|
+
|
1875
|
+
// Save current duration and delay.
|
1876
|
+
var data = elements.map(function (element) {
|
1877
|
+
var style = element.style;
|
1878
|
+
var duration = style.transitionDuration;
|
1879
|
+
var delay = style.transitionDelay;
|
1880
|
+
|
1881
|
+
// Set the duration to zero so it happens immediately
|
1882
|
+
style.transitionDuration = zero;
|
1883
|
+
style.transitionDelay = zero;
|
1884
|
+
|
1885
|
+
return {
|
1886
|
+
duration: duration,
|
1887
|
+
delay: delay
|
1888
|
+
};
|
1889
|
+
});
|
1890
|
+
|
1891
|
+
callback();
|
1892
|
+
|
1893
|
+
// Cause reflow.
|
1894
|
+
elements[0].offsetWidth; // eslint-disable-line no-unused-expressions
|
1895
|
+
|
1896
|
+
// Put the duration back
|
1897
|
+
elements.forEach(function (element, i) {
|
1898
|
+
element.style.transitionDuration = data[i].duration;
|
1899
|
+
element.style.transitionDelay = data[i].delay;
|
1900
|
+
});
|
1901
|
+
}
|
1902
|
+
}]);
|
1903
|
+
return Shuffle;
|
1904
|
+
}();
|
1905
|
+
|
1906
|
+
Shuffle.ShuffleItem = ShuffleItem;
|
1907
|
+
|
1908
|
+
Shuffle.ALL_ITEMS = 'all';
|
1909
|
+
Shuffle.FILTER_ATTRIBUTE_KEY = 'groups';
|
1910
|
+
|
1911
|
+
/**
|
1912
|
+
* @enum {string}
|
1913
|
+
*/
|
1914
|
+
Shuffle.EventType = {
|
1915
|
+
LAYOUT: 'shuffle:layout',
|
1916
|
+
REMOVED: 'shuffle:removed'
|
1917
|
+
};
|
1918
|
+
|
1919
|
+
/** @enum {string} */
|
1920
|
+
Shuffle.Classes = Classes;
|
1921
|
+
|
1922
|
+
/**
|
1923
|
+
* @enum {string}
|
1924
|
+
*/
|
1925
|
+
Shuffle.FilterMode = {
|
1926
|
+
ANY: 'any',
|
1927
|
+
ALL: 'all'
|
1928
|
+
};
|
1929
|
+
|
1930
|
+
// Overrideable options
|
1931
|
+
Shuffle.options = {
|
1932
|
+
// Initial filter group.
|
1933
|
+
group: Shuffle.ALL_ITEMS,
|
1934
|
+
|
1935
|
+
// Transition/animation speed (milliseconds).
|
1936
|
+
speed: 250,
|
1937
|
+
|
1938
|
+
// CSS easing function to use.
|
1939
|
+
easing: 'ease',
|
1940
|
+
|
1941
|
+
// e.g. '.picture-item'.
|
1942
|
+
itemSelector: '*',
|
1943
|
+
|
1944
|
+
// Element or selector string. Use an element to determine the size of columns
|
1945
|
+
// and gutters.
|
1946
|
+
sizer: null,
|
1947
|
+
|
1948
|
+
// A static number or function that tells the plugin how wide the gutters
|
1949
|
+
// between columns are (in pixels).
|
1950
|
+
gutterWidth: 0,
|
1951
|
+
|
1952
|
+
// A static number or function that returns a number which tells the plugin
|
1953
|
+
// how wide the columns are (in pixels).
|
1954
|
+
columnWidth: 0,
|
1955
|
+
|
1956
|
+
// If your group is not json, and is comma delimeted, you could set delimeter
|
1957
|
+
// to ','.
|
1958
|
+
delimeter: null,
|
1959
|
+
|
1960
|
+
// Useful for percentage based heights when they might not always be exactly
|
1961
|
+
// the same (in pixels).
|
1962
|
+
buffer: 0,
|
1963
|
+
|
1964
|
+
// Reading the width of elements isn't precise enough and can cause columns to
|
1965
|
+
// jump between values.
|
1966
|
+
columnThreshold: 0.01,
|
1967
|
+
|
1968
|
+
// Shuffle can be isInitialized with a sort object. It is the same object
|
1969
|
+
// given to the sort method.
|
1970
|
+
initialSort: null,
|
1971
|
+
|
1972
|
+
// By default, shuffle will throttle resize events. This can be changed or
|
1973
|
+
// removed.
|
1974
|
+
throttle: index$2,
|
1975
|
+
|
1976
|
+
// How often shuffle can be called on resize (in milliseconds).
|
1977
|
+
throttleTime: 300,
|
1978
|
+
|
1979
|
+
// Transition delay offset for each item in milliseconds.
|
1980
|
+
staggerAmount: 15,
|
1981
|
+
|
1982
|
+
// Maximum stagger delay in milliseconds.
|
1983
|
+
staggerAmountMax: 250,
|
1984
|
+
|
1985
|
+
// Whether to use transforms or absolute positioning.
|
1986
|
+
useTransforms: true,
|
1987
|
+
|
1988
|
+
// Affects using an array with filter. e.g. `filter(['one', 'two'])`. With "any",
|
1989
|
+
// the element passes the test if any of its groups are in the array. With "all",
|
1990
|
+
// the element only passes if all groups are in the array.
|
1991
|
+
filterMode: Shuffle.FilterMode.ANY
|
1992
|
+
};
|
1993
|
+
|
1994
|
+
// Expose for testing. Hack at your own risk.
|
1995
|
+
Shuffle.__Point = Point;
|
1996
|
+
Shuffle.__sorter = sorter;
|
1997
|
+
Shuffle.__getColumnSpan = getColumnSpan;
|
1998
|
+
Shuffle.__getAvailablePositions = getAvailablePositions;
|
1999
|
+
Shuffle.__getShortColumn = getShortColumn;
|
2000
|
+
|
2001
|
+
return Shuffle;
|
2002
|
+
|
2003
|
+
})));
|
2004
|
+
//# sourceMappingURL=shuffle.js.map
|