-
-
Save codinronan/379592d111070f68e24e1f7f0d9a9d37 to your computer and use it in GitHub Desktop.
Shopify - Fix Instagram feed en Turbo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ | |
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w}); | |
/*============================================================================ | |
Image functions | |
==============================================================================*/ | |
var usePageDots = {{ settings.slideshow_nav_buttons }}; | |
var imageFunctions = { | |
zoom: function(zoomParent, enableTouch, magnify){ | |
var activateZoom = $(zoomParent).data('zoom'); | |
if (activateZoom){ | |
$(zoomParent + ' img') | |
.wrap('<span style="display:inline-block"></span>') | |
.css('display', 'block') | |
.parent() | |
.zoom({ | |
touch: enableTouch, | |
magnify: magnify ? magnify : 1 | |
}); | |
} | |
}, | |
linkGalleryAndCarousel: function($gallery, $carousel){ | |
$carousel.find('.gallery-cell:nth-child(1)').addClass('is-nav-selected'); | |
//EVENT - click on carousel item to slide gallery | |
$carousel.on( 'click', '.gallery-cell', function() { | |
var index = $(this).index(); | |
$carousel.find('.is-nav-selected').removeClass('is-nav-selected'); | |
$(this).addClass('is-nav-selected'); | |
$gallery.flickity( 'select', index ); | |
}); | |
//EVENT - update carousel based on gallery index | |
$gallery.on( 'select.flickity', function() { | |
var galleryData = $(this).data('flickity'); | |
if (galleryData){ | |
$carousel.find('.is-nav-selected').removeClass('is-nav-selected'); | |
$carousel.find('.gallery-cell:nth-child(' + (galleryData.selectedIndex + 1) + ')').addClass('is-nav-selected'); | |
} | |
}); | |
}, | |
fullWidth: function(images, imageContainer){ | |
$(images).each(function(){ | |
var $image = $(this), | |
alt = $image.attr('alt'), | |
src = $image.attr('src'); | |
if (alt.indexOf("[") >= 0){ | |
//remove from description | |
$image.remove(); | |
//find shortcode values and remove from alt | |
var shortcodes = alt.match(/\[(.*?)\]/ig); | |
alt = alt.replace(/\[(.*?)\]/ig, ''); | |
//remove brackets from shortcode to be used as classes | |
var captionClass = $.map( shortcodes, function( value, index ) { | |
value = value.replace(/[\[\]']+/g,''); | |
return value; | |
}); | |
//markup for caption | |
var caption = [ | |
'<div class="position-' + (captionClass.length ? captionClass : 'center') + ' caption js-caption">', | |
'<div class="caption-content caption-background-false align-' + (captionClass.length ? captionClass : 'center') + '">', | |
'<p class="headline">' + alt + '</p>', | |
'</div>', | |
'</div>' | |
].join(''); | |
//image attributes added | |
$image.attr({ | |
alt: alt, | |
class: 'lazyload {{ settings.image_loading_style }}', | |
src: src, | |
dataSizes: 'auto' | |
}); | |
var image = $image.prop('outerHTML') | |
var banner = '<div class="banner">' + image + caption + '</div>' | |
$(imageContainer).append(banner); | |
} | |
}) | |
}, | |
showSecondaryImage: function(){ | |
if ($(window).width() > 798) { | |
$('body').on("mouseenter", ".swap-true", function() { | |
$(this).toggleClass('toggle-images'); | |
}); | |
$('body').on("mouseleave", ".swap-true", function() { | |
$(this).toggleClass('toggle-images'); | |
}); | |
} | |
} | |
} | |
/*============================================================================ | |
Recently Viewed | |
==============================================================================*/ | |
var recentlyViewed = { | |
init: function(){ | |
var productHandle, | |
rvCookie, | |
rvProducts, | |
displayProducts, | |
rvProductArray; | |
if ($('.js-product_section[data-rv-handle]').length){ | |
productHandle = $('.js-product_section').data('rv-handle').toString(); | |
rvCookie = Cookies.get('recentlyViewed'); | |
rvProducts = recentlyViewed.getCookieProducts(rvCookie, productHandle); | |
} else if ($('.recently-viewed__section').length){ | |
rvCookie = Cookies.get('recentlyViewed'); | |
rvProducts = recentlyViewed.getCookieProducts(rvCookie, productHandle); | |
} else if ($('.collection-template-section .js-sidebar-recently-viewed').length){ | |
rvCookie = Cookies.get('recentlyViewed'); | |
rvProducts = recentlyViewed.getCookieProducts(rvCookie, productHandle); | |
} | |
if (rvProducts){ | |
rvProductArray = unescape(rvProducts).split(','); | |
} | |
if (productHandle){ | |
if(!$.inArray(productHandle, rvProductArray) !== -1){ | |
displayProducts = []; | |
rvProductArray.unshift(productHandle); | |
$.each(rvProductArray, function(i, el){ | |
if($.inArray(el, displayProducts) === -1) displayProducts.push(el); | |
}); | |
} | |
recentlyViewed.setCookieProducts(displayProducts); | |
} else { | |
displayProducts = rvProductArray; | |
} | |
if ($('.recently-viewed__section').length){ | |
var parent = '.recently-viewed__section'; | |
recentlyViewed.getProductInformation(parent, displayProducts, productHandle); | |
} else if ($('.js-recently-viewed .rv-main').length){ | |
var parent = '.js-recently-viewed'; | |
recentlyViewed.getProductInformation(parent, displayProducts, productHandle); | |
} | |
if ($('.sidebar .js-sidebar-recently-viewed').length){ | |
var parent = '.sidebar .js-sidebar-recently-viewed'; | |
if (productHandle){ | |
recentlyViewed.getProductInformation(parent, displayProducts, productHandle); | |
} else { | |
recentlyViewed.getProductInformation(parent, displayProducts); | |
} | |
$('.js-sidebar-recently-viewed.hidden').parents('.sidebar-block').hide(); | |
} | |
}, | |
getCookieProducts: function(rvCookie, productHandle){ | |
if (!rvCookie && productHandle) { | |
Cookies.set('recentlyViewed', productHandle, { expires: 30, path: '/' }); | |
rvCookie = Cookies.get('recentlyViewed'); | |
} else { | |
rvCookie = Cookies.get('recentlyViewed'); | |
} | |
return rvCookie; | |
}, | |
setCookieProducts: function(rvProductArray){ | |
Cookies.set('recentlyViewed', escape(rvProductArray.join(',')), { expires: 30, path: '/' }); | |
}, | |
getProductInformation: function(parent, displayProducts, productHandle){ | |
if (productHandle){ | |
displayProducts.splice( $.inArray(productHandle, displayProducts), 1 ); | |
} | |
var productLimit = $(parent).data('visible-products'); | |
if (productLimit && displayProducts){ | |
displayProducts = displayProducts.slice(0, productLimit); | |
} | |
$.each(displayProducts, function (index, value) { | |
if (value){ | |
$(parent).removeClass('hidden'); | |
$(parent).parents('.sidebar-block').show(); | |
$.ajax({ | |
type: 'GET', | |
url: '/products/' + value + '?view=rv', | |
success: function(data) { | |
var rvProduct = $(data).find('.js-recently-viewed-product'); | |
$(parent).find(' .rv-box-' + index ).append(rvProduct); | |
//Convert pricing | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
}, | |
error: function(x, t, m) { | |
console.log(x); | |
console.log(t); | |
console.log(m); | |
}, | |
dataType: "html" | |
}); | |
} | |
if ($(parent).find('.rv-main').hasClass('js-rv-slider')){ | |
if (displayProducts.length <= productLimit) { | |
$('.js-rv-slider .gallery-cell').eq(displayProducts.length).nextAll().addBack().remove(); | |
} else { | |
$('.js-rv-slider .gallery-cell').eq(productLimit).nextAll().addBack().remove(); | |
} | |
recentlyViewed.createSlider(parent, productLimit); | |
} else if ($(parent).find('.rv-main').hasClass('js-rv-grid')){ | |
if (displayProducts.length <= productLimit) { | |
$('.js-rv-grid .thumbnail').eq(displayProducts.length).nextAll().addBack().remove(); | |
} else { | |
$('.js-rv-grid .thumbnail').eq(productLimit).nextAll().addBack().remove(); | |
} | |
} | |
}); | |
}, | |
createSlider: function(el, productsAvailable){ | |
var products_per_slide = $('.js-rv-slider').data('products-per-slide'); | |
var products_limit = $('.js-rv-slider').data('products-limit'); | |
var products_available = productsAvailable; | |
var indexProductsAvailable = productsAvailable - 1; | |
var rvProductstoShow = $('.js-rv-slider').find('.gallery-cell'); | |
var cellAlign, | |
draggable, | |
prevNext, | |
wrapAround, | |
initialIndex; | |
if (products_per_slide == "2" && products_available > products_per_slide && products_limit > products_per_slide || products_per_slide == "4" && products_available > products_per_slide && products_limit > products_per_slide || products_per_slide == "6" && products_available > products_per_slide && products_limit > products_per_slide){ | |
cellAlign = "left"; | |
} else { | |
cellAlign = "center"; | |
} | |
if (products_available > products_per_slide && products_limit > products_per_slide) { | |
draggable = true; | |
prevNext = true; | |
wrapAround = true; | |
} else { | |
draggable = false; | |
prevNext = false; | |
wrapAround = false; | |
} | |
if (products_per_slide == "2" && products_available > products_per_slide || products_per_slide == "4" && products_available > products_per_slide || products_per_slide == "6" && products_available > products_per_slide){ | |
initialIndex = 0; | |
} else if (products_per_slide == "3" && products_available) { | |
initialIndex = 1; | |
} else if (products_per_slide == "5" && products_available) { | |
initialIndex = 2; | |
} else if (products_per_slide == "7" && products_available) { | |
initialIndex = 3; | |
} | |
if ($(window).width() <= 798) { | |
cellAlign = "center"; | |
initialIndex = 1; | |
if (rvProductstoShow.length <= 2){ | |
draggable = false; | |
prevNext = false; | |
wrapAround = false; | |
} else if (products_available > 3 && products_limit > 3) { | |
draggable = true; | |
prevNext = true; | |
wrapAround = true; | |
} else { | |
draggable = false; | |
prevNext = false; | |
wrapAround = false; | |
} | |
$('.js-rv-slider').parents('.even-num-slides').removeClass('even-num-slides'); | |
} | |
$('.js-rv-slider').flickity({ | |
"lazyLoad": 2, | |
"imagesLoaded": true, | |
"draggable": draggable, | |
"prevNextButtons": prevNext, | |
"wrapAround": wrapAround, | |
"cellAlign": cellAlign, | |
"pageDots": usePageDots, | |
"contain": true, | |
"freeScroll": true, | |
"arrowShape": arrowSize, | |
"initialIndex": initialIndex | |
}); | |
$('.js-rv-slider').addClass('slider-initialized'); | |
} | |
} | |
/*============================================================================ | |
Featured collection section | |
==============================================================================*/ | |
var featuredCollectionSection = { | |
init: function(){ | |
$('.js-product-slider .products-slider').each(function (index, value) { | |
var products_per_slide = $(this).data('products-per-slide'); | |
var products_limit = $(this).data('products-limit'); | |
var products_available = $(this).data('products-available'); | |
var cellAlign, | |
draggable, | |
prevNext, | |
wrapAround, | |
initialIndex; | |
if (products_per_slide == "2" && products_available > products_per_slide && products_limit > products_per_slide || products_per_slide == "4" && products_available > products_per_slide && products_limit > products_per_slide || products_per_slide == "6" && products_available > products_per_slide && products_limit > products_per_slide){ | |
cellAlign = "left"; | |
} else { | |
cellAlign = "center"; | |
} | |
if (products_available > products_per_slide && products_limit > products_per_slide) { | |
draggable = true; | |
prevNext = true; | |
wrapAround = true; | |
} else { | |
draggable = false; | |
prevNext = false; | |
wrapAround = false; | |
} | |
if (products_per_slide == "2" && products_available > products_per_slide || products_per_slide == "4" && products_available > products_per_slide || products_per_slide == "6" && products_available > products_per_slide){ | |
initialIndex = 0; | |
} else if (products_per_slide == "3" && products_available) { | |
initialIndex = 1; | |
} else if (products_per_slide == "5" && products_available) { | |
initialIndex = 2; | |
} else if (products_per_slide == "7" && products_available) { | |
initialIndex = 3; | |
} | |
if ($(window).width() <= 798) { | |
cellAlign = "center"; | |
draggable = true; | |
prevNext = true; | |
wrapAround = true; | |
initialIndex = 1; | |
$(this).parents('.even-num-slides').removeClass('even-num-slides'); | |
} | |
$(this).flickity({ | |
"lazyLoad": 2, | |
"imagesLoaded": true, | |
"draggable": draggable, | |
"prevNextButtons": prevNext, | |
"wrapAround": wrapAround, | |
"cellAlign": cellAlign, | |
"pageDots": usePageDots, | |
"contain": true, | |
"freeScroll": true, | |
"arrowShape": arrowSize, | |
"initialIndex": initialIndex | |
}); | |
$(this).addClass('slider-initialized'); | |
}); | |
}, | |
unload: function($target){ | |
var $slider = $target.find('.js-product-slider'); | |
if ($slider.hasClass('flickity-enabled')){ | |
$slider.flickity('destroy'); | |
} | |
} | |
} | |
var featuredPromotions = { | |
init: function(){ | |
if ($(window).width() > 798 || $(window).width() == 0) { | |
$('.feature-overlay').hover(function(){ | |
$(this).find('.feature-details').slideDown('100', function(){ | |
$(this).addClass('reveal-details'); | |
}); | |
}, function(){ | |
$(this).find('.feature-details').removeClass('reveal-details'); | |
$(this).find('.feature-details').slideUp('100'); | |
}); | |
$('.js-featured-promotions').each(function (index, value){ | |
var $promos = $(this); | |
var animationStyle = $(this).data('promo-animation'); | |
$promos.waypoint(function() { | |
$(this.element).find(".feature-section").addClass("animated " + animationStyle); | |
}, { offset: '80%' }); | |
}); | |
} | |
} | |
} | |
/*============================================================================ | |
Slideshow section | |
==============================================================================*/ | |
var slideshow = { | |
init: function(){ | |
$('.js-homepage-slideshow').each(function (index, value){ | |
var $homepageSlider = $(this); | |
var settings = { | |
slideshowSpeed: $homepageSlider.data('slideshow-speed')*1000, | |
slideshowTextAnimation: $homepageSlider.data('slideshow-text-animation'), | |
adaptiveHeight: $homepageSlider.data('adaptive-height') | |
} | |
//initiate the slideshow | |
if (!$homepageSlider.hasClass('flickity-enabled')){ | |
var arrowShow = $homepageSlider.find('.gallery-cell').length === 1 ? false : true; | |
$homepageSlider.flickity({ | |
adaptiveHeight: settings.adaptiveHeight, | |
wrapAround: true, | |
cellAlign: 'left', | |
imagesLoaded: true, | |
prevNextButtons: arrowShow, | |
draggable: arrowShow, | |
pageDots: usePageDots, | |
autoPlay: settings.slideshowSpeed, | |
arrowShape: arrowSize | |
}); | |
if (settings.slideshowTextAnimation != ''){ | |
var flkty = $homepageSlider.data('flickity'); | |
setTimeout(function() { | |
$homepageSlider.find('.gallery-cell:nth-child(1) .caption-content').addClass('animated ' + settings.slideshowTextAnimation); | |
}, 400); | |
$homepageSlider.on( 'select.flickity', function() { | |
if($homepageSlider.is(':visible')) { | |
var currentSlide = flkty.selectedIndex + 1; | |
setTimeout(function() { | |
$homepageSlider.find('.caption-content').removeClass('animated ' + settings.slideshowTextAnimation); | |
$homepageSlider.find('.gallery-cell:nth-child(' + currentSlide + ') .caption-content').addClass('animated ' + settings.slideshowTextAnimation); | |
}, 400); | |
} | |
}); | |
} | |
} | |
if ($homepageSlider.find('.gallery-cell').length > 1) { | |
$homepageSlider.addClass('multi-image'); | |
} else { | |
$homepageSlider.addClass('single-image'); | |
} | |
$homepageSlider.find('.gallery-cell').each(function(){ | |
var buttonWidth = 0; | |
$(this).find('.action_button').each(function(){ | |
$button = $(this); | |
if($(this).width() > buttonWidth){ | |
buttonWidth = $(this).width(); | |
} | |
}); | |
$(this).find('.action_button').width(buttonWidth); | |
}); | |
}); | |
}, | |
unload: function($target){ | |
var $slider = $target.find('.js-homepage-slideshow'); | |
$slider.flickity('destroy'); | |
} | |
} | |
/*============================================================================ | |
Testimonial | |
==============================================================================*/ | |
var testimonial = { | |
init: function(){ | |
$('.js-testimonial').each(function (index, value){ | |
var $testimonialSlider = $(this); | |
var settings = { | |
slideshowSpeed: $testimonialSlider.data('slideshow-speed')*1000, | |
slideshowTextAnimation: $testimonialSlider.data('slideshow-text-animation') | |
} | |
if( $('.testimonial-image').length > 0){ | |
$('.testimonial-block').each(function(){ | |
if( $(this).find('.testimonial-image').length == 0){ | |
var theBlock = $(this).closest('.testimonial-block'); | |
$(theBlock).addClass('set-testimonial-height'); | |
} | |
}) | |
} | |
//initiate the slideshow | |
if (!$testimonialSlider.hasClass('flickity-enabled')){ | |
var arrowShow = $testimonialSlider.find('.gallery-cell').length === 1 ? false : true; | |
$testimonialSlider.flickity({ | |
wrapAround: true, | |
cellAlign: 'left', | |
imagesLoaded: true, | |
prevNextButtons: arrowShow, | |
draggable: arrowShow, | |
pageDots: usePageDots, | |
autoPlay: settings.slideshowSpeed, | |
arrowShape: arrowSize | |
}); | |
if (settings.slideshowTextAnimation != ''){ | |
var flkty = $testimonialSlider.data('flickity'); | |
setTimeout(function() { | |
$testimonialSlider.find('.gallery-cell:nth-child(1) .caption-content').addClass('animated ' + settings.slideshowTextAnimation); | |
}, 400); | |
$testimonialSlider.on( 'select.flickity', function() { | |
if($testimonialSlider.is(':visible')) { | |
var currentSlide = flkty.selectedIndex + 1; | |
setTimeout(function() { | |
$testimonialSlider.find('.caption-content').removeClass('animated ' + settings.slideshowTextAnimation); | |
$testimonialSlider.find('.gallery-cell:nth-child(' + currentSlide + ') .caption-content').addClass('animated ' + settings.slideshowTextAnimation); | |
}, 400); | |
} | |
}); | |
} | |
} | |
if ($testimonialSlider.find('.gallery-cell').length > 1) { | |
$testimonialSlider.addClass('multi-image'); | |
} else { | |
$testimonialSlider.addClass('single-image'); | |
} | |
$testimonialSlider.find('.gallery-cell').each(function(){ | |
var buttonWidth = 0; | |
$(this).find('.action_button').each(function(){ | |
$button = $(this); | |
if($(this).width() > buttonWidth){ | |
buttonWidth = $(this).width(); | |
} | |
}); | |
$(this).find('.action_button').width(buttonWidth); | |
}); | |
}); | |
}, | |
unload: function($target){ | |
var $slider = $target.find('.js-testimonial'); | |
$slider.flickity('destroy'); | |
} | |
} | |
/*============================================================================ | |
Gallery section | |
==============================================================================*/ | |
var gallery = { | |
init: function(){ | |
$('.gallery-horizontal').find('.gallery-image-wrapper').each(function(){ | |
var wrapper = $(this); | |
var images = $(this).find("img"); | |
var imgWidth, | |
imgHeight; | |
$("<img />").attr("src", $(images).attr("src")).on('load', function() { | |
imgWidth = this.width; | |
imgHeight = this.height; | |
$(wrapper).css("flex-basis", imgWidth * 200 / imgHeight); | |
$(wrapper).css("flex-grow", imgWidth * 200 / imgHeight); | |
$(wrapper).find("i").css("padding-bottom", imgHeight / imgWidth * 100 + '%'); | |
}); | |
}); | |
//initialize lightbox | |
lightboxGallery.init(); | |
} | |
} | |
/*============================================================================ | |
Video section | |
==============================================================================*/ | |
//check to see if HTML5 video is supported | |
var supports_video = function(){ | |
return !!document.createElement('video').canPlayType; | |
} | |
var videoSection = { | |
init: function(){ | |
var $videoElement, | |
settings; | |
//Check for videos that are set to autoplay | |
$('.homepage-video').each(function (index, value) { | |
if ($('.homepage-video').length && supports_video()) { | |
$videoElement = $(this); | |
settings = videoSection.getVideoSettings($videoElement); | |
if (is_touch_device() && $(window).width() <= 798 && settings.posterImage === false || $(window).width() <= 798 && settings.posterImage === false) { | |
//add video element on small screens if there is no poster image | |
videoSection.appendFrame($videoElement, settings); | |
} else if (settings.autoPlayVideo && $(window).width() > 798){ | |
//add video element when autoplay is true and it's on a larger screen | |
videoSection.appendFrame($videoElement, settings); | |
} else if (settings.autoPlayVideo === false && settings.posterImage === false){ | |
//add video element when autoplay is false but there is no poster image | |
videoSection.appendFrame($videoElement, settings); | |
} else { | |
//Show poster image on smaller sceens and when it exists | |
$videoElement.find('.homepage-video__placeholder').show(); | |
$videoElement.find('.placeholder-svg--video').show(); | |
} | |
} | |
}); | |
//Attach event listener for videos | |
$('body').on('click', '.video__play-button', function(e) { | |
$videoElement = $(this).parents('.video-section').find('.homepage-video'); | |
$(this).fadeOut(); | |
settings = videoSection.getVideoSettings($videoElement); | |
if ($videoElement.find('.mediaWrapper').length < 1 && $videoElement.find('video').length < 1){ | |
videoSection.appendFrame($videoElement, settings); | |
} | |
}); | |
$('body').on('click', '[data-play-video]', function(e) { | |
$videoElement = $(this).parents('.video-section').find('.homepage-video'); | |
$(this).fadeOut(); | |
settings = videoSection.getVideoSettings($videoElement); | |
if ($videoElement.find('.mediaWrapper').length < 1 && $videoElement.find('video').length < 1){ | |
videoSection.appendFrame($videoElement, settings); | |
} | |
}); | |
}, | |
getVideoSettings: function($videoElement){ | |
var settings = { | |
container: $videoElement.find('.homepage-video'), | |
header: $videoElement.find('.homepage-video--media'), | |
posterImage: $videoElement.data('poster-image'), | |
videoText: $videoElement.find('.homepage-video--media .caption'), | |
videoTrigger: $videoElement.find("[data-play-video]"), | |
autoPlayVideo: $videoElement.data('autoplay'), | |
displayTextOverVideo: $videoElement.data('display-text-over-video'), | |
autoloop: $videoElement.data('autoloop'), | |
id: $videoElement.attr('data-video-src'), | |
aspectRatio: $videoElement.attr('data-aspect-ratio').split(":"), | |
provider: $videoElement.attr('data-provider').toLowerCase(), | |
videoMP4: $videoElement.attr('data-video-mp4'), | |
videoOGV: $videoElement.attr('data-video-ogv') | |
} | |
return settings; | |
}, | |
createFrame: function(settings){ | |
var autoloop, | |
controls, | |
html, | |
autoplay, | |
poster = ''; | |
if(settings.provider === 'youtube') { | |
if (settings.autoloop){ | |
autoloop = '1&iv_load_policy=3&playlist='+settings.id; | |
} else { | |
autoloop = 0; | |
} | |
if (settings.posterImage === false && settings.autoPlayVideo === false){ | |
autoplay = 0; | |
} else { | |
autoplay = 1; | |
} | |
controls = 1; | |
html = '<iframe src="//www.youtube.com/embed/'+settings.id+'?&autoplay='+autoplay+'&loop='+autoloop+'&rel=0&hd=1&showinfo=0&color=white&controls=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe>'; | |
} | |
else if(settings.provider === 'vimeo') { | |
if (settings.posterImage === false && settings.autoPlayVideo === false){ | |
autoplay = 0; | |
} else { | |
autoplay = 1; | |
} | |
if (settings.autoloop){ | |
autoloop = 1; | |
} else { | |
autoloop = 0; | |
} | |
html = '<iframe src="//player.vimeo.com/video/'+settings.id+'?loop='+autoloop+'&title=0&byline=0&portrait=0&color=3d96d2&autoplay='+autoplay+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe>'; | |
} | |
else if(settings.provider === 'html5') { | |
if (settings.posterImage !== false){ | |
poster = ' poster="https://' + settings.posterImage; | |
} | |
if (settings.posterImage === false && settings.autoPlayVideo === false && is_touch_device() === 0){ | |
autoplay = ' '; | |
} else if (settings.autoPlayVideo && settings.posterImage !== false){ | |
poster = ' poster="https://' + settings.posterImage; | |
autoplay = ' autoplay '; | |
} else { | |
autoplay = ' autoplay '; | |
} | |
if (settings.autoloop){ | |
autoloop = ' loop="loop" '; | |
} | |
controls = ''; | |
html = '<video '+ controls + autoplay + autoloop + poster +' id="video" onclick="this.paused?this.play():this.pause();" ><source src="'+settings.videoMP4+'" type="video/mp4"><source src="'+settings.videoOGV+'" type="video/ogg" ></video>'; | |
} | |
return html; | |
}, | |
appendFrame: function($videoElement, settings){ | |
var mediaWrapper; | |
if (settings.displayTextOverVideo === false){ | |
settings.videoText.fadeOut(); | |
} | |
$videoElement.find('.video__play-button').fadeOut(); | |
$videoElement.append(videoSection.createFrame(settings)); | |
if (settings.provider != 'html5'){ | |
var paddingBottomValue = settings.aspectRatio[1] / settings.aspectRatio[0] * 100 + '%'; | |
$videoElement.find('iframe').mediaWrapper({ | |
intrinsic: false, | |
baseWidth : settings.aspectRatio[0], | |
baseHeight: settings.aspectRatio[1] | |
}); | |
$videoElement.css({ | |
height: 0, | |
paddingBottom: paddingBottomValue | |
}); | |
} else { | |
$videoElement.find('.homepage-video--media img').hide(); | |
} | |
}, | |
unload: function($target){ | |
$target.find('[data-play-video]').off('click'); | |
} | |
} | |
var cart = { | |
init: function(){ | |
if ($('#cart_form .tos_agree').length) { | |
//Terms of service on cart page | |
$('body').on('click', "#cart_form input[type='submit']", function() { | |
if ($(this).parents('form').find('.tos_agree').is(':checked')) { | |
$(this).submit(); | |
} else { | |
var warning = '<p class="warning animated bounceIn">' + {{ 'cart.general.agree_to_terms_warning' | t | json }} + '</p>'; | |
if ($('p.warning').length == 0) { | |
$(this).before(warning); | |
} | |
return false; | |
} | |
}); | |
} | |
//Refresh page on add to cart if on cart page | |
if($('body').hasClass('cart')) { | |
$('.product_form form').on("submit", function(){ | |
setTimeout(function(){ | |
document.location.href = "/cart"; | |
}, 500); | |
}); | |
} | |
} | |
} | |
/*============================================================================ | |
Product page | |
==============================================================================*/ | |
selectCallback = function(variant, selector) { | |
var $product = $('.product-' + selector.product.id); | |
var $notify_form = $('.notify-form-' + selector.product.id); | |
var $productForm = $('.product_form', $product); | |
var variantInventory = $productForm.data('variant-inventory'); | |
var $notifyFormInputs = $('.notify_form__inputs'); | |
var notifyEmail = "{{ 'products.notify_form.email' | t }}"; | |
var notifyEmailValue = "{{ contact.fields.email }}"; | |
var notifySend = "{{ 'products.notify_form.send' | t }}"; | |
var notifyUrl = $notifyFormInputs.data('url'); | |
var notifyMessage = "{{ 'products.notify_form.message_content_first' | t }}"+variant.title+"{{ 'products.notify_form.message_content_last' | t }}"+notifyUrl; | |
if ($notifyFormInputs.hasClass('customer--true')) { | |
var notifyCustomerEmail = "{{ customer.email }}"; | |
var notifyEmailInput = '<input type="hidden" class="notify_email" name="contact[email]" id="contact[email]" value="'+ notifyCustomerEmail +'" />' | |
} else { | |
var notifyEmailInput = '<input required type="email" class="notify_email" name="contact[email]" id="contact[email]" placeholder="'+ notifyEmail +'" value="'+ notifyEmailValue +'" />'; | |
} | |
var notifyFormHTML = notifyEmailInput+'<input type="hidden" name="challenge" value="false" /><input type="hidden" name="contact[body]" class="notify_form_message" data-body="'+ notifyMessage +'" value="'+ notifyMessage +'" /><input class="action_button" type="submit" value="'+ notifySend + '" style="margin-bottom:0px" />'; | |
//Image Variant feature | |
if (variant && variant.featured_image && $product.is(":visible")) { | |
var $sliders = $('.product_gallery', $product); | |
$sliders.each(function() { | |
var $slider = $(this); | |
var $sliderInstance = Flickity.data(this); | |
if ($slider.is(":visible") && $sliderInstance != undefined ) { | |
var index = $('[data-image-id="' + variant.featured_image.id + '"]').data('index'); | |
$sliderInstance.select( index, false, true ); | |
} | |
}); | |
} | |
if (variant) { | |
if (variantInventory) { | |
variantInventory.forEach(function(v){ | |
if (v.id === variant.id) { | |
variant.inventory_quantity = v.inventory_quantity; | |
variant.inventory_management = v.inventory_management; | |
variant.inventory_policy = v.inventory_policy; | |
} | |
}); | |
} | |
$('.sku span', $product).text(variant.sku); | |
{% if settings.product_form_style == "swatches" %} | |
for (var i=0,length=variant.options.length; i<length; i++) { | |
var radioButton = $productForm.find('.swatch[data-option-index="' + escape(i) + '"] :radio[value="' + variant.options[i].replace(/\"/g,'\\"') +'"]'); | |
if (radioButton.length) { | |
radioButton.get(0).checked = true; | |
} | |
} | |
{% else %} | |
$(".notify_form_message", $product).attr("value", $(".notify_form_message", $product).data('body') + " - " + variant.title); | |
{% endif %} | |
} | |
if (variant && variant.available == true) { | |
if(variant.price < variant.compare_at_price){ | |
$('.was_price', $product).html('<span class="money">' + Shopify.formatMoney(variant.compare_at_price, $productForm.data('money-format')) + '</span>'); | |
$('.savings', $product).html({{ 'products.product.savings' | t | json }} + ' ' + parseInt(((variant.compare_at_price - variant.price) * 100) / variant.compare_at_price) + '% (' + '<span class="money">' + Shopify.formatMoney(variant.compare_at_price - variant.price, $productForm.data('money-format')) + '</span>)'); | |
$('.current_price', $product).parent().addClass('sale'); | |
} else { | |
$('.was_price', $product).html(''); | |
$('.savings', $product).html(''); | |
$('.current_price', $product).parent().removeClass('sale'); | |
} | |
if (variant.inventory_management && variant.inventory_quantity > 0) { | |
{% if settings.display_inventory_left %} | |
if (variant.inventory_quantity == 1) { | |
items_left_text = {{ 'products.product.items_left_count.one' | t | json }}; | |
} else { | |
items_left_text = {{ 'products.product.items_left_count.other' | t | json }}; | |
} | |
var inventoryThreshold = {{ settings.inventory_threshold }}; | |
if (variant.inventory_quantity <= inventoryThreshold ) { | |
$('.items_left', $product).html(variant.inventory_quantity + " " + items_left_text); | |
} else { | |
$('.items_left', $product).html(""); | |
} | |
{% endif %} | |
{% if settings.limit_quantity %} | |
if(variant.inventory_policy == "deny") { | |
$('.quantity', $product).attr('max', variant.inventory_quantity); | |
} | |
{% endif %} | |
} else { | |
$('.items_left', $product).text(''); | |
$('.quantity', $product).removeAttr('max'); | |
} | |
$('.sold_out', $product).text(''); | |
if (variant.price > 0) { | |
$('.current_price', $product).html('<span class="money">' + Shopify.formatMoney(variant.price, $productForm.data('money-format')) + '</span>'); | |
} else { | |
$('.current_price', $product).html({{ settings.free_price_text | json }}); | |
} | |
$('.add_to_cart', $product).removeClass('disabled').removeAttr('disabled').find('span').text($('.add_to_cart', $product).data('label')); | |
$('.shopify-payment-button', $product).show(); | |
$notify_form.hide(); | |
$notifyFormInputs.empty(); | |
} else { | |
var message = variant ? {{ 'products.product.sold_out' | t | json }} : {{ 'products.product.unavailable' | t | json }}; | |
$('.was_price', $product).text(''); | |
$('.savings', $product).text(''); | |
$('.current_price', $product).text(''); | |
$('.items_left', $product).text(''); | |
$('.quantity', $product).removeAttr('max'); | |
$('.sold_out', $product).text(message); | |
$('.add_to_cart', $product).addClass('disabled').attr('disabled', 'disabled').find('span').text(message); | |
$('.shopify-payment-button', $product).hide(); | |
$notify_form.hide(); | |
$notifyFormInputs.empty(); | |
if (variant && !variant.available) { | |
$notify_form.fadeIn(); | |
$notifyFormInputs.empty(); | |
$notifyFormInputs.append(notifyFormHTML); | |
} | |
} | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
}; | |
var productPage = { | |
init: function(){ | |
var draggable = true; | |
var prevNextButtons = true; | |
var autoplay = $('.product_gallery').data('autoplay'); | |
setTimeout(function(){ | |
imageFunctions.linkGalleryAndCarousel($('.js-product-page-gallery .product_gallery'), $('.js-product-page-gallery .product_gallery_nav')); | |
}, 1000); | |
if($('.js-full-width-product-images').length){ | |
imageFunctions.fullWidth('.product-template .product .description img', '.js-full-width-product-images'); | |
} | |
if ($('.product_gallery').hasClass('single-image')){ | |
draggable = false; | |
prevNextButtons = false; | |
} | |
if(is_touch_device() && $('.product_gallery').hasClass('popup-enabled--false')) { | |
imageFunctions.zoom('.product_gallery'); | |
draggable = false; | |
} else if(is_touch_device() == 0) { | |
imageFunctions.zoom('.product_gallery', false); | |
} | |
$('.product_gallery').flickity({ | |
"adaptiveHeight": true, | |
"wrapAround": "true", | |
"cellAlign": "left", | |
"draggable": draggable, | |
"contain": true, | |
"imagesLoaded": true, | |
"lazyLoad": 2, | |
"pageDots": false, | |
"prevNextButtons": prevNextButtons, | |
"autoPlay": autoplay ? 6000 : false, | |
"dragThreshold": 10, | |
"arrowShape": arrowSize | |
}); | |
var groupCells = true; | |
var navPrevNextButtons = false; | |
var navCellAlign = "center"; | |
var navWrapAround = false; | |
if ($('.product_gallery_nav .gallery-cell').length >= 7) { | |
groupCells = false; | |
navPrevNextButtons = true; | |
navCellAlign = "left"; | |
navWrapAround = true; | |
} | |
$('.product-template .product_gallery_nav.product_gallery_nav--bottom-slider').flickity({ | |
"asNavFor": ".product_gallery", | |
"adaptiveHeight": false, | |
"wrapAround": navWrapAround, | |
"cellAlign": "center", | |
"draggable": true, | |
"groupCells": groupCells, | |
"prevNextButtons": navPrevNextButtons, | |
"pageDots": false, | |
"lazyLoad": 2, | |
"dragThreshold": 10, | |
"arrowShape": arrowSize | |
}); | |
$(".js-product_section .product_form_options").each(function() { | |
new Shopify.OptionSelectors($(this).data("select-id"), { product: $(this).data("product"), onVariantSelected: selectCallback, enableHistoryState: $(this).data("enable-state") }); | |
}); | |
var $notify_form = $('.notify_form .contact-form'); | |
$notify_form.each(function() { | |
var $nf = $(this); | |
$nf.on("submit", function (e) { | |
if($('input[name="challenge"]', $nf).val() !== "true") { | |
$.ajax({ | |
type: $nf.attr('method'), | |
url: $nf.attr('action'), | |
data: $nf.serialize(), | |
success: function (data) { | |
$nf.fadeOut("slow", function(){ | |
$nf.prev('.message').html({{ 'products.notify_form.post_success' | t | json }}); | |
}); | |
}, | |
error: function(data) { | |
$('input[name="challenge"]', $nf).val('true'); | |
$nf.submit(); | |
} | |
}); | |
e.preventDefault(); | |
} | |
}); | |
}); | |
{% if settings.product_form_style == "swatches" %} | |
$('body').on('change', '.swatch :radio', function() { | |
var optionIndex = $(this).closest('.swatch').attr('data-option-index'); | |
var optionValue = $(this).val(); | |
var parentForm = $(this).closest('.product_form'); | |
if (parentForm.siblings('.notify_form').length){ | |
var notifyForm = parentForm.siblings('.notify_form'); | |
} else { | |
//quick shop | |
var notifyForm = $('.js-notify-form'); | |
} | |
var option1 = parentForm.find('.swatch_options input:checked').eq(0).val(); | |
var option2 = parentForm.find('.swatch_options input:checked').eq(1).val() || ''; | |
var option3 = parentForm.find('.swatch_options input:checked').eq(2).val() || ''; | |
if (option1 && option2 && option3){ | |
var notifyMessage = option1 + ' / ' + option2 + ' / ' + option3; | |
} else if (option1 && option2){ | |
var notifyMessage = option1 + ' / ' + option2; | |
} else { | |
var notifyMessage = option1; | |
} | |
notifyForm.find(".notify_form_message").attr("value", notifyForm.find(".notify_form_message").data('body') + " - " + notifyMessage ); | |
$(this) | |
.closest('form') | |
.find('.single-option-selector') | |
.eq(optionIndex) | |
.val(optionValue) | |
.trigger('change'); | |
}); | |
{% endif %} | |
//initialize lightbox | |
lightboxGallery.init(); | |
}, | |
productSwatches: function(){ | |
//Swatches linked with selected options | |
{% if settings.product_form_style == 'swatches'%} | |
if ($('.js-product_section').length){ | |
var $productForms = $('.js-product_section').find('.product_form'); | |
$productForms.addClass('is-visible'); | |
//Loop through each product and set the initial option value state | |
$productForms.each(function(){ | |
var JSONData = $(this).data('product'); | |
var productID = $(this).data('product-id'); | |
var productSection = '.product-' + productID + ' .js-product_section'; | |
var swatchOptions = $(this).find('.swatch_options .swatch'); | |
if (swatchOptions.length > 1){ | |
Shopify.linkOptionSelectors(JSONData, productSection); | |
} | |
}); | |
} | |
//Add click event when there is more than one product on the page (eg. Collection in Detail) | |
if ($('.js-product_section').length > 1){ | |
$('body').on('click', '.swatch-element', function(){ | |
var swatchValue = $(this).data('value'); | |
$(this) | |
.siblings('input[value="'+ swatchValue.replace(/\"/g,'\\"') +'"]') | |
.prop("checked", true) | |
.trigger("change"); | |
var JSONData = $(this).parents('.product_form').data('product'); | |
var productID = $(this).parents('.product_form').data('product-id'); | |
var productSection = '.product-' + productID + ' .js-product_section'; | |
var swatchOptions = $(this).parents('.product_form').find('.swatch_options .swatch'); | |
if (swatchOptions.length > 1){ | |
Shopify.linkOptionSelectors(JSONData, productSection); | |
} | |
}) | |
} | |
{% endif %} | |
}, | |
relatedProducts: function(){ | |
$('.js-related-products-slider .products-slider').each(function (index, value) { | |
var products_per_slide = $(this).data('products-per-slide'); | |
var products_limit = $(this).data('products-limit'); | |
var products_available = $(this).data('products-available'); | |
var cellAlign, | |
draggable, | |
prevNext, | |
wrapAround, | |
initialIndex; | |
if (products_per_slide == "2" && products_available > products_per_slide && products_limit > products_per_slide || products_per_slide == "4" && products_available > products_per_slide && products_limit > products_per_slide || products_per_slide == "6" && products_available > products_per_slide && products_limit > products_per_slide){ | |
cellAlign = "left"; | |
} else { | |
cellAlign = "center"; | |
} | |
if (products_available > products_per_slide && products_limit > products_per_slide) { | |
draggable = true; | |
prevNext = true; | |
wrapAround = true; | |
} else { | |
draggable = false; | |
prevNext = false; | |
wrapAround = false; | |
} | |
if (products_per_slide == "2" && products_available > products_per_slide || products_per_slide == "4" && products_available > products_per_slide || products_per_slide == "6" && products_available > products_per_slide){ | |
initialIndex = 0; | |
} else if (products_per_slide == "3" && products_available) { | |
initialIndex = 1; | |
} else if (products_per_slide == "5" && products_available) { | |
initialIndex = 2; | |
} else if (products_per_slide == "7" && products_available) { | |
initialIndex = 3; | |
} | |
if ($(window).width() <= 798) { | |
cellAlign = "center"; | |
draggable = true; | |
prevNext = true; | |
wrapAround = true; | |
initialIndex = 1; | |
$(this).parents('.even-num-slides').removeClass('even-num-slides'); | |
} | |
$(this).flickity({ | |
"lazyLoad": 2, | |
"imagesLoaded": true, | |
"draggable": draggable, | |
"cellAlign": cellAlign, | |
"prevNextButtons": prevNext, | |
"wrapAround": wrapAround, | |
"pageDots": usePageDots, | |
"contain": true, | |
"freeScroll": true, | |
"arrowShape": arrowSize, | |
"initialIndex": initialIndex | |
}); | |
}); | |
}, | |
initializeQuantityBox: function(){ | |
$('body').on('click', '.js-change-quantity', function() { | |
var $this = $(this), | |
$input = $(this).siblings('input'), | |
val = parseInt($input.val()), | |
valMax = 100000000000000000000000000000, | |
valMin = $input.attr('min') || 0; | |
if ($input.attr('max') != null){ | |
valMax = $input.attr('max'); | |
} | |
if(isNaN(val) || val < valMin) { | |
$input.val(valMin); | |
return false; | |
} else if (val > valMax) { | |
$input.val(valMax); | |
return false; | |
} | |
if($this.data('func') == 'plus') { | |
if(val < valMax) $input.val(val + 1); | |
} else { | |
if(val > valMin) $input.val(val - 1); | |
if($this.parents(".cart_item").length) { | |
if (val - 1 == 0) { | |
$this.closest('.cart_item').addClass('animated fadeOutUp') | |
} | |
} | |
} | |
$input.trigger('change'); | |
}); | |
}, | |
unload: function($target){ | |
var $slider = $target.find('.products-slider'); | |
$slider.flickity('destroy'); | |
} | |
} | |
/*============================================================================ | |
Newsletter Popup | |
==============================================================================*/ | |
var newsletter_popup = { | |
init: function(){ | |
var popup = Cookies.get('popup'); | |
var cookie_enabled = {% if settings.newsletter_popup_days != blank and settings.newsletter_popup_days != "0" %}true{% else %}false{% endif %}; | |
if (cookie_enabled && popup == 'open') { | |
return false; | |
} else { | |
newsletter_popup.open(); | |
} | |
if (cookie_enabled) { | |
Cookies.set('popup', 'open', { expires: {{ settings.newsletter_popup_days }} }); | |
} | |
}, | |
open: function(){ | |
if ({{ settings.newsletter_popup_mobile }} || $(window).width() > 798) { | |
setTimeout( function() { | |
$('[data-remodal-id=newsletter]').remodal().open(); | |
}, | |
{% if settings.newsletter_popup_seconds != blank %}{{ settings.newsletter_popup_seconds }}{% else %}2{% endif %}*1000); | |
} | |
} | |
} | |
/*============================================================================ | |
Header section | |
==============================================================================*/ | |
var header = { | |
init: function(){ | |
var closeDropdown = function() { | |
$('body').removeClass('is-active'); | |
$('.dropdown_link').removeClass('active_link'); | |
$('.dropdown_container').hide(); | |
$('.mobile_nav').find('div').removeClass('open'); | |
}; | |
var closeMiniCart = function() { | |
$('body').removeClass('is-active').removeClass('blocked-scroll'); | |
$('.dropdown_link').toggleClass('active_link'); | |
$('.cart_container').removeClass('active_link'); | |
}; | |
var openMiniCart = function($cart_container) { | |
$('body').addClass('blocked-scroll'); | |
$('.mobile_nav div').removeClass('open'); | |
$('.dropdown_link').removeClass('active_link'); | |
$cart_container.addClass('active_link'); | |
}; | |
//Vertical menu enabled | |
if ($('.dropdown_link--vertical').length){ | |
$('.dropdown_link--vertical, .vertical-menu_submenu').on('mouseover', function(e) { | |
var $dropdown = $(this).parents('.main_nav').find('[data-dropdown="' + $(this).data('dropdown-rel') + '"]'); | |
var clickCount = $(this).attr('data-click-count'); | |
$('.active_link').removeClass('active_link'); | |
if(!$(this).hasClass('active_link')) { | |
$(this).children('a').addClass('active_link'); | |
$('.is-absolute').parent().removeClass('feature_image'); | |
} | |
}); | |
//Enable touch on parent link if on touch device and desktop menu is visible | |
if(is_touch_device()){ | |
$('.vertical-menu .sublink a, .vertical-menu_submenu .sublink a').on('touchstart click', function(e) { | |
e.stopPropagation(); | |
var verticalMenu = $(this); | |
if(e.type == "touchstart") { | |
clicked = true; | |
if($(this).attr('data-click-count') < 1) { | |
openDropdown(verticalMenu); | |
e.preventDefault(); | |
} | |
} | |
else if(e.type == "click" && !clicked) { | |
if($(this).attr('data-click-count') < 1) { | |
openDropdown(verticalMenu); | |
e.preventDefault(); | |
} | |
} | |
else { | |
clicked = false; | |
} | |
function openDropdown(verticalMenu) { | |
var $dropdownMegaMenu = $(verticalMenu).parents('.main_nav').find('[data-dropdown="' + $(this).data('dropdown-rel') + '"]'); | |
var $dropdownVertical = $(verticalMenu).next('.vertical-menu_submenu'); | |
var clickCount = $(verticalMenu).attr('data-click-count'); | |
$('.dropdown_link--vertical').not(verticalMenu).attr('data-click-count', 0); | |
$('.dropdown_link--vertical').attr('data-no-instant', true); | |
$('.dropdown_container').hide(); | |
$dropdownMegaMenu.show(); | |
$('.vertical-menu_submenu').removeClass('is-visible'); | |
$dropdownVertical.addClass('is-visible'); | |
//capture touch event | |
if (e.type == 'touchstart'){ | |
clickCount++; | |
$(verticalMenu).attr('data-click-count', clickCount); | |
if (clickCount < 2){ | |
e.preventDefault(); | |
e.stopPropagation(); | |
return false; | |
} | |
} | |
} | |
}); | |
} | |
} | |
if ($('.promo_banner').length){ | |
var promo_banner = Cookies.get('promo_banner'); | |
if (promo_banner != 'dismiss') { | |
$('body').addClass('promo_banner-show'); | |
$('.promo_banner').on('click', '.promo_banner-close', function(){ | |
$('body').removeClass('promo_banner-show'); | |
Cookies.set('promo_banner', 'dismiss', { expires: 30 }); | |
}); | |
} | |
} | |
//offscreen check for menu | |
$('.vertical-menu_submenu, .vertical-menu_sub-submenu').each(function() { | |
if($(this).is(':off-right')) { | |
$(this).addClass('vertical-menu--align-right'); | |
} | |
}); | |
//Click anywhere outside of dropdown to close | |
$('html').on('click', function(event) { | |
if (!$(event.target).closest('.cart_container').length && $('.cart_content').is(':visible')) { | |
closeMiniCart(); | |
} | |
if (!$(event.target).closest('.dropdown_container').length && $('.dropdown').is(':visible')) { | |
closeDropdown(); | |
} | |
}); | |
//Only apply on larger screen sizes | |
if ($(window).width() > 798) { | |
if ($('.header').hasClass('header-fixed--true')){ | |
//offset scroll position | |
$('body').on('click', '.banner a[href^="#"]', function(e) { | |
e.preventDefault(); | |
var anchorLink = $(this).attr('href'); | |
var headerHeight = $('.main_nav_wrapper.sticky_nav').outerHeight(); | |
$('html, body').animate({ | |
scrollTop: $(anchorLink).offset().top - headerHeight | |
}, 2000); | |
}); | |
if (!$('.main_nav_wrapper').hasClass('sticky_nav')) { | |
var sticky_nav = new Headhesive('.main_nav_wrapper', { | |
offset: 700, | |
throttle: 300, | |
classes: { | |
clone: 'sticky_nav', | |
stick: 'sticky_nav--stick', | |
unstick: 'sticky_nav--unstick' | |
}, | |
onInit: function() { | |
$(".sticky_nav .secondary_logo").css('display', 'none'); | |
$(".sticky_nav .primary_logo").css('display', 'block'); | |
$(".sticky_nav .icon-search").css('display', 'block'); | |
$(".sticky_nav .search_container").css('display', 'none'); | |
$(".sticky_nav .nav:last").prepend($(".header .cart_container").clone()); | |
{% if settings.menu_position == "inline" %} | |
var sticky_nav_height = $(".sticky_nav").height() + 5; | |
{% else %} | |
var sticky_nav_height = $(".sticky_nav .nav").height() + 5; | |
{% endif %} | |
$(".sticky_nav .mini_cart").css("height", $(".sticky_nav").height() + 5); | |
$(".sticky_nav .cart_content").css("top", $(".sticky_nav").height()); | |
}, | |
onUnstick: function() { | |
$('.cart_container').removeClass('active_link'); | |
} | |
}); | |
} | |
} else { | |
$('.header-fixed--true').removeClass('header-fixed--true'); | |
if ($('.main_nav_wrapper').length > 1) { | |
$('.main_nav_wrapper').first().remove(); | |
} | |
} | |
if ($('img.primary_logo:visible')){ | |
$('.logo img', $(".feature_image .header")).attr('src', $('.logo img').data('src-home')); | |
} else { | |
$('.logo img').attr('src', $('.logo img').data('src')); | |
} | |
//Mobile menu | |
} else { | |
if ($('#header').hasClass('mobile_nav-fixed--true')){ | |
$('body').addClass('mobile_nav-fixed--true'); | |
//offset scroll position | |
$('body').on('click', '.banner a[href^="#"]', function(e) { | |
e.preventDefault(); | |
var anchorLink = $(this).attr('href'); | |
var headerHeight = $('#header').outerHeight(); | |
$('html, body').animate({ | |
scrollTop: $(anchorLink).offset().top - headerHeight | |
}, 2000); | |
}); | |
} else { | |
$('body').addClass('mobile_nav-fixed--false'); | |
} | |
} | |
//avoid cart_content duplicating | |
if($('.cart_content').length <= 2) { | |
$('#header .cart_container').append($('.cart_content').clone()); | |
} | |
if ( is_touch_device() || $(window).width() <= 798 ) { | |
$('.dropdown_link').attr('data-no-instant', true); | |
$('body').on('click', '.dropdown_link', function(e) { | |
$('.nav a').removeClass('active_link'); | |
if ($('#header').is(':visible')) { | |
var $dropdown = $(this).parents("#header").find('[data-dropdown="' + $(this).data("dropdown-rel") + '"]') | |
if(!$(this).hasClass('mini_cart')) { | |
$('.cart_container').removeClass('active_link'); | |
} | |
} else { | |
if($(this).hasClass("icon-search")) { | |
window.location = $(this).attr("href"); | |
return false; | |
} | |
var $dropdown = $(this).parents(".main_nav").find('[data-dropdown="' + $(this).data("dropdown-rel") + '"]') | |
} | |
if ($dropdown.is(':visible') || $dropdown.attr('class') === undefined) { | |
$dropdown.hide(); | |
$('body').removeClass('is-active'); | |
} else { | |
$('.dropdown_container').hide(); | |
if(!$(this).hasClass('cart_container')) { | |
$('.is-absolute').parent().removeClass('feature_image'); | |
} | |
$dropdown.show(); | |
$('body').addClass('is-active'); | |
$('.mobile_nav').find('div').removeClass('open'); | |
} | |
if ($dropdown.is(':visible')) { | |
e.stopPropagation(); | |
return false; | |
} | |
}); | |
$('body').on("click", '.mobile_nav', function() { | |
$(this).find('div').toggleClass('open'); | |
}); | |
//Toggle mini-cart with menu icon | |
$(".mini_cart").on("click", function(e) { | |
var $cart_container = $(this).parent(); | |
if($cart_container.hasClass('active_link')) { | |
closeMiniCart(); | |
$('body').removeClass('blocked-scroll'); | |
} else { | |
openMiniCart($cart_container); | |
$('body').addClass('blocked-scroll'); | |
} | |
if (is_touch_device() || $(window).width() <= 798) { | |
e.preventDefault(); | |
} | |
}); | |
$('.cart_content__continue-shopping').on('click', function(e){ | |
closeMiniCart(); | |
}) | |
} else { | |
$(".nav a, .logo a").not(".cart_content a").on("mouseenter", function() { | |
if(!$(this).hasClass("active_link")) { | |
$('.dropdown_container').hide(); | |
$('.active_link').removeClass('active_link'); | |
$('.is-absolute').parent().addClass('feature_image'); | |
} | |
}); | |
$('.main_nav, .top_bar, .cart_container').on("mouseleave", function() { | |
if ( $(window).width() > 798) { | |
$('.dropdown_container').hide(); | |
} | |
$('.active_link').removeClass('active_link'); | |
$('.is-absolute').parent().addClass('feature_image'); | |
}); | |
$('.dropdown_link, .dropdown_link--vertical').attr('data-click-count', 0); | |
$('.dropdown_link').on('mouseover touchstart', function(e) { | |
if ( $(window).width() > 798) { | |
$('.dropdown_container').hide(); | |
} | |
var $dropdown = $(this).parents('.main_nav').find('[data-dropdown="' + $(this).data('dropdown-rel') + '"]'); | |
var clickCount = $(this).attr('data-click-count'); | |
$('.active_link').removeClass('active_link'); | |
if(!$(this).hasClass('active_link')) { | |
$dropdown.show(); | |
if($(this).hasClass('mini_cart')) { | |
$(this).parent('.cart_container').addClass('active_link'); | |
} else { | |
if ( $(window).width() > 798) { | |
$(this).addClass('active_link'); | |
} | |
$('.is-absolute').parent().removeClass('feature_image'); | |
} | |
} | |
//Enable touch on parent link if on touch device and desktop menu is visible | |
if(is_touch_device()){ | |
$('.dropdown_link').not(this).attr('data-click-count', 0); | |
$('.dropdown_link').attr('data-no-instant', true); | |
//capture touch event | |
if (e.type == 'touchstart'){ | |
clickCount++; | |
$(this).attr('data-click-count', clickCount); | |
if (clickCount < 2){ | |
e.preventDefault(); | |
e.stopPropagation(); | |
return false; | |
} | |
} | |
} | |
}); | |
} | |
}, | |
removeDataAttributes: function(target){ | |
if($(target).length){ | |
var i, | |
$target = $(target), | |
attrName, | |
dataAttrsToDelete = [], | |
dataAttrs = $target.get(0).attributes, | |
dataAttrsLen = dataAttrs.length; | |
for (i=0; i<dataAttrsLen; i++) { | |
if ( 'data-' === dataAttrs[i].name.substring(0,5) ) { | |
dataAttrsToDelete.push(dataAttrs[i].name); | |
} | |
} | |
$.each( dataAttrsToDelete, function( index, attrName ) { | |
$target.removeAttr( attrName ); | |
}) | |
} | |
}, | |
loadMegaMenu: function(){ | |
//Remove old mega-menus so that theme-editor works properly | |
$('.sticky_nav .mega-menu').remove(); | |
$('.header .mega-menu').remove(); | |
//Clone the mega menu from section into sticky_nav | |
$('.mega-menu-container .mega-menu') | |
.clone() | |
.appendTo('.sticky_nav .main_nav'); | |
//Remove theme-editor data-attributes | |
header.removeDataAttributes('.sticky_nav .mega-menu.dropdown_container .dropdown_column'); | |
//Loop through mega-menus to add arrow to parent | |
$('.mega-menu-container .mega-menu').each(function(index){ | |
var megaMenuValue = $(this).data("dropdown"); | |
$('[data-dropdown-rel="' + megaMenuValue + '"]') | |
.find('span') | |
.remove(); | |
$('[data-dropdown-rel="' + megaMenuValue + '"]') | |
.not('.icon-search') | |
.append(' <span class="icon-down-arrow"></span>') | |
.addClass('mega-menu-parent') | |
.addClass('dropdown_link') | |
.removeClass('top_link'); | |
$('[data-dropdown="' + megaMenuValue + '"]').each(function(index){ | |
if (!$(this).hasClass('mega-menu')) { | |
$(this).remove(); | |
} | |
}); | |
$(this).clone().appendTo('.header .main_nav'); | |
}); | |
//Remove default mega menus if vertical menus are selected | |
if ($('.dropdown_link--vertical').length){ | |
$('.dropdown_link--vertical.mega-menu-parent + .vertical-menu_submenu').remove(); | |
$('.dropdown_link--vertical:not(.mega-menu-parent)').each(function(index){ | |
var megaMenuValue = $(this).data('dropdown-rel'); | |
$('[data-dropdown="' + megaMenuValue + '"]').remove(); | |
}) | |
} | |
$('.mega-menu-parent').on('mouseenter', function() { | |
if(!$(this).hasClass('active_link')) { | |
$('.dropdown_container').hide(); | |
$(this).parents('.main_nav').find('[data-dropdown="' + $(this).data('dropdown-rel') + '"]').toggle(); | |
$(this).addClass('active_link'); | |
$('.is-absolute').parent().removeClass('feature_image'); | |
} | |
}); | |
//Remove theme-editor data-attributes | |
header.removeDataAttributes('.header .mega-menu.dropdown_container .dropdown_column'); | |
if (is_touch_device() || $(window).width() <= 798) { | |
$('.dropdown_link').attr('data-no-instant', true); | |
} | |
header.loadMobileMegaMenu(); | |
}, | |
loadMobileMegaMenu: function() { | |
//Loop through mega menus and add to mobile menu | |
$('.mega-menu-container .mobile-mega-menu').each(function(index){ | |
$('[data-mobile-dropdown-rel="' + $(this).data("mobile-dropdown") + '"]').find('span').remove(); | |
$('[data-mobile-dropdown-rel="' + $(this).data("mobile-dropdown") + '"] > a').append(' <span class="right icon-down-arrow"></span>').attr('data-no-instant', 'true'); | |
$('[data-mobile-dropdown-rel="' + $(this).data("mobile-dropdown") + '"]').addClass('mobile-mega-menu-parent sublink'); | |
$('[data-mobile-dropdown-rel="' + $(this).data("mobile-dropdown") + '"]').append(this); | |
$('[data-mobile-dropdown-rel="' + $(this).data("mobile-dropdown") + '"] > ul').each(function(index){ | |
if (!$(this).hasClass('mobile-mega-menu')) { | |
$(this).remove(); | |
} | |
}); | |
}); | |
}, | |
unloadMegaMenu: function(){ | |
$('.header .mega-menu').remove(); | |
$('.mega-menu-container .mega-menu').each(function(index){ | |
var menuParent = $(this).data('dropdown'); | |
$('.mega-menu-parent[data-dropdown-rel="' + $(this).data("dropdown") + '"]').find('.icon-down-arrow').remove(); | |
}); | |
}, | |
unload: function() { | |
$('body').off('click', '.mobile_nav'); | |
$('body').off('click', '.dropdown_link'); | |
$('html').off('click'); | |
$('.mini_cart').off('click'); | |
$('.cart_content__continue-shopping').off('click'); | |
$('body').off('click', '.banner a[href^="#"]'); | |
} | |
} | |
/*============================================================================ | |
Load More Search items | |
==============================================================================*/ | |
var enableLoadMoreSearch = function(){ | |
$('body').on('click', '.js-load-more a', function(e){ | |
enableInfiniteSearchScroll(); | |
e.stopPropagation(); | |
return false; | |
}); | |
} | |
var enableInfiniteSearchScroll = function(){ | |
if ($('.search-matrix').length) { | |
var infiniteSearchScroll = new Waypoint.Infinite({ | |
element: $('.search-matrix')[0], | |
items: '.search-matrix', | |
more: '.load-more__btn', | |
loadingClass: 'loading-in-progress', | |
onBeforePageLoad: function(){ | |
$('.js-load-more').hide(); | |
}, | |
onAfterPageLoad: function(data){ | |
$('.search-matrix > .search-matrix .thumbnail').unwrap('.search-matrix'); | |
{% if settings.enable_shopify_review_comments and settings.enable_shopify_collection_badges %} | |
SPR.$(document).ready(function() { | |
return SPR.registerCallbacks(), | |
SPR.initRatingHandler(), | |
SPR.initDomEls(), | |
SPR.loadProducts(), | |
SPR.loadBadges() | |
}) | |
{% endif %} | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
} | |
}) | |
} | |
} | |
/*============================================================================ | |
Map | |
==============================================================================*/ | |
var mapFunction = { | |
init: function() { | |
if ($('.maps').hasClass('js-api-map')) { | |
var mapsToLoad = []; | |
//Create map settings array | |
$('.map').each(function(i, obj) { | |
mapsToLoad.push(this); | |
mapsToLoad[i].sectionid = $(this).data('id'); | |
mapsToLoad[i].address = $(this).data('address'); | |
mapsToLoad[i].directions = $(this).data('directions-address'); | |
mapsToLoad[i].zoom = $(this).data('zoom'); | |
mapsToLoad[i].mapstyle = $(this).data('style'); | |
mapsToLoad[i].showpin = $(this).data('pin'); | |
mapsToLoad[i].apikey = $(this).data('api-key'); | |
}); | |
$.each(mapsToLoad, function(i, instance) { | |
//Enable caching to avoid duplicate google maps files | |
$.ajaxSetup({ cache: true }); | |
//Load maps script and find location coordinates | |
$.getScript( | |
'https://maps.googleapis.com/maps/api/js?key=' + mapsToLoad[i].apikey | |
).then(function() { | |
mapFunction.findLocation(mapsToLoad[i]); | |
$.ajaxSetup({ cache: false }); | |
}); | |
}); | |
} | |
}, | |
findLocation: function(mapArray) { | |
var geoLat; | |
var geoLng; | |
var geocoder = new google.maps.Geocoder(); | |
//Find and set coordinates | |
geocoder.geocode({ address: mapArray.address }, function(results, status) { | |
if (status == google.maps.GeocoderStatus.OK) { | |
geoLat = results[0].geometry.location.lat(); | |
geoLng = results[0].geometry.location.lng(); | |
//Create map | |
mapFunction.initMap(geoLat, geoLng, mapArray); | |
} else { | |
console.log('Error:' + status); | |
} | |
}); | |
}, | |
initMap: function(lat, lng, mapArray) { | |
var location = { lat: lat, lng: lng }; | |
var styleJson = []; | |
//Set style JSON | |
if(mapArray.mapstyle=='aubergine'){ | |
styleJson=[{elementType:'geometry',stylers:[{color:'#1d2c4d'}]},{elementType:'labels.text.fill',stylers:[{color:'#8ec3b9'}]},{elementType:'labels.text.stroke',stylers:[{color:'#1a3646'}]},{featureType:'administrative.country',elementType:'geometry.stroke',stylers:[{color:'#4b6878'}]},{featureType:'administrative.land_parcel',elementType:'labels.text.fill',stylers:[{color:'#64779e'}]},{featureType:'administrative.province',elementType:'geometry.stroke',stylers:[{color:'#4b6878'}]},{featureType:'landscape.man_made',elementType:'geometry.stroke',stylers:[{color:'#334e87'}]},{featureType:'landscape.natural',elementType:'geometry',stylers:[{color:'#023e58'}]},{featureType:'poi',elementType:'geometry',stylers:[{color:'#283d6a'}]},{featureType:'poi',elementType:'labels.text.fill',stylers:[{color:'#6f9ba5'}]},{featureType:'poi',elementType:'labels.text.stroke',stylers:[{color:'#1d2c4d'}]},{featureType:'poi.park',elementType:'geometry.fill',stylers:[{color:'#023e58'}]},{featureType:'poi.park',elementType:'labels.text.fill',stylers:[{color:'#3C7680'}]},{featureType:'road',elementType:'geometry',stylers:[{color:'#304a7d'}]},{featureType:'road',elementType:'labels.text.fill',stylers:[{color:'#98a5be'}]},{featureType:'road',elementType:'labels.text.stroke',stylers:[{color:'#1d2c4d'}]},{featureType:'road.highway',elementType:'geometry',stylers:[{color:'#2c6675'}]},{featureType:'road.highway',elementType:'geometry.stroke',stylers:[{color:'#255763'}]},{featureType:'road.highway',elementType:'labels.text.fill',stylers:[{color:'#b0d5ce'}]},{featureType:'road.highway',elementType:'labels.text.stroke',stylers:[{color:'#023e58'}]},{featureType:'transit',elementType:'labels.text.fill',stylers:[{color:'#98a5be'}]},{featureType:'transit',elementType:'labels.text.stroke',stylers:[{color:'#1d2c4d'}]},{featureType:'transit.line',elementType:'geometry.fill',stylers:[{color:'#283d6a'}]},{featureType:'transit.station',elementType:'geometry',stylers:[{color:'#3a4762'}]},{featureType:'water',elementType:'geometry',stylers:[{color:'#0e1626'}]},{featureType:'water',elementType:'labels.text.fill',stylers:[{color:'#4e6d70'}]}] | |
}else if(mapArray.mapstyle=='retro'){ | |
styleJson=[{elementType:'geometry',stylers:[{color:'#ebe3cd'}]},{elementType:'labels.text.fill',stylers:[{color:'#523735'}]},{elementType:'labels.text.stroke',stylers:[{color:'#f5f1e6'}]},{featureType:'administrative',elementType:'geometry.stroke',stylers:[{color:'#c9b2a6'}]},{featureType:'administrative.land_parcel',elementType:'geometry.stroke',stylers:[{color:'#dcd2be'}]},{featureType:'administrative.land_parcel',elementType:'labels.text.fill',stylers:[{color:'#ae9e90'}]},{featureType:'landscape.natural',elementType:'geometry',stylers:[{color:'#dfd2ae'}]},{featureType:'poi',elementType:'geometry',stylers:[{color:'#dfd2ae'}]},{featureType:'poi',elementType:'labels.text.fill',stylers:[{color:'#93817c'}]},{featureType:'poi.park',elementType:'geometry.fill',stylers:[{color:'#a5b076'}]},{featureType:'poi.park',elementType:'labels.text.fill',stylers:[{color:'#447530'}]},{featureType:'road',elementType:'geometry',stylers:[{color:'#f5f1e6'}]},{featureType:'road.arterial',elementType:'geometry',stylers:[{color:'#fdfcf8'}]},{featureType:'road.highway',elementType:'geometry',stylers:[{color:'#f8c967'}]},{featureType:'road.highway',elementType:'geometry.stroke',stylers:[{color:'#e9bc62'}]},{featureType:'road.highway.controlled_access',elementType:'geometry',stylers:[{color:'#e98d58'}]},{featureType:'road.highway.controlled_access',elementType:'geometry.stroke',stylers:[{color:'#db8555'}]},{featureType:'road.local',elementType:'labels.text.fill',stylers:[{color:'#806b63'}]},{featureType:'transit.line',elementType:'geometry',stylers:[{color:'#dfd2ae'}]},{featureType:'transit.line',elementType:'labels.text.fill',stylers:[{color:'#8f7d77'}]},{featureType:'transit.line',elementType:'labels.text.stroke',stylers:[{color:'#ebe3cd'}]},{featureType:'transit.station',elementType:'geometry',stylers:[{color:'#dfd2ae'}]},{featureType:'water',elementType:'geometry.fill',stylers:[{color:'#b9d3c2'}]},{featureType:'water',elementType:'labels.text.fill',stylers:[{color:'#92998d'}]}] | |
}else if(mapArray.mapstyle=='silver'){ | |
styleJson=[{elementType:'geometry',stylers:[{color:'#f5f5f5'}]},{elementType:'labels.icon',stylers:[{visibility:'off'}]},{elementType:'labels.text.fill',stylers:[{color:'#616161'}]},{elementType:'labels.text.stroke',stylers:[{color:'#f5f5f5'}]},{featureType:'administrative.land_parcel',elementType:'labels.text.fill',stylers:[{color:'#bdbdbd'}]},{featureType:'poi',elementType:'geometry',stylers:[{color:'#eeeeee'}]},{featureType:'poi',elementType:'labels.text.fill',stylers:[{color:'#757575'}]},{featureType:'poi.park',elementType:'geometry',stylers:[{color:'#e5e5e5'}]},{featureType:'poi.park',elementType:'labels.text.fill',stylers:[{color:'#9e9e9e'}]},{featureType:'road',elementType:'geometry',stylers:[{color:'#ffffff'}]},{featureType:'road.arterial',elementType:'labels.text.fill',stylers:[{color:'#757575'}]},{featureType:'road.highway',elementType:'geometry',stylers:[{color:'#dadada'}]},{featureType:'road.highway',elementType:'labels.text.fill',stylers:[{color:'#616161'}]},{featureType:'road.local',elementType:'labels.text.fill',stylers:[{color:'#9e9e9e'}]},{featureType:'transit.line',elementType:'geometry',stylers:[{color:'#e5e5e5'}]},{featureType:'transit.station',elementType:'geometry',stylers:[{color:'#eeeeee'}]},{featureType:'water',elementType:'geometry',stylers:[{color:'#c9c9c9'}]},{featureType:'water',elementType:'labels.text.fill',stylers:[{color:'#9e9e9e'}]}] | |
}else if(mapArray.mapstyle=='night'){ | |
styleJson=[{elementType:'geometry',stylers:[{color:'#242f3e'}]},{elementType:'labels.text.fill',stylers:[{color:'#746855'}]},{elementType:'labels.text.stroke',stylers:[{color:'#242f3e'}]},{featureType:'administrative.locality',elementType:'labels.text.fill',stylers:[{color:'#d59563'}]},{featureType:'poi',elementType:'labels.text.fill',stylers:[{color:'#d59563'}]},{featureType:'poi.park',elementType:'geometry',stylers:[{color:'#263c3f'}]},{featureType:'poi.park',elementType:'labels.text.fill',stylers:[{color:'#6b9a76'}]},{featureType:'road',elementType:'geometry',stylers:[{color:'#38414e'}]},{featureType:'road',elementType:'geometry.stroke',stylers:[{color:'#212a37'}]},{featureType:'road',elementType:'labels.text.fill',stylers:[{color:'#9ca5b3'}]},{featureType:'road.highway',elementType:'geometry',stylers:[{color:'#746855'}]},{featureType:'road.highway',elementType:'geometry.stroke',stylers:[{color:'#1f2835'}]},{featureType:'road.highway',elementType:'labels.text.fill',stylers:[{color:'#f3d19c'}]},{featureType:'transit',elementType:'geometry',stylers:[{color:'#2f3948'}]},{featureType:'transit.station',elementType:'labels.text.fill',stylers:[{color:'#d59563'}]},{featureType:'water',elementType:'geometry',stylers:[{color:'#17263c'}]},{featureType:'water',elementType:'labels.text.fill',stylers:[{color:'#515c6d'}]},{featureType:'water',elementType:'labels.text.stroke',stylers:[{color:'#17263c'}]}]}else{styleJson=[]} | |
//Create google maps link | |
$('.js-map-link').attr( | |
'href', | |
'https://www.google.com/maps/place/' + | |
mapArray.directions + | |
'/@' + | |
lat + | |
',' + | |
lng | |
); | |
//Set map options | |
var mapOptions = { | |
zoom: mapArray.zoom, | |
center: location, | |
styles: styleJson, | |
disableDefaultUI: false | |
}; | |
//Create map | |
var map = new google.maps.Map( | |
document.getElementById(mapArray.sectionid), | |
mapOptions | |
); | |
//Show pin | |
if (mapArray.showpin == true) { | |
var marker = new google.maps.Marker({ | |
position: location, | |
map: map | |
}); | |
} | |
} | |
}; | |
/*============================================================================ | |
Load More Products | |
==============================================================================*/ | |
var enableLoadMoreProducts = function(){ | |
$('body').on('click', '.js-load-more a', function(e){ | |
enableInfiniteScroll(); | |
e.stopPropagation(); | |
return false; | |
}); | |
} | |
var enableInfiniteScroll = function(){ | |
if ($('.collection-matrix').length) { | |
var infiniteScroll = new Waypoint.Infinite({ | |
element: $('.collection-matrix')[0], | |
items: '.collection-matrix', | |
more: '.load-more__btn', | |
loadingClass: 'loading-in-progress', | |
onBeforePageLoad: function(){ | |
$('.js-load-more').hide(); | |
}, | |
onAfterPageLoad: function(data){ | |
$('.collection-matrix > .collection-matrix .thumbnail').unwrap('.collection-matrix'); | |
{% if settings.enable_shopify_review_comments and settings.enable_shopify_collection_badges %} | |
SPR.$(document).ready(function() { | |
return SPR.registerCallbacks(), | |
SPR.initRatingHandler(), | |
SPR.initDomEls(), | |
SPR.loadProducts(), | |
SPR.loadBadges() | |
}) | |
{% endif %} | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
} | |
}) | |
} | |
} | |
/*============================================================================ | |
Filter Products with AJAX | |
==============================================================================*/ | |
Shopify.queryParams = {}; | |
if (location.search.length) { | |
for (var aKeyValue, i = 0, aCouples = location.search.substr(1).split('&'); i < aCouples.length; i++) { | |
aKeyValue = aCouples[i].split('='); | |
if (aKeyValue.length > 1) { | |
Shopify.queryParams[decodeURIComponent(aKeyValue[0])] = decodeURIComponent(aKeyValue[1]); | |
} | |
} | |
} | |
var quickFilter = { | |
init: function(){ | |
var selectedOptions = [], | |
query = '', | |
currentTags = '', | |
siteUrl = 'https://' + $.url('hostname'), | |
url1 = $.url('1') ? '/' + $.url('1') + '/' : '', | |
url2 = $.url('2') ? $.url('2') + '/' : '', | |
url3 = $.url('3'), | |
path = url1 + url2; | |
//Handle dropdowns if they exist | |
if ($('#sort-by').length){ | |
query = $('#sort-by').val(); | |
} else { | |
query = url('?sort_by'); | |
} | |
if ($('#tag_filter').length){ | |
if ($('#tag_filter').data('default-collection') != $('#tag_filter').val()){ | |
urlTag = $('#tag_filter').val().substr($('#tag_filter').val().lastIndexOf('/') + 1); | |
if (urlTag != 'all'){ | |
if ($.inArray( urlTag, selectedOptions ) > -1){ | |
//Do nothing | |
} else { | |
selectedOptions.unshift(urlTag); | |
} | |
} | |
} | |
} | |
//Add all checkbox values to array | |
$('[data-option-filter] input:checked').each(function (){ | |
selectedOptions.push($(this).val()); | |
}); | |
selectedOptions = $.makeArray(selectedOptions); | |
//Loop through tags to create string to update page url | |
$.each(selectedOptions, function(i, value){ | |
if (i != selectedOptions.length - 1) { | |
currentTags += selectedOptions[i] + '+'; | |
} else { | |
currentTags += selectedOptions[i]; | |
} | |
}); | |
Shopify.queryParams.sort_by = query; | |
query = '?' + $.param(Shopify.queryParams); | |
quickFilter.processUrl(path, currentTags, query); | |
}, | |
updateView: function(filterURL) { | |
$.ajax({ | |
type: 'GET', | |
url: filterURL, | |
beforeSend: function() { | |
$(".collection-matrix").addClass('fadeOut animated loading-in-progress filter-loading'); | |
Waypoint.destroyAll() | |
}, | |
success: function(data) { | |
$(".collection-matrix").removeClass('loading-in-progress'); | |
$(".collection-matrix").removeClass('filter-loading'); | |
var filteredBreadcrumb = $(data).find('.breadcrumb_text').html(); | |
$('.breadcrumb_text').html(filteredBreadcrumb); | |
var filteredPagination = $(data).find('.paginate').html(); | |
$('.paginate').html(filteredPagination); | |
var filteredSidebar = $(data).find('.sidebar').html(); | |
$('.sidebar').html(filteredSidebar); | |
var filteredPageLinks = $(data).find('.paginate').html(); | |
$('.paginate').empty(); | |
$('.paginate').html(filteredPageLinks); | |
var filteredData = $(data).find('.collection-matrix'); | |
$('.collection-matrix').remove(); | |
filteredData.insertBefore( $('.load-more__icon') ); | |
window.history && window.history.pushState && window.history.pushState("", "", filterURL); | |
if ($('.sidebar__collection-filter').length){ | |
collectionSidebarFilter.init(); | |
} | |
{% if settings.pagination_type == 'infinite_scroll'%} | |
enableInfiniteScroll(); | |
{% endif %} | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
{% if settings.enable_shopify_review_comments and settings.enable_shopify_collection_badges %} | |
SPR.$(document).ready(function() { | |
return SPR.registerCallbacks(), | |
SPR.initRatingHandler(), | |
SPR.initDomEls(), | |
SPR.loadProducts(), | |
SPR.loadBadges() | |
}) | |
{% endif %} | |
}, | |
error: function(x, t, m) { | |
console.log(x); | |
console.log(t); | |
console.log(m); | |
location.replace(location.protocol + '//' + location.host + filterURL); | |
}, | |
dataType: "html" | |
}); | |
}, | |
processUrl: function(path, tags, query){ | |
var query = query.replace(/\page=(\w+)&/, ''), | |
urlString = ''; | |
urlString = path + tags + query; | |
quickFilter.updateView(urlString); | |
} | |
} | |
$('#sort-by').val($('#sort-by').data('default-sort')); | |
$('body') | |
.on('change', '#tag_filter, #sort-by', function() { | |
quickFilter.init(); | |
}); | |
$('body') | |
.on('change', '#blog_filter', function() { | |
var url = $(this).val(); | |
window.location = url; | |
}); | |
$('input, select, textarea').on('focus blur', function(event) { | |
$('meta[name=viewport]').attr('content', 'width=device-width,initial-scale=1,maximum-scale=' + (event.type == 'blur' ? 10 : 1)); | |
}); | |
/*============================================================================ | |
Search autocomplete | |
==============================================================================*/ | |
var searchAutocomplete = { | |
init: function(){ | |
var currentAjaxRequest = null; | |
var shopURL = $('body').data('shop-url'); | |
{% if settings.search_option == 'products' %} | |
var searchPath = shopURL + '/search?type=product&q='; | |
{% else %} | |
var searchPath = shopURL + '/search?q='; | |
{% endif %} | |
//Submit wildcard searches | |
$(".search_form, .search__form, .header_search_form").on("submit", function(e){ | |
var formValue = $(this).find('input[name="q"]').val(); | |
var cleanFormValue = encodeURI(formValue); | |
e.preventDefault(); | |
if(cleanFormValue == null) { | |
window.location.href = '/search'; | |
} else { | |
window.location.href = searchPath + cleanFormValue + '*'; | |
} | |
}); | |
var searchForms = $('form.search_form, form.search, form.header_search_form').each(function() { | |
var input = $(this).find('input[name="q"]'); | |
// Adding a list for showing search results. | |
$('<div class="search__results-wrapper"><ul class="search__results"></ul></div>').appendTo($(this)); | |
// Listening to keyup and change on the text field within these search forms. | |
input.attr('autocomplete', 'off').bind('keyup change', function() { | |
if(input.val() == '') { | |
$('.search__results').hide(); | |
$('.search__results').empty(); | |
} | |
var term = $(this).val(); | |
var cleanTerm = encodeURI(term); | |
var form = $(this).closest('form'); | |
var searchURL = searchPath + cleanTerm; | |
var resultsList = form.find('.search__results'); | |
if (term.length >= 3) { | |
if (currentAjaxRequest != null) currentAjaxRequest.abort(); | |
currentAjaxRequest = $.getJSON(searchURL +'*&view=json', function(data) { | |
resultsList.empty(); | |
// If we have no results. | |
if(data.results_count == 0) { | |
resultsList.hide(); | |
} else { | |
// If we have results. | |
$.each(data.results, function(index, item) { | |
if(index >= {{ settings.search_to_display }}) { | |
return false; | |
} | |
var link = $('<a></a>').attr('href', item.url); | |
//Collect collection handles if product | |
if(item.object_type == 'product') { | |
var collectionHandles = []; | |
for(i=0; i < item.collections.length; i++) { | |
collectionHandles.push(item.collections[i].handle); | |
} | |
if($.inArray('coming-soon', collectionHandles) != -1) { | |
var itemPrice = {{ 'collections.general.coming_soon' | t | json }}; | |
} else { | |
if(item.available == true) { | |
if(item.raw_compare > item.raw_price ) { | |
var itemPrice = '<span class="was_price">' + item.compare + '</span> ' + item.price; | |
} else { | |
if(item.price_varies && item.price_min > 0) { | |
var itemPrice = {{ 'products.general.from' | t | json }} + ' ' + item.price; | |
} else if(item.price > 0 || item.raw_price > 0) { | |
var itemPrice = item.price; | |
} else { | |
var itemPrice = '{{ settings.free_price_text }}'; | |
} | |
} | |
} else { | |
var itemPrice = {{ 'products.product.sold_out' | t | json }}; | |
} | |
} | |
if(item.thumbnail != 'NULL') { | |
link.append('<div class="thumbnail"><img class="lazyload {{ settings.image_loading_style }}" src="' + item.thumbnail + '" /></div>'); | |
} | |
link.append('<div class="title">' + item.title + '<br><span class="item-pricing">'+ itemPrice +'</span></div>'); | |
} else if(item.object_type == 'article') { | |
if(item.thumbnail != 'NULL') { | |
link.append('<div class="thumbnail"><img class="lazyload {{ settings.image_loading_style }}" src="' + item.thumbnail + '" /></div>'); | |
} | |
link.append('<div class="title">' + item.title + '<br><span class="item-pricing">'+ item.text_content +'</span></div>'); | |
} else if(item.object_type == 'page') { | |
link.append('<div class="title">' + item.title + '<br><span class="item-pricing">'+ item.text_content +'</span></div>'); | |
} | |
link.wrap('<li class="item-result result--' + item.object_type + '"></li>'); | |
resultsList.append(link.parent()); | |
}); | |
// The Ajax request will return at the most 5 results. | |
// If there are more than 5, let's link to the search results page. | |
if(data.results_count >= {{ settings.search_to_display }}) { | |
resultsList.append('<li class="all-results"><span class="title see-all"><a href="' + searchURL + '*">' + {{ 'general.search.all_results' | t | json }} + ' (' + data.results_count + ')</a></span></li>'); | |
} | |
resultsList.fadeIn(200); | |
} | |
}) | |
} | |
}); | |
}); | |
// Clicking outside makes the results disappear. | |
$(document).on('click', function(e){ | |
var container = $('[data-autocomplete-true]'); | |
if (!container.is(e.target) && container.has(e.target).length === 0) { | |
$('[data-autocomplete-true]').find('.search__results-wrapper').hide(); | |
} | |
}); | |
$('[data-autocomplete-true] input').on('focus', function(){ | |
$('.search__results-wrapper').hide(); | |
$(this).parents('[data-autocomplete-true]').find('.search__results-wrapper').show(); | |
}); | |
}, | |
unload: function() { | |
$('body').off('focus', '[data-autocomplete-true] input'); | |
} | |
} | |
/*============================================================================ | |
Sidebar filter on collection pages | |
==============================================================================*/ | |
var collectionSidebarFilter = { | |
init: function(){ | |
$('.filter-active-tag input:checked').parents('.filter-active-tag').siblings('.filter-all-tags').hide(); | |
$('.toggle-all--true .toggle_list .filter-active-tag input:checked').parents('ul.toggle_list').prev().click(); | |
//Hide filters if types or vendors is in URL (can't be combined) | |
if ($.url(2) === 'types' || $.url(2) === 'vendors'){ | |
$('.sidebar__collection-filter').remove(); | |
} | |
$('.sidebar-block:empty').prev().css('border-bottom', 'none'); | |
}, | |
clearAllFilters: function(){ | |
$('[data-option-filter] input').attr('checked', false); | |
$('[data-option-filter] input').trigger('change'); | |
}, | |
clearSelectedFilter: function(optionFilter){ | |
optionFilter.find('[data-option-filter] input').attr('checked', false); | |
optionFilter.find('[data-option-filter] input').trigger('change'); | |
} | |
} | |
//Check the checkbox values | |
$('body').on('change', '[data-option-filter] input', function(){ | |
quickFilter.init(); | |
$("html, body").animate({ | |
scrollTop: ($('#pagecontent').offset().top) | |
}, 500); | |
}) | |
$('body').on('click', '[data-reset-filters]', function(){ | |
collectionSidebarFilter.clearAllFilters(); | |
}); | |
$('body').on('click', '[data-clear-filter]', function(){ | |
var selectedOption = $(this).parents('.filter-active-tag'); | |
collectionSidebarFilter.clearSelectedFilter(selectedOption); | |
}); | |
/*============================================================================ | |
FAQ | |
==============================================================================*/ | |
var faqAccordion = { | |
init: function(){ | |
var flg = 0; | |
var $faqHeading = $('.faqAccordion > dt > button'); | |
$('.faqAccordion > dd').attr('aria-hidden',true); | |
$faqHeading.attr('aria-expanded',false); | |
$faqHeading.on('click activate',function(){ | |
if( flg ) return false; | |
flg = 1; | |
var state = $(this).attr('aria-expanded') === 'false' ? true : false; | |
$(this).attr('aria-expanded',state); | |
$(this).parent().next().slideToggle(function(){ | |
flg = 0; | |
}); | |
$(this).parent().next().attr('aria-hidden',!state); | |
return false; | |
}); | |
$faqHeading.on('keydown',function(event){ | |
var keyCode = event.keyCode || e.which; | |
if (keyCode === 13){ | |
$(this).trigger('activate'); | |
} | |
}); | |
} | |
} | |
/*============================================================================ | |
Utilities | |
==============================================================================*/ | |
{% if settings.slideshow_arrow_size == 'bold' %} | |
var arrowSize = { | |
x0: 10, | |
x1: 40, y1: 50, | |
x2: 80, y2: 50, | |
x3: 50 | |
} | |
{% elsif settings.slideshow_arrow_size == 'light' %} | |
var arrowSize = { | |
x0: 10, | |
x1: 60, y1: 50, | |
x2: 62, y2: 40, | |
x3: 22 | |
} | |
{% else %} | |
//used for settings.slideshow_arrow_size === 'regular' | |
var arrowSize = { | |
x0: 10, | |
x1: 60, y1: 50, | |
x2: 70, y2: 40, | |
x3: 30 | |
} | |
{% endif %} | |
//compatibility with gallery using remodal | |
var lightboxGallery = { | |
init: function(){ | |
//compatibility with gallery using remodal | |
if ($('.lightbox img').length) { | |
var currentSlide; | |
var $lightboxImages = $('a.lightbox'); | |
var groups = []; | |
//get all lightbox images and divide into groups based on rel attribute | |
$lightboxImages.each(function(index){ | |
groups.push($(this).attr('rel')); | |
groups = groups.filter(function(item, i, ar){ return ar.indexOf(item) === i; }); | |
}) | |
//loop through gallery groups and create modals | |
$.each(groups, function(index, value){ | |
//Loop through images and add link to remodal | |
$('.lightbox[rel=' + value + ']').attr('data-remodal-target', 'lightbox-id-' + index ); | |
var lightboxModal = [ | |
'<div class="remodal remodal-lightbox js-remodal-lightbox js-lightbox-' + index + '" data-rel="' + value + '" data-remodal-id="lightbox-id-' + index + '" data-remodal-options="hashTracking: false">', | |
'<a data-remodal-action="close" class="remodal-close"></a>', | |
'<div class="lightbox-gallery"></div>', | |
'</div>' | |
].join(''); | |
//Add modal lightbox to page to be populated by lightboxImageGallery | |
$('body').append(lightboxModal); | |
$('.lightbox[rel=' + value + ']').each(function(index){ | |
$(this).attr('data-image-id', index); | |
$(this).attr('data-no-instant', ''); | |
}); | |
}); | |
} | |
} | |
} | |
var utils = { | |
createAccordion: function(container, tab, content){ | |
var $container = $(container); | |
var $tab = $(container).find(tab); | |
var $content = $(container).find(content); | |
var specificTab = container + ' ' + tab; | |
//Check to see if need to rearrange product tabs to create accordion (backwards compatible) | |
if (container.indexOf(".accordion-tabs") >= 0){ | |
var rearrangedTabs = $.map($tab, function(v, i) { return [v, $content[i]]; }); | |
$container.empty(); | |
$.each(rearrangedTabs, function (index, value) { | |
$container.append(this); | |
}); | |
$content.removeClass('active'); | |
$container.find('.active').next().slideToggle(); | |
tab = container + '> a'; | |
} | |
$(container).children('a').each(function(i, tab) { | |
var tab = $(this); | |
var tabValue = tab.attr('href'); //get tab id | |
tab.attr('data-tab-value', tabValue); //set tab id in data attribute | |
tab.removeAttr("href"); //remove href (to prevent url hash update) | |
}); | |
$(container).find(tab + '.active').next().slideToggle(); | |
$('body').on('click', specificTab, function(e){ | |
e.preventDefault(); | |
$(this).toggleClass('active'); | |
$(this).next().slideToggle(); | |
}); | |
}, | |
mobileAccordion: function(container, tab, content){ | |
$container = $(container); | |
$tab = $(container).find(tab); | |
$content = $(container).find(content); | |
$(tab + '.active').next().slideToggle(); | |
$('body').on('click', tab, function(e){ | |
e.preventDefault(); | |
$(this).toggleClass('active'); | |
$(this).next().slideToggle(); | |
}); | |
}, | |
mobileParentActiveAccordion: function(container, tab, content){ | |
$container = $(container); | |
$tab = $(container).find(tab); | |
$content = $(container).find(content); | |
$(tab + '.active').parent().next().slideToggle(); | |
$('body').on('click', tab, function(e){ | |
e.preventDefault(); | |
$(this).toggleClass('active'); | |
$(this).parent().next().slideToggle(); | |
}); | |
}, | |
initializeTabs: function(){ | |
$('ul.tabs > li > a').attr('data-no-instant', true); | |
$('body').on('click', 'ul.tabs > li > a', function(e) { | |
e.preventDefault(); | |
var contentLocation = $(this).attr('href'); | |
if(contentLocation.charAt(0)=="#") { | |
$('ul.tabs > li > a.active').removeClass('active'); | |
$(this).addClass('active'); | |
$(this).parents('ul.tabs').next().find(contentLocation).show().css({'display': 'block'}).addClass('active').siblings().hide().removeClass('active'); | |
} | |
}); | |
}, | |
pageBannerCheck: function(){ | |
//check for header banner | |
if (!$('.page_banner').length > 0 || $('.header').hasClass('header-background--solid')) { | |
$('.feature_image').removeClass('feature_image'); | |
$('.header.is-absolute').removeClass('is-absolute'); | |
//hide secondary logo | |
$('.secondary_logo--true').find('.secondary_logo').css('display', 'none'); | |
$('.secondary_logo--true').find('.primary_logo').css('display', 'block'); | |
} else { | |
$('.header').parent().addClass('feature_image'); | |
$('.header').addClass('is-absolute'); | |
//check for secondary logo | |
if ($('header.feature_image').hasClass('secondary_logo--true')){ | |
$('.secondary_logo--true').find('.secondary_logo').css('display', 'block'); | |
$('.secondary_logo--true').find('.primary_logo').css('display', 'none'); | |
} | |
} | |
//check for section that uses header banner on home page | |
if ($('.index-sections').children().first('.under-menu').find('.full-width--true').length) { | |
if (!$('.header').hasClass('header-background--solid')) { | |
$('.index .header').parent().addClass('feature_image'); | |
$('.index .header').addClass('is-absolute'); | |
} | |
//check for secondary logo | |
if ($('header.feature_image').hasClass('secondary_logo--true')){ | |
$('.secondary_logo--true').find('.secondary_logo').show(); | |
$('.secondary_logo--true').find('.primary_logo').hide(); | |
} | |
} else { | |
$('.index .feature_image').removeClass('feature_image'); | |
$('.index .header.is-absolute').removeClass('is-absolute'); | |
//hide secondary logo | |
if (!$('header.feature_image').hasClass('secondary_logo--true')){ | |
$('.secondary_logo--true').find('.secondary_logo').hide(); | |
$('.secondary_logo--true').find('.primary_logo').show(); | |
} | |
} | |
//check for section that uses header banner on the page details template | |
if ($('.detail-sections').children().first().hasClass('under-menu')) { | |
if (!$('.header').hasClass('header-background--solid')) { | |
$('[class^="page-details"] .header').parent().addClass('feature_image'); | |
$('[class^="page-details"] .header').addClass('is-absolute'); | |
} | |
//check for secondary logo | |
if ($('header.feature_image').hasClass('secondary_logo--true')){ | |
$('.secondary_logo--true').find('.secondary_logo').show(); | |
$('.secondary_logo--true').find('.primary_logo').hide(); | |
} | |
} else { | |
$('[class^="page-details"] .feature_image').removeClass('feature_image'); | |
$('[class^="page-details"] .header.is-absolute').removeClass('is-absolute'); | |
//hide secondary logo | |
if (!$('header.feature_image').hasClass('secondary_logo--true')){ | |
$('.secondary_logo--true').find('.secondary_logo').hide(); | |
$('.secondary_logo--true').find('.primary_logo').show(); | |
} | |
} | |
}, | |
resizeActionButtons: function(){ | |
$('.js-caption:visible').each(function(){ | |
var buttonWidth = 0; | |
$(this).find('.action_button').each(function(){ | |
$button = $(this); | |
if($(this).width() > buttonWidth){ | |
buttonWidth = $(this).width(); | |
} | |
}); | |
$(this).find('.action_button').width(buttonWidth); | |
}); | |
} | |
} | |
var sliderBlock = { | |
select: function(blockId, $parentSection){ | |
var $blocks = $parentSection.find('.gallery-cell'); | |
var blockIdsArray = $blocks.map(function() { | |
return String($(this).data('block-id')); | |
}); | |
var $slider = $parentSection.find('[data-slider-id]'); | |
var settings = { | |
slideshowTextAnimation: $slider.data('slideshow-text-animation') | |
} | |
var flkty = $slider.data('flickity'); | |
$slider.flickity('pausePlayer'); | |
for(var i = 0; i < blockIdsArray.length; i++){ | |
if(blockIdsArray[i] === blockId){ | |
var currentSlide = i; | |
if (currentSlide !== flkty.selectedIndex){ | |
$slider.flickity( 'select', parseInt(currentSlide), false, true); | |
} | |
} | |
} | |
}, | |
deselect: function($parentSection){ | |
var $slider = $parentSection.find('.flexslider').data('flexslider'); | |
if($slider) { | |
$slider.flickity('unpausePlayer'); | |
} | |
} | |
} | |
//document ready | |
$(function() { | |
var oldFlickityCreate = window.Flickity.prototype._create; | |
window.Flickity.prototype._create = function(){ | |
var that = this; | |
if(this.element.addEventListener){ | |
this.element.addEventListener('load', function(){ | |
that.onresize(); | |
}, true); | |
} | |
this._create = oldFlickityCreate; | |
return oldFlickityCreate.apply(this, arguments); | |
}; | |
objectFitImages(); | |
header.loadMegaMenu(); | |
header.init(); | |
{% if settings.enable_autocomplete %} | |
searchAutocomplete.init(); | |
{% endif %} | |
utils.pageBannerCheck(); | |
slideshow.init(); | |
testimonial.init(); | |
gallery.init(); | |
videoSection.init(); | |
featuredPromotions.init(); | |
featuredCollectionSection.init(); | |
collectionSidebarFilter.init(); | |
cart.init(); | |
mapFunction.init(); | |
productPage.initializeQuantityBox(); | |
productPage.init(); | |
productPage.relatedProducts(); | |
recentlyViewed.init(); | |
// Setup a timer | |
var resizeTimeout; | |
// Listen for resize events | |
window.addEventListener('resize', function ( event ) { | |
// If timer is null, reset it to 66ms and run your functions. | |
// Otherwise, wait until timer is cleared | |
if ( !resizeTimeout ) { | |
resizeTimeout = setTimeout(function() { | |
// Reset timeout | |
resizeTimeout = null; | |
// Run our resize functions | |
if($(window).width() <= 798) { | |
cart.init(); | |
header.unload(); | |
header.init(); | |
} | |
}, 66); | |
} | |
}, false); | |
//Search input hiding | |
//get current input | |
var currentValue = $(".search_form input[name='q']").val() | |
//return amount without * | |
if ($(".search_form input[name='q']").length > 0){ | |
$(".search_form input[name='q']").val( currentValue.replace('*', '') ); | |
} | |
//Set current slide | |
$('body').on('click', '.lightbox', function(){ | |
currentSlide = $(this).data('image-id'); | |
}); | |
var touchStartPos = 0; | |
//Detecting swipe vs tap | |
$(document).bind("touchstart", function (e) { | |
touchStartPos = $(window).scrollTop(); | |
}).bind("touchend", function (e) { | |
var distance = touchStartPos - $(window).scrollTop(); | |
if (distance > 20 || distance < -20) { | |
e.preventDefault; | |
} | |
}); | |
//detect when a remodal lightbox is opened | |
$('body').on('opened', '.js-remodal-lightbox', function() { | |
var $currentLightbox = $(this); | |
var group = $(this).data('rel'); | |
var $groupImages = $('.lightbox[rel=' + group + ']'); | |
var $currentLightboxGallery = $currentLightbox.find('.lightbox-gallery'); | |
var $currentLightboxImages = $currentLightbox.find('.lightbox-image'); | |
var activate_zoom = $('body').find('.product_gallery').data('zoom'); | |
var arrowShow = $currentLightboxImages.length === 1 ? false : true; | |
var draggable = $currentLightboxImages.length === 1 ? false : true; | |
var flktyEnabled = $currentLightbox.find('.lightbox-gallery').hasClass('flickity-enabled'); | |
var $cellElems; | |
$currentLightbox.attr('data-zoom', activate_zoom); | |
if (activate_zoom) { | |
draggable = false; | |
} else { | |
draggable = $currentLightboxImages.length === 1 ? false : true; | |
} | |
//Add gallery when lightbox opens | |
if (!flktyEnabled){ | |
var $lightboxGallery = $currentLightboxGallery.flickity({ | |
"wrapAround": "true", | |
"cellAlign": "center", | |
"contain": true, | |
"imagesLoaded": true, | |
"lazyLoad": 2, | |
"pageDots": false, | |
"draggable": draggable, | |
"prevNextButtons": arrowShow, | |
"arrowShape": arrowSize, | |
"adaptiveHeight": true | |
}); | |
} | |
$groupImages.each(function(index){ | |
var imagePath = $(this).attr('href'); | |
$cellElems = $('<div class="gallery-cell"><img src="'+ imagePath +'" class="lightbox-image"></div>'); | |
if ($groupImages.length > $currentLightboxGallery.find('.gallery-cell').length){ | |
$currentLightboxGallery.flickity( 'append', $cellElems ); | |
} | |
$currentLightboxGallery.flickity( 'select', currentSlide, false, true ).focus(); | |
$currentLightbox.find('.lightbox-image').css('opacity', '1'); | |
}); | |
//add zoom to product images | |
if (activate_zoom) { | |
imageFunctions.zoom('.js-remodal-lightbox', true, 1); | |
} | |
}); | |
//Set current slide | |
$('body').on('click', '.lightbox', function(){ | |
currentSlide = $(this).data('image-id'); | |
}); | |
$('body').on('click', '.sidebar .parent-link--false', function(e) { | |
e.preventDefault(); | |
$menu = $(this).parent('li'); | |
$menu.find('.menu-toggle').toggleClass('active'); | |
$menu.find('ul').slideToggle(); | |
}); | |
$('body').on('closed', '.js-remodal-lightbox', function () { | |
var $currentLightbox = $(this); | |
$currentLightbox.find('img').css('opacity', '0'); | |
}); | |
{% if settings.newsletter_popup != blank %} | |
newsletter_popup.init(); | |
{% endif %} | |
if(window.location.pathname.indexOf('/comments') != -1) { | |
$('html,body').animate({scrollTop: $("#new-comment").offset().top-140},'slow'); | |
} | |
$('body').on('mouseenter', '.icon-search', function() { | |
$('.search-terms').focus(); | |
}); | |
$('body').on('click', '.icon-search', function() { | |
$('input.search-terms').focus(); | |
}); | |
$('body').on('click', '.search-submit', function() { | |
$(this).parent().submit(); | |
}); | |
if ($(window).width() > 798) { | |
$(".animate_right").waypoint(function() { | |
$(this.element).addClass("animated fadeInRight"); | |
}, { offset: '70%' }); | |
$(".animate_left").waypoint(function() { | |
$(this.element).addClass("animated fadeInLeft"); | |
}, { offset: '70%' }); | |
$(".animate_up").waypoint(function() { | |
$(this.element).addClass("animated fadeInUp"); | |
}, { offset: '70%' }); | |
$(".animate_down").waypoint(function() { | |
$(this.element).addClass("animated fadeInDown"); | |
}, { offset: '70%' }); | |
} | |
//backwards compatibility with flexslider | |
$('.slider, .flexslider').find('li').unwrap(); | |
$('.slider, .flexslider').flickity({ | |
pageDots: usePageDots, | |
imagesLoaded: true, | |
arrowShape: arrowSize, | |
lazyLoad: 2 | |
}); | |
utils.createAccordion('.toggle-all--true', 'h4.toggle', 'ul.toggle_list'); | |
utils.createAccordion('.footer_menu', 'h6', 'ul'); | |
utils.createAccordion('.footer_content', 'h6', 'div.toggle_content'); | |
utils.createAccordion('.product_section .accordion-tabs', '.tabs li > a', '.tabs-content li'); | |
utils.mobileParentActiveAccordion('#mobile_menu', 'li.sublink > a.parent-link--true span', 'li.sublink ul'); | |
utils.mobileAccordion('#mobile_menu', 'li.sublink > a.parent-link--false', 'li.sublink ul'); | |
utils.initializeTabs(); | |
utils.resizeActionButtons(); | |
faqAccordion.init(); | |
$(window).on('resize', function() { | |
utils.resizeActionButtons(); | |
}); | |
//Sidebar toggle check | |
if ($(window).width() <= 798) { | |
utils.createAccordion('.toggle-all--false', 'h4.toggle', 'ul.toggle_list'); | |
} | |
$('body').on('click', '.menu-toggle', function(e) { | |
var $content = $(this).next('ul'); | |
$content.slideToggle(); | |
$(this).toggleClass('active'); | |
$(this).attr('aria-expanded', $(this).attr('aria-expanded') == 'true' ? 'false' : 'true'); | |
}); | |
$(':not(.product-page .video-section)').find('iframe[src*=youtube], iframe[src*=vimeo]').mediaWrapper({ intrinsic: true }); | |
if ($(window).width() >= 959) { | |
var modal_width = '870px'; | |
if($(window).width() >= 1200 || $('html').hasClass('ie')) { | |
modal_width = '1110px' | |
} | |
} | |
{% if settings.collection_swatches %} | |
if ($(window).width() > 798) { | |
$('body').on('mouseenter', '.collection_swatches', function() { | |
$('.swatch span', $(this)).each(function() { | |
if($(this).data("image").indexOf("no-image") == -1) { | |
$('<img/>')[0].src = $(this).data("image"); | |
} | |
}); | |
}); | |
$('body').on('mouseenter', '.swatch span', function() { | |
if($(this).data("image").indexOf("no-image") == -1) { | |
$(this).parents('.thumbnail').find('img:not(.secondary)').attr('src', $(this).data("image")); | |
$(this).parents('.thumbnail').find('img:not(.secondary)').attr('srcset', $(this).data("image")); | |
} | |
}); | |
} | |
{% endif %} | |
//Terms of service settings for minicart | |
{% if settings.display_tos_checkbox %} | |
$('body').on('click touchstart', '.cart_content .tos_label', function() { | |
$(this).prev('input').prop('checked', true); | |
}); | |
{% endif %} | |
{% if settings.display_tos_checkbox and settings.go_to_checkout %} | |
//Terms of service on mini-cart | |
$('body').on('click', ".cart_content .action_button", function(e) { | |
if ($(this).parents('form').find('.tos_agree').is(':checked')) { | |
{% if settings.go_to_checkout %} | |
$(this).submit(); | |
{% else %} | |
// Redirect to cart page | |
e.preventDefault(); | |
document.location.href = "/cart"; | |
{% endif %} | |
} else { | |
var warning = '<p class="warning animated bounceIn">' + {{ 'cart.general.agree_to_terms_warning' | t | json }} + '</p>'; | |
if ($('p.warning').length == 0) { | |
$(this).before(warning); | |
} | |
return false; | |
} | |
}); | |
{% elsif settings.go_to_checkout == false %} | |
$('body').on('click', ".cart_content .action_button", function(e) { | |
// Redirect to cart page | |
e.preventDefault(); | |
document.location.href = "/cart"; | |
}); | |
{% endif %} | |
{% if settings.collection_secondary_image != blank %} | |
imageFunctions.showSecondaryImage(); | |
{% endif %} | |
var $contact_form = $('.newsletter .contact-form'); | |
$contact_form.each(function() { | |
var $cf = $(this); | |
$cf.on('submit', function (e) { | |
if($('input[name="challenge"]', $cf).val() !== "true") { | |
$.ajax({ | |
type: $cf.attr('method'), | |
url: $cf.attr('action'), | |
data: $cf.serialize(), | |
success: function (data) { | |
$cf.fadeOut("slow", function(){ | |
$cf.prev('.message').html({{ 'general.newsletter_form.success_text' | t | json }}); | |
}); | |
}, | |
error: function(data) { | |
$('input[name="challenge"]', $cf).val('true'); | |
$cf.submit(); | |
} | |
}); | |
e.preventDefault(); | |
} | |
}); | |
}); | |
$('.maps').click(function () { | |
$('.maps iframe').css("pointer-events", "auto"); | |
}); | |
{% if settings.pagination_type == 'load_more' %} | |
enableLoadMoreProducts(); | |
{% endif %} | |
{% if settings.pagination_type == 'infinite_scroll' %} | |
enableInfiniteScroll(); | |
{% endif %} | |
{% if settings.search_pagination_type == 'load_more' %} | |
enableLoadMoreSearch(); | |
{% endif %} | |
{% if settings.search_pagination_type == 'infinite_scroll' %} | |
enableInfiniteSearchScroll(); | |
{% endif %} | |
/*============================================================================ | |
Quick Shop | |
==============================================================================*/ | |
var globalQuickShopProduct; | |
$('body').on('change', '.currencies', function(e) { | |
$('[data-initial-modal-price]').attr('data-initial-modal-price', ''); | |
}); | |
$('body').on('change', '.js-quick-shop select', function(e) { | |
var currentVariant = $('.js-quick-shop select[name="id"]').val(); | |
if (currentVariant && globalQuickShopProduct){ | |
quickShop.updateVariant(currentVariant); | |
} | |
}); | |
var quickShop = { | |
init: function(){ | |
//Quick-shop variables | |
var productData; | |
var productForm; | |
var notifyForm; | |
//EVENT - click on quick-shop | |
$('body').on('click', '.js-quick-shop-link', function(e){ | |
e.preventDefault(); | |
//split image info into two arrays | |
var arr = $(this).data('images').trim('||').split('||'); | |
var imageIds = []; | |
var imageAlts = []; | |
for (var i = 0; i < arr.length; i += 2) { | |
imageIds.push(arr[i]); | |
arr[i+1] && imageAlts.push(arr[i + 1]); | |
} | |
//Set productData based on data attributes | |
productData = { | |
handle: $(this).data('handle'), | |
product_id: $(this).data('id'), | |
single_variant: $(this).attr('data-single-variant'), | |
product_in_collection_url: $(this).data('url'), | |
escaped_title: $(this).data('title'), | |
details_text: $(this).data('details-text'), | |
full_description: $(this).data('full-description'), | |
regular_description: $(this).data('regular-description'), | |
image_ids: imageIds.filter(function(v){return v!==''}), | |
image_alts: imageAlts, | |
collection_handles: $(this).data('collection-handles').trim(',').split(','), | |
money_format: $(this).data('money-format') | |
} | |
if (!$('.js-gallery-modal').hasClass('flickity-enabled')){ | |
$('.js-gallery-modal').flickity({ | |
"wrapAround": "true", | |
"cellAlign": "left", | |
"contain": true, | |
"imagesLoaded": true, | |
"lazyLoad": 2, | |
"pageDots": false, | |
"prevNextButtons": usePageDots, | |
"autoPlay": autoplay, | |
"dragThreshold": 10, | |
"arrowShape": arrowSize | |
}); | |
} | |
//Find current product and notify forms | |
notifyForm = $(this).next('.js-forms').find('.notify_form'); | |
productForm = $(this).next('.js-forms').find('.product_form'); | |
//Add Product Ids to parent container so form will work | |
$('.quick-shop .container').attr('class', 'container section product-' + productData.product_id); | |
$('.quick-shop .container').attr('id', 'product-' + productData.product_id); | |
$('.quick-shop .container').attr('data-id', productData.product_id); | |
//Function to send attribute data to API | |
quickShop.retrieveProductInfo(productData); | |
}); | |
//EVENT - modal is open | |
$('body').on('opened', '.js-quick-shop', function () { | |
//Copy form data to modal | |
$('.remodal.quick-shop .js-product-form').html(productForm); | |
$('.remodal.quick-shop .js-notify-form').html(notifyForm); | |
//Initiate selectCallback | |
if($(productForm).hasClass("product_form_options") && !$(productForm).hasClass("viewed")) { | |
new Shopify.OptionSelectors($(productForm).data("select-id"), { product: $(productForm).data("product"), onVariantSelected: selectCallback, enableHistoryState: $(productForm).data("enable-state") }); | |
} else { | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
} | |
{% if settings.product_form_style == 'swatches'%} | |
var JSONData = $(productForm).data("product"); | |
var swatchOptions = $(productForm).find('.swatch_options .swatch'); | |
if (swatchOptions.length > 1){ | |
Shopify.linkOptionSelectors(JSONData, '.js-quick-shop'); | |
} | |
{% endif %} | |
utils.initializeTabs(); | |
$('.js-quick-shop select[name="id"]').trigger('change'); | |
}); | |
//EVENT - modal is closed | |
$('body').on('closed', '.js-quick-shop', function (e) { | |
var insertedProductForm = $('.js-quick-shop .product_form'); | |
var insertedNotifyForm = $('.js-quick-shop .notify_form'); | |
//Copy form data back to product loop and add .viewed | |
$('.form-holder-'+ productData.product_id).append(insertedProductForm); | |
$('.form-holder-'+ productData.product_id).append(insertedNotifyForm); | |
$('.form-holder-'+ productData.product_id +' .product_form').addClass('viewed'); | |
$('.form-holder-'+ productData.product_id +' .notify_form').addClass('viewed'); | |
var variantPrice = $('.js-current-price .money').text(); | |
$('.js-quick-shop-link[data-id=' + productData.product_id + ']').attr('data-initial-modal-price', variantPrice); | |
$('.js-current-price, .js-was-price, .js-savings').empty(); | |
if ($('.js-product_section').length){ | |
var $productForm = $('.js-product_section').find('.product_form'); | |
//Set the option value state back to product | |
var JSONData = $productForm.data('product'); | |
var productID = $productForm.data('product-id'); | |
var productSection = '.product-' + productID + ' .js-product_section'; | |
var swatchOptions = $productForm.find('.swatch_options .swatch'); | |
if (swatchOptions.length > 1){ | |
Shopify.linkOptionSelectors(JSONData, productSection); | |
} | |
} | |
}); | |
}, | |
retrieveProductInfo: function(productData){ | |
$.ajax({ | |
dataType: "json", | |
async: false, | |
cache: false, | |
url: "/products/" + productData.handle + ".js", | |
success: function(product) { | |
var product = $.extend({}, product, productData); //Create new object combining info | |
quickShop.populateGallery(product); | |
globalQuickShopProduct = product; | |
quickShop.updateVariant(product.variants[0].id.toString()); | |
} | |
}); | |
}, | |
updateVariant: function(variant){ | |
$('.js-sale-banner, .js-sold-out, .js-current-price, .js-was-price, .js-savings, .js-new-banner, .js-pre-order-banner').empty(); | |
if (globalQuickShopProduct != 'undefined'){ | |
var product = globalQuickShopProduct; | |
$('.modal_price, .js-notify-form').show(); | |
//Title and Vendor | |
$('.js-product-title').html('<a href="'+ product.product_in_collection_url +'" title="'+ product.escaped_title +'">'+ product.title +'</a>'); | |
$('.js-product-vendor') | |
.html('<a href="/collections/vendors?q=' + product.vendor +'">' + product.vendor + '</a>'); | |
//Product Description | |
$('.js-full-description').html(product.full_description); | |
$('.js-regular-description').html(product.regular_description); | |
var productDetails = '<a href="'+ product.product_in_collection_url +'" class="secondary_button" title="'+ product.escaped_title +' Details">'+ product.details_text +'</a>'; | |
$('.js-product-details').html(productDetails); | |
//Collection banners | |
$.each( product.collection_handles, function( value, index ) { | |
if (this.toString() == 'new'){ | |
$('.js-new-banner').html({{ 'collections.general.new' | t | json }}); | |
} | |
if (this.toString() == 'pre-order'){ | |
$('.js-pre-order-banner').html({{ 'collections.general.pre_order' | t | json }}); | |
} | |
if (this.toString() == 'coming-soon'){ | |
product.price = {{ 'collections.general.coming_soon' | t | json }}; | |
} | |
}); | |
if (product.single_variant == 'true'){ | |
//No variants | |
//Sale Banner | |
{% if settings.sale_banner_enabled %} | |
if (product.compare_at_price > product.price){ | |
$('.js-sale-banner').html({{ 'collections.general.sale' | t | json }}); | |
} | |
{% endif %} | |
//Sale | |
if (product.compare_at_price > product.price) { | |
$('.js-current-price').addClass('sale'); | |
} else { | |
$('.js-current-price').removeClass('sale'); | |
} | |
//Availability | |
if (product.available == false){ | |
$('.js-sold-out').html({{ 'products.product.sold_out' | t | json }}); | |
} | |
//Price | |
if (product.available == true) { | |
if (product.compare_at_price > product.price) { | |
$('.js-was-price').html('<span class="money">' + Shopify.formatMoney(product.variants[0].compare_at_price, product.money_format) + '</span>'); | |
$('.js-savings').html({{ 'products.product.savings' | t | json }} + ' ' + parseInt(((product.variants[0].compare_at_price - product.variants[0].price) * 100) / product.variants[0].compare_at_price) + '% (' + '<span class="money">' + Shopify.formatMoney(product.variants[0].compare_at_price - product.variants[0].price, product.money_format) + '</span>)'); | |
} | |
if (product.price == {{ 'collections.general.coming_soon' | t | json }}){ | |
$('.js-current-price').html({{ 'collections.general.coming_soon' | t | json }}); | |
} else if (product.price) { | |
$('.js-current-price').html('<span class="money">' + Shopify.formatMoney(product.variants[0].price, product.money_format) + '</span>'); | |
} else { | |
$('.js-current-price').html('{{settings.free_price_text}}'); | |
} | |
} | |
} else { | |
//Variant loop | |
for (var i = 0; i < product.variants.length; i++) { | |
if (variant == product.variants[i].id.toString()){ | |
//Sale Banner | |
{% if settings.sale_banner_enabled %} | |
if (product.variants[i].compare_at_price > product.variants[i].price){ | |
$('.js-sale-banner').html({{ 'collections.general.sale' | t | json }}); | |
} | |
{% endif %} | |
//Sale | |
if (product.variants[i].compare_at_price > product.variants[i].price) { | |
$('.js-current-price').addClass('sale'); | |
} else { | |
$('.js-current-price').removeClass('sale'); | |
} | |
//Availability | |
if (product.variants[i].available == false){ | |
$('.js-sold-out').html({{ 'products.product.sold_out' | t | json }}); | |
} | |
//Price | |
if (product.variants[i].available == true) { | |
if (product.variants[i].compare_at_price > product.variants[i].price) { | |
$('.js-was-price').html('<span class="money">' + Shopify.formatMoney(product.variants[i].compare_at_price, product.money_format) + '</span>'); | |
$('.js-savings').html({{ 'products.product.savings' | t | json }} + ' ' + parseInt(((product.variants[i].compare_at_price - product.variants[i].price) * 100) / product.variants[i].compare_at_price) + '% (' + '<span class="money">' + Shopify.formatMoney(product.variants[i].compare_at_price - product.variants[i].price, product.money_format) + '</span>)'); | |
} | |
if (product.variants[i].price == {{ 'collections.general.coming_soon' | t | json }}){ | |
$('.js-current-price').html({{ 'collections.general.coming_soon' | t | json }}); | |
} else if (product.variants[i].price) { | |
$('.js-current-price').html('<span class="money">' + Shopify.formatMoney(product.variants[i].price, product.money_format) + '</span>'); | |
} else { | |
$('.js-current-price').html('{{settings.free_price_text}}'); | |
} | |
} | |
} | |
} | |
} | |
} | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
$('.js-quick-shop .text-modal-wrap iframe[src*=youtube], .js-quick-shop .text-modal-wrap iframe[src*=vimeo]').mediaWrapper({ | |
intrinsic: true | |
}); | |
}, | |
populateGallery: function(product){ | |
//Find gallery and carousel | |
var $gallery = $('.js-gallery-modal'); | |
var $carousel = $('.js-gallery-carousel'); | |
//EVENT - modal closed | |
$(document).on('closed', '.js-quick-shop', function (e) { | |
$gallery.flickity( 'remove', $('.js-gallery-modal .gallery-cell') ); | |
$carousel.empty(); | |
}); | |
//Add gallery images based on product info from API | |
function addMainGalleryImages(multiImage){ | |
$.each( product.images, function( i, imgPath ){ | |
var imgGrande = imgPath.replace(/(\.[^.]*)$/, "_grande$1").replace('http:', ''); | |
var img1024x1024 = imgPath.replace(/(\.[^.]*)$/, "_1024x1024$1").replace('http:', ''); | |
var img2048x2048 = imgPath.replace(/(\.[^.]*)$/, "_2048x2048$1").replace('http:', ''); | |
var alt = product.image_alts[i]; | |
var cellContent; | |
if (alt.indexOf("youtube") >= 0){ | |
cellContent = '<div class="video-container youtube"><div>' + alt + '</div></div>'; | |
} else if (alt.indexOf("vimeo") >= 0) { | |
cellContent = '<div class="video-container vimeo"><div>' + alt + '</div></div>'; | |
} else { | |
cellContent = '<img src="'+ imgGrande + '" data-src="' + img1024x1024 + '" alt="' + alt + '" data-image-id="' + product.image_ids[i].trim() + '" data-index="' + i + '" srcset="' + imgGrande + ' 600w, ' + img1024x1024 + ' 1024w, ' + img2048x2048 + ' 2048w" sizes="(min-width: 800px) 50vw, 100vw"/>'; | |
} | |
var $cellElems = $('<div class="gallery-cell">'+ cellContent +'</div>'); | |
$gallery.flickity( 'append', $cellElems ); | |
}); | |
$gallery.removeClass('single-image multi-image').addClass(multiImage ? 'multi-image' : 'single-image'); | |
} | |
//Add carousel images based on product info from API | |
function addCarouselGalleryImages(){ | |
$.each( product.images, function( i, imgPath ){ | |
var carouselSizedImg = imgPath.replace(/(\.[^.]*)$/, "_grande$1").replace('http:', ''); | |
var img = '<img src="'+ carouselSizedImg + '" alt="' + escape(product.image_alts[i]) + '" />'; | |
var $carouselCellElems = $('<div class="gallery-cell">'+ img +'</div>'); | |
$carousel.append($carouselCellElems); | |
}); | |
imageFunctions.linkGalleryAndCarousel($gallery, $carousel); | |
{% if settings.quick_shop_thumbnail_position == 'bottom-slider' %} | |
var groupCells = true; | |
var navPrevNextButtons = false; | |
var navCellAlign = "center"; | |
var navWrapAround = false; | |
if ($('.product_gallery_nav .gallery-cell').length >= 7) { | |
groupCells = false; | |
navPrevNextButtons = true; | |
navCellAlign = "left"; | |
navWrapAround = true; | |
} | |
$('.product_gallery_nav.product_gallery_nav--bottom-slider').flickity({ | |
"asNavFor": ".product_gallery", | |
"adaptiveHeight": false, | |
"wrapAround": navWrapAround, | |
"cellAlign": "center", | |
"draggable": true, | |
"groupCells": groupCells, | |
"prevNextButtons": navPrevNextButtons, | |
"pageDots": false, | |
"lazyLoad": 2, | |
"dragThreshold": 10, | |
"arrowShape": arrowSize | |
}); | |
{% endif %} | |
} | |
//Check how many images are returned from API - addMainGalleryImages() takes true or false based on whether gallery slider is multi-image (shows prev/next arrows) | |
var multiImage; | |
if(product.images.length > 1){ | |
multiImage = true; | |
addMainGalleryImages(multiImage); | |
addCarouselGalleryImages(); | |
} else { | |
multiImage = false; | |
addMainGalleryImages(multiImage); | |
} | |
imageFunctions.zoom('.js-gallery-modal', false); | |
} | |
} | |
{% if settings.quick_shop_enabled %} | |
quickShop.init(); | |
{% endif %} | |
/*============================================================================ | |
Start of cart-related functionality | |
==============================================================================*/ | |
function ajaxSubmitCart(cart) { | |
$cart = cart; | |
$.ajax({ | |
url: '/cart/update.js', | |
dataType: 'json', | |
cache: false, | |
type: 'post', | |
data: $cart.serialize(), | |
success: function (data) { | |
refreshCart(data); | |
} | |
}); | |
} | |
function ajaxUpdateCart(lineID, quantity, parent) { | |
$.ajax({ | |
url: '/cart/change.js', | |
dataType: 'json', | |
cache: false, | |
type: 'post', | |
data: { quantity: quantity, line: lineID }, | |
success: function (data) { | |
refreshCart(data); | |
var lineIDIndex = lineID - 1; | |
//check to see if there are correct amount of products in array | |
if (typeof data.items[lineIDIndex] === "undefined"){ | |
var updated_quantity = 0; | |
} else { | |
var updated_quantity = data.items[lineIDIndex].quantity; | |
} | |
if(quantity > 0 && quantity != updated_quantity) { | |
if (updated_quantity == 1) { | |
items_left_text = {{ 'products.product.items_left_count.one' | t | json }}; | |
} else { | |
items_left_text = {{ 'products.product.items_left_count.other' | t | json }}; | |
} | |
$('.warning--quantity').remove(); | |
var warning = '<p class="warning warning--quantity animated bounceIn">' + updated_quantity + ' ' + items_left_text + '</p>'; | |
parent.find("input[data-line-id='" + lineID + "']").parent().after(warning); | |
parent.find("input[data-line-id='" + lineID + "']").val(updated_quantity); | |
} else if (parent.is('#cart_form')) { | |
$("#cart_form").submit(); | |
} | |
} | |
}); | |
} | |
function refreshCart(cart) { | |
$(".cart_count").empty(); | |
$cartBtn = $(".cart_count"); | |
var value = $cartBtn.text() || '0'; | |
var cart_items_html = ""; | |
var cart_action_html = ""; | |
var cart_savings_html = ""; | |
var $cart = $(".cart_content form"); | |
var discounted_price_total = 0; | |
var total_savings = 0; | |
$cartBtn.text(value.replace(/[0-9]+/,cart.item_count)); | |
if (cart.item_count == 0) { | |
$('.js-empty-cart__message').removeClass('hidden'); | |
$('.js-cart_content__form').addClass('hidden'); | |
} else { | |
$('.js-empty-cart__message').addClass('hidden'); | |
$('.js-cart_content__form').removeClass('hidden'); | |
$.each(cart.items, function(index, item) { | |
var line_id = index + 1; | |
cart_items_html += '<li class="cart_item clearfix">' + | |
'<a href="' + item.url +'">'; | |
if (item.image) { | |
cart_items_html += '<div class="cart_image">' + | |
'<img src="' + item.image.replace(/(\.[^.]*)$/, "_compact$1").replace('http:', '') + '" alt="' + htmlEncode(item.title) + '" />' + | |
'</div>'; | |
} | |
cart_items_html += '<div class="cart_item__title"><div class="item_title">' + item.title; | |
if(item.properties) { | |
$.each(item.properties, function(title, value) { | |
if (value) { | |
cart_items_html += '<div class="line-item">' + title +': ' + value + '</div>'; | |
} | |
}); | |
} | |
cart_items_html += '</div></a>'; | |
cart_items_html += '<div class="left product-quantity-box">' + | |
'<span class="ss-icon product-minus js-change-quantity" data-func="minus"><span class="icon-minus"></span></span>' + | |
'<input type="number" min="0" class="quantity" name="updates[]" id="updates_' + item.id + '" value="' + item.quantity +'" data-line-id="' + line_id +'" />' + | |
'<span class="ss-icon product-plus js-change-quantity" data-func="plus"><span class="icon-plus"></span></span>' + | |
'</div>' + | |
'</div>'; | |
cart_items_html += '<strong class="right price">'; | |
{% if settings.display_savings %} | |
$.ajax({ | |
dataType: "json", | |
async: false, | |
cache: false, | |
url: "/products/" + item.handle + ".js", | |
success: function(data) { | |
var variant_id = item.variant_id; | |
var variant = $.grep(data.variants, function(v) { | |
return v.id == variant_id; | |
}); | |
if(variant[0] && variant[0].compare_at_price > item.price) { | |
cart_items_html += ' <span class="money was_price">' + Shopify.formatMoney(variant[0].compare_at_price, $('body').data('money-format')) + '</span> '; | |
discounted_price_total += item.price * item.quantity; | |
total_savings += variant[0].compare_at_price * item.quantity; | |
} | |
} | |
}); | |
{% endif %} | |
cart_items_html += '<span class="money">' + Shopify.formatMoney(item.price, $('body').data('money-format')) + '</span></strong>' + '</div>'; | |
}); | |
cart_action_html += '<span class="right"><span class="money">' + Shopify.formatMoney(cart.total_price, $('body').data('money-format')) + '</span></span>' + | |
'<span>{{ 'layout.general.subtotal' | t }}</span>'; | |
if(total_savings > 0 ) { | |
cart_savings_html = '<span class="right"><span class="money">' + Shopify.formatMoney(total_savings - discounted_price_total, $('body').data('money-format')) + '</span></span>' + | |
'<span>{{ 'layout.general.savings' | t }}</span>'; | |
} else { | |
cart_savings_html = ""; | |
} | |
} | |
$('.js-cart_items').html(cart_items_html); | |
$('.js-cart_subtotal').html(cart_action_html); | |
$('.js-cart_savings').html(cart_savings_html); | |
{% if settings.show_multiple_currencies %} | |
convertCurrencies(); | |
{% endif %} | |
} | |
$('body').on("change", "#cart_form input.quantity", function() { | |
ajaxUpdateCart($(this).data('line-id'), $(this).val(), $(this).parents('#cart_form')); | |
}); | |
$('body').on("change", ".cart_content input.quantity", function() { | |
ajaxUpdateCart($(this).data('line-id'), $(this).val(), $(this).parents('.cart_content')); | |
}); | |
{% if settings.cart_action == 'ajax' %} | |
$('body').on('submit', ".product_form form", function(e) { | |
e.preventDefault(); | |
var $addToCartForm = $(this); | |
var $addToCartBtn = $addToCartForm.find('.add_to_cart'); | |
$.ajax({ | |
url: '/cart/add.js', | |
dataType: 'json', | |
cache: false, | |
type: 'post', | |
data: $addToCartForm.serialize(), | |
beforeSend: function() { | |
$addToCartBtn.attr('disabled', 'disabled').addClass('disabled'); | |
$addToCartBtn.find('span').removeClass("fadeInDown").addClass('animated zoomOut'); | |
}, | |
success: function(itemData) { | |
$addToCartBtn.find('.checkmark').addClass('checkmark-active'); | |
window.setTimeout(function(){ | |
$addToCartBtn.removeAttr('disabled').removeClass('disabled'); | |
$addToCartBtn.find('.checkmark').removeClass('checkmark-active'); | |
$addToCartBtn.find('span').removeClass('zoomOut').addClass('fadeInDown'); | |
}, 1000); | |
$.ajax({ | |
url: '/cart.js', | |
dataType: "json", | |
cache: false, | |
success: function(cart) { | |
refreshCart(cart); | |
if($('html').hasClass("remodal-is-locked")) { | |
$('.remodal-close').click(); | |
} | |
if($('#header').is(':visible')) { | |
$('#header .cart_container').addClass('active_link'); | |
} else if ($('.sticky_nav--stick').length) { | |
$('.sticky_nav .cart_container').addClass('active_link'); | |
} else { | |
$('.top_bar .cart_container').addClass('active_link'); | |
} | |
//block scrolling on mobile | |
if ($(window).width() <= 798) { | |
var $cart_container = $(this).parent(); | |
if($cart_container.hasClass('active_link')) { | |
$('body').addClass('blocked-scroll'); | |
} else { | |
$('body').addClass('blocked-scroll'); | |
} | |
} | |
} | |
}); | |
}, | |
error: function(XMLHttpRequest) { | |
var response = eval('(' + XMLHttpRequest.responseText + ')'); | |
response = response.description; | |
$('.warning').remove(); | |
var warning = '<p class="warning animated bounceIn">' + response.replace('All 1 ', 'All ') + '</p>'; | |
$addToCartForm.after(warning); | |
$addToCartBtn.removeAttr('disabled').removeClass('disabled'); | |
$addToCartBtn.find('span').text({{ 'products.product.add_to_cart' | t | json }}).removeClass('zoomOut').addClass('zoomIn'); | |
} | |
}); | |
return false; | |
}); | |
{% endif %} | |
//Swatches linked with selected options | |
{% if settings.product_form_style == 'swatches'%} | |
if ($('.js-product_section').length){ | |
var $productForms = $('.js-product_section').find('.product_form'); | |
$productForms.addClass('is-visible'); | |
//Loop through each product and set the initial option value state | |
$productForms.each(function(){ | |
var JSONData = $(this).data('product'); | |
var productID = $(this).data('product-id'); | |
var productSection = '.product-' + productID + ' .js-product_section'; | |
var swatchOptions = $(this).find('.swatch_options .swatch'); | |
if (swatchOptions.length > 1){ | |
Shopify.linkOptionSelectors(JSONData, productSection); | |
} | |
}); | |
} | |
//Add click event when there is more than one product on the page (eg. Collection in Detail) | |
if ($('.js-product_section').length > 1){ | |
$('body').on('click', '.swatch-element', function(){ | |
var swatchValue = $(this).data('value'); | |
$(this) | |
.siblings('input[value="'+ swatchValue.replace(/\"/g,'\\"') +'"]') | |
.prop("checked", true) | |
.trigger("change"); | |
var JSONData = $(this).parents('.product_form').data('product'); | |
var productID = $(this).parents('.product_form').data('product-id'); | |
var productSection = '.product-' + productID + ' .js-product_section'; | |
var swatchOptions = $(this).parents('.product_form').find('.swatch_options .swatch'); | |
if (swatchOptions.length > 1){ | |
Shopify.linkOptionSelectors(JSONData, productSection); | |
} | |
}) | |
} | |
{% endif %} | |
}); | |
/*============================================================================ | |
Swatch options - second and third swatch 'sold-out' will update based on availability of previous options selected | |
==============================================================================*/ | |
Shopify.updateOptionsInSelector = function(selectorIndex, parent) { | |
switch (selectorIndex) { | |
case 0: | |
var key = 'root'; | |
var selector = $(parent + ' .single-option-selector:eq(0)'); | |
break; | |
case 1: | |
var key = $(parent + ' .single-option-selector:eq(0)').val(); | |
var selector = $(parent + ' .single-option-selector:eq(1)'); | |
break; | |
case 2: | |
var key = $(parent + ' .single-option-selector:eq(0)').val(); | |
key += ' / ' + $(parent + ' .single-option-selector:eq(1)').val(); | |
var selector = $(parent + ' .single-option-selector:eq(2)'); | |
} | |
var availableOptions = Shopify.optionsMap[key]; | |
$(parent + ' .swatch[data-option-index="' + selectorIndex + '"] .swatch-element').each(function() { | |
if ($.inArray($(this).attr('data-value'), availableOptions) !== -1) { | |
$(this).removeClass('soldout').find(':radio').removeAttr('disabled','disabled').removeAttr('checked'); | |
} | |
else { | |
$(this).addClass('soldout').find(':radio').removeAttr('checked').attr('disabled','disabled'); | |
} | |
}); | |
}; | |
Shopify.linkOptionSelectors = function(product, parent) { | |
// Building our mapping object. | |
Shopify.optionsMap = {}; | |
for (var i=0; i<product.variants.length; i++) { | |
var variant = product.variants[i]; | |
if (variant.available) { | |
// Gathering values for the 1st drop-down. | |
Shopify.optionsMap['root'] = Shopify.optionsMap['root'] || []; | |
Shopify.optionsMap['root'].push(variant.option1); | |
Shopify.optionsMap['root'] = Shopify.uniq(Shopify.optionsMap['root']); | |
// Gathering values for the 2nd drop-down. | |
if (product.options.length > 1) { | |
var key = variant.option1; | |
Shopify.optionsMap[key] = Shopify.optionsMap[key] || []; | |
Shopify.optionsMap[key].push(variant.option2); | |
Shopify.optionsMap[key] = Shopify.uniq(Shopify.optionsMap[key]); | |
} | |
// Gathering values for the 3rd drop-down. | |
if (product.options.length === 3) { | |
var key = variant.option1 + ' / ' + variant.option2; | |
Shopify.optionsMap[key] = Shopify.optionsMap[key] || []; | |
Shopify.optionsMap[key].push(variant.option3); | |
Shopify.optionsMap[key] = Shopify.uniq(Shopify.optionsMap[key]); | |
} | |
} | |
} | |
// Update options right away. | |
Shopify.updateOptionsInSelector(0, parent); | |
if (product.options.length > 1) Shopify.updateOptionsInSelector(1, parent); | |
if (product.options.length === 3) Shopify.updateOptionsInSelector(2, parent); | |
// When there is an update in the first dropdown. | |
$(parent + " .single-option-selector:eq(0)").change(function() { | |
Shopify.updateOptionsInSelector(1, parent); | |
if (product.options.length === 3) Shopify.updateOptionsInSelector(2, parent); | |
return true; | |
}); | |
// When there is an update in the second dropdown. | |
$(parent + " .single-option-selector:eq(1)").change(function() { | |
if (product.options.length === 3) Shopify.updateOptionsInSelector(2, parent); | |
return true; | |
}); | |
}; | |
//Used for cart functionality | |
function htmlEncode(value){ | |
if (value) { | |
return $('<div/>').text(value).html(); | |
} else { | |
return ''; | |
} | |
} | |
//Check if device is touch-enabled | |
function is_touch_device() { | |
return 'ontouchstart' in window || navigator.maxTouchPoints; | |
}; | |
/* option_selection.js */ | |
function floatToString(t,e){var o=t.toFixed(e).toString();return o.match(/^\.\d+/)?"0"+o:o}if("undefined"==typeof Shopify)var Shopify={};Shopify.each=function(t,e){for(var o=0;o<t.length;o++)e(t[o],o)},Shopify.map=function(t,e){for(var o=[],i=0;i<t.length;i++)o.push(e(t[i],i));return o},Shopify.arrayIncludes=function(t,e){for(var o=0;o<t.length;o++)if(t[o]==e)return!0;return!1},Shopify.uniq=function(t){for(var e=[],o=0;o<t.length;o++)Shopify.arrayIncludes(e,t[o])||e.push(t[o]);return e},Shopify.isDefined=function(t){return"undefined"==typeof t?!1:!0},Shopify.getClass=function(t){return Object.prototype.toString.call(t).slice(8,-1)},Shopify.extend=function(t,e){function o(){}o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t,t.baseConstructor=e,t.superClass=e.prototype},Shopify.locationSearch=function(){return window.location.search},Shopify.locationHash=function(){return window.location.hash},Shopify.replaceState=function(t){window.history.replaceState({},document.title,t)},Shopify.urlParam=function(t){var e=RegExp("[?&]"+t+"=([^&#]*)").exec(Shopify.locationSearch());return e&&decodeURIComponent(e[1].replace(/\+/g," "))},Shopify.newState=function(t,e){var o;return o=Shopify.urlParam(t)?Shopify.locationSearch().replace(RegExp("("+t+"=)[^&#]+"),"$1"+e):""===Shopify.locationSearch()?"?"+t+"="+e:Shopify.locationSearch()+"&"+t+"="+e,o+Shopify.locationHash()},Shopify.setParam=function(t,e){Shopify.replaceState(Shopify.newState(t,e))},Shopify.Product=function(t){Shopify.isDefined(t)&&this.update(t)},Shopify.Product.prototype.update=function(t){for(property in t)this[property]=t[property]},Shopify.Product.prototype.optionNames=function(){return"Array"==Shopify.getClass(this.options)?this.options:[]},Shopify.Product.prototype.optionValues=function(t){if(!Shopify.isDefined(this.variants))return null;var e=Shopify.map(this.variants,function(e){var o="option"+(t+1);return void 0==e[o]?null:e[o]});return null==e[0]?null:Shopify.uniq(e)},Shopify.Product.prototype.getVariant=function(t){var e=null;return t.length!=this.options.length?e:(Shopify.each(this.variants,function(o){for(var i=!0,r=0;r<t.length;r++){var n="option"+(r+1);o[n]!=t[r]&&(i=!1)}return 1==i?void(e=o):void 0}),e)},Shopify.Product.prototype.getVariantById=function(t){for(var e=0;e<this.variants.length;e++){var o=this.variants[e];if(t==o.id)return o}return null},Shopify.money_format="${{amount}}",Shopify.formatMoney=function(t,e){function o(t,e){return"undefined"==typeof t?e:t}function i(t,e,i,r){if(e=o(e,2),i=o(i,","),r=o(r,"."),isNaN(t)||null==t)return 0;t=(t/100).toFixed(e);var n=t.split("."),a=n[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+i),s=n[1]?r+n[1]:"";return a+s}"string"==typeof t&&(t=t.replace(".",""));var r="",n=/\{\{\s*(\w+)\s*\}\}/,a=e||this.money_format;switch(a.match(n)[1]){case"amount":r=i(t,2);break;case"amount_no_decimals":r=i(t,0);break;case"amount_with_comma_separator":r=i(t,2,".",",");break;case"amount_with_apostrophe_separator":r=i(t,2);break;case"amount_no_decimals_with_comma_separator":r=i(t,0,".",",")}return a.replace(n,r)},Shopify.OptionSelectors=function(t,e){return this.selectorDivClass="selector-wrapper",this.selectorClass="single-option-selector",this.variantIdFieldIdSuffix="-variant-id",this.variantIdField=null,this.historyState=null,this.selectors=[],this.domIdPrefix=t,this.product=new Shopify.Product(e.product),this.onVariantSelected=Shopify.isDefined(e.onVariantSelected)?e.onVariantSelected:function(){},this.replaceSelector(t),this.initDropdown(),e.enableHistoryState&&(this.historyState=new Shopify.OptionSelectors.HistoryState(this)),!0},Shopify.OptionSelectors.prototype.initDropdown=function(){var t={initialLoad:!0},e=this.selectVariantFromDropdown(t);if(!e){var o=this;setTimeout(function(){o.selectVariantFromParams(t)||o.fireOnChangeForFirstDropdown.call(o,t)})}},Shopify.OptionSelectors.prototype.fireOnChangeForFirstDropdown=function(t){this.selectors[0].element.onchange(t)},Shopify.OptionSelectors.prototype.selectVariantFromParamsOrDropdown=function(t){var e=this.selectVariantFromParams(t);e||this.selectVariantFromDropdown(t)},Shopify.OptionSelectors.prototype.replaceSelector=function(t){var e=document.getElementById(t),o=e.parentNode;Shopify.each(this.buildSelectors(),function(t){o.insertBefore(t,e)}),e.style.display="none",this.variantIdField=e},Shopify.OptionSelectors.prototype.selectVariantFromDropdown=function(t){var e=document.getElementById(this.domIdPrefix).querySelector("[selected]");if(e||(e=document.getElementById(this.domIdPrefix).querySelector('[selected="selected"]')),!e)return!1;var o=e.value;return this.selectVariant(o,t)},Shopify.OptionSelectors.prototype.selectVariantFromParams=function(t){var e=Shopify.urlParam("variant");return this.selectVariant(e,t)},Shopify.OptionSelectors.prototype.selectVariant=function(t,e){var o=this.product.getVariantById(t);if(null==o)return!1;for(var i=0;i<this.selectors.length;i++){var r=this.selectors[i].element,n=r.getAttribute("data-option"),a=o[n];null!=a&&this.optionExistInSelect(r,a)&&(r.value=a)}return"undefined"!=typeof jQuery?jQuery(this.selectors[0].element).trigger("change",e):this.selectors[0].element.onchange(e),!0},Shopify.OptionSelectors.prototype.optionExistInSelect=function(t,e){for(var o=0;o<t.options.length;o++)if(t.options[o].value==e)return!0},Shopify.OptionSelectors.prototype.insertSelectors=function(t,e){Shopify.isDefined(e)&&this.setMessageElement(e),this.domIdPrefix="product-"+this.product.id+"-variant-selector";var o=document.getElementById(t);Shopify.each(this.buildSelectors(),function(t){o.appendChild(t)})},Shopify.OptionSelectors.prototype.buildSelectors=function(){for(var t=0;t<this.product.optionNames().length;t++){var e=new Shopify.SingleOptionSelector(this,t,this.product.optionNames()[t],this.product.optionValues(t));e.element.disabled=!1,this.selectors.push(e)}var o=this.selectorDivClass,i=this.product.optionNames(),r=Shopify.map(this.selectors,function(t){var e=document.createElement("div");if(e.setAttribute("class",o),i.length>1){var r=document.createElement("label");r.htmlFor=t.element.id,r.innerHTML=t.name,e.appendChild(r)}return e.appendChild(t.element),e});return r},Shopify.OptionSelectors.prototype.selectedValues=function(){for(var t=[],e=0;e<this.selectors.length;e++){var o=this.selectors[e].element.value;t.push(o)}return t},Shopify.OptionSelectors.prototype.updateSelectors=function(t,e){var o=this.selectedValues(),i=this.product.getVariant(o);i?(this.variantIdField.disabled=!1,this.variantIdField.value=i.id):this.variantIdField.disabled=!0,this.onVariantSelected(i,this,e),null!=this.historyState&&this.historyState.onVariantChange(i,this,e)},Shopify.OptionSelectorsFromDOM=function(t,e){var o=e.optionNames||[],i=e.priceFieldExists||!0,r=e.delimiter||"/",n=this.createProductFromSelector(t,o,i,r);e.product=n,Shopify.OptionSelectorsFromDOM.baseConstructor.call(this,t,e)},Shopify.extend(Shopify.OptionSelectorsFromDOM,Shopify.OptionSelectors),Shopify.OptionSelectorsFromDOM.prototype.createProductFromSelector=function(t,e,o,i){if(!Shopify.isDefined(o))var o=!0;if(!Shopify.isDefined(i))var i="/";var r=document.getElementById(t),n=r.childNodes,a=(r.parentNode,e.length),s=[];Shopify.each(n,function(t,r){if(1==t.nodeType&&"option"==t.tagName.toLowerCase()){var n=t.innerHTML.split(new RegExp("\\s*\\"+i+"\\s*"));0==e.length&&(a=n.length-(o?1:0));var p=n.slice(0,a),l=o?n[a]:"",c=(t.getAttribute("value"),{available:t.disabled?!1:!0,id:parseFloat(t.value),price:l,option1:p[0],option2:p[1],option3:p[2]});s.push(c)}});var p={variants:s};if(0==e.length){p.options=[];for(var l=0;a>l;l++)p.options[l]="option "+(l+1)}else p.options=e;return p},Shopify.SingleOptionSelector=function(t,e,o,i){this.multiSelector=t,this.values=i,this.index=e,this.name=o,this.element=document.createElement("select");for(var r=0;r<i.length;r++){var n=document.createElement("option");n.value=i[r],n.innerHTML=i[r],this.element.appendChild(n)}return this.element.setAttribute("class",this.multiSelector.selectorClass),this.element.setAttribute("data-option","option"+(e+1)),this.element.id=t.domIdPrefix+"-option-"+e,this.element.onchange=function(o,i){i=i||{},t.updateSelectors(e,i)},!0},Shopify.Image={preload:function(t,e){for(var o=0;o<t.length;o++){var i=t[o];this.loadImage(this.getSizedImageUrl(i,e))}},loadImage:function(t){(new Image).src=t},switchImage:function(t,e,o){if(t&&e){var i=this.imageSize(e.src),r=this.getSizedImageUrl(t.src,i);o?o(r,t,e):e.src=r}},imageSize:function(t){var e=t.match(/_(1024x1024|2048x2048|pico|icon|thumb|small|compact|medium|large|grande)\./);return null!=e?e[1]:null},getSizedImageUrl:function(t,e){if(null==e)return t;if("master"==e)return this.removeProtocol(t);var o=t.match(/\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?$/i);if(null!=o){var i=t.split(o[0]),r=o[0];return this.removeProtocol(i[0]+"_"+e+r)}return null},removeProtocol:function(t){return t.replace(/http(s)?:/,"")}},Shopify.OptionSelectors.HistoryState=function(t){this.browserSupports()&&this.register(t)},Shopify.OptionSelectors.HistoryState.prototype.register=function(t){window.addEventListener("popstate",function(e){t.selectVariantFromParamsOrDropdown({popStateCall:!0})})},Shopify.OptionSelectors.HistoryState.prototype.onVariantChange=function(t,e,o){this.browserSupports()&&(!t||o.initialLoad||o.popStateCall||Shopify.setParam("variant",t.id))},Shopify.OptionSelectors.HistoryState.prototype.browserSupports=function(){return window.history&&window.history.replaceState}; | |
/* | |
* jQuery offscreen plugin | |
* | |
* Copyright Cory LaViska for A Beautiful Site, LLC | |
* | |
* @license: http://opensource.org/licenses/MIT | |
* | |
*/ | |
(function($) { | |
$.extend($.expr[':'], { | |
'off-top': function(el) { | |
return $(el).offset().top < $(window).scrollTop(); | |
}, | |
'off-right': function(el) { | |
return $(el).offset().left + $(el).outerWidth() - $(window).scrollLeft() > $(window).width(); | |
}, | |
'off-bottom': function(el) { | |
return $(el).offset().top + $(el).outerHeight() - $(window).scrollTop() > $(window).height(); | |
}, | |
'off-left': function(el) { | |
return $(el).offset().left < $(window).scrollLeft(); | |
}, | |
'off-screen': function(el) { | |
return $(el).is(':off-top, :off-right, :off-bottom, :off-left'); | |
} | |
}); | |
})(jQuery); | |
/*! | |
Zoom 1.7.15 | |
license: MIT | |
http://www.jacklmoore.com/zoom | |
*/ | |
(function($){var defaults={url:false,callback:false,target:false,duration:120,on:"mouseover",touch:true,onZoomIn:false,onZoomOut:false,magnify:1};$.zoom=function(target,source,img,magnify){var targetHeight,targetWidth,sourceHeight,sourceWidth,xRatio,yRatio,offset,$target=$(target),position=$target.css("position"),$source=$(source);$target.css("position",/(absolute|fixed)/.test(position)?position:"relative");$target.css("overflow","hidden");img.style.width=img.style.height="";$(img).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:img.width*magnify,height:img.height*magnify,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(target);return{init:function(){targetWidth=$target.outerWidth();targetHeight=$target.outerHeight();if(source===$target[0]){sourceWidth=targetWidth;sourceHeight=targetHeight}else{sourceWidth=$source.outerWidth();sourceHeight=$source.outerHeight()}xRatio=(img.width-targetWidth)/sourceWidth;yRatio=(img.height-targetHeight)/sourceHeight;offset=$source.offset()},move:function(e){var left=e.pageX-offset.left,top=e.pageY-offset.top;top=Math.max(Math.min(top,sourceHeight),0);left=Math.max(Math.min(left,sourceWidth),0);img.style.left=left*-xRatio+"px";img.style.top=top*-yRatio+"px"}}};$.fn.zoom=function(options){return this.each(function(){var settings=$.extend({},defaults,options||{}),target=settings.target||this,source=this,$source=$(source),$target=$(target),img=document.createElement("img"),$img=$(img),mousemove="mousemove.zoom",clicked=false,touched=false,$urlElement;if(!settings.url){$urlElement=$source.find("img");if($urlElement[0]){settings.url=$urlElement.data("src")||$urlElement.attr("src")}if(!settings.url){return}}(function(){var position=$target.css("position");var overflow=$target.css("overflow");$source.one("zoom.destroy",function(){$source.off(".zoom");$target.css("position",position);$target.css("overflow",overflow);$img.remove()})})();img.onload=function(){var zoom=$.zoom(target,source,img,settings.magnify);function start(e){zoom.init();zoom.move(e);$img.stop().fadeTo($.support.opacity?settings.duration:0,1,$.isFunction(settings.onZoomIn)?settings.onZoomIn.call(img):false)}function stop(){$img.stop().fadeTo(settings.duration,0,$.isFunction(settings.onZoomOut)?settings.onZoomOut.call(img):false)}if(settings.on==="grab"){$source.on("mousedown.zoom",function(e){if(e.which===1){$(document).one("mouseup.zoom",function(){stop();$(document).off(mousemove,zoom.move)});start(e);$(document).on(mousemove,zoom.move);e.preventDefault()}})}else if(settings.on==="click"){$source.on("click.zoom",function(e){if(clicked){return}else{clicked=true;start(e);$(document).on(mousemove,zoom.move);$(document).one("click.zoom",function(){stop();clicked=false;$(document).off(mousemove,zoom.move)});return false}})}else if(settings.on==="toggle"){$source.on("click.zoom",function(e){if(clicked){stop()}else{start(e)}clicked=!clicked})}else if(settings.on==="mouseover"){zoom.init();$source.on("mouseenter.zoom",start).on("mouseleave.zoom",stop).on(mousemove,zoom.move)}if(settings.touch){$source.on("touchstart.zoom",function(e){e.preventDefault();if(touched){touched=false;stop()}else{touched=true;start(e.originalEvent.touches[0]||e.originalEvent.changedTouches[0])}}).on("touchmove.zoom",function(e){e.preventDefault();zoom.move(e.originalEvent.touches[0]||e.originalEvent.changedTouches[0])}).on("touchend.zoom",function(e){e.preventDefault();if(touched){touched=false;stop()}})}if($.isFunction(settings.callback)){settings.callback.call(img)}};img.src=settings.url})};$.fn.zoom.defaults=defaults})(window.jQuery); | |
/* | |
* Remodal - v1.1.0 | |
* Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. | |
* http://vodkabears.github.io/remodal/ | |
* | |
* Made by Ilya Makarov | |
* Under MIT License | |
*/ | |
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return b(a,c)}):"object"==typeof exports?b(a,require("jquery")):b(a,a.jQuery||a.Zepto)}(this,function(a,b){"use strict";function c(a){if(w&&"none"===a.css("animation-name")&&"none"===a.css("-webkit-animation-name")&&"none"===a.css("-moz-animation-name")&&"none"===a.css("-o-animation-name")&&"none"===a.css("-ms-animation-name"))return 0;var b,c,d,e,f=a.css("animation-duration")||a.css("-webkit-animation-duration")||a.css("-moz-animation-duration")||a.css("-o-animation-duration")||a.css("-ms-animation-duration")||"0s",g=a.css("animation-delay")||a.css("-webkit-animation-delay")||a.css("-moz-animation-delay")||a.css("-o-animation-delay")||a.css("-ms-animation-delay")||"0s",h=a.css("animation-iteration-count")||a.css("-webkit-animation-iteration-count")||a.css("-moz-animation-iteration-count")||a.css("-o-animation-iteration-count")||a.css("-ms-animation-iteration-count")||"1";for(f=f.split(", "),g=g.split(", "),h=h.split(", "),e=0,c=f.length,b=Number.NEGATIVE_INFINITY;e<c;e++)d=parseFloat(f[e])*parseInt(h[e],10)+parseFloat(g[e]),d>b&&(b=d);return b}function d(){if(b(document.body).height()<=b(window).height())return 0;var a,c,d=document.createElement("div"),e=document.createElement("div");return d.style.visibility="hidden",d.style.width="100px",document.body.appendChild(d),a=d.offsetWidth,d.style.overflow="scroll",e.style.width="100%",d.appendChild(e),c=e.offsetWidth,d.parentNode.removeChild(d),a-c}function e(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)||(c=b(document.body),a=parseInt(c.css("padding-right"),10)+d(),c.css("padding-right",a+"px"),e.addClass(f))}}function f(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)&&(c=b(document.body),a=parseInt(c.css("padding-right"),10)-d(),c.css("padding-right",a+"px"),e.removeClass(f))}}function g(a,b,c,d){var e=k("is",b),f=[k("is",u.CLOSING),k("is",u.OPENING),k("is",u.CLOSED),k("is",u.OPENED)].join(" ");a.$bg.removeClass(f).addClass(e),a.$overlay.removeClass(f).addClass(e),a.$wrapper.removeClass(f).addClass(e),a.$modal.removeClass(f).addClass(e),a.state=b,!c&&a.$modal.trigger({type:b,reason:d},[{reason:d}])}function h(a,d,e){var f=0,g=function(a){a.target===this&&f++},h=function(a){a.target===this&&0===--f&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())};b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].on(r,g).on(s,h)}),a(),0===c(e.$bg)&&0===c(e.$overlay)&&0===c(e.$wrapper)&&0===c(e.$modal)&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())}function i(a){a.state!==u.CLOSED&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(b,c){a[c].off(r+" "+s)}),a.$bg.removeClass(a.settings.modifier),a.$overlay.removeClass(a.settings.modifier).hide(),a.$wrapper.hide(),f(),g(a,u.CLOSED,!0))}function j(a){var b,c,d,e,f={};for(a=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,","),b=a.split(","),e=0,c=b.length;e<c;e++)b[e]=b[e].split(":"),d=b[e][1],("string"==typeof d||d instanceof String)&&(d="true"===d||"false"!==d&&d),("string"==typeof d||d instanceof String)&&(d=isNaN(d)?d:+d),f[b[e][0]]=d;return f}function k(){for(var a=q,b=0;b<arguments.length;++b)a+="-"+arguments[b];return a}function l(){var a,c,d=location.hash.replace("#","");if(d){try{c=b('[data-remodal-id="'+d+'"]')}catch(e){}c&&c.length&&(a=b[p].lookup[c.data(p)],a&&a.settings.hashTracking&&a.open())}else n&&n.state===u.OPENED&&n.settings.hashTracking&&n.close()}function m(a,c){var d=b(document.body),e=d,f=this;f.settings=b.extend({},t,c),f.index=b[p].lookup.push(f)-1,f.state=u.CLOSED,f.$overlay=b("."+k("overlay")),null!==f.settings.appendTo&&f.settings.appendTo.length&&(e=b(f.settings.appendTo)),f.$overlay.length||(f.$overlay=b("<div>").addClass(k("overlay")+" "+k("is",u.CLOSED)).hide(),e.append(f.$overlay)),f.$bg=b("."+k("bg")).addClass(k("is",u.CLOSED)),f.$modal=a.addClass(q+" "+k("is-initialized")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).attr("tabindex","-1"),f.$wrapper=b("<div>").addClass(k("wrapper")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).hide().append(f.$modal),e.append(f.$wrapper),f.$wrapper.on("click."+q,'[data-remodal-action="close"]',function(a){a.preventDefault(),f.close()}),f.$wrapper.on("click."+q,'[data-remodal-action="cancel"]',function(a){a.preventDefault(),f.$modal.trigger(v.CANCELLATION),f.settings.closeOnCancel&&f.close(v.CANCELLATION)}),f.$wrapper.on("click."+q,'[data-remodal-action="confirm"]',function(a){a.preventDefault(),f.$modal.trigger(v.CONFIRMATION),f.settings.closeOnConfirm&&f.close(v.CONFIRMATION)}),f.$wrapper.on("click."+q,function(a){var c=b(a.target);c.hasClass(k("wrapper"))&&f.settings.closeOnOutsideClick&&f.close()})}var n,o,p="remodal",q=a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.NAMESPACE||p,r=b.map(["animationstart","webkitAnimationStart","MSAnimationStart","oAnimationStart"],function(a){return a+"."+q}).join(" "),s=b.map(["animationend","webkitAnimationEnd","MSAnimationEnd","oAnimationEnd"],function(a){return a+"."+q}).join(" "),t=b.extend({hashTracking:!0,closeOnConfirm:!0,closeOnCancel:!0,closeOnEscape:!0,closeOnOutsideClick:!0,modifier:"",appendTo:null},a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.DEFAULTS),u={CLOSING:"closing",CLOSED:"closed",OPENING:"opening",OPENED:"opened"},v={CONFIRMATION:"confirmation",CANCELLATION:"cancellation"},w=function(){var a=document.createElement("div").style;return void 0!==a.animationName||void 0!==a.WebkitAnimationName||void 0!==a.MozAnimationName||void 0!==a.msAnimationName||void 0!==a.OAnimationName}(),x=/iPad|iPhone|iPod/.test(navigator.platform);m.prototype.open=function(){var a,c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&(a=c.$modal.attr("data-remodal-id"),a&&c.settings.hashTracking&&(o=b(window).scrollTop(),location.hash=a),n&&n!==c&&i(n),n=c,e(),c.$bg.addClass(c.settings.modifier),c.$overlay.addClass(c.settings.modifier).show(),c.$wrapper.show().scrollTop(0),c.$modal.focus(),h(function(){g(c,u.OPENING)},function(){g(c,u.OPENED)},c))},m.prototype.close=function(a){var c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&(c.settings.hashTracking&&c.$modal.attr("data-remodal-id")===location.hash.substr(1)&&(location.hash="",b(window).scrollTop(o)),h(function(){g(c,u.CLOSING,!1,a)},function(){c.$bg.removeClass(c.settings.modifier),c.$overlay.removeClass(c.settings.modifier).hide(),c.$wrapper.hide(),f(),g(c,u.CLOSED,!1,a)},c))},m.prototype.getState=function(){return this.state},m.prototype.destroy=function(){var a,c=b[p].lookup;i(this),this.$wrapper.remove(),delete c[this.index],a=b.grep(c,function(a){return!!a}).length,0===a&&(this.$overlay.remove(),this.$bg.removeClass(k("is",u.CLOSING)+" "+k("is",u.OPENING)+" "+k("is",u.CLOSED)+" "+k("is",u.OPENED)))},b[p]={lookup:[]},b.fn[p]=function(a){var c,d;return this.each(function(e,f){d=b(f),null==d.data(p)?(c=new m(d,a),d.data(p,c.index),c.settings.hashTracking&&d.attr("data-remodal-id")===location.hash.substr(1)&&c.open()):c=b[p].lookup[d.data(p)]}),c},b(document).ready(function(){b('body').on("click","[data-remodal-target]",function(a){a.preventDefault();var c=a.currentTarget,d=c.getAttribute("data-remodal-target"),e=b('[data-remodal-id="'+d+'"]');b[p].lookup[e.data(p)].open()}),b('body').find("."+q).each(function(a,c){var d=b(c),e=d.data("remodal-options");e?("string"==typeof e||e instanceof String)&&(e=j(e)):e={},d[p](e)}),b('body').on("keydown."+q,function(a){n&&n.settings.closeOnEscape&&n.state===u.OPENED&&27===a.keyCode&&n.close()}),b(window).on("hashchange."+q,l)})}); | |
/*! | |
* JavaScript Cookie v2.1.4 | |
* https://github.com/js-cookie/js-cookie | |
* | |
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack | |
* Released under the MIT license | |
*/ | |
!function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var o=arguments[e];for(var t in o)n[t]=o[t]}return n}function n(o){function t(n,r,i){var c;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=e({path:"/"},t.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(e){}r=o.write?o.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=(n=(n=encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var f="";for(var s in i)i[s]&&(f+="; "+s,!0!==i[s]&&(f+="="+i[s]));return document.cookie=n+"="+r+f}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u<p.length;u++){var l=p[u].split("="),C=l.slice(1).join("=");'"'===C.charAt(0)&&(C=C.slice(1,-1));try{var g=l[0].replace(d,decodeURIComponent);if(C=o.read?o.read(C,g):o(C,g)||C.replace(d,decodeURIComponent),this.json)try{C=JSON.parse(C)}catch(e){}if(n===g){c=C;break}n||(c[g]=C)}catch(e){}}return c}}return t.set=t,t.get=function(e){return t.call(t,e)},t.getJSON=function(){return t.apply({json:!0},[].slice.call(arguments))},t.defaults={},t.remove=function(n,o){t(n,"",e(o,{expires:-1}))},t.withConverter=n,t}return n(function(){})}); | |
/*! | |
Waypoints - 4.0.0 | |
Copyright © 2011-2015 Caleb Troughton | |
Licensed under the MIT license. | |
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt | |
*/ | |
!function(){"use strict";function t(o){if(!o)throw new Error("No options passed to Waypoint constructor");if(!o.element)throw new Error("No element option passed to Waypoint constructor");if(!o.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+e,this.options=t.Adapter.extend({},t.defaults,o),this.element=this.options.element,this.adapter=new t.Adapter(this.element),this.callback=o.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=t.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=t.Context.findOrCreateByElement(this.options.context),t.offsetAliases[this.options.offset]&&(this.options.offset=t.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),i[this.key]=this,e+=1}var e=0,i={};t.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},t.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},t.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete i[this.key]},t.prototype.disable=function(){return this.enabled=!1,this},t.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},t.prototype.next=function(){return this.group.next(this)},t.prototype.previous=function(){return this.group.previous(this)},t.invokeAll=function(t){var e=[];for(var o in i)e.push(i[o]);for(var n=0,r=e.length;r>n;n++)e[n][t]()},t.destroyAll=function(){t.invokeAll("destroy")},t.disableAll=function(){t.invokeAll("disable")},t.enableAll=function(){t.invokeAll("enable")},t.refreshAll=function(){t.Context.refreshAll()},t.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},t.viewportWidth=function(){return document.documentElement.clientWidth},t.adapters=[],t.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},t.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}},window.Waypoint=t}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}function e(t){this.element=t,this.Adapter=n.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+i,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,o[t.waypointContextKey]=this,i+=1,this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}var i=0,o={},n=window.Waypoint,r=window.onload;e.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},e.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical);t&&e&&(this.adapter.off(".waypoints"),delete o[this.key])},e.prototype.createThrottledResizeHandler=function(){function t(){e.handleResize(),e.didResize=!1}var e=this;this.adapter.on("resize.waypoints",function(){e.didResize||(e.didResize=!0,n.requestAnimationFrame(t))})},e.prototype.createThrottledScrollHandler=function(){function t(){e.handleScroll(),e.didScroll=!1}var e=this;this.adapter.on("scroll.waypoints",function(){(!e.didScroll||n.isTouch)&&(e.didScroll=!0,n.requestAnimationFrame(t))})},e.prototype.handleResize=function(){n.Context.refreshAll()},e.prototype.handleScroll=function(){var t={},e={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};for(var i in e){var o=e[i],n=o.newScroll>o.oldScroll,r=n?o.forward:o.backward;for(var s in this.waypoints[i]){var a=this.waypoints[i][s],l=o.oldScroll<a.triggerPoint,h=o.newScroll>=a.triggerPoint,p=l&&h,u=!l&&!h;(p||u)&&(a.queueTrigger(r),t[a.group.id]=a.group)}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},e.prototype.innerHeight=function(){return this.element==this.element.window?n.viewportHeight():this.adapter.innerHeight()},e.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},e.prototype.innerWidth=function(){return this.element==this.element.window?n.viewportWidth():this.adapter.innerWidth()},e.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;n>o;o++)t[o].destroy()},e.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),o={};this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(var r in t){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,u,c,d=this.waypoints[r][a],f=d.options.offset,w=d.triggerPoint,y=0,g=null==w;d.element!==d.element.window&&(y=d.adapter.offset()[s.offsetProp]),"function"==typeof f?f=f.apply(d):"string"==typeof f&&(f=parseFloat(f),d.options.offset.indexOf("%")>-1&&(f=Math.ceil(s.contextDimension*f/100))),l=s.contextScroll-s.contextOffset,d.triggerPoint=y+l-f,h=w<s.oldScroll,p=d.triggerPoint>=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}(); | |
/*! | |
Waypoints Infinite Scroll Shortcut - 4.0.0 | |
Copyright © 2011-2015 Caleb Troughton | |
Licensed under the MIT license. | |
https://github.com/imakewebthings/waypoints/blob/master/licenses.txt | |
*/ | |
!function(){"use strict";function t(n){this.options=i.extend({},t.defaults,n),this.container=this.options.element,"auto"!==this.options.container&&(this.container=this.options.container),this.$container=i(this.container),this.$more=i(this.options.more),this.$more.length&&(this.setupHandler(),this.waypoint=new o(this.options))}var i=window.jQuery,o=window.Waypoint;t.prototype.setupHandler=function(){this.options.handler=i.proxy(function(){this.options.onBeforePageLoad(),this.destroy(),this.$container.addClass(this.options.loadingClass),i.get(i(this.options.more).attr("href"),i.proxy(function(t){var n=i(i.parseHTML(t)),e=n.find(this.options.more),s=n.find(this.options.items);s.length||(s=n.filter(this.options.items)),this.$container.append(s),this.$container.removeClass(this.options.loadingClass),e.length||(e=n.filter(this.options.more)),e.length?(this.$more.replaceWith(e),this.$more=e,this.waypoint=new o(this.options)):this.$more.remove(),this.options.onAfterPageLoad(s)},this))},this)},t.prototype.destroy=function(){this.waypoint&&this.waypoint.destroy()},t.defaults={container:"auto",items:".infinite-item",more:".infinite-more-link",offset:"bottom-in-view",loadingClass:"infinite-loading",onBeforePageLoad:i.noop,onAfterPageLoad:i.noop},o.Infinite=t}(); | |
// mediaWrapper.js: Simple responsive iframes | |
// MIT license http://www.opensource.org/licenses/mit-license.php/ | |
// @author Matthew A. K. Smith http://www.akselkreis.com | |
!function(t){t.fn.mediaWrapper=function(i){var e=t.extend({intrinsic:!0,baseWidth:16,baseHeight:9},i);return this.each(function(){var i="";i=1==e.intrinsic&&""!==t(this).attr("width")&&""!==t(this).attr("height")?t(this).attr("height")/t(this).attr("width")*100:e.baseHeight/e.baseWidth*100,t(this).wrap('<div class="mediaWrapper" style="position: relative; width: 100%; height: 0; padding: '+i+'% 0 0 0; " />').css({position:"absolute",width:"100%",height:"100%",top:"0",left:"0"})})}}(jQuery); | |
/* | |
* Pointer Events Polyfill: Adds support for the style attribute "pointer-events: none" to browsers without this feature (namely, IE). | |
* (c) 2013, Kent Mewhort, licensed under BSD. See LICENSE.txt for details. | |
*/ | |
function PointerEventsPolyfill(t){if(this.options={selector:"*",mouseEvents:["click","dblclick","mousedown","mouseup"],usePolyfillIf:function(){if("Microsoft Internet Explorer"==navigator.appName){var t=navigator.userAgent;if(null!=t.match(/MSIE ([0-9]{1,}[\.0-9]{0,})/)){var e=parseFloat(RegExp.$1);if(11>e)return!0}}return!1}},t){var e=this;$.each(t,function(t,n){e.options[t]=n})}this.options.usePolyfillIf()&&this.register_mouse_events()}PointerEventsPolyfill.initialize=function(t){return null==PointerEventsPolyfill.singleton&&(PointerEventsPolyfill.singleton=new PointerEventsPolyfill(t)),PointerEventsPolyfill.singleton},PointerEventsPolyfill.prototype.register_mouse_events=function(){$(document).on(this.options.mouseEvents.join(" "),this.options.selector,function(t){if("none"==$(this).css("pointer-events")){var e=$(this).css("display");$(this).css("display","none");var n=document.elementFromPoint(t.clientX,t.clientY);return e?$(this).css("display",e):$(this).css("display",""),t.target=n,$(n).trigger(t),!1}return!0})}; | |
/*! | |
* Flickity PACKAGED v2.0.10 | |
* Touch, responsive, flickable carousels | |
* | |
* Licensed GPLv3 for open source use | |
* or Flickity Commercial License for commercial use | |
* | |
* http://flickity.metafizzy.co | |
* Copyright 2017 Metafizzy | |
*/ | |
!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,o,a){function h(t,e,n){var s,o="$()."+i+'("'+e+'")';return t.each(function(t,h){var l=a.data(h,i);if(!l)return void r(i+" not initialized. Cannot call methods, i.e. "+o);var c=l[e];if(!c||"_"==e.charAt(0))return void r(o+" is not a valid method");var d=c.apply(l,n);s=void 0===s?d:s}),void 0!==s?s:t}function l(t,e){t.each(function(t,n){var s=a.data(n,i);s?(s.option(e),s._init()):(s=new o(n,e),a.data(n,i,s))})}a=a||e||t.jQuery,a&&(o.prototype.option||(o.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=s.call(arguments,1);return h(this,t,e)}return l(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var s=Array.prototype.slice,o=t.console,r="undefined"==typeof o?function(){}:function(t){o.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return n.indexOf(e)==-1&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return n!=-1&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],s=0;s<i.length;s++){var o=i[s],r=n&&n[o];r&&(this.off(t,o),delete n[o]),o.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=t.indexOf("%")==-1&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<l;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function s(){if(!c){c=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var s=n(e);o.isBoxSizeOuter=r=200==t(s.width),i.removeChild(e)}}function o(e){if(s(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var o=n(e);if("none"==o.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var c=a.isBorderBox="border-box"==o.boxSizing,d=0;d<l;d++){var u=h[d],f=o[u],p=parseFloat(f);a[u]=isNaN(p)?0:p}var v=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,m=a.marginLeft+a.marginRight,y=a.marginTop+a.marginBottom,E=a.borderLeftWidth+a.borderRightWidth,S=a.borderTopWidth+a.borderBottomWidth,b=c&&r,x=t(o.width);x!==!1&&(a.width=x+(b?0:v+E));var C=t(o.height);return C!==!1&&(a.height=C+(b?0:g+S)),a.innerWidth=a.width-(v+E),a.innerHeight=a.height-(g+S),a.outerWidth=a.width+m,a.outerHeight=a.height+y,a}}var r,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],l=h.length,c=!1;return o}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i],s=n+"MatchesSelector";if(t[s])return s}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e},i.makeArray=function(t){var e=[];if(Array.isArray(t))e=t;else if(t&&"object"==typeof t&&"number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e},i.removeFrom=function(t,e){var i=t.indexOf(e);i!=-1&&t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,n){t=i.makeArray(t);var s=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!n)return void s.push(t);e(t,n)&&s.push(t);for(var i=t.querySelectorAll(n),o=0;o<i.length;o++)s.push(i[o])}}),s},i.debounceMethod=function(t,e,i){var n=t.prototype[e],s=e+"Timeout";t.prototype[e]=function(){var t=this[s];t&&clearTimeout(t);var e=arguments,o=this;this[s]=setTimeout(function(){n.apply(o,e),delete o[s]},i||100)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var n=t.console;return i.htmlInit=function(e,s){i.docReady(function(){var o=i.toDashed(s),r="data-"+o,a=document.querySelectorAll("["+r+"]"),h=document.querySelectorAll(".js-"+o),l=i.makeArray(a).concat(i.makeArray(h)),c=r+"-options",d=t.jQuery;l.forEach(function(t){var i,o=t.getAttribute(r)||t.getAttribute(c);try{i=o&&JSON.parse(o)}catch(a){return void(n&&n.error("Error parsing "+r+" on "+t.className+": "+a))}var h=new e(t,i);d&&d.data(t,s,h)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/cell",["get-size/get-size"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("get-size")):(t.Flickity=t.Flickity||{},t.Flickity.Cell=e(t,t.getSize))}(window,function(t,e){function i(t,e){this.element=t,this.parent=e,this.create()}var n=i.prototype;return n.create=function(){this.element.style.position="absolute",this.x=0,this.shift=0},n.destroy=function(){this.element.style.position="";var t=this.parent.originSide;this.element.style[t]=""},n.getSize=function(){this.size=e(this.element)},n.setPosition=function(t){this.x=t,this.updateTarget(),this.renderPosition(t)},n.updateTarget=n.setDefaultTarget=function(){var t="left"==this.parent.originSide?"marginLeft":"marginRight";this.target=this.x+this.size[t]+this.size.width*this.parent.cellAlign},n.renderPosition=function(t){var e=this.parent.originSide;this.element.style[e]=this.parent.getPositionValue(t)},n.wrapShift=function(t){this.shift=t,this.renderPosition(this.x+this.parent.slideableWidth*t)},n.remove=function(){this.element.parentNode.removeChild(this.element)},i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/slide",e):"object"==typeof module&&module.exports?module.exports=e():(t.Flickity=t.Flickity||{},t.Flickity.Slide=e())}(window,function(){"use strict";function t(t){this.parent=t,this.isOriginLeft="left"==t.originSide,this.cells=[],this.outerWidth=0,this.height=0}var e=t.prototype;return e.addCell=function(t){if(this.cells.push(t),this.outerWidth+=t.size.outerWidth,this.height=Math.max(t.size.outerHeight,this.height),1==this.cells.length){this.x=t.x;var e=this.isOriginLeft?"marginLeft":"marginRight";this.firstMargin=t.size[e]}},e.updateTarget=function(){var t=this.isOriginLeft?"marginRight":"marginLeft",e=this.getLastCell(),i=e?e.size[t]:0,n=this.outerWidth-(this.firstMargin+i);this.target=this.x+this.firstMargin+n*this.parent.cellAlign},e.getLastCell=function(){return this.cells[this.cells.length-1]},e.select=function(){this.changeSelectedClass("add")},e.unselect=function(){this.changeSelectedClass("remove")},e.changeSelectedClass=function(t){this.cells.forEach(function(e){e.element.classList[t]("is-selected")})},e.getCellElements=function(){return this.cells.map(function(t){return t.element})},t}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/animate",["fizzy-ui-utils/utils"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("fizzy-ui-utils")):(t.Flickity=t.Flickity||{},t.Flickity.animatePrototype=e(t,t.fizzyUIUtils))}(window,function(t,e){var i=t.requestAnimationFrame||t.webkitRequestAnimationFrame,n=0;i||(i=function(t){var e=(new Date).getTime(),i=Math.max(0,16-(e-n)),s=setTimeout(t,i);return n=e+i,s});var s={};s.startAnimation=function(){this.isAnimating||(this.isAnimating=!0,this.restingFrames=0,this.animate())},s.animate=function(){this.applyDragForce(),this.applySelectedAttraction();var t=this.x;if(this.integratePhysics(),this.positionSlider(),this.settle(t),this.isAnimating){var e=this;i(function(){e.animate()})}};var o=function(){var t=document.documentElement.style;return"string"==typeof t.transform?"transform":"WebkitTransform"}();return s.positionSlider=function(){var t=this.x;this.options.wrapAround&&this.cells.length>1&&(t=e.modulo(t,this.slideableWidth),t-=this.slideableWidth,this.shiftWrapCells(t)),t+=this.cursorPosition,t=this.options.rightToLeft&&o?-t:t;var i=this.getPositionValue(t);this.slider.style[o]=this.isAnimating?"translate3d("+i+",0,0)":"translateX("+i+")";var n=this.slides[0];if(n){var s=-this.x-n.target,r=s/this.slidesWidth;this.dispatchEvent("scroll",null,[r,s])}},s.positionSliderAtSelected=function(){this.cells.length&&(this.x=-this.selectedSlide.target,this.positionSlider())},s.getPositionValue=function(t){return this.options.percentPosition?.01*Math.round(t/this.size.innerWidth*1e4)+"%":Math.round(t)+"px"},s.settle=function(t){this.isPointerDown||Math.round(100*this.x)!=Math.round(100*t)||this.restingFrames++,this.restingFrames>2&&(this.isAnimating=!1,delete this.isFreeScrolling,this.positionSlider(),this.dispatchEvent("settle"))},s.shiftWrapCells=function(t){var e=this.cursorPosition+t;this._shiftCells(this.beforeShiftCells,e,-1);var i=this.size.innerWidth-(t+this.slideableWidth+this.cursorPosition);this._shiftCells(this.afterShiftCells,i,1)},s._shiftCells=function(t,e,i){for(var n=0;n<t.length;n++){var s=t[n],o=e>0?i:0;s.wrapShift(o),e-=s.size.outerWidth}},s._unshiftCells=function(t){if(t&&t.length)for(var e=0;e<t.length;e++)t[e].wrapShift(0)},s.integratePhysics=function(){this.x+=this.velocity,this.velocity*=this.getFrictionFactor()},s.applyForce=function(t){this.velocity+=t},s.getFrictionFactor=function(){return 1-this.options[this.isFreeScrolling?"freeScrollFriction":"friction"]},s.getRestingPosition=function(){return this.x+this.velocity/(1-this.getFrictionFactor())},s.applyDragForce=function(){if(this.isPointerDown){var t=this.dragX-this.x,e=t-this.velocity;this.applyForce(e)}},s.applySelectedAttraction=function(){if(!this.isPointerDown&&!this.isFreeScrolling&&this.cells.length){var t=this.selectedSlide.target*-1-this.x,e=t*this.options.selectedAttraction;this.applyForce(e)}},s}),function(t,e){if("function"==typeof define&&define.amd)define("flickity/js/flickity",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./cell","./slide","./animate"],function(i,n,s,o,r,a){return e(t,i,n,s,o,r,a)});else if("object"==typeof module&&module.exports)module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./cell"),require("./slide"),require("./animate"));else{var i=t.Flickity;t.Flickity=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,i.Cell,i.Slide,i.animatePrototype)}}(window,function(t,e,i,n,s,o,r){function a(t,e){for(t=n.makeArray(t);t.length;)e.appendChild(t.shift())}function h(t,e){var i=n.getQueryElement(t);if(!i)return void(d&&d.error("Bad element for Flickity: "+(i||t)));if(this.element=i,this.element.flickityGUID){var s=f[this.element.flickityGUID];return s.option(e),s}l&&(this.$element=l(this.element)),this.options=n.extend({},this.constructor.defaults),this.option(e),this._create()}var l=t.jQuery,c=t.getComputedStyle,d=t.console,u=0,f={};h.defaults={accessibility:!0,cellAlign:"center",freeScrollFriction:.075,friction:.28,namespaceJQueryEvents:!0,percentPosition:!0,resize:!0,selectedAttraction:.025,setGallerySize:!0},h.createMethods=[];var p=h.prototype;n.extend(p,e.prototype),p._create=function(){var e=this.guid=++u;this.element.flickityGUID=e,f[e]=this,this.selectedIndex=0,this.restingFrames=0,this.x=0,this.velocity=0,this.originSide=this.options.rightToLeft?"right":"left",this.viewport=document.createElement("div"),this.viewport.className="flickity-viewport",this._createSlider(),(this.options.resize||this.options.watchCSS)&&t.addEventListener("resize",this),h.createMethods.forEach(function(t){this[t]()},this),this.options.watchCSS?this.watchCSS():this.activate()},p.option=function(t){n.extend(this.options,t)},p.activate=function(){if(!this.isActive){this.isActive=!0,this.element.classList.add("flickity-enabled"),this.options.rightToLeft&&this.element.classList.add("flickity-rtl"),this.getSize();var t=this._filterFindCellElements(this.element.children);a(t,this.slider),this.viewport.appendChild(this.slider),this.element.appendChild(this.viewport),this.reloadCells(),this.options.accessibility&&(this.element.tabIndex=0,this.element.addEventListener("keydown",this)),this.emitEvent("activate");var e,i=this.options.initialIndex;e=this.isInitActivated?this.selectedIndex:void 0!==i&&this.cells[i]?i:0,this.select(e,!1,!0),this.isInitActivated=!0}},p._createSlider=function(){var t=document.createElement("div");t.className="flickity-slider",t.style[this.originSide]=0,this.slider=t},p._filterFindCellElements=function(t){return n.filterFindElements(t,this.options.cellSelector)},p.reloadCells=function(){this.cells=this._makeCells(this.slider.children),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize()},p._makeCells=function(t){var e=this._filterFindCellElements(t),i=e.map(function(t){return new s(t,this)},this);return i},p.getLastCell=function(){return this.cells[this.cells.length-1]},p.getLastSlide=function(){return this.slides[this.slides.length-1]},p.positionCells=function(){this._sizeCells(this.cells),this._positionCells(0)},p._positionCells=function(t){t=t||0,this.maxCellHeight=t?this.maxCellHeight||0:0;var e=0;if(t>0){var i=this.cells[t-1];e=i.x+i.size.outerWidth}for(var n=this.cells.length,s=t;s<n;s++){var o=this.cells[s];o.setPosition(e),e+=o.size.outerWidth,this.maxCellHeight=Math.max(o.size.outerHeight,this.maxCellHeight)}this.slideableWidth=e,this.updateSlides(),this._containSlides(),this.slidesWidth=n?this.getLastSlide().target-this.slides[0].target:0},p._sizeCells=function(t){t.forEach(function(t){t.getSize()})},p.updateSlides=function(){if(this.slides=[],this.cells.length){var t=new o(this);this.slides.push(t);var e="left"==this.originSide,i=e?"marginRight":"marginLeft",n=this._getCanCellFit();this.cells.forEach(function(e,s){if(!t.cells.length)return void t.addCell(e);var r=t.outerWidth-t.firstMargin+(e.size.outerWidth-e.size[i]);n.call(this,s,r)?t.addCell(e):(t.updateTarget(),t=new o(this),this.slides.push(t),t.addCell(e))},this),t.updateTarget(),this.updateSelectedSlide()}},p._getCanCellFit=function(){var t=this.options.groupCells;if(!t)return function(){return!1};if("number"==typeof t){var e=parseInt(t,10);return function(t){return t%e!==0}}var i="string"==typeof t&&t.match(/^(\d+)%$/),n=i?parseInt(i[1],10)/100:1;return function(t,e){return e<=(this.size.innerWidth+1)*n}},p._init=p.reposition=function(){this.positionCells(),this.positionSliderAtSelected()},p.getSize=function(){this.size=i(this.element),this.setCellAlign(),this.cursorPosition=this.size.innerWidth*this.cellAlign};var v={center:{left:.5,right:.5},left:{left:0,right:1},right:{right:0,left:1}};return p.setCellAlign=function(){var t=v[this.options.cellAlign];this.cellAlign=t?t[this.originSide]:this.options.cellAlign},p.setGallerySize=function(){if(this.options.setGallerySize){var t=this.options.adaptiveHeight&&this.selectedSlide?this.selectedSlide.height:this.maxCellHeight;this.viewport.style.height=t+"px"}},p._getWrapShiftCells=function(){if(this.options.wrapAround){this._unshiftCells(this.beforeShiftCells),this._unshiftCells(this.afterShiftCells);var t=this.cursorPosition,e=this.cells.length-1;this.beforeShiftCells=this._getGapCells(t,e,-1),t=this.size.innerWidth-this.cursorPosition,this.afterShiftCells=this._getGapCells(t,0,1)}},p._getGapCells=function(t,e,i){for(var n=[];t>0;){var s=this.cells[e];if(!s)break;n.push(s),e+=i,t-=s.size.outerWidth}return n},p._containSlides=function(){if(this.options.contain&&!this.options.wrapAround&&this.cells.length){var t=this.options.rightToLeft,e=t?"marginRight":"marginLeft",i=t?"marginLeft":"marginRight",n=this.slideableWidth-this.getLastCell().size[i],s=n<this.size.innerWidth,o=this.cursorPosition+this.cells[0].size[e],r=n-this.size.innerWidth*(1-this.cellAlign);this.slides.forEach(function(t){s?t.target=n*this.cellAlign:(t.target=Math.max(t.target,o),t.target=Math.min(t.target,r))},this)}},p.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),l&&this.$element){t+=this.options.namespaceJQueryEvents?".flickity":"";var s=t;if(e){var o=l.Event(e);o.type=t,s=o}this.$element.trigger(s,i)}},p.select=function(t,e,i){this.isActive&&(t=parseInt(t,10),this._wrapSelect(t),(this.options.wrapAround||e)&&(t=n.modulo(t,this.slides.length)),this.slides[t]&&(this.selectedIndex=t,this.updateSelectedSlide(),i?this.positionSliderAtSelected():this.startAnimation(),this.options.adaptiveHeight&&this.setGallerySize(),this.dispatchEvent("select"),this.dispatchEvent("cellSelect")))},p._wrapSelect=function(t){var e=this.slides.length,i=this.options.wrapAround&&e>1;if(!i)return t;var s=n.modulo(t,e),o=Math.abs(s-this.selectedIndex),r=Math.abs(s+e-this.selectedIndex),a=Math.abs(s-e-this.selectedIndex);!this.isDragSelect&&r<o?t+=e:!this.isDragSelect&&a<o&&(t-=e),t<0?this.x-=this.slideableWidth:t>=e&&(this.x+=this.slideableWidth)},p.previous=function(t,e){this.select(this.selectedIndex-1,t,e)},p.next=function(t,e){this.select(this.selectedIndex+1,t,e)},p.updateSelectedSlide=function(){var t=this.slides[this.selectedIndex];t&&(this.unselectSelectedSlide(),this.selectedSlide=t,t.select(),this.selectedCells=t.cells,this.selectedElements=t.getCellElements(),this.selectedCell=t.cells[0],this.selectedElement=this.selectedElements[0])},p.unselectSelectedSlide=function(){this.selectedSlide&&this.selectedSlide.unselect()},p.selectCell=function(t,e,i){var n;"number"==typeof t?n=this.cells[t]:("string"==typeof t&&(t=this.element.querySelector(t)),n=this.getCell(t));for(var s=0;n&&s<this.slides.length;s++){var o=this.slides[s],r=o.cells.indexOf(n);if(r!=-1)return void this.select(s,e,i)}},p.getCell=function(t){for(var e=0;e<this.cells.length;e++){var i=this.cells[e];if(i.element==t)return i}},p.getCells=function(t){t=n.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getCell(t);i&&e.push(i)},this),e},p.getCellElements=function(){return this.cells.map(function(t){return t.element})},p.getParentCell=function(t){var e=this.getCell(t);return e?e:(t=n.getParent(t,".flickity-slider > *"),this.getCell(t))},p.getAdjacentCellElements=function(t,e){if(!t)return this.selectedSlide.getCellElements();e=void 0===e?this.selectedIndex:e;var i=this.slides.length;if(1+2*t>=i)return this.getCellElements();for(var s=[],o=e-t;o<=e+t;o++){var r=this.options.wrapAround?n.modulo(o,i):o,a=this.slides[r];a&&(s=s.concat(a.getCellElements()))}return s},p.uiChange=function(){this.emitEvent("uiChange")},p.childUIPointerDown=function(t){this.emitEvent("childUIPointerDown",[t])},p.onresize=function(){this.watchCSS(),this.resize()},n.debounceMethod(h,"onresize",150),p.resize=function(){if(this.isActive){this.getSize(),this.options.wrapAround&&(this.x=n.modulo(this.x,this.slideableWidth)),this.positionCells(),this._getWrapShiftCells(),this.setGallerySize(),this.emitEvent("resize");var t=this.selectedElements&&this.selectedElements[0];this.selectCell(t,!1,!0)}},p.watchCSS=function(){var t=this.options.watchCSS;if(t){var e=c(this.element,":after").content;e.indexOf("flickity")!=-1?this.activate():this.deactivate()}},p.onkeydown=function(t){if(this.options.accessibility&&(!document.activeElement||document.activeElement==this.element))if(37==t.keyCode){var e=this.options.rightToLeft?"next":"previous";this.uiChange(),this[e]()}else if(39==t.keyCode){var i=this.options.rightToLeft?"previous":"next";this.uiChange(),this[i]()}},p.deactivate=function(){this.isActive&&(this.element.classList.remove("flickity-enabled"),this.element.classList.remove("flickity-rtl"),this.cells.forEach(function(t){t.destroy()}),this.unselectSelectedSlide(),this.element.removeChild(this.viewport),a(this.slider.children,this.element),this.options.accessibility&&(this.element.removeAttribute("tabIndex"),this.element.removeEventListener("keydown",this)),this.isActive=!1,this.emitEvent("deactivate"))},p.destroy=function(){this.deactivate(),t.removeEventListener("resize",this),this.emitEvent("destroy"),l&&this.$element&&l.removeData(this.element,"flickity"),delete this.element.flickityGUID,delete f[this.guid]},n.extend(p,r),h.data=function(t){t=n.getQueryElement(t);var e=t&&t.flickityGUID;return e&&f[e]},n.htmlInit(h,"flickity"),l&&l.bridget&&l.bridget("flickity",h),h.setJQuery=function(t){l=t},h.Cell=s,h}),function(t,e){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.Unipointer=e(t,t.EvEmitter)}(window,function(t,e){function i(){}function n(){}var s=n.prototype=Object.create(e.prototype);s.bindStartEvent=function(t){this._bindStartEvent(t,!0)},s.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},s._bindStartEvent=function(e,i){i=void 0===i||!!i;var n=i?"addEventListener":"removeEventListener";t.PointerEvent?e[n]("pointerdown",this):(e[n]("mousedown",this),e[n]("touchstart",this))},s.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},s.getTouch=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(i.identifier==this.pointerIdentifier)return i}},s.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},s.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},s.onpointerdown=function(t){this._pointerDown(t,t)},s._pointerDown=function(t,e){this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},s.pointerDown=function(t,e){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])};var o={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]};return s._bindPostStartEvents=function(e){if(e){var i=o[e.type];i.forEach(function(e){t.addEventListener(e,this)},this),this._boundPointerEvents=i}},s._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach(function(e){t.removeEventListener(e,this)},this),delete this._boundPointerEvents)},s.onmousemove=function(t){this._pointerMove(t,t)},s.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},s.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},s._pointerMove=function(t,e){this.pointerMove(t,e)},s.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},s.onmouseup=function(t){this._pointerUp(t,t)},s.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},s.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},s._pointerUp=function(t,e){this._pointerDone(),this.pointerUp(t,e)},s.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},s._pointerDone=function(){this.isPointerDown=!1,delete this.pointerIdentifier,this._unbindPostStartEvents(),this.pointerDone()},s.pointerDone=i,s.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},s.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},s._pointerCancel=function(t,e){this._pointerDone(),this.pointerCancel(t,e)},s.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},n.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},n}),function(t,e){"function"==typeof define&&define.amd?define("unidragger/unidragger",["unipointer/unipointer"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("unipointer")):t.Unidragger=e(t,t.Unipointer)}(window,function(t,e){function i(){}var n=i.prototype=Object.create(e.prototype);return n.bindHandles=function(){this._bindHandles(!0)},n.unbindHandles=function(){this._bindHandles(!1)},n._bindHandles=function(e){e=void 0===e||!!e;for(var i=e?"addEventListener":"removeEventListener",n=0;n<this.handles.length;n++){var s=this.handles[n];this._bindStartEvent(s,e),s[i]("click",this),t.PointerEvent&&(s.style.touchAction=e?this._touchActionValue:"")}},n._touchActionValue="none",n.pointerDown=function(t,e){if("INPUT"==t.target.nodeName&&"range"==t.target.type)return this.isPointerDown=!1,void delete this.pointerIdentifier;this._dragPointerDown(t,e);var i=document.activeElement;i&&i.blur&&i.blur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])},n._dragPointerDown=function(t,i){this.pointerDownPoint=e.getPointerPoint(i);var n=this.canPreventDefaultOnPointerDown(t,i);n&&t.preventDefault()},n.canPreventDefaultOnPointerDown=function(t){return"SELECT"!=t.target.nodeName},n.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,i]),this._dragMove(t,e,i)},n._dragPointerMove=function(t,i){var n=e.getPointerPoint(i),s={x:n.x-this.pointerDownPoint.x,y:n.y-this.pointerDownPoint.y};return!this.isDragging&&this.hasDragStarted(s)&&this._dragStart(t,i),s},n.hasDragStarted=function(t){return Math.abs(t.x)>3||Math.abs(t.y)>3},n.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},n._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},n._dragStart=function(t,i){this.isDragging=!0,this.dragStartPoint=e.getPointerPoint(i),this.isPreventingClicks=!0,this.dragStart(t,i)},n.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},n._dragMove=function(t,e,i){this.isDragging&&this.dragMove(t,e,i)},n.dragMove=function(t,e,i){t.preventDefault(),this.emitEvent("dragMove",[t,e,i])},n._dragEnd=function(t,e){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,e)},n.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},n.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},n._staticClick=function(t,e){if(!this.isIgnoringMouseUp||"mouseup"!=t.type){var i=t.target.nodeName;"INPUT"!=i&&"TEXTAREA"!=i||t.target.focus(),this.staticClick(t,e),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400))}},n.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},i.getPointerPoint=e.getPointerPoint,i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/drag",["./flickity","unidragger/unidragger","fizzy-ui-utils/utils"],function(i,n,s){return e(t,i,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("unidragger"),require("fizzy-ui-utils")):t.Flickity=e(t,t.Flickity,t.Unidragger,t.fizzyUIUtils)}(window,function(t,e,i,n){function s(t){var e="touchstart"==t.type,i="touch"==t.pointerType,n=d[t.target.nodeName];return e||i||n}function o(){return{x:t.pageXOffset,y:t.pageYOffset}}n.extend(e.defaults,{draggable:!0,dragThreshold:3}),e.createMethods.push("_createDrag");var r=e.prototype;n.extend(r,i.prototype),r._touchActionValue="pan-y";var a="createTouch"in document,h=!1;r._createDrag=function(){this.on("activate",this.bindDrag),this.on("uiChange",this._uiChangeDrag),this.on("childUIPointerDown",this._childUIPointerDownDrag),this.on("deactivate",this.unbindDrag),a&&!h&&(t.addEventListener("touchmove",function(){}),h=!0)},r.bindDrag=function(){this.options.draggable&&!this.isDragBound&&(this.element.classList.add("is-draggable"),this.handles=[this.viewport],this.bindHandles(),this.isDragBound=!0)},r.unbindDrag=function(){this.isDragBound&&(this.element.classList.remove("is-draggable"),this.unbindHandles(),delete this.isDragBound)},r._uiChangeDrag=function(){delete this.isFreeScrolling},r._childUIPointerDownDrag=function(t){t.preventDefault(),this.pointerDownFocus(t)};var l={TEXTAREA:!0,INPUT:!0,OPTION:!0},c={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0};r.pointerDown=function(e,i){var n=l[e.target.nodeName]&&!c[e.target.type];if(n)return this.isPointerDown=!1,void delete this.pointerIdentifier;this._dragPointerDown(e,i);var s=document.activeElement;s&&s.blur&&s!=this.element&&s!=document.body&&s.blur(),this.pointerDownFocus(e),this.dragX=this.x,this.viewport.classList.add("is-pointer-down"),this._bindPostStartEvents(e),this.pointerDownScroll=o(),t.addEventListener("scroll",this),this.dispatchEvent("pointerDown",e,[i])},r.pointerDownFocus=function(e){var i=s(e);if(this.options.accessibility&&!i){var n=t.pageYOffset;this.element.focus(),t.pageYOffset!=n&&t.scrollTo(t.pageXOffset,n)}};var d={INPUT:!0,SELECT:!0};return r.canPreventDefaultOnPointerDown=function(t){var e=s(t);return!e},r.hasDragStarted=function(t){return Math.abs(t.x)>this.options.dragThreshold},r.pointerUp=function(t,e){delete this.isTouchScrolling,this.viewport.classList.remove("is-pointer-down"),this.dispatchEvent("pointerUp",t,[e]),this._dragPointerUp(t,e)},r.pointerDone=function(){t.removeEventListener("scroll",this),delete this.pointerDownScroll},r.dragStart=function(e,i){this.dragStartPosition=this.x,this.startAnimation(),t.removeEventListener("scroll",this),this.dispatchEvent("dragStart",e,[i])},r.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.dispatchEvent("pointerMove",t,[e,i]),this._dragMove(t,e,i)},r.dragMove=function(t,e,i){t.preventDefault(),this.previousDragX=this.dragX;var n=this.options.rightToLeft?-1:1,s=this.dragStartPosition+i.x*n;if(!this.options.wrapAround&&this.slides.length){var o=Math.max(-this.slides[0].target,this.dragStartPosition);s=s>o?.5*(s+o):s;var r=Math.min(-this.getLastSlide().target,this.dragStartPosition);s=s<r?.5*(s+r):s}this.dragX=s,this.dragMoveTime=new Date,this.dispatchEvent("dragMove",t,[e,i])},r.dragEnd=function(t,e){this.options.freeScroll&&(this.isFreeScrolling=!0);var i=this.dragEndRestingSelect();if(this.options.freeScroll&&!this.options.wrapAround){var n=this.getRestingPosition();this.isFreeScrolling=-n>this.slides[0].target&&-n<this.getLastSlide().target}else this.options.freeScroll||i!=this.selectedIndex||(i+=this.dragEndBoostSelect());delete this.previousDragX,this.isDragSelect=this.options.wrapAround,this.select(i),delete this.isDragSelect,this.dispatchEvent("dragEnd",t,[e])},r.dragEndRestingSelect=function(){var t=this.getRestingPosition(),e=Math.abs(this.getSlideDistance(-t,this.selectedIndex)),i=this._getClosestResting(t,e,1),n=this._getClosestResting(t,e,-1),s=i.distance<n.distance?i.index:n.index; | |
return s},r._getClosestResting=function(t,e,i){for(var n=this.selectedIndex,s=1/0,o=this.options.contain&&!this.options.wrapAround?function(t,e){return t<=e}:function(t,e){return t<e};o(e,s)&&(n+=i,s=e,e=this.getSlideDistance(-t,n),null!==e);)e=Math.abs(e);return{distance:s,index:n-i}},r.getSlideDistance=function(t,e){var i=this.slides.length,s=this.options.wrapAround&&i>1,o=s?n.modulo(e,i):e,r=this.slides[o];if(!r)return null;var a=s?this.slideableWidth*Math.floor(e/i):0;return t-(r.target+a)},r.dragEndBoostSelect=function(){if(void 0===this.previousDragX||!this.dragMoveTime||new Date-this.dragMoveTime>100)return 0;var t=this.getSlideDistance(-this.dragX,this.selectedIndex),e=this.previousDragX-this.dragX;return t>0&&e>0?1:t<0&&e<0?-1:0},r.staticClick=function(t,e){var i=this.getParentCell(t.target),n=i&&i.element,s=i&&this.cells.indexOf(i);this.dispatchEvent("staticClick",t,[e,n,s])},r.onscroll=function(){var t=o(),e=this.pointerDownScroll.x-t.x,i=this.pointerDownScroll.y-t.y;(Math.abs(e)>3||Math.abs(i)>3)&&this._pointerDone()},e}),function(t,e){"function"==typeof define&&define.amd?define("tap-listener/tap-listener",["unipointer/unipointer"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("unipointer")):t.TapListener=e(t,t.Unipointer)}(window,function(t,e){function i(t){this.bindTap(t)}var n=i.prototype=Object.create(e.prototype);return n.bindTap=function(t){t&&(this.unbindTap(),this.tapElement=t,this._bindStartEvent(t,!0))},n.unbindTap=function(){this.tapElement&&(this._bindStartEvent(this.tapElement,!0),delete this.tapElement)},n.pointerUp=function(i,n){if(!this.isIgnoringMouseUp||"mouseup"!=i.type){var s=e.getPointerPoint(n),o=this.tapElement.getBoundingClientRect(),r=t.pageXOffset,a=t.pageYOffset,h=s.x>=o.left+r&&s.x<=o.right+r&&s.y>=o.top+a&&s.y<=o.bottom+a;if(h&&this.emitEvent("tap",[i,n]),"mouseup"!=i.type){this.isIgnoringMouseUp=!0;var l=this;setTimeout(function(){delete l.isIgnoringMouseUp},400)}}},n.destroy=function(){this.pointerDone(),this.unbindTap()},i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/prev-next-button",["./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(i,n,s){return e(t,i,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):e(t,t.Flickity,t.TapListener,t.fizzyUIUtils)}(window,function(t,e,i,n){"use strict";function s(t,e){this.direction=t,this.parent=e,this._create()}function o(t){return"string"==typeof t?t:"M "+t.x0+",50 L "+t.x1+","+(t.y1+50)+" L "+t.x2+","+(t.y2+50)+" L "+t.x3+",50 L "+t.x2+","+(50-t.y2)+" L "+t.x1+","+(50-t.y1)+" Z"}var r="http://www.w3.org/2000/svg";s.prototype=new i,s.prototype._create=function(){this.isEnabled=!0,this.isPrevious=this.direction==-1;var t=this.parent.options.rightToLeft?1:-1;this.isLeft=this.direction==t;var e=this.element=document.createElement("button");e.className="flickity-prev-next-button",e.className+=this.isPrevious?" previous":" next",e.setAttribute("type","button"),this.disable(),e.setAttribute("aria-label",this.isPrevious?"previous":"next");var i=this.createSVG();e.appendChild(i),this.on("tap",this.onTap),this.parent.on("select",this.update.bind(this)),this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))},s.prototype.activate=function(){this.bindTap(this.element),this.element.addEventListener("click",this),this.parent.element.appendChild(this.element)},s.prototype.deactivate=function(){this.parent.element.removeChild(this.element),i.prototype.destroy.call(this),this.element.removeEventListener("click",this)},s.prototype.createSVG=function(){var t=document.createElementNS(r,"svg");t.setAttribute("viewBox","0 0 100 100");var e=document.createElementNS(r,"path"),i=o(this.parent.options.arrowShape);return e.setAttribute("d",i),e.setAttribute("class","arrow"),this.isLeft||e.setAttribute("transform","translate(100, 100) rotate(180) "),t.appendChild(e),t},s.prototype.onTap=function(){if(this.isEnabled){this.parent.uiChange();var t=this.isPrevious?"previous":"next";this.parent[t]()}},s.prototype.handleEvent=n.handleEvent,s.prototype.onclick=function(){var t=document.activeElement;t&&t==this.element&&this.onTap()},s.prototype.enable=function(){this.isEnabled||(this.element.disabled=!1,this.isEnabled=!0)},s.prototype.disable=function(){this.isEnabled&&(this.element.disabled=!0,this.isEnabled=!1)},s.prototype.update=function(){var t=this.parent.slides;if(this.parent.options.wrapAround&&t.length>1)return void this.enable();var e=t.length?t.length-1:0,i=this.isPrevious?0:e,n=this.parent.selectedIndex==i?"disable":"enable";this[n]()},s.prototype.destroy=function(){this.deactivate()},n.extend(e.defaults,{prevNextButtons:!0,arrowShape:{x0:10,x1:60,y1:50,x2:70,y2:40,x3:30}}),e.createMethods.push("_createPrevNextButtons");var a=e.prototype;return a._createPrevNextButtons=function(){this.options.prevNextButtons&&(this.prevButton=new s((-1),this),this.nextButton=new s(1,this),this.on("activate",this.activatePrevNextButtons))},a.activatePrevNextButtons=function(){this.prevButton.activate(),this.nextButton.activate(),this.on("deactivate",this.deactivatePrevNextButtons)},a.deactivatePrevNextButtons=function(){this.prevButton.deactivate(),this.nextButton.deactivate(),this.off("deactivate",this.deactivatePrevNextButtons)},e.PrevNextButton=s,e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/page-dots",["./flickity","tap-listener/tap-listener","fizzy-ui-utils/utils"],function(i,n,s){return e(t,i,n,s)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("tap-listener"),require("fizzy-ui-utils")):e(t,t.Flickity,t.TapListener,t.fizzyUIUtils)}(window,function(t,e,i,n){function s(t){this.parent=t,this._create()}s.prototype=new i,s.prototype._create=function(){this.holder=document.createElement("ol"),this.holder.className="flickity-page-dots",this.dots=[],this.on("tap",this.onTap),this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))},s.prototype.activate=function(){this.setDots(),this.bindTap(this.holder),this.parent.element.appendChild(this.holder)},s.prototype.deactivate=function(){this.parent.element.removeChild(this.holder),i.prototype.destroy.call(this)},s.prototype.setDots=function(){var t=this.parent.slides.length-this.dots.length;t>0?this.addDots(t):t<0&&this.removeDots(-t)},s.prototype.addDots=function(t){for(var e=document.createDocumentFragment(),i=[];t;){var n=document.createElement("li");n.className="dot",e.appendChild(n),i.push(n),t--}this.holder.appendChild(e),this.dots=this.dots.concat(i)},s.prototype.removeDots=function(t){var e=this.dots.splice(this.dots.length-t,t);e.forEach(function(t){this.holder.removeChild(t)},this)},s.prototype.updateSelected=function(){this.selectedDot&&(this.selectedDot.className="dot"),this.dots.length&&(this.selectedDot=this.dots[this.parent.selectedIndex],this.selectedDot.className="dot is-selected")},s.prototype.onTap=function(t){var e=t.target;if("LI"==e.nodeName){this.parent.uiChange();var i=this.dots.indexOf(e);this.parent.select(i)}},s.prototype.destroy=function(){this.deactivate()},e.PageDots=s,n.extend(e.defaults,{pageDots:!0}),e.createMethods.push("_createPageDots");var o=e.prototype;return o._createPageDots=function(){this.options.pageDots&&(this.pageDots=new s(this),this.on("activate",this.activatePageDots),this.on("select",this.updateSelectedPageDots),this.on("cellChange",this.updatePageDots),this.on("resize",this.updatePageDots),this.on("deactivate",this.deactivatePageDots))},o.activatePageDots=function(){this.pageDots.activate()},o.updateSelectedPageDots=function(){this.pageDots.updateSelected()},o.updatePageDots=function(){this.pageDots.setDots()},o.deactivatePageDots=function(){this.pageDots.deactivate()},e.PageDots=s,e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/player",["ev-emitter/ev-emitter","fizzy-ui-utils/utils","./flickity"],function(t,i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("fizzy-ui-utils"),require("./flickity")):e(t.EvEmitter,t.fizzyUIUtils,t.Flickity)}(window,function(t,e,i){function n(t){this.parent=t,this.state="stopped",o&&(this.onVisibilityChange=function(){this.visibilityChange()}.bind(this),this.onVisibilityPlay=function(){this.visibilityPlay()}.bind(this))}var s,o;"hidden"in document?(s="hidden",o="visibilitychange"):"webkitHidden"in document&&(s="webkitHidden",o="webkitvisibilitychange"),n.prototype=Object.create(t.prototype),n.prototype.play=function(){if("playing"!=this.state){var t=document[s];if(o&&t)return void document.addEventListener(o,this.onVisibilityPlay);this.state="playing",o&&document.addEventListener(o,this.onVisibilityChange),this.tick()}},n.prototype.tick=function(){if("playing"==this.state){var t=this.parent.options.autoPlay;t="number"==typeof t?t:3e3;var e=this;this.clear(),this.timeout=setTimeout(function(){e.parent.next(!0),e.tick()},t)}},n.prototype.stop=function(){this.state="stopped",this.clear(),o&&document.removeEventListener(o,this.onVisibilityChange)},n.prototype.clear=function(){clearTimeout(this.timeout)},n.prototype.pause=function(){"playing"==this.state&&(this.state="paused",this.clear())},n.prototype.unpause=function(){"paused"==this.state&&this.play()},n.prototype.visibilityChange=function(){var t=document[s];this[t?"pause":"unpause"]()},n.prototype.visibilityPlay=function(){this.play(),document.removeEventListener(o,this.onVisibilityPlay)},e.extend(i.defaults,{pauseAutoPlayOnHover:!0}),i.createMethods.push("_createPlayer");var r=i.prototype;return r._createPlayer=function(){this.player=new n(this),this.on("activate",this.activatePlayer),this.on("uiChange",this.stopPlayer),this.on("pointerDown",this.stopPlayer),this.on("deactivate",this.deactivatePlayer)},r.activatePlayer=function(){this.options.autoPlay&&(this.player.play(),this.element.addEventListener("mouseenter",this))},r.playPlayer=function(){this.player.play()},r.stopPlayer=function(){this.player.stop()},r.pausePlayer=function(){this.player.pause()},r.unpausePlayer=function(){this.player.unpause()},r.deactivatePlayer=function(){this.player.stop(),this.element.removeEventListener("mouseenter",this)},r.onmouseenter=function(){this.options.pauseAutoPlayOnHover&&(this.player.pause(),this.element.addEventListener("mouseleave",this))},r.onmouseleave=function(){this.player.unpause(),this.element.removeEventListener("mouseleave",this)},i.Player=n,i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/add-remove-cell",["./flickity","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("fizzy-ui-utils")):e(t,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i){function n(t){var e=document.createDocumentFragment();return t.forEach(function(t){e.appendChild(t.element)}),e}var s=e.prototype;return s.insert=function(t,e){var i=this._makeCells(t);if(i&&i.length){var s=this.cells.length;e=void 0===e?s:e;var o=n(i),r=e==s;if(r)this.slider.appendChild(o);else{var a=this.cells[e].element;this.slider.insertBefore(o,a)}if(0===e)this.cells=i.concat(this.cells);else if(r)this.cells=this.cells.concat(i);else{var h=this.cells.splice(e,s-e);this.cells=this.cells.concat(i).concat(h)}this._sizeCells(i);var l=e>this.selectedIndex?0:i.length;this._cellAddedRemoved(e,l)}},s.append=function(t){this.insert(t,this.cells.length)},s.prepend=function(t){this.insert(t,0)},s.remove=function(t){var e,n,s=this.getCells(t),o=0,r=s.length;for(e=0;e<r;e++){n=s[e];var a=this.cells.indexOf(n)<this.selectedIndex;o-=a?1:0}for(e=0;e<r;e++)n=s[e],n.remove(),i.removeFrom(this.cells,n);s.length&&this._cellAddedRemoved(0,o)},s._cellAddedRemoved=function(t,e){e=e||0,this.selectedIndex+=e,this.selectedIndex=Math.max(0,Math.min(this.slides.length-1,this.selectedIndex)),this.cellChange(t,!0),this.emitEvent("cellAddedRemoved",[t,e])},s.cellSizeChange=function(t){var e=this.getCell(t);if(e){e.getSize();var i=this.cells.indexOf(e);this.cellChange(i)}},s.cellChange=function(t,e){var i=this.slideableWidth;if(this._positionCells(t),this._getWrapShiftCells(),this.setGallerySize(),this.emitEvent("cellChange",[t]),this.options.freeScroll){var n=i-this.slideableWidth;this.x+=n*this.cellAlign,this.positionSlider()}else e&&this.positionSliderAtSelected(),this.select(this.selectedIndex)},e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/lazyload",["./flickity","fizzy-ui-utils/utils"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("./flickity"),require("fizzy-ui-utils")):e(t,t.Flickity,t.fizzyUIUtils)}(window,function(t,e,i){"use strict";function n(t){if("IMG"==t.nodeName&&t.getAttribute("data-flickity-lazyload"))return[t];var e=t.querySelectorAll("img[data-flickity-lazyload]");return i.makeArray(e)}function s(t,e){this.img=t,this.flickity=e,this.load()}e.createMethods.push("_createLazyload");var o=e.prototype;return o._createLazyload=function(){this.on("select",this.lazyLoad)},o.lazyLoad=function(){var t=this.options.lazyLoad;if(t){var e="number"==typeof t?t:0,i=this.getAdjacentCellElements(e),o=[];i.forEach(function(t){var e=n(t);o=o.concat(e)}),o.forEach(function(t){new s(t,this)},this)}},s.prototype.handleEvent=i.handleEvent,s.prototype.load=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.img.getAttribute("data-flickity-lazyload"),this.img.removeAttribute("data-flickity-lazyload")},s.prototype.onload=function(t){this.complete(t,"flickity-lazyloaded")},s.prototype.onerror=function(t){this.complete(t,"flickity-lazyerror")},s.prototype.complete=function(t,e){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this);var i=this.flickity.getParentCell(this.img),n=i&&i.element;this.flickity.cellSizeChange(n),this.img.classList.add(e),this.flickity.dispatchEvent("lazyLoad",t,n)},e.LazyLoader=s,e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/index",["./flickity","./drag","./prev-next-button","./page-dots","./player","./add-remove-cell","./lazyload"],e):"object"==typeof module&&module.exports&&(module.exports=e(require("./flickity"),require("./drag"),require("./prev-next-button"),require("./page-dots"),require("./player"),require("./add-remove-cell"),require("./lazyload")))}(window,function(t){return t}),function(t,e){"function"==typeof define&&define.amd?define("flickity-as-nav-for/as-nav-for",["flickity/js/index","fizzy-ui-utils/utils"],e):"object"==typeof module&&module.exports?module.exports=e(require("flickity"),require("fizzy-ui-utils")):t.Flickity=e(t.Flickity,t.fizzyUIUtils)}(window,function(t,e){function i(t,e,i){return(e-t)*i+t}t.createMethods.push("_createAsNavFor");var n=t.prototype;return n._createAsNavFor=function(){this.on("activate",this.activateAsNavFor),this.on("deactivate",this.deactivateAsNavFor),this.on("destroy",this.destroyAsNavFor);var t=this.options.asNavFor;if(t){var e=this;setTimeout(function(){e.setNavCompanion(t)})}},n.setNavCompanion=function(i){i=e.getQueryElement(i);var n=t.data(i);if(n&&n!=this){this.navCompanion=n;var s=this;this.onNavCompanionSelect=function(){s.navCompanionSelect()},n.on("select",this.onNavCompanionSelect),this.on("staticClick",this.onNavStaticClick),this.navCompanionSelect(!0)}},n.navCompanionSelect=function(t){if(this.navCompanion){var e=this.navCompanion.selectedCells[0],n=this.navCompanion.cells.indexOf(e),s=n+this.navCompanion.selectedCells.length-1,o=Math.floor(i(n,s,this.navCompanion.cellAlign));if(this.selectCell(o,!1,t),this.removeNavSelectedElements(),!(o>=this.cells.length)){var r=this.cells.slice(n,s+1);this.navSelectedElements=r.map(function(t){return t.element}),this.changeNavSelectedClass("add")}}},n.changeNavSelectedClass=function(t){this.navSelectedElements.forEach(function(e){e.classList[t]("is-nav-selected")})},n.activateAsNavFor=function(){this.navCompanionSelect(!0)},n.removeNavSelectedElements=function(){this.navSelectedElements&&(this.changeNavSelectedClass("remove"),delete this.navSelectedElements)},n.onNavStaticClick=function(t,e,i,n){"number"==typeof n&&this.navCompanion.selectCell(n)},n.deactivateAsNavFor=function(){this.removeNavSelectedElements()},n.destroyAsNavFor=function(){this.navCompanion&&(this.navCompanion.off("select",this.onNavCompanionSelect),this.off("staticClick",this.onNavStaticClick),delete this.navCompanion)},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("imagesloaded/imagesloaded",["ev-emitter/ev-emitter"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,function(t,e){function i(t,e){for(var i in e)t[i]=e[i];return t}function n(t){var e=[];if(Array.isArray(t))e=t;else if("number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e}function s(t,e,o){return this instanceof s?("string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=n(t),this.options=i({},this.options),"function"==typeof e?o=e:i(this.options,e),o&&this.on("always",o),this.getImages(),a&&(this.jqDeferred=new a.Deferred),void setTimeout(function(){this.check()}.bind(this))):new s(t,e,o)}function o(t){this.img=t}function r(t,e){this.url=t,this.element=e,this.img=new Image}var a=t.jQuery,h=t.console;s.prototype=Object.create(e.prototype),s.prototype.options={},s.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},s.prototype.addElementImages=function(t){"IMG"==t.nodeName&&this.addImage(t),this.options.background===!0&&this.addElementBackgroundImages(t);var e=t.nodeType;if(e&&l[e]){for(var i=t.querySelectorAll("img"),n=0;n<i.length;n++){var s=i[n];this.addImage(s)}if("string"==typeof this.options.background){var o=t.querySelectorAll(this.options.background);for(n=0;n<o.length;n++){var r=o[n];this.addElementBackgroundImages(r)}}}};var l={1:!0,9:!0,11:!0};return s.prototype.addElementBackgroundImages=function(t){var e=getComputedStyle(t);if(e)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(e.backgroundImage);null!==n;){var s=n&&n[2];s&&this.addBackground(s,t),n=i.exec(e.backgroundImage)}},s.prototype.addImage=function(t){var e=new o(t);this.images.push(e)},s.prototype.addBackground=function(t,e){var i=new r(t,e);this.images.push(i)},s.prototype.check=function(){function t(t,i,n){setTimeout(function(){e.progress(t,i,n)})}var e=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(e){e.once("progress",t),e.check()}):void this.complete()},s.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&h&&h.log("progress: "+i,t,e)},s.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){var e=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[e](this)}},o.prototype=Object.create(e.prototype),o.prototype.check=function(){var t=this.getIsImageComplete();return t?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},o.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},o.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.img,e])},o.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},o.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},o.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},o.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},r.prototype=Object.create(o.prototype),r.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var t=this.getIsImageComplete();t&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},r.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},r.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},s.makeJQueryPlugin=function(e){e=e||t.jQuery,e&&(a=e,a.fn.imagesLoaded=function(t,e){var i=new s(this,t,e);return i.jqDeferred.promise(a(this))})},s.makeJQueryPlugin(),s}),function(t,e){"function"==typeof define&&define.amd?define(["flickity/js/index","imagesloaded/imagesloaded"],function(i,n){return e(t,i,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("flickity"),require("imagesloaded")):t.Flickity=e(t,t.Flickity,t.imagesLoaded)}(window,function(t,e,i){"use strict";e.createMethods.push("_createImagesLoaded");var n=e.prototype;return n._createImagesLoaded=function(){this.on("activate",this.imagesLoaded)},n.imagesLoaded=function(){function t(t,i){var n=e.getParentCell(i.img);e.cellSizeChange(n&&n.element),e.options.freeScroll||e.positionSliderAtSelected()}if(this.options.imagesLoaded){var e=this;i(this.slider).on("progress",t)}},e}); | |
/*! modernizr 3.3.1 (Custom Build) | MIT * | |
* https://modernizr.com/download/?-touchevents-setclasses !*/ | |
!function(e,n,t){function o(e,n){return typeof e===n}function s(){var e,n,t,s,a,i,r;for(var l in c)if(c.hasOwnProperty(l)){if(e=[],n=c[l],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(s=o(n.fn,"function")?n.fn():n.fn,a=0;a<e.length;a++)i=e[a],r=i.split("."),1===r.length?Modernizr[r[0]]=s:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=s),f.push((s?"":"no-")+r.join("-"))}}function a(e){var n=u.className,t=Modernizr._config.classPrefix||"";if(p&&(n=n.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");n=n.replace(o,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(n+=" "+t+e.join(" "+t),p?u.className.baseVal=n:u.className=n)}function i(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):p?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function r(){var e=n.body;return e||(e=i(p?"svg":"body"),e.fake=!0),e}function l(e,t,o,s){var a,l,f,c,d="modernizr",p=i("div"),h=r();if(parseInt(o,10))for(;o--;)f=i("div"),f.id=s?s[o]:d+(o+1),p.appendChild(f);return a=i("style"),a.type="text/css",a.id="s"+d,(h.fake?h:p).appendChild(a),h.appendChild(p),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(n.createTextNode(e)),p.id=d,h.fake&&(h.style.background="",h.style.overflow="hidden",c=u.style.overflow,u.style.overflow="hidden",u.appendChild(h)),l=t(p,e),h.fake?(h.parentNode.removeChild(h),u.style.overflow=c,u.offsetHeight):p.parentNode.removeChild(p),!!l}var f=[],c=[],d={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){c.push({name:e,fn:n,options:t})},addAsyncTest:function(e){c.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=d,Modernizr=new Modernizr;var u=n.documentElement,p="svg"===u.nodeName.toLowerCase(),h=d._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];d._prefixes=h;var m=d.testStyles=l;Modernizr.addTest("touchevents",function(){var t;if("ontouchstart"in e||e.DocumentTouch&&n instanceof DocumentTouch)t=!0;else{var o=["@media (",h.join("touch-enabled),("),"heartz",")","{#modernizr{top:9px;position:absolute}}"].join("");m(o,function(e){t=9===e.offsetTop})}return t}),s(),a(f),delete d.addTest,delete d.addAsyncTest;for(var v=0;v<Modernizr._q.length;v++)Modernizr._q[v]();e.Modernizr=Modernizr}(window,document); | |
/*! | |
* Headhesive.js v1.2.3 - An on-demand sticky header | |
* Author: Copyright (c) Mark Goodyear <@markgdyr> <http://markgoodyear.com> | |
* Url: http://markgoodyear.com/labs/headhesive | |
* License: MIT | |
*/ | |
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return e()}):"object"==typeof exports?module.exports=e():t.Headhesive=e()}(this,function(){"use strict";var t=function(e,s){for(var o in s)s.hasOwnProperty(o)&&(e[o]="object"==typeof s[o]?t(e[o],s[o]):s[o]);return e},e=function(t,e){var s,o,i,n=Date.now||function(){return(new Date).getTime()},l=null,c=0,r=function(){c=n(),l=null,i=t.apply(s,o),s=o=null};return function(){var f=n(),h=e-(f-c);return s=this,o=arguments,0>=h?(clearTimeout(l),l=null,c=f,i=t.apply(s,o),s=o=null):l||(l=setTimeout(r,h)),i}},s=function(){return void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop},o=function(t,e){for(var s=0,o=t.offsetHeight;t;)s+=t.offsetTop,t=t.offsetParent;return"bottom"===e&&(s+=o),s},i=function(e,s){"querySelector"in document&&"addEventListener"in window&&(this.visible=!1,this.options={offset:300,offsetSide:"top",classes:{clone:"headhesive",stick:"headhesive--stick",unstick:"headhesive--unstick"},throttle:250,onInit:function(){},onStick:function(){},onUnstick:function(){},onDestroy:function(){}},this.elem="string"==typeof e?document.querySelector(e):e,this.options=t(this.options,s),this.init())};return i.prototype={constructor:i,init:function(){if(this.clonedElem=this.elem.cloneNode(!0),this.clonedElem.className+=" "+this.options.classes.clone,document.body.insertBefore(this.clonedElem,document.body.firstChild),"number"==typeof this.options.offset)this.scrollOffset=this.options.offset;else{if("string"!=typeof this.options.offset)throw new Error("Invalid offset: "+this.options.offset);this._setScrollOffset()}this._throttleUpdate=e(this.update.bind(this),this.options.throttle),this._throttleScrollOffset=e(this._setScrollOffset.bind(this),this.options.throttle),window.addEventListener("scroll",this._throttleUpdate,!1),window.addEventListener("resize",this._throttleScrollOffset,!1),this.options.onInit.call(this)},_setScrollOffset:function(){"string"==typeof this.options.offset&&(this.scrollOffset=o(document.querySelector(this.options.offset),this.options.offsetSide))},destroy:function(){document.body.removeChild(this.clonedElem),window.removeEventListener("scroll",this._throttleUpdate),window.removeEventListener("resize",this._throttleScrollOffset),this.options.onDestroy.call(this)},stick:function(){this.visible||(this.clonedElem.className=this.clonedElem.className.replace(new RegExp("(^|\\s)*"+this.options.classes.unstick+"(\\s|$)*","g"),""),this.clonedElem.className+=" "+this.options.classes.stick,this.visible=!0,this.options.onStick.call(this))},unstick:function(){this.visible&&(this.clonedElem.className=this.clonedElem.className.replace(new RegExp("(^|\\s)*"+this.options.classes.stick+"(\\s|$)*","g"),""),this.clonedElem.className+=" "+this.options.classes.unstick,this.visible=!1,this.options.onUnstick.call(this))},update:function(){s()>this.scrollOffset?this.stick():this.unstick()}},i}); | |
/*! js-url - v2.5.0 - 2017-04-22 */ | |
!function(){var a=function(){function a(){}function b(a){return decodeURIComponent(a.replace(/\+/g," "))}function c(a,b){var c=a.charAt(0),d=b.split(c);return c===a?d:(a=parseInt(a.substring(1),10),d[a<0?d.length+a:a-1])}function d(a,c){for(var d=a.charAt(0),e=c.split("&"),f=[],g={},h=[],i=a.substring(1),j=0,k=e.length;j<k;j++)if(f=e[j].match(/(.*?)=(.*)/),f||(f=[e[j],e[j],""]),""!==f[1].replace(/\s/g,"")){if(f[2]=b(f[2]||""),i===f[1])return f[2];h=f[1].match(/(.*)\[([0-9]+)\]/),h?(g[h[1]]=g[h[1]]||[],g[h[1]][h[2]]=f[2]):g[f[1]]=f[2]}return d===a?g:g[i]}return function(b,e){var f,g={};if("tld?"===b)return a();if(e=e||window.location.toString(),!b)return e;if(b=b.toString(),f=e.match(/^mailto:([^\/].+)/))g.protocol="mailto",g.email=f[1];else{if((f=e.match(/(.*?)\/#\!(.*)/))&&(e=f[1]+f[2]),(f=e.match(/(.*?)#(.*)/))&&(g.hash=f[2],e=f[1]),g.hash&&b.match(/^#/))return d(b,g.hash);if((f=e.match(/(.*?)\?(.*)/))&&(g.query=f[2],e=f[1]),g.query&&b.match(/^\?/))return d(b,g.query);if((f=e.match(/(.*?)\:?\/\/(.*)/))&&(g.protocol=f[1].toLowerCase(),e=f[2]),(f=e.match(/(.*?)(\/.*)/))&&(g.path=f[2],e=f[1]),g.path=(g.path||"").replace(/^([^\/])/,"/$1"),b.match(/^[\-0-9]+$/)&&(b=b.replace(/^([^\/])/,"/$1")),b.match(/^\//))return c(b,g.path.substring(1));if(f=c("/-1",g.path.substring(1)),f&&(f=f.match(/(.*?)\.(.*)/))&&(g.file=f[0],g.filename=f[1],g.fileext=f[2]),(f=e.match(/(.*)\:([0-9]+)$/))&&(g.port=f[2],e=f[1]),(f=e.match(/(.*?)@(.*)/))&&(g.auth=f[1],e=f[2]),g.auth&&(f=g.auth.match(/(.*)\:(.*)/),g.user=f?f[1]:g.auth,g.pass=f?f[2]:void 0),g.hostname=e.toLowerCase(),"."===b.charAt(0))return c(b,g.hostname);a()&&(f=g.hostname.match(a()),f&&(g.tld=f[3],g.domain=f[2]?f[2]+"."+f[3]:void 0,g.sub=f[1]||void 0)),g.port=g.port||("https"===g.protocol?"443":"80"),g.protocol=g.protocol||("443"===g.port?"https":"http")}return b in g?g[b]:"{}"===b?g:void 0}}();"function"==typeof window.define&&window.define.amd?window.define("js-url",[],function(){return a}):("undefined"!=typeof window.jQuery&&window.jQuery.extend({url:function(a,b){return window.url(a,b)}}),window.url=a)}(); | |
/*! npm.im/object-fit-images 3.2.3 */ | |
var objectFitImages=function(){"use strict";function t(t,e){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='"+t+"' height='"+e+"'%3E%3C/svg%3E"}function e(t){if(t.srcset&&!m&&window.picturefill){var e=window.picturefill._;t[e.ns]&&t[e.ns].evaled||e.fillImg(t,{reselect:!0}),t[e.ns].curSrc||(t[e.ns].supported=!1,e.fillImg(t,{reselect:!0})),t.currentSrc=t[e.ns].curSrc||t.src}}function i(t){for(var e,i=getComputedStyle(t).fontFamily,r={};null!==(e=l.exec(i));)r[e[1]]=e[2];return r}function r(e,i,r){var n=t(i||1,r||0);p.call(e,"src")!==n&&b.call(e,"src",n)}function n(t,e){t.naturalWidth?e(t):setTimeout(n,100,t,e)}function c(t){var c=i(t),o=t[a];if(c["object-fit"]=c["object-fit"]||"fill",!o.img){if("fill"===c["object-fit"])return;if(!o.skipTest&&g&&!c["object-position"])return}if(!o.img){o.img=new Image(t.width,t.height),o.img.srcset=p.call(t,"data-ofi-srcset")||t.srcset,o.img.src=p.call(t,"data-ofi-src")||t.src,b.call(t,"data-ofi-src",t.src),t.srcset&&b.call(t,"data-ofi-srcset",t.srcset),r(t,t.naturalWidth||t.width,t.naturalHeight||t.height),t.srcset&&(t.srcset="");try{s(t)}catch(t){window.console&&console.warn("https://bit.ly/ofi-old-browser")}}e(o.img),t.style.backgroundImage='url("'+(o.img.currentSrc||o.img.src).replace(/"/g,'\\"')+'")',t.style.backgroundPosition=c["object-position"]||"center",t.style.backgroundRepeat="no-repeat",t.style.backgroundOrigin="content-box",/scale-down/.test(c["object-fit"])?n(o.img,function(){o.img.naturalWidth>t.width||o.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=c["object-fit"].replace("none","auto").replace("fill","100% 100%"),n(o.img,function(e){r(t,e.naturalWidth,e.naturalHeight)})}function s(t){var e={get:function(e){return t[a].img[e||"src"]},set:function(e,i){return t[a].img[i||"src"]=e,b.call(t,"data-ofi-"+i,e),c(t),e}};Object.defineProperty(t,"src",e),Object.defineProperty(t,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(t,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}function o(t,e){var i=!h&&!t;if(e=e||{},t=t||"img",f&&!e.skipTest||!d)return!1;"img"===t?t=document.getElementsByTagName("img"):"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var r=0;r<t.length;r++)t[r][a]=t[r][a]||{skipTest:e.skipTest},c(t[r]);i&&(document.body.addEventListener("load",function(t){"IMG"===t.target.tagName&&o(t.target,{skipTest:e.skipTest})},!0),h=!0,t="img"),e.watchMQ&&window.addEventListener("resize",o.bind(null,t,{skipTest:e.skipTest}))}var a="bfred-it:object-fit-images",l=/(object-fit|object-position)\s*:\s*([-\w\s%]+)/g,u="undefined"==typeof Image?{style:{"object-position":1}}:new Image,g="object-fit"in u.style,f="object-position"in u.style,d="background-size"in u.style,m="string"==typeof u.currentSrc,p=u.getAttribute,b=u.setAttribute,h=!1;return o.supportsObjectFit=g,o.supportsObjectPosition=f,function(){function t(t,e){return t[a]&&t[a].img&&("src"===e||"srcset"===e)?t[a].img:t}f||(HTMLImageElement.prototype.getAttribute=function(e){return p.call(t(this,e),e)},HTMLImageElement.prototype.setAttribute=function(e,i){return b.call(t(this,e),e,String(i))})}(),o}(); | |
/*============================================================================ | |
Home page - social media | |
==============================================================================*/ | |
var social = { | |
twitter: function(){ | |
if (!window.twttr){ | |
//Initialize twitter feed | |
window.twttr = (function (d,s,id) { | |
var t, js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; js=d.createElement(s); js.id=id; | |
js.src="https://platform.twitter.com/widgets.js"; | |
fjs.parentNode.insertBefore(js, fjs); | |
return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } }); | |
}(document, "script", "twitter-wjs")); | |
} | |
if (window.twttr) { | |
window.twttr.ready(function (twttr) { | |
twttr.widgets.load( | |
document.getElementById("twitter-timeline") | |
); | |
}); | |
} | |
}, | |
unload: function(){ | |
} | |
} | |
var instagram = { | |
loadContent: function(s){ | |
if(s.clientID) { | |
var url = 'https://api.instagram.com/v1/users/self/media/recent/?access_token='+s.clientID; | |
$.ajax({ | |
type: 'GET', | |
url: url, | |
dataType: 'jsonp', | |
success: function(data) { | |
if(data.meta.code === 200 && data.data.length) { | |
var data = data.data; | |
var count = 0; | |
s.el.empty(); | |
for(var i = 0; i < data.length; i++) { | |
var thisMedia = data[i], item; | |
var url = thisMedia.images.standard_resolution.url; | |
if(!thisMedia.images.standard_resolution.url.indexOf("null") > -1) { | |
item = '<div class="il-photo__img instagram__bg" style="background-image:url('+url+')" data-filter="'+thisMedia.filter+'" /></div>'; | |
item = '<a href="'+thisMedia.link+'" target="_blank" class="instagram__link">'+item+'</a>'; | |
} | |
if(thisMedia.videos) { | |
item = '<div class="instagram__video instagram__bg" style="background-image:url('+url+')" data-filter="'+thisMedia.filter+'" /></div>'; | |
item = '<a href="'+thisMedia.link+'" target="_blank" class="instagram__link instagram__video-link">'+item+'</a>'; | |
} | |
if(item) { | |
item = '<div class="'+s.column+ ' columns instagram__item small-down--one-whole">'+item+'</div>'; | |
} | |
if(item !== '') { | |
s.el.append(item); | |
count++; | |
} | |
if(count == s.limit) { | |
break; | |
} | |
} | |
} | |
}, | |
error: function() { | |
} | |
}); | |
} | |
} | |
} | |
$('.social-feeds-wrap').each(function (index, value) { | |
social.twitter(); | |
var $target = $(this).find(".js-instafeed"); | |
instagram.loadContent({ | |
el: $target, | |
clientID: $target.data('client-id'), | |
limit: $target.data('count'), | |
column: $target.data('column') | |
}); | |
}); | |
$(document) | |
.on('shopify:block:select', function(e){ | |
var blockId = e.detail.blockId; | |
var $parentSection = $('#shopify-section-' + e.detail.sectionId); | |
if ($parentSection.hasClass('slideshow-section') || $parentSection.hasClass('testimonial-section')){ | |
sliderBlock.select(blockId, $parentSection); | |
} | |
if($parentSection.hasClass('page-details-section')){ | |
if($('.map-section').length) { | |
mapFunction.init(); | |
} | |
} | |
if ($parentSection.hasClass('cart-section')){ | |
if ($('.block__featured_collection').length){ | |
featuredCollectionSection.init(); | |
} | |
} | |
if ($parentSection.hasClass('product-template')){ | |
{% if settings.enable_shopify_review_comments %} | |
if($('#shopify-product-reviews').length >= 1) { | |
SPR.$(document).ready(function() { | |
return SPR.registerCallbacks(), | |
SPR.initRatingHandler(), | |
SPR.initDomEls(), | |
SPR.loadProducts(), | |
SPR.loadBadges() | |
}) | |
} | |
{% endif %} | |
} | |
utils.resizeActionButtons(); | |
}); | |
$(document) | |
.on('shopify:block:deselect', function(e){ | |
var $parentSection = $('#shopify-section-' + e.detail.sectionId); | |
if ($parentSection.hasClass('slideshow-section') || $parentSection.hasClass('testimonial-section')){ | |
sliderBlock.deselect($parentSection) | |
} | |
}); | |
$(document) | |
.on('shopify:section:reorder', function(e){ | |
utils.pageBannerCheck(); | |
}); | |
$(document) | |
.on('shopify:section:load', function(e){ | |
var $parentSection = $('#shopify-section-' + e.detail.sectionId); | |
utils.pageBannerCheck(); | |
{% if settings.newsletter_popup != blank %} | |
newsletter_popup.init(); | |
{% endif %} | |
if ($parentSection.hasClass('social-feeds-section')){ | |
$('.social-feeds-wrap').each(function (index, value) { | |
social.twitter(); | |
var $target = $(this).find(".js-instafeed"); | |
instagram.loadContent({ | |
el: $target, | |
clientID: $target.data('client-id'), | |
limit: $target.data('count'), | |
column: $target.data('column') | |
}); | |
}); | |
} | |
if ($parentSection.hasClass('faq-section')){ | |
faqAccordion.init(); | |
} | |
if ($parentSection.hasClass('cart-section')){ | |
cart.init(); | |
if ($('.block__featured_collection').length){ | |
featuredCollectionSection.init(); | |
} | |
} | |
if ($parentSection.hasClass('featured-promotions-section')){ | |
featuredPromotions.init(); | |
} | |
if ($parentSection.hasClass('slideshow-section')){ | |
slideshow.init(); | |
} | |
{% if settings.enable_autocomplete %} | |
if ($parentSection.hasClass('search-section')){ | |
searchAutocomplete.init(); | |
} | |
{% endif %} | |
if ($parentSection.hasClass('testimonial-section')){ | |
testimonial.init(); | |
} | |
if ($parentSection.hasClass('image-gallery-section')){ | |
gallery.init(); | |
} | |
if ($parentSection.hasClass('featured-products-section')){ | |
productPage.initializeQuantityBox(); | |
productPage.productSwatches(); | |
productPage.init(); | |
{% if settings.enable_shopify_review_comments %} | |
if($('.shopify-product-reviews-badge').length) { | |
SPR.$(document).ready(function() { | |
return SPR.registerCallbacks(), | |
SPR.initRatingHandler(), | |
SPR.initDomEls(), | |
SPR.loadProducts(), | |
SPR.loadBadges() | |
}) | |
} | |
{% endif %} | |
} | |
if($parentSection.hasClass('map-section')){ | |
mapFunction.init(); | |
} | |
if ($parentSection.hasClass('featured-collection-section')){ | |
featuredCollectionSection.init(); | |
} | |
if ($parentSection.hasClass('video-section')){ | |
videoSection.init(); | |
} | |
if ($parentSection.hasClass('recently-viewed__section')){ | |
recentlyViewed.init(); | |
} | |
if ($parentSection.hasClass('product-template')){ | |
productPage.init(); | |
productPage.productSwatches(); | |
productPage.relatedProducts(); | |
recentlyViewed.init(); | |
{% if settings.enable_shopify_review_comments %} | |
if($('#shopify-product-reviews').length || $('.shopify-product-reviews-badge').length) { | |
SPR.$(document).ready(function() { | |
return SPR.registerCallbacks(), | |
SPR.initRatingHandler(), | |
SPR.initDomEls(), | |
SPR.loadProducts(), | |
SPR.loadBadges() | |
}) | |
} | |
{% endif %} | |
} | |
if ($parentSection.hasClass('article-template-section')){ | |
if(window.location.pathname.indexOf('/comments') != -1) { | |
$('html,body').animate({scrollTop: $("#new-comment").offset().top-140},'slow'); | |
} | |
} | |
if ($parentSection.hasClass('collection-template-section')){ | |
collectionSidebarFilter.init(); | |
} | |
if($parentSection.hasClass('contact-section')){ | |
mapFunction.init(); | |
} | |
if ($parentSection.hasClass('search-template-section')){ | |
{% if settings.enable_autocomplete %} | |
searchAutocomplete.init(); | |
{% endif %} | |
collectionSidebarFilter.init(); | |
} | |
if ($parentSection.hasClass('header-section')){ | |
header.init(); | |
header.loadMegaMenu(); | |
} | |
if ($parentSection.hasClass('mega-menu-section')){ | |
header.loadMegaMenu(); | |
} | |
if ($parentSection.hasClass('page-details-section')) { | |
featuredCollectionSection.init(); | |
videoSection.init(); | |
recentlyViewed.init(); | |
} | |
if ($parentSection.hasClass('product-details-section')) { | |
featuredCollectionSection.init(); | |
videoSection.init(); | |
mapFunction.init(); | |
recentlyViewed.init(); | |
} | |
}); | |
$(document) | |
.on('shopify:section:unload', function(e){ | |
var $target = $(e.target); | |
var $parentSection = $('#shopify-section-' + e.detail.sectionId); | |
if ($parentSection.hasClass('header-section')){ | |
header.unload($target); | |
header.unloadMegaMenu(); | |
} | |
if ($parentSection.hasClass('slideshow-section')){ | |
slideshow.unload($target); | |
} | |
if ($parentSection.hasClass('testimonial-section')){ | |
testimonial.unload($target); | |
} | |
if ($parentSection.hasClass('video-section')){ | |
videoSection.unload($target); | |
} | |
if ($parentSection.hasClass('search-section')){ | |
searchAutocomplete.unload($target); | |
} | |
if ($parentSection.hasClass('product-template')){ | |
productPage.unload($target); | |
} | |
if ($parentSection.hasClass('mega-menu-section')){ | |
header.unloadMegaMenu(); | |
} | |
if ($parentSection.hasClass('page-details-section')) { | |
videoSection.unload($target); | |
} | |
if ($parentSection.hasClass('product-details-section')) { | |
videoSection.unload($target); | |
} | |
}); | |
$(document) | |
.on('shopify:section:select', function(e){ | |
var $parentSection = $('#shopify-section-' + e.detail.sectionId); | |
if ($parentSection.hasClass('social-feeds-section')){ | |
$('.social-feeds-wrap').each(function (index, value) { | |
social.twitter(); | |
}); | |
} | |
if ($parentSection.hasClass('mega-menu-section')){ | |
var megaMenuParent = $('.header .' + e.detail.sectionId).data('dropdown'); | |
setTimeout(function() { | |
$('a.mega-menu-parent[data-dropdown-rel="' + megaMenuParent + '"]').trigger('mouseenter'); | |
$('a.mega-menu-parent[data-dropdown-rel="' + megaMenuParent + '"]').parents('header').addClass('editor-hover--true'); | |
header.removeDataAttributes('.header .mega-menu.dropdown_container .dropdown_column'); | |
}, 10); | |
} | |
if ($parentSection.hasClass('featured-collection-section')){ | |
featuredCollectionSection.unload($parentSection); | |
featuredCollectionSection.init(); | |
} | |
utils.pageBannerCheck(); | |
var evt = document.createEvent('UIEvents'); | |
evt.initUIEvent('resize', true, false, window, 0); | |
window.dispatchEvent(evt); | |
}); | |
$(document) | |
.on('shopify:section:deselect', function(e){ | |
var $parentSection = $('#shopify-section-' + e.detail.sectionId); | |
if ($parentSection.hasClass('mega-menu-section')){ | |
var megaMenuParent = $('.header .' + e.detail.sectionId).data('dropdown'); | |
$('a.mega-menu-parent[data-dropdown-rel="' + megaMenuParent + '"]').trigger('mouseout'); | |
$('a.mega-menu-parent[data-dropdown-rel="' + megaMenuParent + '"]').parents('header').removeClass('editor-hover--true'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment