/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),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("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) },_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(Z),x("BeforeChange",function(e,t,n){t!==n&&(t===Z?D():n===Z&&D(!0))}),x(l+"."+Z,function(){D()})},getIframe:function(n,i){var o=n.src,r=t.st.iframe;e.each(r.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var a={};return r.srcAction&&(a[r.srcAction]=o),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var K=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},Y=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,i=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",x(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+i,function(e,n){n.text&&(n.text=Y(n.text,t.currItem.index,t.items.length))}),x(p+i,function(e,i,o,r){var a=t.items.length;o.counter=a>1?Y(n.tCounter,r.index,a):""}),x("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,o=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=r?"mfpFastClick":"click";o[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(o.add(a))}}),x(m+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+i,function(){o.off(i),t.wrap.off("click"+i),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=K(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=K(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),o=Math.min(n[1],t.items.length);for(e=1;(t.direction?o:i)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?i:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=K(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()})(window.jQuery||window.Zepto); ;/*! tooltipster v4.2.6 */!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){function b(a){this.$container,this.constraints=null,this.__$tooltip,this.__init(a)}function c(b,c){var d=!0;return a.each(b,function(a,e){return void 0===c[a]||b[a]!==c[a]?(d=!1,!1):void 0}),d}function d(b){var c=b.attr("id"),d=c?h.window.document.getElementById(c):null;return d?d===b[0]:a.contains(h.window.document.body,b[0])}function e(){if(!g)return!1;var a=g.document.body||g.document.documentElement,b=a.style,c="transition",d=["Moz","Webkit","Khtml","O","ms"];if("string"==typeof b[c])return!0;c=c.charAt(0).toUpperCase()+c.substr(1);for(var e=0;e0?e=c.__plugins[d]:a.each(c.__plugins,function(a,b){return b.name.substring(b.name.length-d.length-1)=="."+d?(e=b,!1):void 0}),e}if(b.name.indexOf(".")<0)throw new Error("Plugins must be namespaced");return c.__plugins[b.name]=b,b.core&&c.__bridge(b.core,c,b.name),this},_trigger:function(){var a=Array.prototype.slice.apply(arguments);return"string"==typeof a[0]&&(a[0]={type:a[0]}),this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,a),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,a),this},instances:function(b){var c=[],d=b||".tooltipstered";return a(d).each(function(){var b=a(this),d=b.data("tooltipster-ns");d&&a.each(d,function(a,d){c.push(b.data(d))})}),c},instancesLatest:function(){return this.__instancesLatestArr},off:function(){return this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},origins:function(b){var c=b?b+" ":"";return a(c+".tooltipstered").toArray()},setDefaults:function(b){return a.extend(f,b),this},triggerHandler:function(){return this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},a.tooltipster=new i,a.Tooltipster=function(b,c){this.__callbacks={close:[],open:[]},this.__closingTime,this.__Content,this.__contentBcr,this.__destroyed=!1,this.__$emitterPrivate=a({}),this.__$emitterPublic=a({}),this.__enabled=!0,this.__garbageCollector,this.__Geometry,this.__lastPosition,this.__namespace="tooltipster-"+Math.round(1e6*Math.random()),this.__options,this.__$originParents,this.__pointerIsOverOrigin=!1,this.__previousThemes=[],this.__state="closed",this.__timeouts={close:[],open:null},this.__touchEvents=[],this.__tracker=null,this._$origin,this._$tooltip,this.__init(b,c)},a.Tooltipster.prototype={__init:function(b,c){var d=this;if(d._$origin=a(b),d.__options=a.extend(!0,{},f,c),d.__optionsFormat(),!h.IE||h.IE>=d.__options.IEmin){var e=null;if(void 0===d._$origin.data("tooltipster-initialTitle")&&(e=d._$origin.attr("title"),void 0===e&&(e=null),d._$origin.data("tooltipster-initialTitle",e)),null!==d.__options.content)d.__contentSet(d.__options.content);else{var g,i=d._$origin.attr("data-tooltip-content");i&&(g=a(i)),g&&g[0]?d.__contentSet(g.first()):d.__contentSet(e)}d._$origin.removeAttr("title").addClass("tooltipstered"),d.__prepareOrigin(),d.__prepareGC(),a.each(d.__options.plugins,function(a,b){d._plug(b)}),h.hasTouchCapability&&a(h.window.document.body).on("touchmove."+d.__namespace+"-triggerOpen",function(a){d._touchRecordEvent(a)}),d._on("created",function(){d.__prepareTooltip()})._on("repositioned",function(a){d.__lastPosition=a.position})}else d.__options.disabled=!0},__contentInsert:function(){var a=this,b=a._$tooltip.find(".tooltipster-content"),c=a.__Content,d=function(a){c=a};return a._trigger({type:"format",content:a.__Content,format:d}),a.__options.functionFormat&&(c=a.__options.functionFormat.call(a,a,{origin:a._$origin[0]},a.__Content)),"string"!=typeof c||a.__options.contentAsHTML?b.empty().append(c):b.text(c),a},__contentSet:function(b){return b instanceof a&&this.__options.contentCloning&&(b=b.clone(!0)),this.__Content=b,this._trigger({type:"updated",content:b}),this},__destroyError:function(){throw new Error("This tooltip has been destroyed and cannot execute your method call.")},__geometry:function(){var b=this,c=b._$origin,d=b._$origin.is("area");if(d){var e=b._$origin.parent().attr("name");c=a('img[usemap="#'+e+'"]')}var f=c[0].getBoundingClientRect(),g=a(h.window.document),i=a(h.window),j=c,k={available:{document:null,window:null},document:{size:{height:g.height(),width:g.width()}},window:{scroll:{left:h.window.scrollX||h.window.document.documentElement.scrollLeft,top:h.window.scrollY||h.window.document.documentElement.scrollTop},size:{height:i.height(),width:i.width()}},origin:{fixedLineage:!1,offset:{},size:{height:f.bottom-f.top,width:f.right-f.left},usemapImage:d?c[0]:null,windowOffset:{bottom:f.bottom,left:f.left,right:f.right,top:f.top}}};if(d){var l=b._$origin.attr("shape"),m=b._$origin.attr("coords");if(m&&(m=m.split(","),a.map(m,function(a,b){m[b]=parseInt(a)})),"default"!=l)switch(l){case"circle":var n=m[0],o=m[1],p=m[2],q=o-p,r=n-p;k.origin.size.height=2*p,k.origin.size.width=k.origin.size.height,k.origin.windowOffset.left+=r,k.origin.windowOffset.top+=q;break;case"rect":var s=m[0],t=m[1],u=m[2],v=m[3];k.origin.size.height=v-t,k.origin.size.width=u-s,k.origin.windowOffset.left+=s,k.origin.windowOffset.top+=t;break;case"poly":for(var w=0,x=0,y=0,z=0,A="even",B=0;By&&(y=C,0===B&&(w=y)),w>C&&(w=C),A="odd"):(C>z&&(z=C,1==B&&(x=z)),x>C&&(x=C),A="even")}k.origin.size.height=z-x,k.origin.size.width=y-w,k.origin.windowOffset.left+=w,k.origin.windowOffset.top+=x}}var D=function(a){k.origin.size.height=a.height,k.origin.windowOffset.left=a.left,k.origin.windowOffset.top=a.top,k.origin.size.width=a.width};for(b._trigger({type:"geometry",edit:D,geometry:{height:k.origin.size.height,left:k.origin.windowOffset.left,top:k.origin.windowOffset.top,width:k.origin.size.width}}),k.origin.windowOffset.right=k.origin.windowOffset.left+k.origin.size.width,k.origin.windowOffset.bottom=k.origin.windowOffset.top+k.origin.size.height,k.origin.offset.left=k.origin.windowOffset.left+k.window.scroll.left,k.origin.offset.top=k.origin.windowOffset.top+k.window.scroll.top,k.origin.offset.bottom=k.origin.offset.top+k.origin.size.height,k.origin.offset.right=k.origin.offset.left+k.origin.size.width,k.available.document={bottom:{height:k.document.size.height-k.origin.offset.bottom,width:k.document.size.width},left:{height:k.document.size.height,width:k.origin.offset.left},right:{height:k.document.size.height,width:k.document.size.width-k.origin.offset.right},top:{height:k.origin.offset.top,width:k.document.size.width}},k.available.window={bottom:{height:Math.max(k.window.size.height-Math.max(k.origin.windowOffset.bottom,0),0),width:k.window.size.width},left:{height:k.window.size.height,width:Math.max(k.origin.windowOffset.left,0)},right:{height:k.window.size.height,width:Math.max(k.window.size.width-Math.max(k.origin.windowOffset.right,0),0)},top:{height:Math.max(k.origin.windowOffset.top,0),width:k.window.size.width}};"html"!=j[0].tagName.toLowerCase();){if("fixed"==j.css("position")){k.origin.fixedLineage=!0;break}j=j.parent()}return k},__optionsFormat:function(){return"number"==typeof this.__options.animationDuration&&(this.__options.animationDuration=[this.__options.animationDuration,this.__options.animationDuration]),"number"==typeof this.__options.delay&&(this.__options.delay=[this.__options.delay,this.__options.delay]),"number"==typeof this.__options.delayTouch&&(this.__options.delayTouch=[this.__options.delayTouch,this.__options.delayTouch]),"string"==typeof this.__options.theme&&(this.__options.theme=[this.__options.theme]),null===this.__options.parent?this.__options.parent=a(h.window.document.body):"string"==typeof this.__options.parent&&(this.__options.parent=a(this.__options.parent)),"hover"==this.__options.trigger?(this.__options.triggerOpen={mouseenter:!0,touchstart:!0},this.__options.triggerClose={mouseleave:!0,originClick:!0,touchleave:!0}):"click"==this.__options.trigger&&(this.__options.triggerOpen={click:!0,tap:!0},this.__options.triggerClose={click:!0,tap:!0}),this._trigger("options"),this},__prepareGC:function(){var b=this;return b.__options.selfDestruction?b.__garbageCollector=setInterval(function(){var c=(new Date).getTime();b.__touchEvents=a.grep(b.__touchEvents,function(a,b){return c-a.time>6e4}),d(b._$origin)||b.close(function(){b.destroy()})},2e4):clearInterval(b.__garbageCollector),b},__prepareOrigin:function(){var a=this;if(a._$origin.off("."+a.__namespace+"-triggerOpen"),h.hasTouchCapability&&a._$origin.on("touchstart."+a.__namespace+"-triggerOpen touchend."+a.__namespace+"-triggerOpen touchcancel."+a.__namespace+"-triggerOpen",function(b){a._touchRecordEvent(b)}),a.__options.triggerOpen.click||a.__options.triggerOpen.tap&&h.hasTouchCapability){var b="";a.__options.triggerOpen.click&&(b+="click."+a.__namespace+"-triggerOpen "),a.__options.triggerOpen.tap&&h.hasTouchCapability&&(b+="touchend."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){a._touchIsMeaningfulEvent(b)&&a._open(b)})}if(a.__options.triggerOpen.mouseenter||a.__options.triggerOpen.touchstart&&h.hasTouchCapability){var b="";a.__options.triggerOpen.mouseenter&&(b+="mouseenter."+a.__namespace+"-triggerOpen "),a.__options.triggerOpen.touchstart&&h.hasTouchCapability&&(b+="touchstart."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){!a._touchIsTouchEvent(b)&&a._touchIsEmulatedEvent(b)||(a.__pointerIsOverOrigin=!0,a._openShortly(b))})}if(a.__options.triggerClose.mouseleave||a.__options.triggerClose.touchleave&&h.hasTouchCapability){var b="";a.__options.triggerClose.mouseleave&&(b+="mouseleave."+a.__namespace+"-triggerOpen "),a.__options.triggerClose.touchleave&&h.hasTouchCapability&&(b+="touchend."+a.__namespace+"-triggerOpen touchcancel."+a.__namespace+"-triggerOpen"),a._$origin.on(b,function(b){a._touchIsMeaningfulEvent(b)&&(a.__pointerIsOverOrigin=!1)})}return a},__prepareTooltip:function(){var b=this,c=b.__options.interactive?"auto":"";return b._$tooltip.attr("id",b.__namespace).css({"pointer-events":c,zIndex:b.__options.zIndex}),a.each(b.__previousThemes,function(a,c){b._$tooltip.removeClass(c)}),a.each(b.__options.theme,function(a,c){b._$tooltip.addClass(c)}),b.__previousThemes=a.merge([],b.__options.theme),b},__scrollHandler:function(b){var c=this;if(c.__options.triggerClose.scroll)c._close(b);else if(d(c._$origin)&&d(c._$tooltip)){var e=null;if(b.target===h.window.document)c.__Geometry.origin.fixedLineage||c.__options.repositionOnScroll&&c.reposition(b);else{e=c.__geometry();var f=!1;if("fixed"!=c._$origin.css("position")&&c.__$originParents.each(function(b,c){var d=a(c),g=d.css("overflow-x"),h=d.css("overflow-y");if("visible"!=g||"visible"!=h){var i=c.getBoundingClientRect();if("visible"!=g&&(e.origin.windowOffset.lefti.right))return f=!0,!1;if("visible"!=h&&(e.origin.windowOffset.topi.bottom))return f=!0,!1}return"fixed"==d.css("position")?!1:void 0}),f)c._$tooltip.css("visibility","hidden");else if(c._$tooltip.css("visibility","visible"),c.__options.repositionOnScroll)c.reposition(b);else{var g=e.origin.offset.left-c.__Geometry.origin.offset.left,i=e.origin.offset.top-c.__Geometry.origin.offset.top;c._$tooltip.css({left:c.__lastPosition.coord.left+g,top:c.__lastPosition.coord.top+i})}}c._trigger({type:"scroll",event:b,geo:e})}return c},__stateSet:function(a){return this.__state=a,this._trigger({type:"state",state:a}),this},__timeoutsClear:function(){return clearTimeout(this.__timeouts.open),this.__timeouts.open=null,a.each(this.__timeouts.close,function(a,b){clearTimeout(b)}),this.__timeouts.close=[],this},__trackerStart:function(){var a=this,b=a._$tooltip.find(".tooltipster-content");return a.__options.trackTooltip&&(a.__contentBcr=b[0].getBoundingClientRect()),a.__tracker=setInterval(function(){if(d(a._$origin)&&d(a._$tooltip)){if(a.__options.trackOrigin){var e=a.__geometry(),f=!1;c(e.origin.size,a.__Geometry.origin.size)&&(a.__Geometry.origin.fixedLineage?c(e.origin.windowOffset,a.__Geometry.origin.windowOffset)&&(f=!0):c(e.origin.offset,a.__Geometry.origin.offset)&&(f=!0)),f||(a.__options.triggerClose.mouseleave?a._close():a.reposition())}if(a.__options.trackTooltip){var g=b[0].getBoundingClientRect();g.height===a.__contentBcr.height&&g.width===a.__contentBcr.width||(a.reposition(),a.__contentBcr=g)}}else a._close()},a.__options.trackerInterval),a},_close:function(b,c,d){var e=this,f=!0;if(e._trigger({type:"close",event:b,stop:function(){f=!1}}),f||d){c&&e.__callbacks.close.push(c),e.__callbacks.open=[],e.__timeoutsClear();var g=function(){a.each(e.__callbacks.close,function(a,c){c.call(e,e,{event:b,origin:e._$origin[0]})}),e.__callbacks.close=[]};if("closed"!=e.__state){var i=!0,j=new Date,k=j.getTime(),l=k+e.__options.animationDuration[1];if("disappearing"==e.__state&&l>e.__closingTime&&e.__options.animationDuration[1]>0&&(i=!1),i){e.__closingTime=l,"disappearing"!=e.__state&&e.__stateSet("disappearing");var m=function(){clearInterval(e.__tracker),e._trigger({type:"closing",event:b}),e._$tooltip.off("."+e.__namespace+"-triggerClose").removeClass("tooltipster-dying"),a(h.window).off("."+e.__namespace+"-triggerClose"),e.__$originParents.each(function(b,c){a(c).off("scroll."+e.__namespace+"-triggerClose")}),e.__$originParents=null,a(h.window.document.body).off("."+e.__namespace+"-triggerClose"),e._$origin.off("."+e.__namespace+"-triggerClose"),e._off("dismissable"),e.__stateSet("closed"),e._trigger({type:"after",event:b}),e.__options.functionAfter&&e.__options.functionAfter.call(e,e,{event:b,origin:e._$origin[0]}),g()};h.hasTransitions?(e._$tooltip.css({"-moz-animation-duration":e.__options.animationDuration[1]+"ms","-ms-animation-duration":e.__options.animationDuration[1]+"ms","-o-animation-duration":e.__options.animationDuration[1]+"ms","-webkit-animation-duration":e.__options.animationDuration[1]+"ms","animation-duration":e.__options.animationDuration[1]+"ms","transition-duration":e.__options.animationDuration[1]+"ms"}),e._$tooltip.clearQueue().removeClass("tooltipster-show").addClass("tooltipster-dying"),e.__options.animationDuration[1]>0&&e._$tooltip.delay(e.__options.animationDuration[1]),e._$tooltip.queue(m)):e._$tooltip.stop().fadeOut(e.__options.animationDuration[1],m)}}else g()}return e},_off:function(){return this.__$emitterPrivate.off.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_on:function(){return this.__$emitterPrivate.on.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_one:function(){return this.__$emitterPrivate.one.apply(this.__$emitterPrivate,Array.prototype.slice.apply(arguments)),this},_open:function(b,c){var e=this;if(!e.__destroying&&d(e._$origin)&&e.__enabled){var f=!0;if("closed"==e.__state&&(e._trigger({type:"before",event:b,stop:function(){f=!1}}),f&&e.__options.functionBefore&&(f=e.__options.functionBefore.call(e,e,{event:b,origin:e._$origin[0]}))),f!==!1&&null!==e.__Content){c&&e.__callbacks.open.push(c),e.__callbacks.close=[],e.__timeoutsClear();var g,i=function(){"stable"!=e.__state&&e.__stateSet("stable"),a.each(e.__callbacks.open,function(a,b){b.call(e,e,{origin:e._$origin[0],tooltip:e._$tooltip[0]})}),e.__callbacks.open=[]};if("closed"!==e.__state)g=0,"disappearing"===e.__state?(e.__stateSet("appearing"),h.hasTransitions?(e._$tooltip.clearQueue().removeClass("tooltipster-dying").addClass("tooltipster-show"),e.__options.animationDuration[0]>0&&e._$tooltip.delay(e.__options.animationDuration[0]),e._$tooltip.queue(i)):e._$tooltip.stop().fadeIn(i)):"stable"==e.__state&&i();else{if(e.__stateSet("appearing"),g=e.__options.animationDuration[0],e.__contentInsert(),e.reposition(b,!0),h.hasTransitions?(e._$tooltip.addClass("tooltipster-"+e.__options.animation).addClass("tooltipster-initial").css({"-moz-animation-duration":e.__options.animationDuration[0]+"ms","-ms-animation-duration":e.__options.animationDuration[0]+"ms","-o-animation-duration":e.__options.animationDuration[0]+"ms","-webkit-animation-duration":e.__options.animationDuration[0]+"ms","animation-duration":e.__options.animationDuration[0]+"ms","transition-duration":e.__options.animationDuration[0]+"ms"}),setTimeout(function(){"closed"!=e.__state&&(e._$tooltip.addClass("tooltipster-show").removeClass("tooltipster-initial"),e.__options.animationDuration[0]>0&&e._$tooltip.delay(e.__options.animationDuration[0]),e._$tooltip.queue(i))},0)):e._$tooltip.css("display","none").fadeIn(e.__options.animationDuration[0],i),e.__trackerStart(),a(h.window).on("resize."+e.__namespace+"-triggerClose",function(b){var c=a(document.activeElement);(c.is("input")||c.is("textarea"))&&a.contains(e._$tooltip[0],c[0])||e.reposition(b)}).on("scroll."+e.__namespace+"-triggerClose",function(a){e.__scrollHandler(a)}),e.__$originParents=e._$origin.parents(),e.__$originParents.each(function(b,c){a(c).on("scroll."+e.__namespace+"-triggerClose",function(a){e.__scrollHandler(a)})}),e.__options.triggerClose.mouseleave||e.__options.triggerClose.touchleave&&h.hasTouchCapability){e._on("dismissable",function(a){a.dismissable?a.delay?(m=setTimeout(function(){e._close(a.event)},a.delay),e.__timeouts.close.push(m)):e._close(a):clearTimeout(m)});var j=e._$origin,k="",l="",m=null;e.__options.interactive&&(j=j.add(e._$tooltip)),e.__options.triggerClose.mouseleave&&(k+="mouseenter."+e.__namespace+"-triggerClose ",l+="mouseleave."+e.__namespace+"-triggerClose "),e.__options.triggerClose.touchleave&&h.hasTouchCapability&&(k+="touchstart."+e.__namespace+"-triggerClose",l+="touchend."+e.__namespace+"-triggerClose touchcancel."+e.__namespace+"-triggerClose"),j.on(l,function(a){if(e._touchIsTouchEvent(a)||!e._touchIsEmulatedEvent(a)){var b="mouseleave"==a.type?e.__options.delay:e.__options.delayTouch;e._trigger({delay:b[1],dismissable:!0,event:a,type:"dismissable"})}}).on(k,function(a){!e._touchIsTouchEvent(a)&&e._touchIsEmulatedEvent(a)||e._trigger({dismissable:!1,event:a,type:"dismissable"})})}e.__options.triggerClose.originClick&&e._$origin.on("click."+e.__namespace+"-triggerClose",function(a){e._touchIsTouchEvent(a)||e._touchIsEmulatedEvent(a)||e._close(a)}),(e.__options.triggerClose.click||e.__options.triggerClose.tap&&h.hasTouchCapability)&&setTimeout(function(){if("closed"!=e.__state){var b="",c=a(h.window.document.body);e.__options.triggerClose.click&&(b+="click."+e.__namespace+"-triggerClose "),e.__options.triggerClose.tap&&h.hasTouchCapability&&(b+="touchend."+e.__namespace+"-triggerClose"),c.on(b,function(b){e._touchIsMeaningfulEvent(b)&&(e._touchRecordEvent(b),e.__options.interactive&&a.contains(e._$tooltip[0],b.target)||e._close(b))}),e.__options.triggerClose.tap&&h.hasTouchCapability&&c.on("touchstart."+e.__namespace+"-triggerClose",function(a){e._touchRecordEvent(a)})}},0),e._trigger("ready"),e.__options.functionReady&&e.__options.functionReady.call(e,e,{origin:e._$origin[0],tooltip:e._$tooltip[0]})}if(e.__options.timer>0){var m=setTimeout(function(){e._close()},e.__options.timer+g);e.__timeouts.close.push(m)}}}return e},_openShortly:function(a){var b=this,c=!0;if("stable"!=b.__state&&"appearing"!=b.__state&&!b.__timeouts.open&&(b._trigger({type:"start",event:a,stop:function(){c=!1}}),c)){var d=0==a.type.indexOf("touch")?b.__options.delayTouch:b.__options.delay;d[0]?b.__timeouts.open=setTimeout(function(){b.__timeouts.open=null,b.__pointerIsOverOrigin&&b._touchIsMeaningfulEvent(a)?(b._trigger("startend"),b._open(a)):b._trigger("startcancel")},d[0]):(b._trigger("startend"),b._open(a))}return b},_optionsExtract:function(b,c){var d=this,e=a.extend(!0,{},c),f=d.__options[b];return f||(f={},a.each(c,function(a,b){var c=d.__options[a];void 0!==c&&(f[a]=c)})),a.each(e,function(b,c){void 0!==f[b]&&("object"!=typeof c||c instanceof Array||null==c||"object"!=typeof f[b]||f[b]instanceof Array||null==f[b]?e[b]=f[b]:a.extend(e[b],f[b]))}),e},_plug:function(b){var c=a.tooltipster._plugin(b);if(!c)throw new Error('The "'+b+'" plugin is not defined');return c.instance&&a.tooltipster.__bridge(c.instance,this,c.name),this},_touchIsEmulatedEvent:function(a){for(var b=!1,c=(new Date).getTime(),d=this.__touchEvents.length-1;d>=0;d--){var e=this.__touchEvents[d];if(!(c-e.time<500))break;e.target===a.target&&(b=!0)}return b},_touchIsMeaningfulEvent:function(a){return this._touchIsTouchEvent(a)&&!this._touchSwiped(a.target)||!this._touchIsTouchEvent(a)&&!this._touchIsEmulatedEvent(a)},_touchIsTouchEvent:function(a){return 0==a.type.indexOf("touch")},_touchRecordEvent:function(a){return this._touchIsTouchEvent(a)&&(a.time=(new Date).getTime(),this.__touchEvents.push(a)),this},_touchSwiped:function(a){for(var b=!1,c=this.__touchEvents.length-1;c>=0;c--){var d=this.__touchEvents[c];if("touchmove"==d.type){b=!0;break}if("touchstart"==d.type&&a===d.target)break}return b},_trigger:function(){var b=Array.prototype.slice.apply(arguments);return"string"==typeof b[0]&&(b[0]={type:b[0]}),b[0].instance=this,b[0].origin=this._$origin?this._$origin[0]:null,b[0].tooltip=this._$tooltip?this._$tooltip[0]:null,this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate,b),a.tooltipster._trigger.apply(a.tooltipster,b),this.__$emitterPublic.trigger.apply(this.__$emitterPublic,b),this},_unplug:function(b){var c=this;if(c[b]){var d=a.tooltipster._plugin(b);d.instance&&a.each(d.instance,function(a,d){c[a]&&c[a].bridged===c[b]&&delete c[a]}),c[b].__destroy&&c[b].__destroy(),delete c[b]}return c},close:function(a){return this.__destroyed?this.__destroyError():this._close(null,a),this},content:function(a){var b=this;if(void 0===a)return b.__Content;if(b.__destroyed)b.__destroyError();else if(b.__contentSet(a),null!==b.__Content){if("closed"!==b.__state&&(b.__contentInsert(),b.reposition(),b.__options.updateAnimation))if(h.hasTransitions){var c=b.__options.updateAnimation;b._$tooltip.addClass("tooltipster-update-"+c),setTimeout(function(){"closed"!=b.__state&&b._$tooltip.removeClass("tooltipster-update-"+c)},1e3)}else b._$tooltip.fadeTo(200,.5,function(){"closed"!=b.__state&&b._$tooltip.fadeTo(200,1)})}else b._close();return b},destroy:function(){var b=this;if(b.__destroyed)b.__destroyError();else{"closed"!=b.__state?b.option("animationDuration",0)._close(null,null,!0):b.__timeoutsClear(),b._trigger("destroy"),b.__destroyed=!0,b._$origin.removeData(b.__namespace).off("."+b.__namespace+"-triggerOpen"),a(h.window.document.body).off("."+b.__namespace+"-triggerOpen");var c=b._$origin.data("tooltipster-ns");if(c)if(1===c.length){var d=null;"previous"==b.__options.restoration?d=b._$origin.data("tooltipster-initialTitle"):"current"==b.__options.restoration&&(d="string"==typeof b.__Content?b.__Content:a("
").append(b.__Content).html()),d&&b._$origin.attr("title",d),b._$origin.removeClass("tooltipstered"),b._$origin.removeData("tooltipster-ns").removeData("tooltipster-initialTitle")}else c=a.grep(c,function(a,c){return a!==b.__namespace}),b._$origin.data("tooltipster-ns",c);b._trigger("destroyed"),b._off(),b.off(),b.__Content=null,b.__$emitterPrivate=null,b.__$emitterPublic=null,b.__options.parent=null,b._$origin=null,b._$tooltip=null,a.tooltipster.__instancesLatestArr=a.grep(a.tooltipster.__instancesLatestArr,function(a,c){return b!==a}),clearInterval(b.__garbageCollector)}return b},disable:function(){return this.__destroyed?(this.__destroyError(),this):(this._close(),this.__enabled=!1,this)},elementOrigin:function(){return this.__destroyed?void this.__destroyError():this._$origin[0]},elementTooltip:function(){return this._$tooltip?this._$tooltip[0]:null},enable:function(){return this.__enabled=!0,this},hide:function(a){return this.close(a)},instance:function(){return this},off:function(){return this.__destroyed||this.__$emitterPublic.off.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},on:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.on.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},one:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.one.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this},open:function(a){return this.__destroyed?this.__destroyError():this._open(null,a),this},option:function(b,c){return void 0===c?this.__options[b]:(this.__destroyed?this.__destroyError():(this.__options[b]=c,this.__optionsFormat(),a.inArray(b,["trigger","triggerClose","triggerOpen"])>=0&&this.__prepareOrigin(),"selfDestruction"===b&&this.__prepareGC()),this)},reposition:function(a,b){var c=this;return c.__destroyed?c.__destroyError():"closed"!=c.__state&&d(c._$origin)&&(b||d(c._$tooltip))&&(b||c._$tooltip.detach(),c.__Geometry=c.__geometry(),c._trigger({type:"reposition",event:a,helper:{geo:c.__Geometry}})),c},show:function(a){return this.open(a)},status:function(){return{destroyed:this.__destroyed,enabled:this.__enabled,open:"closed"!==this.__state,state:this.__state}},triggerHandler:function(){return this.__destroyed?this.__destroyError():this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic,Array.prototype.slice.apply(arguments)),this}},a.fn.tooltipster=function(){var b=Array.prototype.slice.apply(arguments),c="You are using a single HTML element as content for several tooltips. You probably want to set the contentCloning option to TRUE.";if(0===this.length)return this;if("string"==typeof b[0]){var d="#*$~&";return this.each(function(){var e=a(this).data("tooltipster-ns"),f=e?a(this).data(e[0]):null;if(!f)throw new Error("You called Tooltipster's \""+b[0]+'" method on an uninitialized element');if("function"!=typeof f[b[0]])throw new Error('Unknown method "'+b[0]+'"');this.length>1&&"content"==b[0]&&(b[1]instanceof a||"object"==typeof b[1]&&null!=b[1]&&b[1].tagName)&&!f.__options.contentCloning&&f.__options.debug&&console.log(c);var g=f[b[0]](b[1],b[2]);return g!==f||"instance"===b[0]?(d=g,!1):void 0}),"#*$~&"!==d?d:this}a.tooltipster.__instancesLatestArr=[];var e=b[0]&&void 0!==b[0].multiple,g=e&&b[0].multiple||!e&&f.multiple,h=b[0]&&void 0!==b[0].content,i=h&&b[0].content||!h&&f.content,j=b[0]&&void 0!==b[0].contentCloning,k=j&&b[0].contentCloning||!j&&f.contentCloning,l=b[0]&&void 0!==b[0].debug,m=l&&b[0].debug||!l&&f.debug;return this.length>1&&(i instanceof a||"object"==typeof i&&null!=i&&i.tagName)&&!k&&m&&console.log(c),this.each(function(){var c=!1,d=a(this),e=d.data("tooltipster-ns"),f=null;e?g?c=!0:m&&(console.log("Tooltipster: one or more tooltips are already attached to the element below. Ignoring."),console.log(this)):c=!0,c&&(f=new a.Tooltipster(this,b[0]),e||(e=[]),e.push(f.__namespace),d.data("tooltipster-ns",e),d.data(f.__namespace,f),f.__options.functionInit&&f.__options.functionInit.call(f,f,{origin:this}),f._trigger("init")),a.tooltipster.__instancesLatestArr.push(f)}),this},b.prototype={__init:function(b){this.__$tooltip=b,this.__$tooltip.css({left:0,overflow:"hidden",position:"absolute",top:0}).find(".tooltipster-content").css("overflow","auto"),this.$container=a('
').append(this.__$tooltip).appendTo(h.window.document.body)},__forceRedraw:function(){var a=this.__$tooltip.parent();this.__$tooltip.detach(),this.__$tooltip.appendTo(a)},constrain:function(a,b){return this.constraints={width:a,height:b},this.__$tooltip.css({display:"block",height:"",overflow:"auto",width:a}),this},destroy:function(){this.__$tooltip.detach().find(".tooltipster-content").css({display:"",overflow:""}),this.$container.remove()},free:function(){return this.constraints=null,this.__$tooltip.css({display:"",height:"",overflow:"visible",width:""}),this},measure:function(){this.__forceRedraw();var a=this.__$tooltip[0].getBoundingClientRect(),b={size:{height:a.height||a.bottom-a.top,width:a.width||a.right-a.left}};if(this.constraints){var c=this.__$tooltip.find(".tooltipster-content"),d=this.__$tooltip.outerHeight(),e=c[0].getBoundingClientRect(),f={height:d<=this.constraints.height,width:a.width<=this.constraints.width&&e.width>=c[0].scrollWidth-1};b.fits=f.height&&f.width}return h.IE&&h.IE<=11&&b.size.width!==h.window.document.documentElement.clientWidth&&(b.size.width=Math.ceil(b.size.width)+1),b}};var j=navigator.userAgent.toLowerCase();-1!=j.indexOf("msie")?h.IE=parseInt(j.split("msie")[1]):-1!==j.toLowerCase().indexOf("trident")&&-1!==j.indexOf(" rv:11")?h.IE=11:-1!=j.toLowerCase().indexOf("edge/")&&(h.IE=parseInt(j.toLowerCase().split("edge/")[1]));var k="tooltipster.sideTip";return a.tooltipster._plugin({name:k,instance:{__defaults:function(){return{arrow:!0,distance:6,functionPosition:null,maxWidth:null,minIntersection:16,minWidth:0,position:null,side:"top",viewportAware:!0}},__init:function(a){var b=this;b.__instance=a,b.__namespace="tooltipster-sideTip-"+Math.round(1e6*Math.random()),b.__previousState="closed",b.__options,b.__optionsFormat(),b.__instance._on("state."+b.__namespace,function(a){"closed"==a.state?b.__close():"appearing"==a.state&&"closed"==b.__previousState&&b.__create(),b.__previousState=a.state}),b.__instance._on("options."+b.__namespace,function(){b.__optionsFormat()}),b.__instance._on("reposition."+b.__namespace,function(a){b.__reposition(a.event,a.helper)})},__close:function(){this.__instance.content()instanceof a&&this.__instance.content().detach(),this.__instance._$tooltip.remove(),this.__instance._$tooltip=null},__create:function(){var b=a('
');this.__options.arrow||b.find(".tooltipster-box").css("margin",0).end().find(".tooltipster-arrow").hide(),this.__options.minWidth&&b.css("min-width",this.__options.minWidth+"px"),this.__options.maxWidth&&b.css("max-width",this.__options.maxWidth+"px"), this.__instance._$tooltip=b,this.__instance._trigger("created")},__destroy:function(){this.__instance._off("."+self.__namespace)},__optionsFormat:function(){var b=this;if(b.__options=b.__instance._optionsExtract(k,b.__defaults()),b.__options.position&&(b.__options.side=b.__options.position),"object"!=typeof b.__options.distance&&(b.__options.distance=[b.__options.distance]),b.__options.distance.length<4&&(void 0===b.__options.distance[1]&&(b.__options.distance[1]=b.__options.distance[0]),void 0===b.__options.distance[2]&&(b.__options.distance[2]=b.__options.distance[0]),void 0===b.__options.distance[3]&&(b.__options.distance[3]=b.__options.distance[1]),b.__options.distance={top:b.__options.distance[0],right:b.__options.distance[1],bottom:b.__options.distance[2],left:b.__options.distance[3]}),"string"==typeof b.__options.side){var c={top:"bottom",right:"left",bottom:"top",left:"right"};b.__options.side=[b.__options.side,c[b.__options.side]],"left"==b.__options.side[0]||"right"==b.__options.side[0]?b.__options.side.push("top","bottom"):b.__options.side.push("right","left")}6===a.tooltipster._env.IE&&b.__options.arrow!==!0&&(b.__options.arrow=!1)},__reposition:function(b,c){var d,e=this,f=e.__targetFind(c),g=[];e.__instance._$tooltip.detach();var h=e.__instance._$tooltip.clone(),i=a.tooltipster._getRuler(h),j=!1,k=e.__instance.option("animation");switch(k&&h.removeClass("tooltipster-"+k),a.each(["window","document"],function(d,k){var l=null;if(e.__instance._trigger({container:k,helper:c,satisfied:j,takeTest:function(a){l=a},results:g,type:"positionTest"}),1==l||0!=l&&0==j&&("window"!=k||e.__options.viewportAware))for(var d=0;d=h.outerSize.width&&c.geo.available[k][n].height>=h.outerSize.height?h.fits=!0:h.fits=!1:h.fits=p.fits,"window"==k&&(h.fits?"top"==n||"bottom"==n?h.whole=c.geo.origin.windowOffset.right>=e.__options.minIntersection&&c.geo.window.size.width-c.geo.origin.windowOffset.left>=e.__options.minIntersection:h.whole=c.geo.origin.windowOffset.bottom>=e.__options.minIntersection&&c.geo.window.size.height-c.geo.origin.windowOffset.top>=e.__options.minIntersection:h.whole=!1),g.push(h),h.whole)j=!0;else if("natural"==h.mode&&(h.fits||h.size.width<=c.geo.available[k][n].width))return!1}})}}),e.__instance._trigger({edit:function(a){g=a},event:b,helper:c,results:g,type:"positionTested"}),g.sort(function(a,b){if(a.whole&&!b.whole)return-1;if(!a.whole&&b.whole)return 1;if(a.whole&&b.whole){var c=e.__options.side.indexOf(a.side),d=e.__options.side.indexOf(b.side);return d>c?-1:c>d?1:"natural"==a.mode?-1:1}if(a.fits&&!b.fits)return-1;if(!a.fits&&b.fits)return 1;if(a.fits&&b.fits){var c=e.__options.side.indexOf(a.side),d=e.__options.side.indexOf(b.side);return d>c?-1:c>d?1:"natural"==a.mode?-1:1}return"document"==a.container&&"bottom"==a.side&&"natural"==a.mode?-1:1}),d=g[0],d.coord={},d.side){case"left":case"right":d.coord.top=Math.floor(d.target-d.size.height/2);break;case"bottom":case"top":d.coord.left=Math.floor(d.target-d.size.width/2)}switch(d.side){case"left":d.coord.left=c.geo.origin.windowOffset.left-d.outerSize.width;break;case"right":d.coord.left=c.geo.origin.windowOffset.right+d.distance.horizontal;break;case"top":d.coord.top=c.geo.origin.windowOffset.top-d.outerSize.height;break;case"bottom":d.coord.top=c.geo.origin.windowOffset.bottom+d.distance.vertical}"window"==d.container?"top"==d.side||"bottom"==d.side?d.coord.left<0?c.geo.origin.windowOffset.right-this.__options.minIntersection>=0?d.coord.left=0:d.coord.left=c.geo.origin.windowOffset.right-this.__options.minIntersection-1:d.coord.left>c.geo.window.size.width-d.size.width&&(c.geo.origin.windowOffset.left+this.__options.minIntersection<=c.geo.window.size.width?d.coord.left=c.geo.window.size.width-d.size.width:d.coord.left=c.geo.origin.windowOffset.left+this.__options.minIntersection+1-d.size.width):d.coord.top<0?c.geo.origin.windowOffset.bottom-this.__options.minIntersection>=0?d.coord.top=0:d.coord.top=c.geo.origin.windowOffset.bottom-this.__options.minIntersection-1:d.coord.top>c.geo.window.size.height-d.size.height&&(c.geo.origin.windowOffset.top+this.__options.minIntersection<=c.geo.window.size.height?d.coord.top=c.geo.window.size.height-d.size.height:d.coord.top=c.geo.origin.windowOffset.top+this.__options.minIntersection+1-d.size.height):(d.coord.left>c.geo.window.size.width-d.size.width&&(d.coord.left=c.geo.window.size.width-d.size.width),d.coord.left<0&&(d.coord.left=0)),e.__sideChange(h,d.side),c.tooltipClone=h[0],c.tooltipParent=e.__instance.option("parent").parent[0],c.mode=d.mode,c.whole=d.whole,c.origin=e.__instance._$origin[0],c.tooltip=e.__instance._$tooltip[0],delete d.container,delete d.fits,delete d.mode,delete d.outerSize,delete d.whole,d.distance=d.distance.horizontal||d.distance.vertical;var l=a.extend(!0,{},d);if(e.__instance._trigger({edit:function(a){d=a},event:b,helper:c,position:l,type:"position"}),e.__options.functionPosition){var m=e.__options.functionPosition.call(e,e.__instance,c,l);m&&(d=m)}i.destroy();var n,o;"top"==d.side||"bottom"==d.side?(n={prop:"left",val:d.target-d.coord.left},o=d.size.width-this.__options.minIntersection):(n={prop:"top",val:d.target-d.coord.top},o=d.size.height-this.__options.minIntersection),n.valo&&(n.val=o);var p;p=c.geo.origin.fixedLineage?c.geo.origin.windowOffset:{left:c.geo.origin.windowOffset.left+c.geo.window.scroll.left,top:c.geo.origin.windowOffset.top+c.geo.window.scroll.top},d.coord={left:p.left+(d.coord.left-c.geo.origin.windowOffset.left),top:p.top+(d.coord.top-c.geo.origin.windowOffset.top)},e.__sideChange(e.__instance._$tooltip,d.side),c.geo.origin.fixedLineage?e.__instance._$tooltip.css("position","fixed"):e.__instance._$tooltip.css("position",""),e.__instance._$tooltip.css({left:d.coord.left,top:d.coord.top,height:d.size.height,width:d.size.width}).find(".tooltipster-arrow").css({left:"",top:""}).css(n.prop,n.val),e.__instance._$tooltip.appendTo(e.__instance.option("parent")),e.__instance._trigger({type:"repositioned",event:b,position:d})},__sideChange:function(a,b){a.removeClass("tooltipster-bottom").removeClass("tooltipster-left").removeClass("tooltipster-right").removeClass("tooltipster-top").addClass("tooltipster-"+b)},__targetFind:function(a){var b={},c=this.__instance._$origin[0].getClientRects();if(c.length>1){var d=this.__instance._$origin.css("opacity");1==d&&(this.__instance._$origin.css("opacity",.99),c=this.__instance._$origin[0].getClientRects(),this.__instance._$origin.css("opacity",1))}if(c.length<2)b.top=Math.floor(a.geo.origin.windowOffset.left+a.geo.origin.size.width/2),b.bottom=b.top,b.left=Math.floor(a.geo.origin.windowOffset.top+a.geo.origin.size.height/2),b.right=b.left;else{var e=c[0];b.top=Math.floor(e.left+(e.right-e.left)/2),e=c.length>2?c[Math.ceil(c.length/2)-1]:c[0],b.right=Math.floor(e.top+(e.bottom-e.top)/2),e=c[c.length-1],b.bottom=Math.floor(e.left+(e.right-e.left)/2),e=c.length>2?c[Math.ceil((c.length+1)/2)-1]:c[c.length-1],b.left=Math.floor(e.top+(e.bottom-e.top)/2)}return b}}}),a}); ;function octShowProducts(octButtonID,octModuleID,itemsLimit,countProducts){const currentWidth=viewport().width;if(currentWidth>1200){itemsLimit=12;}else if((currentWidth<=1200)&&(currentWidth>992)){itemsLimit=8;}else if(currentWidth<=992){itemsLimit=6;} const buttonID=octButtonID;const moduleID=octModuleID+' > .item-box:hidden';if(countProducts<=itemsLimit){$('#'+buttonID).parent().parent().parent().hide();} $('#'+moduleID).slice(0,itemsLimit).show();$('#'+buttonID).on('click',function(){$('#'+moduleID).slice(0,itemsLimit).slideToggle(50);if($('#'+moduleID).length==0){let href=$('#'+buttonID).parent().parent().parent().parent().children('.carousel-module-row').children('.carousel-module-row-header').children('a').attr('href');$('#'+buttonID).html('Посмотреть все предложения');$('#'+buttonID).attr('onclick','window.location.href = "'+href+'"');$('#'+buttonID).removeAttr('id');}});} ; ;(function($, window, document, undefined){ function Owl(element, options){ this.settings = null; this.options = $.extend({}, Owl.Defaults, options); this.$element = $(element); this._handlers ={}; this._plugins ={}; this._supress ={}; this._current = null; this._speed = null; this._coordinates = []; this._breakpoint = null; this._width = null; this._items = []; this._clones = []; this._mergers = []; this._widths = []; this._invalidated ={}; this._pipe = []; this._drag ={ time:null, target:null, pointer:null, stage:{ start:null, current:null }, direction:null }; this._states ={ current:{}, tags:{ 'initializing':[ 'busy' ], 'animating':[ 'busy' ], 'dragging':[ 'interacting' ] } }; $.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler){ this._handlers[handler] = $.proxy(this[handler], this); }, this)); $.each(Owl.Plugins, $.proxy(function(key, plugin){ this._plugins[key.charAt(0).toLowerCase() + key.slice(1)] = new plugin(this); }, this)); $.each(Owl.Workers, $.proxy(function(priority, worker){ this._pipe.push({ 'filter':worker.filter, 'run':$.proxy(worker.run, this) }); }, this)); this.setup(); this.initialize(); } Owl.Defaults ={ items:3, loop:false, center:false, rewind:false, checkVisibility:true, mouseDrag:true, touchDrag:true, pullDrag:true, freeDrag:false, margin:0, stagePadding:0, merge:false, mergeFit:true, autoWidth:false, startPosition:0, rtl:false, smartSpeed:250, fluidSpeed:false, dragEndSpeed:false, responsive:{}, responsiveRefreshRate:200, responsiveBaseElement:window, fallbackEasing:'swing', slideTransition:'', info:false, nestedItemSelector:false, itemElement:'div', stageElement:'div', refreshClass:'owl-refresh', loadedClass:'owl-loaded', loadingClass:'owl-loading', rtlClass:'owl-rtl', responsiveClass:'owl-responsive', dragClass:'owl-drag', itemClass:'owl-item', stageClass:'owl-stage', stageOuterClass:'owl-stage-outer', grabClass:'owl-grab' }; Owl.Width ={ Default:'default', Inner:'inner', Outer:'outer' }; Owl.Type ={ Event:'event', State:'state' }; Owl.Plugins ={}; Owl.Workers = [{ filter:[ 'width', 'settings' ], run:function(){ this._width = this.$element.width(); } },{ filter:[ 'width', 'items', 'settings' ], run:function(cache){ cache.current = this._items && this._items[this.relative(this._current)]; } },{ filter:[ 'items', 'settings' ], run:function(){ this.$stage.children('.cloned').remove(); } },{ filter:[ 'width', 'items', 'settings' ], run:function(cache){ var margin = this.settings.margin || '', grid = !this.settings.autoWidth, rtl = this.settings.rtl, css ={ 'width':'auto', 'margin-left':rtl ? margin :'', 'margin-right':rtl ? '' :margin }; !grid && this.$stage.children().css(css); cache.css = css; } },{ filter:[ 'width', 'items', 'settings' ], run:function(cache){ var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, merge = null, iterator = this._items.length, grid = !this.settings.autoWidth, widths = []; cache.items ={ merge:false, width:width }; while (iterator--){ merge = this._mergers[iterator]; merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge; cache.items.merge = merge > 1 || cache.items.merge; widths[iterator] = !grid ? this._items[iterator].width() :width * merge; } this._widths = widths; } },{ filter:[ 'items', 'settings' ], run:function(){ var clones = [], items = this._items, settings = this.settings, // TODO:Should be computed from number of min width items in stage view = Math.max(settings.items * 2, 4), size = Math.ceil(items.length / 2) * 2, repeat = settings.loop && items.length ? settings.rewind ? view :Math.max(view, size) :0, append = '', prepend = ''; repeat /= 2; while (repeat > 0){ // Switch to only using appended clones clones.push(this.normalize(clones.length / 2, true)); append = append + items[clones[clones.length - 1]][0].outerHTML; clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true)); prepend = items[clones[clones.length - 1]][0].outerHTML + prepend; repeat -= 1; } this._clones = clones; $(append).addClass('cloned').appendTo(this.$stage); $(prepend).addClass('cloned').prependTo(this.$stage); } },{ filter:[ 'width', 'items', 'settings' ], run:function(){ var rtl = this.settings.rtl ? 1 :-1, size = this._clones.length + this._items.length, iterator = -1, previous = 0, current = 0, coordinates = []; while (++iterator < size){ previous = coordinates[iterator - 1] || 0; current = this._widths[this.relative(iterator)] + this.settings.margin; coordinates.push(previous + current * rtl); } this._coordinates = coordinates; } },{ filter:[ 'width', 'items', 'settings' ], run:function(){ var padding = this.settings.stagePadding, coordinates = this._coordinates, css ={ 'width':Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2, 'padding-left':padding || '', 'padding-right':padding || '' }; this.$stage.css(css); } },{ filter:[ 'width', 'items', 'settings' ], run:function(cache){ var iterator = this._coordinates.length, grid = !this.settings.autoWidth, items = this.$stage.children(); if (grid && cache.items.merge){ while (iterator--){ cache.css.width = this._widths[this.relative(iterator)]; items.eq(iterator).css(cache.css); } }else if (grid){ cache.css.width = cache.items.width; items.css(cache.css); } } },{ filter:[ 'items' ], run:function(){ this._coordinates.length < 1 && this.$stage.removeAttr('style'); } },{ filter:[ 'width', 'items', 'settings' ], run:function(cache){ cache.current = cache.current ? this.$stage.children().index(cache.current) :0; cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current)); this.reset(cache.current); } },{ filter:[ 'position' ], run:function(){ this.animate(this.coordinates(this._current)); } },{ filter:[ 'width', 'position', 'items', 'settings' ], run:function(){ var rtl = this.settings.rtl ? 1 :-1, padding = this.settings.stagePadding * 2, begin = this.coordinates(this.current()) + padding, end = begin + this.width() * rtl, inner, outer, matches = [], i, n; for (i = 0, n = this._coordinates.length;i < n;i++){ inner = this._coordinates[i - 1] || 0; outer = Math.abs(this._coordinates[i]) + padding * rtl; if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end))) || (this.op(outer, '<', begin) && this.op(outer, '>', end))){ matches.push(i); } } this.$stage.children('.active').removeClass('active'); this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active'); this.$stage.children('.center').removeClass('center'); if (this.settings.center){ this.$stage.children().eq(this.current()).addClass('center'); } } }]; Owl.prototype.initializeStage = function(){ this.$stage = this.$element.find('.' + this.settings.stageClass); // if the stage is already in the DOM, grab it and skip stage initialization if (this.$stage.length){ return; } this.$element.addClass(this.options.loadingClass); // create stage this.$stage = $('<' + this.settings.stageElement + '>',{ "class":this.settings.stageClass }).wrap( $( '
',{ "class":this.settings.stageOuterClass })); // append stage this.$element.append(this.$stage.parent()); }; Owl.prototype.initializeItems = function(){ var $items = this.$element.find('.owl-item'); // if the items are already in the DOM, grab them and skip item initialization if ($items.length){ this._items = $items.get().map(function(item){ return $(item); }); this._mergers = this._items.map(function(){ return 1; }); this.refresh(); return; } // append content this.replace(this.$element.children().not(this.$stage.parent())); // check visibility if (this.isVisible()){ // update view this.refresh(); }else{ // invalidate width this.invalidate('width'); } this.$element .removeClass(this.options.loadingClass) .addClass(this.options.loadedClass); }; Owl.prototype.initialize = function(){ this.enter('initializing'); this.trigger('initialize'); this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl); if (this.settings.autoWidth && !this.is('pre-loading')){ var imgs, nestedSelector, width; imgs = this.$element.find('img'); nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector :undefined; width = this.$element.children(nestedSelector).width(); if (imgs.length && width <= 0){ this.preloadAutoWidthImages(imgs); } } this.initializeStage(); this.initializeItems(); // register event handlers this.registerEventHandlers(); this.leave('initializing'); this.trigger('initialized'); }; Owl.prototype.isVisible = function(){ return this.settings.checkVisibility ? this.$element.is(':visible') :true; }; Owl.prototype.setup = function(){ var viewport = this.viewport(), overwrites = this.options.responsive, match = -1, settings = null; if (!overwrites){ settings = $.extend({}, this.options); }else{ $.each(overwrites, function(breakpoint){ if (breakpoint <= viewport && breakpoint > match){ match = Number(breakpoint); } }); settings = $.extend({}, this.options, overwrites[match]); if (typeof settings.stagePadding === 'function'){ settings.stagePadding = settings.stagePadding(); } delete settings.responsive; // responsive class if (settings.responsiveClass){ this.$element.attr('class', this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match) ); } } this.trigger('change',{property:{name:'settings', value:settings}}); this._breakpoint = match; this.settings = settings; this.invalidate('settings'); this.trigger('changed',{property:{name:'settings', value:this.settings}}); }; Owl.prototype.optionsLogic = function(){ if (this.settings.autoWidth){ this.settings.stagePadding = false; this.settings.merge = false; } }; Owl.prototype.prepare = function(item){ var event = this.trigger('prepare',{content:item}); if (!event.data){ event.data = $('<' + this.settings.itemElement + '/>') .addClass(this.options.itemClass).append(item) } this.trigger('prepared',{content:event.data}); return event.data; }; Owl.prototype.update = function(){ var i = 0, n = this._pipe.length, filter = $.proxy(function(p){return this[p]}, this._invalidated), cache ={}; while (i < n){ if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0){ this._pipe[i].run(cache); } i++; } this._invalidated ={}; !this.is('valid') && this.enter('valid'); }; Owl.prototype.width = function(dimension){ dimension = dimension || Owl.Width.Default; switch (dimension){ case Owl.Width.Inner: case Owl.Width.Outer: return this._width; default: return this._width - this.settings.stagePadding * 2 + this.settings.margin; } }; Owl.prototype.refresh = function(){ this.enter('refreshing'); this.trigger('refresh'); this.setup(); this.optionsLogic(); this.$element.addClass(this.options.refreshClass); this.update(); this.$element.removeClass(this.options.refreshClass); this.leave('refreshing'); this.trigger('refreshed'); }; Owl.prototype.onThrottledResize = function(){ window.clearTimeout(this.resizeTimer); this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate); }; Owl.prototype.onResize = function(){ if (!this._items.length){ return false; } if (this._width === this.$element.width()){ return false; } if (!this.isVisible()){ return false; } this.enter('resizing'); if (this.trigger('resize').isDefaultPrevented()){ this.leave('resizing'); return false; } this.invalidate('width'); this.refresh(); this.leave('resizing'); this.trigger('resized'); }; Owl.prototype.registerEventHandlers = function(){ if ($.support.transition){ this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this)); } if (this.settings.responsive !== false){ this.on(window, 'resize', this._handlers.onThrottledResize); } if (this.settings.mouseDrag){ this.$element.addClass(this.options.dragClass); this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this)); this.$stage.on('dragstart.owl.core selectstart.owl.core', function(){return false}); } if (this.settings.touchDrag){ this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this)); this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this)); } }; Owl.prototype.onDragStart = function(event){ var stage = null; if (event.which === 3){ return; } if ($.support.transform){ stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(','); stage ={ x:stage[stage.length === 16 ? 12 :4], y:stage[stage.length === 16 ? 13 :5] }; }else{ stage = this.$stage.position(); stage ={ x:this.settings.rtl ? stage.left + this.$stage.width() - this.width() + this.settings.margin : stage.left, y:stage.top }; } if (this.is('animating')){ $.support.transform ? this.animate(stage.x) :this.$stage.stop() this.invalidate('position'); } this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown'); this.speed(0); this._drag.time = new Date().getTime(); this._drag.target = $(event.target); this._drag.stage.start = stage; this._drag.stage.current = stage; this._drag.pointer = this.pointer(event); $(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this)); $(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event){ var delta = this.difference(this._drag.pointer, this.pointer(event)); $(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this)); if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')){ return; } event.preventDefault(); this.enter('dragging'); this.trigger('drag'); }, this)); }; Owl.prototype.onDragMove = function(event){ var minimum = null, maximum = null, pull = null, delta = this.difference(this._drag.pointer, this.pointer(event)), stage = this.difference(this._drag.stage.start, delta); if (!this.is('dragging')){ return; } event.preventDefault(); if (this.settings.loop){ minimum = this.coordinates(this.minimum()); maximum = this.coordinates(this.maximum() + 1) - minimum; stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum; }else{ minimum = this.settings.rtl ? this.coordinates(this.maximum()) :this.coordinates(this.minimum()); maximum = this.settings.rtl ? this.coordinates(this.minimum()) :this.coordinates(this.maximum()); pull = this.settings.pullDrag ? -1 * delta.x / 5 :0; stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull); } this._drag.stage.current = stage; this.animate(stage.x); }; Owl.prototype.onDragEnd = function(event){ var delta = this.difference(this._drag.pointer, this.pointer(event)), stage = this._drag.stage.current, direction = delta.x > 0 ^ this.settings.rtl ? 'left' :'right'; $(document).off('.owl.core'); this.$element.removeClass(this.options.grabClass); if (delta.x !== 0 && this.is('dragging') || !this.is('valid')){ this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed); this.current(this.closest(stage.x, delta.x !== 0 ? direction :this._drag.direction)); this.invalidate('position'); this.update(); this._drag.direction = direction; if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300){ this._drag.target.one('click.owl.core', function(){return false}); } } if (!this.is('dragging')){ return; } this.leave('dragging'); this.trigger('dragged'); }; Owl.prototype.closest = function(coordinate, direction){ var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates(); if (!this.settings.freeDrag){ // check closest item $.each(coordinates, $.proxy(function(index, value){ // on a left pull, check on current index if (direction === 'left' && coordinate > value - pull && coordinate < value + pull){ position = index; // on a right pull, check on previous index // to do so, subtract width from value and set position = index + 1 }else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull){ position = index + 1; }else if (this.op(coordinate, '<', value) && this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] :value - width)){ position = direction === 'left' ? index + 1 :index; } return position === -1; }, this)); } if (!this.settings.loop){ // non loop boundries if (this.op(coordinate, '>', coordinates[this.minimum()])){ position = coordinate = this.minimum(); }else if (this.op(coordinate, '<', coordinates[this.maximum()])){ position = coordinate = this.maximum(); } } return position; }; Owl.prototype.animate = function(coordinate){ var animate = this.speed() > 0; this.is('animating') && this.onTransitionEnd(); if (animate){ this.enter('animating'); this.trigger('translate'); } if ($.support.transform3d && $.support.transition){ this.$stage.css({ transform:'translate3d(' + coordinate + 'px,0px,0px)', transition:(this.speed() / 1000) + 's' + ( this.settings.slideTransition ? ' ' + this.settings.slideTransition :'' ) }); }else if (animate){ this.$stage.animate({ left:coordinate + 'px' }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this)); }else{ this.$stage.css({ left:coordinate + 'px' }); } }; Owl.prototype.is = function(state){ return this._states.current[state] && this._states.current[state] > 0; }; Owl.prototype.current = function(position){ if (position === undefined){ return this._current; } if (this._items.length === 0){ return undefined; } position = this.normalize(position); if (this._current !== position){ var event = this.trigger('change',{property:{name:'position', value:position}}); if (event.data !== undefined){ position = this.normalize(event.data); } this._current = position; this.invalidate('position'); this.trigger('changed',{property:{name:'position', value:this._current}}); } return this._current; }; Owl.prototype.invalidate = function(part){ if ($.type(part) === 'string'){ this._invalidated[part] = true; this.is('valid') && this.leave('valid'); } return $.map(this._invalidated, function(v, i){return i}); }; Owl.prototype.reset = function(position){ position = this.normalize(position); if (position === undefined){ return; } this._speed = 0; this._current = position; this.suppress([ 'translate', 'translated' ]); this.animate(this.coordinates(position)); this.release([ 'translate', 'translated' ]); }; Owl.prototype.normalize = function(position, relative){ var n = this._items.length, m = relative ? 0 :this._clones.length; if (!this.isNumeric(position) || n < 1){ position = undefined; }else if (position < 0 || position >= n + m){ position = ((position - m / 2) % n + n) % n + m / 2; } return position; }; Owl.prototype.relative = function(position){ position -= this._clones.length / 2; return this.normalize(position, true); }; Owl.prototype.maximum = function(relative){ var settings = this.settings, maximum = this._coordinates.length, iterator, reciprocalItemsWidth, elementWidth; if (settings.loop){ maximum = this._clones.length / 2 + this._items.length - 1; }else if (settings.autoWidth || settings.merge){ iterator = this._items.length; if (iterator){ reciprocalItemsWidth = this._items[--iterator].width(); elementWidth = this.$element.width(); while (iterator--){ reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin; if (reciprocalItemsWidth > elementWidth){ break; } } } maximum = iterator + 1; }else if (settings.center){ maximum = this._items.length - 1; }else{ maximum = this._items.length - settings.items; } if (relative){ maximum -= this._clones.length / 2; } return Math.max(maximum, 0); }; Owl.prototype.minimum = function(relative){ return relative ? 0 :this._clones.length / 2; }; Owl.prototype.items = function(position){ if (position === undefined){ return this._items.slice(); } position = this.normalize(position, true); return this._items[position]; }; Owl.prototype.mergers = function(position){ if (position === undefined){ return this._mergers.slice(); } position = this.normalize(position, true); return this._mergers[position]; }; Owl.prototype.clones = function(position){ var odd = this._clones.length / 2, even = odd + this._items.length, map = function(index){return index % 2 === 0 ? even + index / 2 :odd - (index + 1) / 2}; if (position === undefined){ return $.map(this._clones, function(v, i){return map(i)}); } return $.map(this._clones, function(v, i){return v === position ? map(i) :null}); }; Owl.prototype.speed = function(speed){ if (speed !== undefined){ this._speed = speed; } return this._speed; }; Owl.prototype.coordinates = function(position){ var multiplier = 1, newPosition = position - 1, coordinate; if (position === undefined){ return $.map(this._coordinates, $.proxy(function(coordinate, index){ return this.coordinates(index); }, this)); } if (this.settings.center){ if (this.settings.rtl){ multiplier = -1; newPosition = position + 1; } coordinate = this._coordinates[position]; coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier; }else{ coordinate = this._coordinates[newPosition] || 0; } coordinate = Math.ceil(coordinate); return coordinate; }; Owl.prototype.duration = function(from, to, factor){ if (factor === 0){ return 0; } return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed)); }; Owl.prototype.to = function(position, speed){ var current = this.current(), revert = null, distance = position - this.relative(current), direction = (distance > 0) - (distance < 0), items = this._items.length, minimum = this.minimum(), maximum = this.maximum(); if (this.settings.loop){ if (!this.settings.rewind && Math.abs(distance) > items / 2){ distance += direction * -1 * items; } position = current + distance; revert = ((position - minimum) % items + items) % items + minimum; if (revert !== position && revert - distance <= maximum && revert - distance > 0){ current = revert - distance; position = revert; this.reset(current); } }else if (this.settings.rewind){ maximum += 1; position = (position % maximum + maximum) % maximum; }else{ position = Math.max(minimum, Math.min(maximum, position)); } this.speed(this.duration(current, position, speed)); this.current(position); if (this.isVisible()){ this.update(); } }; Owl.prototype.next = function(speed){ speed = speed || false; this.to(this.relative(this.current()) + 1, speed); }; Owl.prototype.prev = function(speed){ speed = speed || false; this.to(this.relative(this.current()) - 1, speed); }; Owl.prototype.onTransitionEnd = function(event){ // if css2 animation then event object is undefined if (event !== undefined){ event.stopPropagation(); // Catch only owl-stage transitionEnd event if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)){ return false; } } this.leave('animating'); this.trigger('translated'); }; Owl.prototype.viewport = function(){ var width; if (this.options.responsiveBaseElement !== window){ width = $(this.options.responsiveBaseElement).width(); }else if (window.innerWidth){ width = window.innerWidth; }else if (document.documentElement && document.documentElement.clientWidth){ width = document.documentElement.clientWidth; }else{ console.warn('Can not detect viewport width.'); } return width; }; Owl.prototype.replace = function(content){ this.$stage.empty(); this._items = []; if (content){ content = (content instanceof jQuery) ? content :$(content); } if (this.settings.nestedItemSelector){ content = content.find('.' + this.settings.nestedItemSelector); } content.filter(function(){ return this.nodeType === 1; }).each($.proxy(function(index, item){ item = this.prepare(item); this.$stage.append(item); this._items.push(item); this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); }, this)); this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition :0); this.invalidate('items'); }; Owl.prototype.add = function(content, position){ var current = this.relative(this._current); position = position === undefined ? this._items.length :this.normalize(position, true); content = content instanceof jQuery ? content :$(content); this.trigger('add',{content:content, position:position}); content = this.prepare(content); if (this._items.length === 0 || position === this._items.length){ this._items.length === 0 && this.$stage.append(content); this._items.length !== 0 && this._items[position - 1].after(content); this._items.push(content); this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); }else{ this._items[position].before(content); this._items.splice(position, 0, content); this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); } this._items[current] && this.reset(this._items[current].index()); this.invalidate('items'); this.trigger('added',{content:content, position:position}); }; Owl.prototype.remove = function(position){ position = this.normalize(position, true); if (position === undefined){ return; } this.trigger('remove',{content:this._items[position], position:position}); this._items[position].remove(); this._items.splice(position, 1); this._mergers.splice(position, 1); this.invalidate('items'); this.trigger('removed',{content:null, position:position}); }; Owl.prototype.preloadAutoWidthImages = function(images){ images.each($.proxy(function(i, element){ this.enter('pre-loading'); element = $(element); $(new Image()).one('load', $.proxy(function(e){ element.attr('src', e.target.src); element.css('opacity', 1); this.leave('pre-loading'); !this.is('pre-loading') && !this.is('initializing') && this.refresh(); }, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina')); }, this)); }; Owl.prototype.destroy = function(){ this.$element.off('.owl.core'); this.$stage.off('.owl.core'); $(document).off('.owl.core'); if (this.settings.responsive !== false){ window.clearTimeout(this.resizeTimer); this.off(window, 'resize', this._handlers.onThrottledResize); } for (var i in this._plugins){ this._plugins[i].destroy(); } this.$stage.children('.cloned').remove(); this.$stage.unwrap(); this.$stage.children().contents().unwrap(); this.$stage.children().unwrap(); this.$stage.remove(); this.$element .removeClass(this.options.refreshClass) .removeClass(this.options.loadingClass) .removeClass(this.options.loadedClass) .removeClass(this.options.rtlClass) .removeClass(this.options.dragClass) .removeClass(this.options.grabClass) .attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), '')) .removeData('owl.carousel'); }; Owl.prototype.op = function(a, o, b){ var rtl = this.settings.rtl; switch (o){ case '<': return rtl ? a > b :a < b; case '>': return rtl ? a < b :a > b; case '>=': return rtl ? a <= b :a >= b; case '<=': return rtl ? a >= b :a <= b; default: break; } }; Owl.prototype.on = function(element, event, listener, capture){ if (element.addEventListener){ element.addEventListener(event, listener, capture); }else if (element.attachEvent){ element.attachEvent('on' + event, listener); } }; Owl.prototype.off = function(element, event, listener, capture){ if (element.removeEventListener){ element.removeEventListener(event, listener, capture); }else if (element.detachEvent){ element.detachEvent('on' + event, listener); } }; Owl.prototype.trigger = function(name, data, namespace, state, enter){ var status ={ item:{count:this._items.length, index:this.current()} }, handler = $.camelCase( $.grep([ 'on', name, namespace ], function(v){return v}) .join('-').toLowerCase() ), event = $.Event( [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(), $.extend({relatedTarget:this}, status, data) ); if (!this._supress[name]){ $.each(this._plugins, function(name, plugin){ if (plugin.onTrigger){ plugin.onTrigger(event); } }); this.register({type:Owl.Type.Event, name:name}); this.$element.trigger(event); if (this.settings && typeof this.settings[handler] === 'function'){ this.settings[handler].call(this, event); } } return event; }; Owl.prototype.enter = function(name){ $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name){ if (this._states.current[name] === undefined){ this._states.current[name] = 0; } this._states.current[name]++; }, this)); }; Owl.prototype.leave = function(name){ $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name){ this._states.current[name]--; }, this)); }; Owl.prototype.register = function(object){ if (object.type === Owl.Type.Event){ if (!$.event.special[object.name]){ $.event.special[object.name] ={}; } if (!$.event.special[object.name].owl){ var _default = $.event.special[object.name]._default; $.event.special[object.name]._default = function(e){ if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)){ return _default.apply(this, arguments); } return e.namespace && e.namespace.indexOf('owl') > -1; }; $.event.special[object.name].owl = true; } }else if (object.type === Owl.Type.State){ if (!this._states.tags[object.name]){ this._states.tags[object.name] = object.tags; }else{ this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags); } this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i){ return $.inArray(tag, this._states.tags[object.name]) === i; }, this)); } }; Owl.prototype.suppress = function(events){ $.each(events, $.proxy(function(index, event){ this._supress[event] = true; }, this)); }; Owl.prototype.release = function(events){ $.each(events, $.proxy(function(index, event){ delete this._supress[event]; }, this)); }; Owl.prototype.pointer = function(event){ var result ={x:null, y:null}; event = event.originalEvent || event || window.event; event = event.touches && event.touches.length ? event.touches[0] :event.changedTouches && event.changedTouches.length ? event.changedTouches[0] :event; if (event.pageX){ result.x = event.pageX; result.y = event.pageY; }else{ result.x = event.clientX; result.y = event.clientY; } return result; }; Owl.prototype.isNumeric = function(number){ return !isNaN(parseFloat(number)); }; Owl.prototype.difference = function(first, second){ return{ x:first.x - second.x, y:first.y - second.y }; }; $.fn.owlCarouselBundleExpert = function(option){ var args = Array.prototype.slice.call(arguments, 1); return this.each(function(){ var $this = $(this), data = $this.data('owl.carousel'); if (!data){ data = new Owl(this, typeof option == 'object' && option); $this.data('owl.carousel', data); $.each([ 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove' ], function(i, event){ data.register({type:Owl.Type.Event, name:event}); data.$element.on(event + '.owl.carousel.core', $.proxy(function(e){ if (e.namespace && e.relatedTarget !== this){ this.suppress([ event ]); data[event].apply(this, [].slice.call(arguments, 1)); this.release([ event ]); } }, data)); }); } if (typeof option == 'string' && option.charAt(0) !== '_'){ data[option].apply(data, args); } }); }; $.fn.owlCarouselBundleExpert.Constructor = Owl; })(window.Zepto || window.jQuery, window, document); ;(function($, window, document, undefined){ var AutoRefresh = function(carousel){ this._core = carousel; this._interval = null; this._visible = null; this._handlers ={ 'initialized.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.autoRefresh){ this.watch(); } }, this) }; // set default options this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options); // register event handlers this._core.$element.on(this._handlers); }; AutoRefresh.Defaults ={ autoRefresh:true, autoRefreshInterval:500 }; AutoRefresh.prototype.watch = function(){ if (this._interval){ return; } this._visible = this._core.isVisible(); this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval); }; AutoRefresh.prototype.refresh = function(){ if (this._core.isVisible() === this._visible){ return; } this._visible = !this._visible; this._core.$element.toggleClass('owl-hidden', !this._visible); this._visible && (this._core.invalidate('width') && this._core.refresh()); }; AutoRefresh.prototype.destroy = function(){ var handler, property; window.clearInterval(this._interval); for (handler in this._handlers){ this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)){ typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarouselBundleExpert.Constructor.Plugins.AutoRefresh = AutoRefresh; })(window.Zepto || window.jQuery, window, document); ;(function($, window, document, undefined){ var Lazy = function(carousel){ this._core = carousel; this._loaded = []; this._handlers ={ 'initialized.owl.carousel change.owl.carousel resized.owl.carousel':$.proxy(function(e){ if (!e.namespace){ return; } if (!this._core.settings || !this._core.settings.lazyLoad){ return; } if ((e.property && e.property.name == 'position') || e.type == 'initialized'){ var settings = this._core.settings, n = (settings.center && Math.ceil(settings.items / 2) || settings.items), i = ((settings.center && n * -1) || 0), position = (e.property && e.property.value !== undefined ? e.property.value :this._core.current()) + i, clones = this._core.clones().length, load = $.proxy(function(i, v){this.load(v)}, this); //TODO:Need documentation for this new option if (settings.lazyLoadEager > 0){ n += settings.lazyLoadEager; // If the carousel is looping also preload images that are to the "left" if (settings.loop){ position -= settings.lazyLoadEager; n++; } } while (i++ < n){ this.load(clones / 2 + this._core.relative(position)); clones && $.each(this._core.clones(this._core.relative(position)), load); position++; } } }, this) }; // set the default options this._core.options = $.extend({}, Lazy.Defaults, this._core.options); // register event handler this._core.$element.on(this._handlers); }; Lazy.Defaults ={ lazyLoad:false, lazyLoadEager:0 }; Lazy.prototype.load = function(position){ var $item = this._core.$stage.children().eq(position), $elements = $item && $item.find('.owl-lazy'); if (!$elements || $.inArray($item.get(0), this._loaded) > -1){ return; } $elements.each($.proxy(function(index, element){ var $element = $(element), image, url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset'); this._core.trigger('load',{element:$element, url:url}, 'lazy'); if ($element.is('img')){ $element.one('load.owl.lazy', $.proxy(function(){ $element.css('opacity', 1); this._core.trigger('loaded',{element:$element, url:url}, 'lazy'); }, this)).attr('src', url); }else if ($element.is('source')){ $element.one('load.owl.lazy', $.proxy(function(){ this._core.trigger('loaded',{element:$element, url:url}, 'lazy'); }, this)).attr('srcset', url); }else{ image = new Image(); image.onload = $.proxy(function(){ $element.css({ 'background-image':'url("' + url + '")', 'opacity':'1' }); this._core.trigger('loaded',{element:$element, url:url}, 'lazy'); }, this); image.src = url; } }, this)); this._loaded.push($item.get(0)); }; Lazy.prototype.destroy = function(){ var handler, property; for (handler in this.handlers){ this._core.$element.off(handler, this.handlers[handler]); } for (property in Object.getOwnPropertyNames(this)){ typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarouselBundleExpert.Constructor.Plugins.Lazy = Lazy; })(window.Zepto || window.jQuery, window, document); ;(function($, window, document, undefined){ var AutoHeight = function(carousel){ this._core = carousel; this._previousHeight = null; this._handlers ={ 'initialized.owl.carousel refreshed.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.autoHeight){ this.update(); } }, this), 'changed.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){ this.update(); } }, this), 'loaded.owl.lazy':$.proxy(function(e){ if (e.namespace && this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()){ this.update(); } }, this) }; // set default options this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options); // register event handlers this._core.$element.on(this._handlers); this._intervalId = null; var refThis = this; // These changes have been taken from a PR by gavrochelegnou proposed in #1575 // and have been made compatible with the latest jQuery version $(window).on('load', function(){ if (refThis._core.settings.autoHeight){ refThis.update(); } }); // Autoresize the height of the carousel when window is resized // When carousel has images, the height is dependent on the width // and should also change on resize $(window).resize(function(){ if (refThis._core.settings.autoHeight){ if (refThis._intervalId != null){ clearTimeout(refThis._intervalId); } refThis._intervalId = setTimeout(function(){ refThis.update(); }, 250); } }); }; AutoHeight.Defaults ={ autoHeight:false, autoHeightClass:'owl-height' }; AutoHeight.prototype.update = function(){ var start = this._core._current, end = start + this._core.settings.items, lazyLoadEnabled = this._core.settings.lazyLoad, visible = this._core.$stage.children().toArray().slice(start, end), heights = [], maxheight = 0; $.each(visible, function(index, item){ heights.push($(item).height()); }); maxheight = Math.max.apply(null, heights); if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight){ maxheight = this._previousHeight; } this._previousHeight = maxheight; this._core.$stage.parent() .height(maxheight) .addClass(this._core.settings.autoHeightClass); }; AutoHeight.prototype.destroy = function(){ var handler, property; for (handler in this._handlers){ this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)){ typeof this[property] !== 'function' && (this[property] = null); } }; $.fn.owlCarouselBundleExpert.Constructor.Plugins.AutoHeight = AutoHeight; })(window.Zepto || window.jQuery, window, document); ;(function($, window, document, undefined){ var Video = function(carousel){ this._core = carousel; this._videos ={}; this._playing = null; this._handlers ={ 'initialized.owl.carousel':$.proxy(function(e){ if (e.namespace){ this._core.register({type:'state', name:'playing', tags:[ 'interacting' ]}); } }, this), 'resize.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.video && this.isInFullScreen()){ e.preventDefault(); } }, this), 'refreshed.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.is('resizing')){ this._core.$stage.find('.cloned .owl-video-frame').remove(); } }, this), 'changed.owl.carousel':$.proxy(function(e){ if (e.namespace && e.property.name === 'position' && this._playing){ this.stop(); } }, this), 'prepared.owl.carousel':$.proxy(function(e){ if (!e.namespace){ return; } var $element = $(e.content).find('.owl-video'); if ($element.length){ $element.css('display', 'none'); this.fetch($element, $(e.content)); } }, this) }; // set default options this._core.options = $.extend({}, Video.Defaults, this._core.options); // register event handlers this._core.$element.on(this._handlers); this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e){ this.play(e); }, this)); }; Video.Defaults ={ video:false, videoHeight:false, videoWidth:false }; Video.prototype.fetch = function(target, item){ var type = (function(){ if (target.attr('data-vimeo-id')){ return 'vimeo'; }else if (target.attr('data-vzaar-id')){ return 'vzaar' }else{ return 'youtube'; } })(), id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'), width = target.attr('data-width') || this._core.settings.videoWidth, height = target.attr('data-height') || this._core.settings.videoHeight, url = target.attr('href'); if (url){ id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); if (id[3].indexOf('youtu') > -1){ type = 'youtube'; }else if (id[3].indexOf('vimeo') > -1){ type = 'vimeo'; }else if (id[3].indexOf('vzaar') > -1){ type = 'vzaar'; }else{ throw new Error('Video URL not supported.'); } id = id[6]; }else{ throw new Error('Missing video URL.'); } this._videos[url] ={ type:type, id:id, width:width, height:height }; item.attr('data-video', url); this.thumbnail(target, this._videos[url]); }; Video.prototype.thumbnail = function(target, video){ var tnLink, icon, path, dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' :'', customTn = target.find('img'), srcType = 'src', lazyClass = '', settings = this._core.settings, create = function(path){ icon = '
'; if (settings.lazyLoad){ tnLink = $('
',{ "class":'owl-video-tn ' + lazyClass, "srcType":path }); }else{ tnLink = $( '
',{ "class":"owl-video-tn", "style":'opacity:1;background-image:url(' + path + ')' }); } target.after(tnLink); target.after(icon); }; // wrap video content into owl-video-wrapper div target.wrap( $( '
',{ "class":"owl-video-wrapper", "style":dimensions })); if (this._core.settings.lazyLoad){ srcType = 'data-src'; lazyClass = 'owl-lazy'; } // custom thumbnail if (customTn.length){ create(customTn.attr(srcType)); customTn.remove(); return false; } if (video.type === 'youtube'){ path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg"; create(path); }else if (video.type === 'vimeo'){ $.ajax({ type:'GET', url:'//vimeo.com/api/v2/video/' + video.id + '.json', jsonp:'callback', dataType:'jsonp', success:function(data){ path = data[0].thumbnail_large; create(path); } }); }else if (video.type === 'vzaar'){ $.ajax({ type:'GET', url:'//vzaar.com/api/videos/' + video.id + '.json', jsonp:'callback', dataType:'jsonp', success:function(data){ path = data.framegrab_url; create(path); } }); } }; Video.prototype.stop = function(){ this._core.trigger('stop', null, 'video'); this._playing.find('.owl-video-frame').remove(); this._playing.removeClass('owl-video-playing'); this._playing = null; this._core.leave('playing'); this._core.trigger('stopped', null, 'video'); }; Video.prototype.play = function(event){ var target = $(event.target), item = target.closest('.' + this._core.settings.itemClass), video = this._videos[item.attr('data-video')], width = video.width || '100%', height = video.height || this._core.$stage.height(), html, iframe; if (this._playing){ return; } this._core.enter('playing'); this._core.trigger('play', null, 'video'); item = this._core.items(this._core.relative(item.index())); this._core.reset(item.index()); html = $( '' ); html.attr( 'height', height ); html.attr( 'width', width ); if (video.type === 'youtube'){ html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id ); }else if (video.type === 'vimeo'){ html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' ); }else if (video.type === 'vzaar'){ html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' ); } iframe = $(html).wrap( '
' ).insertAfter(item.find('.owl-video')); this._playing = item.addClass('owl-video-playing'); }; Video.prototype.isInFullScreen = function(){ var element = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement; return element && $(element).parent().hasClass('owl-video-frame'); }; Video.prototype.destroy = function(){ var handler, property; this._core.$element.off('click.owl.video'); for (handler in this._handlers){ this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)){ typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarouselBundleExpert.Constructor.Plugins.Video = Video; })(window.Zepto || window.jQuery, window, document); ;(function($, window, document, undefined){ var Animate = function(scope){ this.core = scope; this.core.options = $.extend({}, Animate.Defaults, this.core.options); this.swapping = true; this.previous = undefined; this.next = undefined; this.handlers ={ 'change.owl.carousel':$.proxy(function(e){ if (e.namespace && e.property.name == 'position'){ this.previous = this.core.current(); this.next = e.property.value; } }, this), 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel':$.proxy(function(e){ if (e.namespace){ this.swapping = e.type == 'translated'; } }, this), 'translate.owl.carousel':$.proxy(function(e){ if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)){ this.swap(); } }, this) }; this.core.$element.on(this.handlers); }; Animate.Defaults ={ animateOut:false, animateIn:false }; Animate.prototype.swap = function(){ if (this.core.settings.items !== 1){ return; } if (!$.support.animation || !$.support.transition){ return; } this.core.speed(0); var left, clear = $.proxy(this.clear, this), previous = this.core.$stage.children().eq(this.previous), next = this.core.$stage.children().eq(this.next), incoming = this.core.settings.animateIn, outgoing = this.core.settings.animateOut; if (this.core.current() === this.previous){ return; } if (outgoing){ left = this.core.coordinates(this.previous) - this.core.coordinates(this.next); previous.one($.support.animation.end, clear) .css({'left':left + 'px'}) .addClass('animated owl-animated-out') .addClass(outgoing); } if (incoming){ next.one($.support.animation.end, clear) .addClass('animated owl-animated-in') .addClass(incoming); } }; Animate.prototype.clear = function(e){ $(e.target).css({'left':''}) .removeClass('animated owl-animated-out owl-animated-in') .removeClass(this.core.settings.animateIn) .removeClass(this.core.settings.animateOut); this.core.onTransitionEnd(); }; Animate.prototype.destroy = function(){ var handler, property; for (handler in this.handlers){ this.core.$element.off(handler, this.handlers[handler]); } for (property in Object.getOwnPropertyNames(this)){ typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarouselBundleExpert.Constructor.Plugins.Animate = Animate; })(window.Zepto || window.jQuery, window, document); ;(function($, window, document, undefined){ var Autoplay = function(carousel){ this._core = carousel; this._call = null; this._time = 0; this._timeout = 0; this._paused = true; this._handlers ={ 'changed.owl.carousel':$.proxy(function(e){ if (e.namespace && e.property.name === 'settings'){ if (this._core.settings.autoplay){ this.play(); }else{ this.stop(); } }else if (e.namespace && e.property.name === 'position' && this._paused){ // Reset the timer. This code is triggered when the position // of the carousel was changed through user interaction. this._time = 0; } }, this), 'initialized.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.autoplay){ this.play(); } }, this), 'play.owl.autoplay':$.proxy(function(e, t, s){ if (e.namespace){ this.play(t, s); } }, this), 'stop.owl.autoplay':$.proxy(function(e){ if (e.namespace){ this.stop(); } }, this), 'mouseover.owl.autoplay':$.proxy(function(){ if (this._core.settings.autoplayHoverPause && this._core.is('rotating')){ this.pause(); } }, this), 'mouseleave.owl.autoplay':$.proxy(function(){ if (this._core.settings.autoplayHoverPause && this._core.is('rotating')){ this.play(); } }, this), 'touchstart.owl.core':$.proxy(function(){ if (this._core.settings.autoplayHoverPause && this._core.is('rotating')){ this.pause(); } }, this), 'touchend.owl.core':$.proxy(function(){ if (this._core.settings.autoplayHoverPause){ this.play(); } }, this) }; // register event handlers this._core.$element.on(this._handlers); // set default options this._core.options = $.extend({}, Autoplay.Defaults, this._core.options); }; Autoplay.Defaults ={ autoplay:false, autoplayTimeout:5000, autoplayHoverPause:false, autoplaySpeed:false }; Autoplay.prototype._next = function(speed){ this._call = window.setTimeout( $.proxy(this._next, this, speed), this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read() ); if (this._core.is('interacting') || document.hidden){ return; } this._core.next(speed || this._core.settings.autoplaySpeed); } Autoplay.prototype.read = function(){ return new Date().getTime() - this._time; }; Autoplay.prototype.play = function(timeout, speed){ var elapsed; if (!this._core.is('rotating')){ this._core.enter('rotating'); } timeout = timeout || this._core.settings.autoplayTimeout; // Calculate the elapsed time since the last transition. If the carousel // wasn't playing this calculation will yield zero. elapsed = Math.min(this._time % (this._timeout || timeout), timeout); if (this._paused){ // Start the clock. this._time = this.read(); this._paused = false; }else{ // Clear the active timeout to allow replacement. window.clearTimeout(this._call); } // Adjust the origin of the timer to match the new timeout value. this._time += this.read() % timeout - elapsed; this._timeout = timeout; this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed); }; Autoplay.prototype.stop = function(){ if (this._core.is('rotating')){ // Reset the clock. this._time = 0; this._paused = true; window.clearTimeout(this._call); this._core.leave('rotating'); } }; Autoplay.prototype.pause = function(){ if (this._core.is('rotating') && !this._paused){ // Pause the clock. this._time = this.read(); this._paused = true; window.clearTimeout(this._call); } }; Autoplay.prototype.destroy = function(){ var handler, property; this.stop(); for (handler in this._handlers){ this._core.$element.off(handler, this._handlers[handler]); } for (property in Object.getOwnPropertyNames(this)){ typeof this[property] != 'function' && (this[property] = null); } }; $.fn.owlCarouselBundleExpert.Constructor.Plugins.autoplay = Autoplay; })(window.Zepto || window.jQuery, window, document); ;(function($, window, document, undefined){ 'use strict'; var Navigation = function(carousel){ this._core = carousel; this._initialized = false; this._pages = []; this._controls ={}; this._templates = []; this.$element = this._core.$element; this._overrides ={ next:this._core.next, prev:this._core.prev, to:this._core.to }; this._handlers ={ 'prepared.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.dotsData){ this._templates.push('
' + $(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '
'); } }, this), 'added.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.dotsData){ this._templates.splice(e.position, 0, this._templates.pop()); } }, this), 'remove.owl.carousel':$.proxy(function(e){ if (e.namespace && this._core.settings.dotsData){ this._templates.splice(e.position, 1); } }, this), 'changed.owl.carousel':$.proxy(function(e){ if (e.namespace && e.property.name == 'position'){ this.draw(); } }, this), 'initialized.owl.carousel':$.proxy(function(e){ if (e.namespace && !this._initialized){ this._core.trigger('initialize', null, 'navigation'); this.initialize(); this.update(); this.draw(); this._initialized = true; this._core.trigger('initialized', null, 'navigation'); } }, this), 'refreshed.owl.carousel':$.proxy(function(e){ if (e.namespace && this._initialized){ this._core.trigger('refresh', null, 'navigation'); this.update(); this.draw(); this._core.trigger('refreshed', null, 'navigation'); } }, this) }; // set default options this._core.options = $.extend({}, Navigation.Defaults, this._core.options); // register event handlers this.$element.on(this._handlers); }; Navigation.Defaults ={ nav:false, navText:[ '', '' ], navSpeed:false, navElement:'button type="button" role="presentation"', navContainer:false, navContainerClass:'owl-nav', navClass:[ 'owl-prev', 'owl-next' ], slideBy:1, dotClass:'owl-dot', dotsClass:'owl-dots', dots:true, dotsEach:false, dotsData:false, dotsSpeed:false, dotsContainer:false }; Navigation.prototype.initialize = function(){ var override, settings = this._core.settings; // create DOM structure for relative navigation this._controls.$relative = (settings.navContainer ? $(settings.navContainer) :$('
').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled'); this._controls.$previous = $('<' + settings.navElement + '>') .addClass(settings.navClass[0]) .html(settings.navText[0]) .prependTo(this._controls.$relative) .on('click', $.proxy(function(e){ this.prev(settings.navSpeed); }, this)); this._controls.$next = $('<' + settings.navElement + '>') .addClass(settings.navClass[1]) .html(settings.navText[1]) .appendTo(this._controls.$relative) .on('click', $.proxy(function(e){ this.next(settings.navSpeed); }, this)); // create DOM structure for absolute navigation if (!settings.dotsData){ this._templates = [ $('
'); } if (json['success']){ $('#admin-bundle-expert-container').html(json['bundle_expert']) bundle_expert.init_event_modal_form_dismiss(); } }, error:function (xhr, ajaxOptions, thrownError){ alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); }, timeout); } BundleExpert.on_click_change_quantity = function (click_element, quantity){ var kit_item = $(click_element).closest('.kit-item'); var old_quantity = parseInt($(kit_item).find('input.input-quantity-field').val()); if (isNaN(old_quantity)) old_quantity = 1; var new_quantity = old_quantity + quantity; if (new_quantity <= 0 && $(kit_item).find('input[data-id=input-is-free-product]').val() == 1){ } if (new_quantity <= 0){ new_quantity = 1; } $(kit_item).find('input.input-quantity-field').val(new_quantity); $(kit_item).find('input[data-id=input-quantity]').val(new_quantity); var kit_widget = $(click_element).closest('.kit-widget'); var widget_unique_id = $(kit_widget).attr('data-widget-unique-id'); var item_position = $(click_element).closest('.kit-item-product').attr('data-item-position'); var item_position_free = $(click_element).closest('.kit-item-product').attr('data-item-position-free'); var kit_form = $('#bundle-expert-container .bundle-expert-forms-container').find('div[data-widget-unique-id=' + widget_unique_id + '] .kit-form'); bundle_expert_form.update_product_quantity(kit_form, item_position, item_position_free, new_quantity); bundle_expert.update_widget_kit_total(kit_widget); } BundleExpert.on_click_change_quantity_in_form = function (click_element, quantity){ var product_form = $(click_element).closest('.be-product-form'); var item_position = $(product_form).attr('data-item-position'); var item_position_free = $(product_form).attr('data-item-position-free'); var kit_form = $(click_element).closest('.kit-form'); var old_quantity = parseInt($(product_form).find('input.input-quantity-field').val()); if (isNaN(old_quantity)) old_quantity = 1; var new_quantity = old_quantity + quantity; if (new_quantity <= 0){ new_quantity = 1; } $(click_element).closest('.quantity-buttons').find('input.input-quantity-field').val(new_quantity); bundle_expert_form.update_product_quantity(kit_form, item_position, item_position_free, new_quantity); bundle_expert_form.update_kit_form_total(kit_form); } BundleExpert.init_time_field_in_widgets = function (){ if ($.fn.datetimepicker){ $('.kit-widget').find('.date').datetimepicker({ pickTime:false }).on('dp.change', function (e){ bundle_expert_form.on_change_product_option($(this).find('input')); }); $('.kit-widget').find('.datetime').datetimepicker({ pickDate:true, pickTime:true }).on('dp.change', function (e){ bundle_expert_form.on_change_product_option($(this).find('input')); }); $('.kit-widget').find('.time').datetimepicker({ pickDate:false }).on('dp.change', function (e){ bundle_expert_form.on_change_product_option($(this).find('input')); }); } } BundleExpert.init_time_field_in_widget_item = function (kit_widget, item_position, item_position_free){ if ($.fn.datetimepicker){ var kit_item = $(kit_widget).find('.kit-items').find('.kit-item[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']') $(kit_item).find('.date').datetimepicker({ pickTime:false }).on('dp.change', function (e){ bundle_expert_form.on_change_product_option($(this).find('input')); }); $(kit_item).find('.datetime').datetimepicker({ pickDate:true, pickTime:true }).on('dp.change', function (e){ bundle_expert_form.on_change_product_option($(this).find('input')); }); $(kit_item).find('.time').datetimepicker({ pickDate:false }).on('dp.change', function (e){ bundle_expert_form.on_change_product_option($(this).find('input')); }); ; } } BundleExpert.free_products_update_input_index = function (kit_widget, item_position){ var free_item_position = 0; $(kit_widget).find('.kit-items .kit-item.free-product[data-item-position=' + item_position + '] .product-selected input[data-id=input-free-product-in-kit][value=1]').closest('.kit-item').each(function (index, element){ var prev_free_item_position = $(element).attr('data-item-position-free'); $(element).attr('data-item-position-free', free_item_position); $(element).find('.kit-item-product').attr('data-item-position-free', free_item_position); $(element).find('.kit-item-product input[data-id=input-item-position-free]').val(free_item_position); $(element).find('.kit-item-product input, .kit-item-product select, .kit-item-product textarea').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_free_w[' + item_position + '][' + prev_free_item_position + ']', 'kit_items_free_w[' + item_position + '][' + free_item_position + ']'); $(element).attr('name', attr_name); }); free_item_position++; }) } BundleExpert.free_product_add_to_kit = function (kit_item, clear_kit_form){ if (typeof clear_kit_form === "undefined"){ clear_kit_form = true; } var kit_widget = $(kit_item).closest('.kit-widget'); var widget_unique_id = $(kit_widget).attr('data-widget-unique-id'); kit_widget = $('.kit-widget[data-widget-unique-id='+widget_unique_id+']'); var item_position = parseInt($(kit_item).attr('data-item-position')); var item_position_free = parseInt($(kit_widget).find('.kit-items .kit-item.free-product[data-item-position=' + item_position + '] input[data-id=input-free-product-in-kit][value=1]').length); if (isNaN(item_position_free)){ item_position_free = 0; }else{ if (item_position_free > 0){ } } $(kit_item).attr('data-item-position', item_position); $(kit_item).attr('data-item-position-free', item_position_free); $(kit_item).find('.kit-item-product').attr('data-item-position', item_position); $(kit_item).find('.kit-item-product').attr('data-item-position-free', item_position_free); $(kit_item).find('.kit-item-product input[data-id=input-item-position]').val(item_position); $(kit_item).find('.kit-item-product input[data-id=input-item-position-free]').val(item_position_free); $(kit_item).find('.kit-item-product input, .kit-item-product textarea, .kit-item-product select').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_w[' + item_position + ']', 'kit_items_free_w[' + item_position + '][' + item_position_free + ']'); $(element).attr('name', attr_name); }); $(kit_item).attr('data-empty-item', 0); $(kit_item).find('input[data-id=input-free-product-in-kit]').val(1); $(kit_item).find('.kit-item-product').addClass('product-selected'); $(kit_item).find('.select-product-button').hide(); $(kit_item).find('.add-to-kit-free-product-button').hide(); bundle_expert.free_products_update_input_index(kit_widget, item_position); if(!bundle_expert.is_widget_checkbox_mode(kit_widget)){ $(kit_widget).find('.kit-items #kit-items-container').find('.free-product-container-in-kit[data-item-position=' + item_position + ']').append(kit_item); $(kit_widget).find('.kit-items #kit-items-container').find('.free-product-container-in-kit[data-item-position=' + item_position + ']').show(); } bundle_expert.init_time_field_in_widget_item(kit_widget, item_position, item_position_free); if(clear_kit_form){ var widget_unique_id = $(kit_widget).attr('data-widget-unique-id'); $('.bundle-expert-forms-container').find('[data-widget-unique-id=' + widget_unique_id + ']').remove(); } if ($(kit_widget).find('#free-item-products-container .free-items .kit-item[data-item-position=' + item_position + ']').length > 0){ $(kit_widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').hide(); }else{ $(kit_widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').show(); } be_custom.point('019',{'kit_widget':kit_widget}); this.update_widget_kit_total(kit_widget) } BundleExpert.free_product_remove_from_kit = function (kit_item, clear_kit_form){ if (typeof clear_kit_form === "undefined"){ clear_kit_form = true; } var kit_widget = $(kit_item).closest('.kit-widget'); var widget_unique_id = $(kit_widget).attr('data-widget-unique-id'); kit_widget = $('.kit-widget[data-widget-unique-id='+widget_unique_id+']'); var free_products_table_mode = parseInt($(kit_widget).attr('data-free-products-table-mode')); var item_position = parseInt($(kit_item).attr('data-item-position')); var item_position_free = parseInt($(kit_item).attr('data-item-position-free')); if (free_products_table_mode === 1){ $(kit_item).find('.kit-item-product input, select, textarea').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_free_w[' + item_position + '][' + item_position_free + ']', 'kit_items_w[' + item_position + ']'); $(element).attr('name', attr_name); }); $(kit_item).attr('data-empty-item', 1); $(kit_item).find('input[data-id=input-free-product-in-kit]').val(0); $(kit_item).find('.kit-item-product').removeClass('product-selected'); $(kit_item).attr('data-item-position-free', 0); $(kit_item).find('.kit-item-product').attr('data-item-position-free', 0); $(kit_item).find('input[data-id=input-item-position-free]').val(0); $(kit_item).find('.selectable-item-container').removeClass('hidden'); $(kit_item).find('.select-product-button').hide(); $(kit_item).find('.add-to-kit-free-product-button').show(); if(!bundle_expert.is_widget_checkbox_mode(kit_widget)){ $(kit_widget).find('#free-item-products-container .free-items .free-products-group[data-item-position=' + item_position + ']').prepend(kit_item); var product_count = $(kit_widget).find('.free-product-container-in-kit[data-item-position=' + item_position + '] .kit-item-product').length; if (product_count == 0){ $(kit_widget).find('.free-product-container-in-kit[data-item-position=' + item_position + ']').hide(); } } }else{ $(kit_item).remove(); } bundle_expert.free_products_update_input_index(kit_widget, item_position); if(clear_kit_form){ var widget_unique_id = $(kit_widget).attr('data-widget-unique-id'); $('.bundle-expert-forms-container').find('[data-widget-unique-id=' + widget_unique_id + ']').remove(); } this.update_widget_kit_total(kit_widget) if ($(kit_widget).find('#free-item-products-container .free-items .kit-item[data-item-position=' + item_position + ']').length > 0){ $(kit_widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').hide(); }else{ $(kit_widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').show(); } } BundleExpert.on_click_remove_product_button = function (click_element, clear_kit_form){ if (typeof clear_kit_form === "undefined"){ clear_kit_form = true; } var kit_item = $(click_element).closest('.kit-item'); var kit_widget = $(kit_item).closest('.kit-widget'); if ($(kit_item).hasClass('free-product')){ this.free_product_remove_from_kit(kit_item); }else{ if ($(kit_item).hasClass('selectable')){ $(kit_item).attr('data-empty-item', 1) $(kit_item).find('input[data-id=input-is-item-is-empty]').val(1); $(kit_item).find('.kit-item-product').removeClass('product-selected'); $(kit_item).find('.kit-item-product').addClass('hidden'); $(kit_item).find('.empty-kit-item-product').removeClass('hidden'); var widget_unique_id = $(kit_widget).attr('data-widget-unique-id'); $('.bundle-expert-forms-container').find('[data-widget-unique-id=' + widget_unique_id + ']').remove(); this.update_widget_kit_total(kit_widget) } } if(clear_kit_form){ var widget_unique_id = $(kit_widget).attr('data-widget-unique-id'); $('.bundle-expert-forms-container').find('[data-widget-unique-id=' + widget_unique_id + ']').remove(); } be_custom.point('041',{'widget':kit_widget}); } BundleExpert.update_widget_kit_total = function (widget){ if(!this.checkWidgetUpdateTotalEnable(widget)){ return; } var data = $(widget).find('.kit-data').find('input[type=\'text\'], input[type=\'hidden\']'); var kit_from_cart_unique_id = $(widget).find('.kit-data input[name=kit_from_cart_unique_id]').val() var data_products = $(widget).find('.kit-items .kit-item-product.product-selected').find('input[type=\'text\'], input[type=\'hidden\'], input[type=\'radio\']:checked, input[type=\'checkbox\']:checked, select, textarea, .kit-data input[type=\'hidden\']'); var disabled = $(widget).find('.kit-items .kit-item-product.product-selected').find('input:disabled, select:disabled, textarea:disabled'); disabled.prop('disabled', false); var serialized = $(data_products).serializeArray(); disabled.prop('disabled', true); data = $(data).add(serialized); data = $(data).add({'kit_from_cart_unique_id':kit_from_cart_unique_id}); if ($(widget).hasClass('product-as-kit-mode') || $(widget).hasClass('product-as-kit-mode-light-mode')){ var product_as_kit_quantity = $(bundle_expert.selectors.product_page.product_data).find('input[name=quantity]').val(); if (typeof product_as_kit_quantity !== 'undefined'){ data = $(data).add({'name':'product_as_kit_quantity', 'value':product_as_kit_quantity}); } } if ($(widget).hasClass('product-as-kit-mode')){ var product_data = bundle_expert_help.get_product_page_data_for_send(); var data = data.add(product_data); var product_id = $(widget).find('.kit-data input[name=main_product_id]').val(); var data = data.add({'name':'product_as_kit_data[product_id]', 'value':product_id}); } data = bundle_expert_help.normalize_options_names(data); var url = ''; if (!bundle_expert.admin_mode){ url = 'index.php?route=checkout/bundle_expert/get_kit_total'; }else{ if (!bundle_expert.admin_mode_new_api){ url = 'index.php?route=catalog/bundle_expert/api&token=' + bundle_expert.admin_token + '&api=api/bundle_expert/getKitTotal'; }else{ url = bundle_expert.store_url + 'index.php?route=api/bundle_expert/getKitTotal&' + bundle_expert.api_token_name + bundle_expert.api_token_value; } } $.ajax({ url:url, type:'post', data:data, dataType:'json', beforeSend:function (){ }, complete:function (){ }, success:function (json){ if (json['error']){ } if (json['total_kit']){ $(widget).find('.be-price-old.total-default').html(json['total_default']) $(widget).find('.be-price-old.total-default').attr('data-price-value', json['total_default_value']) $(widget).find('.total-default-new').html(json['total_default_new']) $(widget).find('.total-default-new').attr('data-price-value', json['total_default_new_value']) if (json['total_default_value'] === json['total_default_new_value']){ $(widget).find('.be-price-old.total-default').hide(); }else{ $(widget).find('.be-price-old.total-default').show(); } $(widget).find('.be-price-old.total-kit-old').html(json['total_kit_old']) $(widget).find('.be-price-old.total-kit-old').attr('data-price-value', json['total_kit_old_value']); $(widget).find('.total-kit').html(json['total_kit']) $(widget).find('.total-kit').attr('data-price-value', json['total_kit_value']); if (json['total_kit_old_value'] === json['total_kit_value']){ $(widget).find('.be-price-old.total-kit-old').hide(); }else{ $(widget).find('.be-price-old.total-kit-old').show(); } if(json['total_default_value'] != json['total_kit_value']){ $(widget).find('.total-default-container').removeClass('hidden').show(); }else{ $(widget).find('.total-default-container').addClass('hidden').hide(); } for (var i = 0;i < json['products_price_data'].length;i++){ var price_data = json['products_price_data'][i]; var kit_item_poduct = $(widget).find('.kit-items').find('.kit-item-product[data-item-position=' + price_data['item_position'] + '][data-item-position-free=' + price_data['item_position_free'] + '][data-product-id=' + price_data['product_id'] + ']'); if (price_data['special']){ $(kit_item_poduct).find('.be-price .be-price-new').html(price_data['special']); $(kit_item_poduct).find('.be-price .be-price-old').html(price_data['price']); }else{ $(kit_item_poduct).find('.be-price').html(price_data['price']); } if (price_data['price_discount_text']){ $(kit_item_poduct).find('.item-price-discount').html(price_data['price_discount_text']); } } if ($(widget).hasClass('product-as-kit-mode') || $(widget).hasClass('product-as-kit-mode-light-mode')){ bundle_expert.update_product_page_price_html(widget, json); } be_custom.point('018',{'widget':widget, 'json':json}); } } }); } BundleExpert.show_widget_error = function (widget, error){ var json = error; $(widget).find('#kit-items-container').prepend('
' + json['error_text'] + '
'); var j; var i; for (j in json['error']){ if (json['error'][j]['option']){ var item_position = json['error'][j]['item_position']; var item_position_free = json['error'][j]['item_position_free']; var active_product_form = $(widget).find('#kit-items-container .kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); ; $(widget).find('#kit-items-container').find('.kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']').find('.alert-icon').show(); for (var k = 0;k < json['error'][j]['option'].length;k++){ var error_option = json['error'][j]['option'][k]; for (i in error_option){ var element = $(active_product_form).find('#input-option' + i.replace('_', '-')); if (element.parent().hasClass('input-group')){ element.parent().after('
' + error_option[i] + '
'); }else{ element.after('
' + error_option[i] + '
'); } } } } if (json['error'][j]['recurring']){ $(active_product_form).find('select[name=\'recurring_id\']').after('
' + json['error'][j]['recurring'] + '
'); } } be_custom.point('039',{'widget':widget, 'error':error}); } BundleExpert.show_product_as_kit_error = function (error){ var i; var product_element_data = $(bundle_expert.selectors.product_page.product_data).first(); if (error['option']){ for (var k = 0;k < error['option'].length;k++){ var error_option = error['option'][k]; for (i in error_option){ var element = $(product_element_data).find('#input-option' + i.replace('_', '-')); if (element.parent().hasClass('input-group')){ element.parent().after('
' + error_option[i] + '
'); }else{ element.after('
' + error_option[i] + '
'); } } } } if (error['recurring']){ $(active_product_form).find('select[name=\'recurring_id\']').after('
' + error['recurring'] + '
'); } } BundleExpert.product_as_kit_page_buttons_init = function (widget){ if(typeof window['be_custom']['product_as_kit_page_buttons_init'] !== 'function'){ var button_selector = bundle_expert.selectors['product_page']['button']; $(button_selector).each(function (index, element){ var button = element; if ($(button).length > 0){ var button_clone = $(button).clone(); var widget_unique_id = widget['unique_id']; var onclick_attr = "bundle_expert.add_to_cart_by_single_product('" + widget_unique_id + "', false);"; var id_attr = $(button_clone).attr('id') + '-replaced'; $(button_clone).attr('onclick', onclick_attr); $(button_clone).attr('id', id_attr); $(button_clone).attr('data-widget-unique-id', widget_unique_id); $(button).replaceWith(button_clone); } }) var product_as_kit_options = $(bundle_expert.selectors.product_page.product_data).find('input[name^=option][type=\'radio\'], input[name^=option][type=\'checkbox\'], select[name^=option]'); if (typeof product_as_kit_options !== 'undefined'){ $(product_as_kit_options).each(function (index, option_element){ var onchange_text = 'bundle_expert.on_changed_product_as_kit_option(this);'; $(option_element).attr('onchange', onchange_text); $(option_element).attr('data-widget-unique-id', widget['unique_id']); }) } if (bundle_expert.animate_price){ if (bundle_expert.selectors.product_page.button_plus !== ''){ var btn_plus_selector = bundle_expert.selectors.product_page.button_plus; var btn_plus_clone = $(btn_plus_selector).first().clone(); $(btn_plus_selector).replaceWith(btn_plus_clone); $(btn_plus_clone).unbind('click'); $(btn_plus_clone).attr('onclick', 'bundle_expert.product_as_kit_page_change_quantity(1);'); } if (bundle_expert.selectors.product_page.button_minus !== ''){ var btn_minus_selector = bundle_expert.selectors.product_page.button_minus; var btn_minus_clone = $(btn_minus_selector).first().clone(); $(btn_minus_selector).replaceWith(btn_minus_clone); $(btn_minus_clone).unbind('click'); $(btn_minus_clone).attr('onclick', 'bundle_expert.product_as_kit_page_change_quantity(-1);'); } if (bundle_expert.selectors.product_page.quantity !== ''){ var input_quantity_selector = bundle_expert.selectors.product_page.quantity; var input_quantity_clone = $(input_quantity_selector).first().clone(); $(input_quantity_selector).replaceWith(input_quantity_clone); $(input_quantity_selector).attr('data-widget-unique-id', widget['unique_id']) $(input_quantity_clone).unbind('change'); $(input_quantity_clone).attr('onchange', 'bundle_expert.product_as_kit_page_quantity_changed();'); } } }else{ be_custom.product_as_kit_page_buttons_init(widget); } be_custom.point('023',{'widget':widget}); } BundleExpert.product_as_kit_page_change_quantity = function (value){ var input_quantity_selector = bundle_expert.selectors.product_page.quantity; var input_val = $(input_quantity_selector).val(); var quantity = parseInt(input_val)+value; if (quantity <=0){ $(input_quantity_selector).val(1); }else{ $(input_quantity_selector).val(quantity) } $(input_quantity_selector).change(); } BundleExpert.product_as_kit_page_quantity_changed = function (){ var input_quantity_selector = bundle_expert.selectors.product_page.quantity; var input_quantity = $(input_quantity_selector).first(); $(input_quantity).unbind('change'); var widget_unique_id = $(input_quantity).attr('data-widget-unique-id'); var widget=$('.kit-widget[data-widget-unique-id='+widget_unique_id+']'); bundle_expert.update_widget_kit_total(widget); } BundleExpert.update_product_page_price_html = function (widget, json){ if ($(widget).hasClass('product-as-kit-mode') || $(widget).hasClass('product-as-kit-mode-light-mode')){ if ('product_page' in bundle_expert.selectors){ var price_selector = bundle_expert.selectors.product_page.price; var special_selector = '.product-special-container'; var price = $(widget).find('.be-price-old.total-default').html(); var price_value = $(widget).find('.be-price-old.total-default').attr('data-price-value'); if (price_value === ''){ price = $(widget).find('.total-default-new').html(); price_value = $(widget).find('.total-default-new').attr('data-price-value'); } var special = $(widget).find('.total-kit').html(); var special_value = $(widget).find('.total-kit').attr('data-price-value'); $(price_selector).attr('widget-handler-id', $(widget).attr('data-widget-unique-id')); if (typeof window['be_custom']['update_product_page_price_html'] === 'function'){ if (typeof json !== 'undefined'){ price = json['product_as_kit_total_default']; special = json['product_as_kit_total']; } var pointer ={ 'widget':widget, 'selectors':bundle_expert.selectors, 'price':price, 'price_value':price_value, 'special':special, 'special_value':special_value }; if (typeof json !== 'undefined'){ pointer.json = json; } be_custom.update_product_page_price_html(pointer); }else{ $(special_selector).hide(); if (price_value === special_value){ var html = '' + price + '' }else{ var html = ''; if (price_value !== ''){ html += '' + price + ''; } html += '' + special + ''; } if (this.first_change_price){ html = '' + html + ''; if(bundle_expert.selectors.product_page.price_parent!==''){ $(price_selector).closest(bundle_expert.selectors.product_page.price_parent).html(html); }else{ $(price_selector).parent().replaceWith(html); } }else{ $(price_selector).html(html); } if((!this.first_change_price && this.animate_price)){ if (price_value === special_value){ be_animate_price.animatePrice(price_value); }else{ be_animate_price.animatePrice(special_value); be_animate_price.animateOldPrice(price_value); } } this.first_change_price = false; } } } } BundleExpert.show_bundle_errors = function (widget_element, json){ if (json['error']){ if (typeof window['be_custom']['show_bundle_errors'] === 'function'){ be_custom.show_bundle_errors(widget_element, json) }else{ if (json['error']['product_as_kit']){ bundle_expert.show_product_as_kit_error(json['error']['product_as_kit']); delete json['error']['product_as_kit']; var t = 1; } if ($(widget_element).hasClass('kit-widget-table') && $(widget_element).hasClass('display-options-input')){ var table_mode_with_options = true; }else{ var table_mode_with_options = false; } if (table_mode_with_options){ bundle_expert.show_widget_error(widget_element, json); }else{ bundle_expert_form.form_error = json; var element = $(widget_element).find('.kit-item').first(); bundle_expert.show_kit_form(element); } } } } BundleExpert.update_cart_html = function (json){ if (be_custom_header_cart!=='' && typeof window['be_custom_header_cart']['update_cart_html'] === 'function'){ be_custom_header_cart.update_cart_html(json); }else{ if (typeof window['be_custom']['update_cart_html'] === 'function'){ be_custom.update_cart_html(json) }else{ $('#content').parent().before('
' + json['success'] + '
'); setTimeout(function (){ $('#cart-total').html(json['total']); }, 100); $('html, body').animate({scrollTop:0}, 'slow'); $('#cart > ul').load('index.php?route=common/cart/info ul li'); } } if (typeof window['be_popup_bundle'] !== 'undefined'){ be_popup_bundle.close_after_cart(); } } BundleExpert.update_active_option_class = function (form_group){ $(form_group).find('label').removeClass('be-selected-option'); $(form_group).find('input[type="radio"]:checked, input[type="checkbox"]:checked').closest('label').addClass('be-selected-option'); be_custom.point('020',{'form_group':form_group}); } BundleExpert.init_upload_file_buttons_in_widget = function (widget){ $(widget).find('[id^=button-upload]').click(function (){ bundle_expert.init_upload_file(this); }) } BundleExpert.init_upload_file = function (element){ var node = element; var kit_form = $(element).closest('.kit-widget'); $(kit_form).find('#form-upload').remove(); $(kit_form).prepend(''); $(kit_form).find('#form-upload input[name=\'file\']').trigger('click'); if (typeof bundle_expert.file_timer !== 'undefined'){ clearInterval(bundle_expert.file_timer); } bundle_expert.file_timer = setInterval(function (){ if ($(kit_form).find('#form-upload input[name=\'file\']').val() != ''){ clearInterval(bundle_expert.file_timer); var url = bundle_expert.store_url + 'index.php?route=tool/upload'; $.ajax({ url:url, type:'post', dataType:'json', data:new FormData($(kit_form).find('#form-upload')[0]), cache:false, contentType:false, processData:false, beforeSend:function (){ $(node).button('loading'); }, complete:function (){ $(node).button('reset'); }, success:function (json){ $('.text-danger').remove(); if (json['error']){ $(node).parent().find('input').after('
' + json['error'] + '
'); } if (json['success']){ alert(json['success']); $(node).parent().find('input').attr('value', json['code']); } }, error:function (xhr, ajaxOptions, thrownError){ alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); } }, 500); } BundleExpert.on_changed_product_as_kit_option = function (element){ var widget_unique_id = $(element).attr('data-widget-unique-id'); var widget = $('.kit-widget[data-widget-unique-id='+widget_unique_id+']'); bundle_expert.update_widget_kit_total(widget); } BundleExpert.on_checkbox_in_kit_changed = function (element, clear_kit_form){ if (typeof clear_kit_form === "undefined"){ clear_kit_form = true; } var kit_item = $(element).closest('.kit-item'); var widget = $(element).closest('.kit-widget'); var checkbox_value = $(element).prop('checked'); if($(kit_item).hasClass('free-product')){ if (checkbox_value){ bundle_expert.free_product_add_to_kit(kit_item, clear_kit_form); }else{ bundle_expert.free_product_remove_from_kit(kit_item, clear_kit_form); } } if($(kit_item).closest('.product-to-choice-container').length>0){ var container = $(kit_item).closest('.product-to-choice-container'); if(checkbox_value){ $(kit_item).find('.kit-item-product').addClass('product-selected'); if($(kit_item).hasClass('empty-mode-can-be-empty')){ $(kit_item).find('[data-id=input-is-item-is-empty]').val(0); } $(container).find('.kit-item').not(kit_item).each(function (index, item_element){ $(item_element).find('.kit-item-product').removeClass('product-selected'); if($(item_element).hasClass('empty-mode-can-be-empty')){ $(item_element).find('[data-id=input-is-item-is-empty]').val(1); } $(item_element).find('.kit-item-in-checkbox input').prop('checked', false); }) }else{ if($(kit_item).hasClass('empty-mode-can-be-empty')){ $(kit_item).find('.kit-item-product').removeClass('product-selected'); }else{ $(element).prop('checked', true); } } if(clear_kit_form){ var widget_unique_id = $(widget).attr('data-widget-unique-id'); $('.bundle-expert-forms-container').find('[data-widget-unique-id=' + widget_unique_id + ']').remove(); } } be_custom.point('034',{'widget':widget,'kit_item':kit_item}); bundle_expert.update_widget_kit_total(widget); } BundleExpert.add_product_id_to_category_products = function (widget){ category_product_selector = widget['config_category_page']['selector']; $(category_product_selector).each(function (index, element){ var added = $(element).find('.bundle-expert-product-id'); if($(added).length===0){ var html = ''; $(element).append(html); }else{ return false; } }) } BundleExpert.is_widget_checkbox_mode = function (widget){ if($(widget).hasClass('checkbox-mode')){ return true; }else{ return false; } } BundleExpert.setWidgetUpdateTotalEnable = function (widget, enable){ if(enable){ $(widget).removeClass('not-update-total'); }else{ $(widget).addClass('not-update-total'); } } BundleExpert.checkWidgetUpdateTotalEnable = function (widget){ if($(widget).hasClass('not-update-total')){ enable = false; }else{ enable = true; } return enable; } var BundleExpertForm ={}; BundleExpertForm.constructor = function (){ this.items_carousel = ''; this.select_item_products_mode = false; this.open_mode = ''; this.form_error = ''; this.just_show_free_product_by_id = ''; } BundleExpertForm.hide_kit_form = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.modal-body .body-content .kit-form').first(); if (kit_form.length > 0){ this.select_item_products_mode = false; bundle_expert_form.enable_buttons_on_select_item_product(); bundle_expert_form.enable_buttons_on_load(); $(kit_form).find('.kit-form-widget-main-container').show(); $(kit_form).find('.kit-form-item-products-main-container').hide(); $(modal).find('.cart-merge-popup-message').hide(); $(modal).find('.owl-carousel-bundle-expert').trigger('destroy.owl.carousel'); if ($.fn.datetimepicker){ $(kit_form).find('.time').datetimepicker('update'); $(kit_form).find('.date').datetimepicker('update'); $(kit_form).find('.datetime').datetimepicker('update'); $('.kit-widget').find('.time').datetimepicker('update'); $('.kit-widget').find('.date').datetimepicker('update'); $('.kit-widget').find('.datetime').datetimepicker('update'); } var stored_container = $(kit_form).find('.stored-total-values-before-select-product'); if($(stored_container).find('.stored-total-default').html()!==''){ $(kit_form).attr('total-default', $(stored_container).find('.stored-total-default').html()); $(kit_form).attr('total-default-new', $(stored_container).find('.stored-total-default-new').html()); $(kit_form).attr('total-kit', $(stored_container).find('.stored-total-kit').html()); $(kit_form).attr('total-kit-old', $(stored_container).find('.stored-total-kit-old').html()); } var widget_unique_id = $(modal).find('.modal-body .body-content').attr('data-widget-unique-id'); bundle_expert_form.update_widget_by_form(kit_form); var html = $(kit_form).clone(); this.fix_clone_select($(modal).find('.modal-body .body-content .kit-form'), html); $(modal).find('.modal-body .body-content').html(''); $(html).find('.kit-form-item-products-container').html(''); $(html).removeClass('select-product-mode'); this.open_mode = ""; $('.bundle-expert-forms-container').find('[data-widget-unique-id=' + widget_unique_id + ']').html(html); if (bundle_expert.admin_mode){ $('#bundle-expert-container .bundle-expert-forms-container').html(''); $('#bundle-expert-container .bundle-expert-forms-container-from-cart').html(''); } $(modal).find('.modal-footer button[data-dismiss=modal]').click(); } } BundleExpertForm._get_active_item_position = function (kit_form){ var kit_form_widget = $(kit_form).find('.kit-form-widget-main-container').first(); var kit_item_product_active = $(kit_form_widget).find('.kit-item-product.active'); var index = $(kit_form_widget).find('.kit-item-product').index(kit_item_product_active) return index; } BundleExpertForm._get_active_item = function (kit_form){ var kit_form_widget = $(kit_form).find('.kit-form-widget-main-container').first(); var kit_item_product_active = $(kit_form_widget).find('.kit-item-product.active'); return kit_item_product_active; } BundleExpertForm._get_active_item_product_position = function (kit_form, item_positon){ var kit_form_widget = $(kit_form).find('.kit-form-item-products-main-container .kit-form-item-products[data-item-position=' + item_positon + ']').first(); var kit_item_products = $(kit_form_widget).find('.kit-item-product'); var kit_item_product_active = $(kit_form_widget).find('.kit-item-product.active'); var index = $(kit_item_products).index(kit_item_product_active); return index; } BundleExpertForm._get_active_item_product_id = function (kit_form, item_positon, item_positon_free){ var kit_form_widget = $(kit_form).find('.kit-form-item-products-main-container .kit-form-item-products[data-item-position=' + item_positon + '][data-item-position-free=' + item_positon_free + ']').first(); var kit_item_product_active = $(kit_form_widget).find('.kit-item-product.active'); var product_id = $(kit_item_product_active).attr('data-product-id'); return product_id; } BundleExpertForm._get_active_item_product = function (kit_form, item_positon){ var kit_form_widget = $(kit_form).find('.kit-form-item-products-main-container .kit-form-item-products[data-item-position=' + item_positon + ']').first(); var kit_item_product_active = $(kit_form_widget).find('.kit-item-product.active'); return kit_item_product_active; } BundleExpertForm.show_modal_kit_form = function (kit_id, main_product_id, widget_unique_id, active_item_index, active_item_index_free, main_product_in_cart, cart_merge_enable){ var modal = $('#bundle-expert-form-modal'); $(modal).find('.modal-content').attr('kit_id', kit_id); $(modal).find('.modal-content').attr('main_product_id', main_product_id); $(modal).find('.modal-content').attr('widget_unique_id', widget_unique_id); $(modal).find('.modal-content').attr('active_item_index', active_item_index); $(modal).find('.modal-content').attr('active_item_index_free', active_item_index_free); $(modal).find('.modal-content').attr('main_product_in_cart', main_product_in_cart); $(modal).find('.modal-content').attr('cart_merge_enable', cart_merge_enable); $(modal).find('.modal-content').attr('kit_from_cart', 0); var tt = jQuery._data( $(modal), "events" ); var events = []; $.each($._data($(modal)[0], "events"), function(i, event){ events[i]=event; $.each(event, function(j, h){ }); }); $(modal).modal('show'); } BundleExpertForm.show_kit_form = function (){ var owl_carousel_status = bundle_expert_help.get_owl_carousel_status(); if(!owl_carousel_status){ bundle_expert_help.load_owl_carousel('kit_form'); return; } var modal = $('#bundle-expert-form-modal'); var kit_id = $(modal).find('.modal-content').attr('kit_id'); var main_product_id = $(modal).find('.modal-content').attr('main_product_id'); var widget_unique_id = $(modal).find('.modal-content').attr('widget_unique_id'); var active_item_index = $(modal).find('.modal-content').attr('active_item_index'); var active_item_index_free = $(modal).find('.modal-content').attr('active_item_index_free'); var main_product_in_cart = $(modal).find('.modal-content').attr('main_product_in_cart'); var cart_merge_enable = $(modal).find('.modal-content').attr('cart_merge_enable'); var kit_form = $('.bundle-expert-forms-container').find('div[data-widget-unique-id=' + widget_unique_id + ']').find('.kit-form[data-kit-id=' + kit_id + ']').first(); var kit_title = $('.kit-widget[data-widget-unique-id=' + widget_unique_id + ']').attr('data-kit-title'); $(modal).find('.modal-title').html(kit_title); if (kit_form.length !== 0){ if (this.open_mode === "select_product_mode"){ $(kit_form).addClass('select-product-mode'); } $(kit_form).find('.kit-form-product-container .loader-overlay').hide(); $(modal).find('.modal-body .body-loading').hide(); $(modal).find('.modal-body .body-content').html(kit_form); $(modal).find('.modal-footer .total-row .total-kit').html($(kit_form).attr('total-kit')); $(modal).find('.modal-footer .total-row .total').html($(kit_form).attr('total-default')); $(modal).find('.modal-body .body-content').attr('data-widget-unique-id', widget_unique_id); $(kit_form).find('input[name=main_product_in_cart]').val(main_product_in_cart); $(kit_form).find('input[name=cart_merge_enable]').val(cart_merge_enable); var kit_items = $(kit_form).find('.kit-form-widget-container .kit-item'); var first_item = $(kit_items).find('.kit-item-product[data-item-position=' + active_item_index + '][data-item-position-free=' + active_item_index_free + ']'); if ($(first_item).length == 0){ var first_item = $(kit_items).find('.kit-item-product[data-item-position=' + active_item_index + '][data-item-position-free=-1]'); } bundle_expert_form.enable_buttons_on_load(); this.items_carousel = $(kit_form).find('#bundle-expert-form-widget-carousel'); $(this.items_carousel).removeClass('owl-hidden'); bundle_expert.init_carousel(this.items_carousel, -1); bundle_expert_form.set_active_product(first_item); bundle_expert_form.update_kit_form_total(kit_form); if (this.open_mode === "select_product_mode"){ bundle_expert_form.show_item_products(first_item) } if (this.form_error !== ''){ this.show_form_error(kit_form, this.form_error); } be_custom.point('009',{'kit_form':kit_form}); }else{ $(modal).find('.modal-body .body-loading').show(); $(modal).find('.modal-body .body-content').html(''); var url = ''; if (!bundle_expert.admin_mode){ url = 'index.php?route=module/bundle_expert/getKitForm'; }else{ if (!bundle_expert.admin_mode_new_api){ url = 'index.php?route=catalog/bundle_expert/api&token=' + bundle_expert.admin_token + '&api=api/bundle_expert/getKitForm'; }else{ url = bundle_expert.store_url + 'index.php?route=api/bundle_expert/getKitForm&' + bundle_expert.api_token_name + bundle_expert.api_token_value; } } $(modal).find('.modal-body .kit-form-loading-overlay').html(''); $(modal).find('.modal-body .kit-form-loading-overlay').show(); var widget = $('.kit-widget[data-widget-unique-id=' + widget_unique_id + ']'); var free_products = $(widget).find('.kit-items .kit-item'); var data = $(free_products).find('.product-selected input[type=\'text\'], .product-selected input[type=\'hidden\'], .product-selected input[type=\'radio\']:checked, .product-selected input[type=\'checkbox\']:checked, .product-selected select, .product-selected textarea').serializeArray(); data = $(data).add({'name':'kit_id', 'value':kit_id}); data = $(data).add({'name':'main_product_id', 'value':main_product_id}); data = $(data).add({'name':'main_product_in_cart', 'value':main_product_in_cart}); data = bundle_expert_help.normalize_options_names(data); $.ajax({ url:url, type:'post', data:data, dataType:'json', beforeSend:function (){ }, complete:function (){ $(modal).find('.modal-body .kit-form-loading-overlay').hide(); }, success:function (json){ $(modal).find('.modal-body .kit-form-loading-overlay').hide(); if (json['html']){ var html = '
' + json['html'] + '
' $('.bundle-expert-forms-container').append(html); var form_element = $('.bundle-expert-forms-container').find('div[data-widget-unique-id=' + widget_unique_id + ']').find('.kit-form[data-kit-id=' + kit_id + ']').first(); bundle_expert_form.init_kit_form(form_element); bundle_expert_form.show_kit_form(kit_id, main_product_id, widget_unique_id, active_item_index, main_product_in_cart); } if (json['kit_error']){ $(modal).find('.modal-body .body-loading').hide(); var html = '
' + json['kit_error'] + '
' $(modal).find('.modal-body .body-content').html(html); } } }); } } BundleExpertForm.show_modal_kit_form_from_cart = function (kit_unique_id, active_item_index, active_item_index_free){ var modal = $('#bundle-expert-form-modal'); $(modal).find('.modal-content').attr('kit_unique_id', kit_unique_id); $(modal).find('.modal-content').attr('active_item_index', active_item_index); $(modal).find('.modal-content').attr('active_item_index_free', active_item_index_free); $(modal).find('.modal-content').attr('kit_from_cart', 1); $(modal).modal('show'); } BundleExpertForm.show_kit_form_from_cart = function (){ var modal = $('#bundle-expert-form-modal'); var kit_unique_id = $(modal).find('.modal-content').attr('kit_unique_id'); var active_item_index = $(modal).find('.modal-content').attr('active_item_index'); var active_item_index_free = $(modal).find('.modal-content').attr('active_item_index_free'); $(modal).find('.modal-title').html('...'); var kit_form = $('.bundle-expert-forms-container-from-cart').find('div[kit-unique-id=' + kit_unique_id + ']').find('.kit-form').first(); if (kit_form.length !== 0){ $(kit_form).find('.kit-form-product-container .loader-overlay').hide(); $(modal).find('.modal-body .body-loading').hide(); $(modal).find('.modal-title').html($(kit_form).find('input[name=kit_title]').val()); $(modal).find('.modal-body .body-content').html(kit_form); $(modal).find('.modal-footer .total-row .total-kit').html($(kit_form).attr('total-kit')); $(modal).find('.modal-footer .total-row .total').html($(kit_form).attr('total-default')); $(modal).find('.modal-body .body-content').attr('kit-unique-id', kit_unique_id); var kit_items = $(kit_form).find('.kit-form-widget-container .kit-item'); var first_item = $(kit_items[active_item_index]).find('.kit-item-product'); bundle_expert_form.set_active_product(first_item); this.items_carousel = $(kit_form).find('#bundle-expert-form-widget-carousel'); $(this.items_carousel).removeClass('owl-hidden'); bundle_expert.init_carousel(this.items_carousel, -1); bundle_expert_form.update_kit_form_total(kit_form); be_custom.point('010',{'kit_form':kit_form}); }else{ $(modal).find('.modal-body .kit-form-loading-overlay').html(''); $(modal).find('.modal-body .kit-form-loading-overlay').show(); $(modal).find('.modal-body .body-content').html(''); var url = ''; if (!bundle_expert.admin_mode){ url = 'index.php?route=module/bundle_expert/getKitFormFromCart'; }else{ if (!bundle_expert.admin_mode_new_api){ url = 'index.php?route=catalog/bundle_expert/api&token=' + bundle_expert.admin_token + '&api=api/bundle_expert/getKitFormFromCart'; ; }else{ url = bundle_expert.store_url + 'index.php?route=api/bundle_expert/getKitFormFromCart&' + bundle_expert.api_token_name + bundle_expert.api_token_value; if (bundle_expert.debug_mode) bundle_expert.setCookie('XDEBUG_SESSION', 'XDEBUG_ECLIPSE'); } } var owl_carousel_status = bundle_expert_help.get_owl_carousel_status(); if(!owl_carousel_status){ bundle_expert_help.load_owl_carousel('kit_form_from_cart'); return; } $.ajax({ url:url, type:'post', data:{kit_unique_id:kit_unique_id}, dataType:'json', beforeSend:function (){ }, complete:function (){ $(modal).find('.modal-body .kit-form-loading-overlay').hide(); }, success:function (json){ $(modal).find('.modal-body .kit-form-loading-overlay').hide(); if (json['html']){ var html = '
' + json['html'] + '
' $('.bundle-expert-forms-container-from-cart').append(html); var form_element = $('.bundle-expert-forms-container-from-cart').find('div[kit-unique-id=' + kit_unique_id + ']').find('.kit-form').first(); bundle_expert_form.init_kit_form(form_element); bundle_expert_form.show_kit_form_from_cart(kit_unique_id, active_item_index); } if (json['kit_error']){ $(modal).find('.modal-body .body-loading').hide(); var html = '
' + json['kit_error'] + '
' $(modal).find('.modal-body .body-content').html(html); } if (json['kit_enable_status_error']){ $(modal).find('.modal-body .body-loading').hide(); var html = '
' + json['kit_enable_status_error_text'] + '
' $(modal).find('.modal-body .body-content').html(html); } } }); } } BundleExpertForm.init_kit_form = function (kit_form){ $(kit_form).find('.kit-form-product-container .be-product-form').each(function (index1, form_element){ bundle_expert_form.init_product_form(form_element); }) var kit_form_product_container = $(kit_form).find('.kit-form-product-container .kit-form-product-item-conatiner .be-product-form '); $(kit_form_product_container).each(function (index, element){ var tt= $(element).find('#input-for-empty-mode-item-is-empty').val(); if($(element).find('#input-for-empty-mode-item-is-empty').val()==1){ $(element).removeClass('be-selected'); }else{ $(element).addClass('be-selected'); } }) } BundleExpertForm.init_product_form = function (product_form){ var unique_id = $(product_form).attr('unique-id'); var kit_form = $(product_form).closest('.kit-form'); var product_id = $(product_form).attr('data-product-id'); var item_positon = $(product_form).attr('data-item-position'); var item_positon_free = parseInt($(product_form).attr('data-item-position-free')); var item_product_positon = $(product_form).attr('data-item-product-position'); $(product_form).find('.nav.nav-tabs li a').each(function (index, element){ var href = $(element).attr('href'); href = href + '-' + unique_id; $(element).attr('href', href); }) $(product_form).find('.tab-content .tab-pane').each(function (index, element){ var id = $(element).attr('id'); id = id + '-' + unique_id; $(element).attr('id', id); }) bundle_expert_form.product_form_init_standart(product_form); $(product_form).find('#options-container .form-group').each(function (index, group){ bundle_expert.update_active_option_class(group); }) be_custom.point('006',{'product_form':product_form}); } BundleExpertForm.on_click_product_form_option = function (click_element){ be_custom.point('037',{'click_element':click_element}); } BundleExpertForm.on_change_product_option = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); bundle_expert.update_active_option_class($(click_element).closest('.form-group')); if ($(kit_form).length > 0){ if (!bundle_expert_form.select_item_products_mode){ be_custom.point('008',{ 'product_form':$(click_element).closest('.be-product-form'), 'click_element':click_element }); bundle_expert_form.update_kit_form_total(kit_form) bundle_expert_form.clear_items_products(kit_form); }else{ be_custom.point('012',{'product_form':$(click_element).closest('.be-product-form'), 'click_element':click_element}); bundle_expert_form.update_kit_form_total(kit_form) } }else{ var widget = $(click_element).closest('.kit-widget'); var kit_item = $(click_element).closest('.kit-item-product'); var widget_unique_id = $(widget).attr('data-widget-unique-id'); var kit_form = $('#bundle-expert-container .bundle-expert-forms-container div[data-widget-unique-id=' + widget_unique_id + ']').find('.kit-form'); if ($(kit_form).length > 0){ var item_position = $(kit_item).attr('data-item-position'); var item_position_free = $(kit_item).attr('data-item-position-free'); var product_id = $(kit_item).attr('data-product-id'); var product_form = $(kit_form).find('.be-product-form[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '][data-product-id=' + product_id + ']'); if ($(product_form).length > 0){ var options_source = $(kit_item).find('.product-options-values').contents(); var options_target_container = $(product_form).find('#options-container'); bundle_expert_help.copy_options(options_source, options_target_container, 'to_form'); } } bundle_expert.update_widget_kit_total(widget); be_custom.point('007',{'widget':widget, 'click_element':click_element}); } } BundleExpertForm.show_product_form = function (kit_form, kit_id, main_product_id, item_position, item_position_free, product_id, kit_from_cart_unique_id, completeCallback){ var product_form = $(kit_form).find('.kit-form-product-container').find('.be-product-form[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '][data-product-id=' + product_id + ']'); if (product_form.length > 0){ $(product_form).find('#carousel-kit-product-form-images .be-image-additional').on('click', function (event){ var image_href = $(this).find('a').attr('href-link'); $(product_form).find('.thumbnail.main-image img').attr('src', image_href); }); if (this.select_item_products_mode === true || this.open_mode == "select_product_mode"){ }else{ $(product_form).find('.quantity-buttons').show(); } if (this.select_item_products_mode === true){ $(product_form).find('#content-empty').addClass('hidden'); $(product_form).find('#content').removeClass('hidden'); }else{ var is_item_empty = parseInt($(kit_form).find('.kit-items').find('.kit-item[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']').attr('data-empty-item')); if (is_item_empty === 1){ $(product_form).find('#content').addClass('hidden'); $(product_form).find('#content-empty').removeClass('hidden'); }else{ $(product_form).find('#content').removeClass('hidden'); $(product_form).find('#content-empty').addClass('hidden'); } } ; $(product_form).find('#options-container .form-group').each(function (index, group){ bundle_expert.update_active_option_class(group); }) bundle_expert_form.product_form_init_standart(product_form); $(product_form).closest('.kit-form-product-item-conatiner').show(); $(product_form).show(); $(product_form).addClass('active-form'); $(product_form).find('[id^=button-upload]').unbind('click'); $(product_form).find('[id^=button-upload]').bind('click', function (){ bundle_expert_form.init_upload_file(this); }) be_custom.point('016',{'kit_form':kit_form, 'product_form':product_form}); var image_carousel = $(product_form).find('#carousel-kit-product-form-images'); $(image_carousel).removeClass('owl-hidden'); $(image_carousel).owlCarouselBundleExpert({ items:4, autoPlay:false, mouseDrag:false, nav:true, navText:['', ''], dots:false, center:false }); if (typeof completeCallback !== 'undefined'){ completeCallback(product_form); } if (this.select_item_products_mode === true){ var product_quantity = $(product_form).find('input.input-quantity-field').val(); bundle_expert_form.update_product_quantity(kit_form, item_position, item_position_free, product_quantity); this.update_kit_form_total(kit_form); } }else{ var url = ''; if (!bundle_expert.admin_mode){ url = 'index.php?route=module/bundle_expert/getKitFormProduct'; }else{ if (!bundle_expert.admin_mode_new_api){ url = 'index.php?route=catalog/bundle_expert/api&token=' + bundle_expert.admin_token + '&api=api/bundle_expert/getKitFormProduct'; }else{ url = bundle_expert.store_url + 'index.php?route=api/bundle_expert/getKitFormProduct&' + bundle_expert.api_token_name + bundle_expert.api_token_value; } } if (this.select_item_products_mode){ var is_free_product = 0; }else{ var active_item = $(kit_form).find('.kit-form-widget-container .kit-items .kit-item-product.product-selected[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); var is_free_product = $(active_item).find('input[data-id=input-is-free-product]').val(); } $.ajax({ url:url, type:'post', data:{ kit_id:kit_id, main_product_id:main_product_id, item_position:item_position, item_position_free:item_position_free, product_id:product_id, kit_from_cart_unique_id:kit_from_cart_unique_id, is_free_product:is_free_product }, dataType:'json', beforeSend:function (){ $(kit_form).find('.kit-form-product-container .loader-overlay').show(); bundle_expert_form.disable_buttons_on_load(); bundle_expert_form.disable_kit_form_widget_items_on_product_load(); }, complete:function (){ $(kit_form).find('.kit-form-product-container .loader-overlay').hide(); bundle_expert_form.enable_buttons_on_load(); bundle_expert_form.enable_kit_form_widget_items_on_product_load(); }, success:function (json){ if (json['kit_error']){ var modal = $('#bundle-expert-form-modal'); $(modal).find('.modal-body .body-loading').hide(); var html = '
' + json['kit_error'] + '
' $(modal).find('.modal-body .body-content').html(html); } if (json['html']){ $(kit_form).find('.kit-form-product-container .kit-form-product-item-conatiner[data-item-position=' + item_position + ']').append(json['html']) product_form = $(kit_form).find('.kit-form-product-container').find('.be-product-form[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); if ($(product_form).length !== 0){ bundle_expert_form.init_product_form(product_form); bundle_expert_form.show_product_form(kit_form, kit_id, main_product_id, item_position, item_position_free, product_id, kit_from_cart_unique_id, completeCallback); } } } }); } } BundleExpertForm.on_click_select_item_product_button = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); if (kit_form.length > 0){ bundle_expert_form.open_mode = ""; bundle_expert_form.set_active_product($(click_element).closest('.kit-item').find('.kit-item-product .be-product-thumb')); bundle_expert_form.show_item_products($(click_element).closest('.kit-item').find('.kit-item-product .be-product-thumb')); }else{ bundle_expert_form.open_mode = "select_product_mode"; bundle_expert_form.set_active_product($(click_element).closest('.kit-item').find('.kit-item-product .be-product-thumb')); } } BundleExpertForm.on_click_add_free_product_button = function (click_element){ var kit_item = $(click_element).closest('.kit-item'); bundle_expert.free_product_add_to_kit(kit_item); } BundleExpertForm.set_active_product = function (click_element){ if ($(click_element).hasClass('not-clickable')) return; if ($(click_element).closest('#free-item-products-container').length > 0){ bundle_expert_form.open_mode = "select_product_mode"; } var kit_form = $(click_element).closest('.kit-form'); bundle_expert_form.item_products_filter_set_visible(false); if (kit_form.length == 0){ var widget = $(click_element).closest('.kit-widget'); var kit_id = $(widget).attr('data-kit-id'); var main_product_id = $(widget).find('.kit-data').find('input[name=main_product_id]').val(); var main_product_in_cart = $(widget).find('.kit-data').find('input[name=main_product_in_cart]').val(); var cart_merge_enable = $(widget).find('.kit-data').find('input[name=cart_merge_enable]').val(); var widget_unique_id = $(widget).attr('data-widget-unique-id'); var active_item_position = $(click_element).closest('.kit-item-product').attr('data-item-position'); var active_item_position_free = $(click_element).closest('.kit-item-product').attr('data-item-position-free'); var is_free_product = parseInt($(click_element).closest('.kit-item-product').find('input[data-id=input-is-free-product]').val()); var free_product_in_kit = parseInt($(click_element).closest('.kit-item-product').find('input[data-id=input-free-product-in-kit]').val()); if (is_free_product == 1 && free_product_in_kit == 0){ bundle_expert_form.open_mode = "select_product_mode"; active_item_position_free = -1; bundle_expert_form.just_show_free_product_by_id = $(click_element).closest('.kit-item-product').attr('data-product-id'); } bundle_expert_form.show_modal_kit_form(kit_id, main_product_id, widget_unique_id, active_item_position, active_item_position_free, main_product_in_cart, cart_merge_enable); return; } var widget = $(click_element).closest('.kit-form-widget-container, .kit-form-item-products'); if ($(widget).hasClass('kit-form-item-products')) var is_item_products_widget = true; else var is_item_products_widget = false; var kit_id = $(kit_form).find('.kit-data input[name=kit_id]').val(); var main_product_id = $(kit_form).find('.kit-data input[name=main_product_id]').val(); var kit_from_cart_unique_id = $(kit_form).find('.kit-data input[name=kit_from_cart_unique_id]').val(); var kit_item = $(click_element).closest('.kit-item'); var kit_item_product = $(click_element).closest('.kit-item-product'); var item_position = $(kit_item_product).attr('data-item-position'); var item_position_free = $(kit_item_product).attr('data-item-position-free'); var product_id = $(kit_item_product).attr('data-product-id'); $(widget).find('.kit-item-product').removeClass('active'); $(widget).find('.empty-kit-item-product').removeClass('active'); $(kit_item_product).addClass('active'); $(kit_item_product).closest('.kit-item').find('.empty-kit-item-product').addClass('active'); if (parseInt($(kit_item).attr('data-empty-item')) === 1){ var name = $(kit_item).find('.empty-kit-item-product .be-product-title').html(); }else{ var name = $(kit_item).find('.be-product-title').html(); } $(kit_form).find('.kit-form-arrows .be-product-title').html(name); var href = $(kit_form).find('.kit-form-arrows .be-product-title a').attr('data-href'); $(kit_form).find('.kit-form-arrows .be-product-title a').attr('href', href); if ($(kit_item).hasClass('selectable')){ $(kit_form).find('.kit-form-arrows .product-select-button').show(); }else{ $(kit_form).find('.kit-form-arrows .product-select-button').hide(); } if (bundle_expert_form.items_carousel !== ''){ if (is_item_products_widget) var product_index = $(kit_item_product).attr('data-item-product-position'); else var product_index = $(kit_item_product).attr('data-item-position'); $(widget).find('.owl-carousel-bundle-expert').trigger('to.owl.carousel', [product_index, 500, true]); } $(kit_form).find('.kit-form-product-item-conatiner').hide(); $(kit_form).find('.kit-form-product-container').find('.be-product-form').hide(); $(kit_form).find('.kit-form-product-container').find('.be-product-form').removeClass('active-form'); be_custom.point('015',{'kit_form':kit_form}); this.show_product_form(kit_form, kit_id, main_product_id, item_position, item_position_free, product_id, kit_from_cart_unique_id); } BundleExpertForm.set_prev_active_product = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); var kit_form_widget = $(kit_form).find('.kit-form-widget-main-container').first(); var kit_items = $(kit_form_widget).find('.kit-item'); var index = this._get_active_item_position(kit_form); if (index > 0){ index--; }else{ index = kit_items.length - 1; return; } this.set_active_product($(kit_items[index]).find('.kit-item-product').first()); } BundleExpertForm.set_prev_active_select_product = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); var active_item_position = this._get_active_item_position(kit_form); var item_position = $(click_element).attr('data-item-position'); var kit_form_widget = $(kit_form).find('.kit-form-item-products-main-container .kit-form-item-products[data-item-position=' + item_position + ']').first(); var kit_item_products = $(kit_form_widget).find('.kit-item-product'); var index = this._get_active_item_product_position(kit_form, item_position); if (index > 0){ index--; }else{ index = kit_item_products.length - 1; return; } this.set_active_product($(kit_item_products[index])); } BundleExpertForm.set_next_active_product = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); var kit_form_widget = $(kit_form).find('.kit-form-widget-main-container').first(); var kit_items = $(kit_form_widget).find('.kit-item'); var index = this._get_active_item_position(kit_form); if (index >= kit_items.length - 1){ index = 0; return; }else{ index++; } this.set_active_product($(kit_items[index]).find('.kit-item-product').first()); } BundleExpertForm.set_next_active_select_product = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); var active_item_position = this._get_active_item_position(kit_form); var item_position = $(click_element).attr('data-item-position'); var kit_form_widget = $(kit_form).find('.kit-form-item-products-main-container .kit-form-item-products[data-item-position=' + item_position + ']').first(); var kit_item_products = $(kit_form_widget).find('.kit-item-product'); var index = this._get_active_item_product_position(kit_form, item_position); if (index >= kit_item_products.length - 1){ index = 0; $(kit_form_widget).find('#more-button').click(); return; }else{ index++; } this.set_active_product($(kit_item_products[index])); } BundleExpertForm.show_item_products = function (click_element){ this.select_item_products_mode = true; bundle_expert_form.disable_buttons_on_select_item_product(); var kit_form = $(click_element).closest('.kit-form'); var kit_id = $(kit_form).find('.kit-data input[name=kit_id]').val(); var main_product_id = $(kit_form).find('.kit-data input[name=main_product_id]').val(); var kit_from_cart_unique_id = $(kit_form).find('.kit-data input[name=kit_from_cart_unique_id]').val(); var kit_item_product = $(kit_form).find('.kit-form-widget-container .kit-item-product.active'); var item_position = $(kit_item_product).attr('data-item-position'); var item_position_free = $(kit_item_product).attr('data-item-position-free'); var product_id = $(kit_item_product).attr('data-product-id'); var item_products_main_container = $(kit_form).find('.kit-form-item-products-main-container').first(); var item_products_container = $(kit_form).find('.kit-form-item-products-container').first(); $(item_products_container).find('.kit-form-item-products').hide(); $(item_products_main_container).attr('active-item-position', item_position); var item_products = $(item_products_container).find('.kit-form-item-products[data-item-position=' + item_position + ']'); var select_button = $(kit_form).find('.kit-form-item-products-buttons #button-set-item-product-selected'); $(select_button).attr('data-item-position', item_position); $(select_button).attr('data-item-position-free', item_position_free); var arrows_button = $(kit_form).find('.kit-form-item-products-main-container .arrows-container button'); $(arrows_button).attr('data-item-position', item_position); $(arrows_button).attr('data-item-position-free', item_position_free); var stored_container =$(kit_form).find('.stored-total-values-before-select-product'); $(stored_container).find('.stored-total-default').html($(kit_form).attr('total-default')); $(stored_container).find('.stored-total-default-new').html($(kit_form).attr('total-default-new')); $(stored_container).find('.stored-total-kit').html($(kit_form).attr('total-kit')); $(stored_container).find('.stored-total-kit-old').html($(kit_form).attr('total-kit-old')); if (item_products.length === 0){ bundle_expert_form.load_item_products(kit_form, kit_id, main_product_id, item_position, item_position_free, kit_from_cart_unique_id, 0); }else{ var active_element = $(item_products_container).find('.kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '][data-product-id=' + product_id + ']'); if ($(active_element).length == 0){ active_element = $(item_products_container).find('.kit-item-product[data-item-position=' + item_position + ']').first(); } bundle_expert_form.set_active_product(active_element); be_custom.point('027',{'active_element':active_element}); $(item_products).show(); } $(kit_form).find('.kit-form-widget-main-container').hide(); $(item_products_main_container).show(); } BundleExpertForm.load_item_products = function (kit_form, kit_id, main_product_id, item_position, item_position_free, kit_from_cart_unique_id, last_item_product_position){ var url = ''; if (!bundle_expert.admin_mode){ url = 'index.php?route=module/bundle_expert/getKitItemProducts'; }else{ if (!bundle_expert.admin_mode_new_api){ url = 'index.php?route=catalog/bundle_expert/api&token=' + bundle_expert.admin_token + '&api=api/bundle_expert/getKitItemProducts'; }else{ url = bundle_expert.store_url + 'index.php?route=api/bundle_expert/getKitItemProducts&' + bundle_expert.api_token_name + bundle_expert.api_token_value; } } var item_products_main_container = $(kit_form).find('.kit-form-item-products-main-container').first(); var item_products_container = $(kit_form).find('.kit-form-item-products-container').first(); var item_products = $(item_products_container).find('.kit-form-item-products[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); var kit_item_product = $(kit_form).find('.kit-form-widget-container .kit-item-product.active'); var product_id = $(kit_item_product).attr('data-product-id'); var filter_title = $(kit_form).find('input[name=filter_title]').val(); var data = bundle_expert_form._get_kit_form_data(kit_form); data = $(data).add({'name':'kit_id', 'value':kit_id}); data = $(data).add({'name':'main_product_id', 'value':main_product_id}); data = $(data).add({'name':'item_position', 'value':item_position}); data = $(data).add({'name':'kit_from_cart_unique_id', 'value':kit_from_cart_unique_id}); data = $(data).add({'name':'last_item_product_position', 'value':last_item_product_position}); data = $(data).add({'name':'main_product_id', 'value':main_product_id}); data = $(data).add({'name':'filter_title', 'value':filter_title}); $.ajax({ url:url, type:'post', data:data, dataType:'json', beforeSend:function (){ if (last_item_product_position == 0){ $(item_products_main_container).find('.loader-overlay').show(); $(item_products_main_container).find('.kit-form-item-products-buttons').hide(); }else{ $(item_products).find('.item-more-button #more-button').hide(); $(item_products).find('.item-more-button #loading-spinner').show(); } bundle_expert_form.disable_buttons_on_load(); }, complete:function (){ $(item_products_main_container).find('.loader-overlay').hide(); $(item_products_main_container).find('.kit-form-item-products-buttons').show(); item_products = $(item_products_container).find('.kit-form-item-products[data-item-position=' + item_position + ']'); $(item_products).find('.item-more-button #more-button').show(); $(item_products).find('.item-more-button #loading-spinner').hide(); if ($(item_products).find('.item.product-item').length == 0) $(kit_form).find('#button-set-item-product-selected').prop('disabled', true); }, success:function (json){ bundle_expert_form.enable_buttons_on_load(); bundle_expert_form.disable_buttons_on_select_item_product(); if (json['kit_error']){ var modal = $('#bundle-expert-form-modal'); $(modal).find('.modal-body .body-loading').hide(); var html = '
' + json['kit_error'] + '
' $(modal).find('.modal-body .body-content').html(html); bundle_expert_form.hide_item_products($(modal).find('#button-set-item-product-selected').first()) } if (json['html']){ if (last_item_product_position === 0){ $(item_products_container).append(json['html']) item_products = $(item_products_container).find('.kit-form-item-products[data-item-position=' + item_position + ']'); $(item_products).attr('data-last-item-product-position', json['last_item_product_position']); var active_element = $(item_products_container).find('.kit-item-product[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); if ($(active_element).length === 0){ if (bundle_expert_form.just_show_free_product_by_id !== ''){ active_element = $(item_products_container).find('.kit-item-product[data-item-position=' + item_position + '][data-product-id=' + bundle_expert_form.just_show_free_product_by_id + ']'); if ($(active_element).length == 0){ active_element = $(item_products_container).find('.kit-item-product[data-item-position=' + item_position + ']').first(); } }else{ active_element = $(item_products_container).find('.kit-item-product[data-item-position=' + item_position + ']').first(); } bundle_expert_form.just_show_free_product_by_id = ''; } if ($(item_products).find('.item.product-item').length != 0){ var items_products_carousel = $(item_products).find('#carousel-kit-form-item-products'); var container_width = $(kit_form).width(); $(items_products_carousel).removeClass('owl-hidden'); bundle_expert.init_carousel(items_products_carousel, container_width); }else{ $(item_products).html($(item_products).find('.empty-list-item')); } if ($(active_element).length !== 0){ bundle_expert_form.set_active_product(active_element); be_custom.point('028',{'active_element':active_element}); } $(item_products).show(); }else{ var item_products = $(item_products_container).find('.kit-form-item-products[data-item-position=' + item_position + ']'); var carousel = $(item_products).find('#carousel-kit-form-item-products').first(); var more_button = $(item_products).find('#more-button').closest('.item'); var more_button_position = $(item_products).find('.item').index(more_button); $(carousel).trigger('remove.owl.carousel', [more_button_position]); $(item_products).attr('data-last-item-product-position', json['last_item_product_position']); var items = $(json['html']).find('.item'); for (var i = 0;i < items.length;i++){ $(carousel).trigger('add.owl.carousel', [items[i]]).trigger('refresh.owl.carousel'); } } $(item_products).find('.kit-item-product').each(function (index, element){ $(element).attr('data-item-product-position', index); }) } be_custom.point('038',{'kit_form':kit_form}); } }); } BundleExpertForm.load_more_item_products = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); var kit_id = $(kit_form).attr('data-kit-id'); var main_product_id = $(kit_form).attr('data-main-product-id'); var item_position = $(click_element).closest('.kit-form-item-products').attr('data-item-position'); var item_position_free = $(click_element).closest('.kit-form-item-products').attr('data-item-position-free'); var kit_from_cart_unique_id = $(kit_form).find('.kit-data input[name=kit_from_cart_unique_id]').val(); var last_item_product_position = parseInt($(click_element).closest('.kit-form-item-products').attr('data-last-item-product-position')) + 1; bundle_expert_form.load_item_products(kit_form, kit_id, main_product_id, item_position, item_position_free, kit_from_cart_unique_id, last_item_product_position); } BundleExpertForm.item_products_filter_click = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form'); var kit_form_arrows = $(kit_form).find('.kit-form-item-products-main-container .kit-form-arrows'); if ($(kit_form_arrows).find('.product-title-filter').hasClass('hidden')){ bundle_expert_form.item_products_filter_set_visible(true); $(kit_form_arrows).find('.product-title-filter input').focus(); }else{ var kit_id = $(kit_form).attr('data-kit-id'); var main_product_id = $(kit_form).attr('data-main-product-id'); var item_position = $(kit_form).find('.kit-form-item-products-main-container').attr('active-item-position'); var item_position_free = $(kit_form).find('.kit-form-item-products-main-container').attr('active-item-position-free'); var kit_from_cart_unique_id = $(kit_form).find('.kit-data input[name=kit_from_cart_unique_id]').val(); var last_item_product_position = 0; var item_products = $(kit_form).find('.kit-form-item-products-container .kit-form-item-products[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); $(item_products).remove(); bundle_expert_form.load_item_products(kit_form, kit_id, main_product_id, item_position, item_position_free, kit_from_cart_unique_id, last_item_product_position); } } BundleExpertForm.item_products_filter_reset = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form'); var filter_title = $(kit_form).find('input[name=filter_title]').val(); if (filter_title !== ''){ $(kit_form).find('input[name=filter_title]').val(''); bundle_expert_form.item_products_filter_click(); } bundle_expert_form.item_products_filter_set_visible(false); } BundleExpertForm.item_products_filter_set_visible = function (visible){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form'); var kit_form_arrows = $(kit_form).find('.kit-form-item-products-main-container .kit-form-arrows'); if (visible){ $(kit_form_arrows).find('.be-product-title').addClass('hidden'); $(kit_form_arrows).find('.product-title-filter').removeClass('hidden'); }else{ $(kit_form_arrows).find('.be-product-title').removeClass('hidden'); $(kit_form_arrows).find('.product-title-filter').addClass('hidden'); } } BundleExpertForm.update_kit_form_product_free_index = function (kit_form, item_position){ var selected_free_products = $(kit_form).find('.be-product-form.be-selected[data-item-position='+item_position+']:not(.product-form-free-product-plug)'); $(selected_free_products).each(function (index0, product_form){ $(product_form).find('input, textarea, select').each(function (index1, element){ var attr_name = $(element).attr('name'); var item_position_free = index0; attr_name = attr_name.replace(/\[[0-900]\]\[[0-900]\]/g, '['+item_position+']['+item_position_free+']'); $(element).attr('name', attr_name); }); }) var selected_free_products = $(kit_form).find('.kit-form-widget-main-container .kit-items .kit-item:not(.free-product-template)[data-item-position=' + item_position + ']').closest('.kit-item'); $(selected_free_products).each(function (index0, product_element){ $(product_element).find('input, textarea, select').each(function (index1, element){ var attr_name = $(element).attr('name'); var item_position_free = index0; attr_name = attr_name.replace(/\[[0-900]\]\[[0-900]\]/g, '['+item_position+']['+item_position_free+']'); $(element).attr('name', attr_name); }); }) } BundleExpertForm.set_kit_form_product_free_index = function (kit_form, product_id, item_position, item_position_free){ var product_form = $(kit_form).find('.be-product-form[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); var widget_item = $(kit_form).find('.kit-form-widget-main-container .kit-items .kit-item-product[data-item-position=' + item_position + '][data-product-id=' + product_id + ']').closest('.kit-item'); if ($(widget_item).hasClass('free-product')){ bundle_expert_form.update_kit_form_product_free_index(kit_form, item_position); } } BundleExpertForm.on_click_delete_item_from_kit = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); var kit_item = $(click_element).closest('.kit-item'); var kit_item_product = $(kit_item).find('.kit-item-product'); var product_id = $(kit_item_product).attr('data-product-id'); if($(kit_form).length>0){ var item_position = $(kit_item).attr('data-item-position'); var item_position_free = $(kit_item).attr('data-item-position-free'); var kit_form_product_container = $(kit_form).find('.kit-form-product-container').first(); var product_form = $(kit_form_product_container).find('.be-product-form[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); var is_free_product = $(kit_item).hasClass('free-product'); if($(kit_item_product).hasClass('active')){ if(is_free_product){ var prev = $(kit_item).closest('.owl-item').prev('.owl-item'); if ($(prev).length > 0){ $(prev).find('.be-product-thumb').click(); }else{ var next = $(kit_item).closest('.owl-item').next('.owl-item'); if ($(next).length > 0){ $(next).find('.be-product-thumb').click(); } } } } if(is_free_product){ $(product_form).replaceWith(''); }else{ $(product_form).replaceWith(''); if($(kit_item_product).hasClass('active')){ var empty_form = $(kit_form_product_container).find('.be-product-form[data-item-position=' + item_position + '][data-product-id=' + '-1' + ']'); $(empty_form).addClass('active-form'); } } if(is_free_product){ var carousel_item = $(kit_item).closest('.owl-item'); bundle_expert_form.removeFreeProductFromCarousel(carousel_item); }else{ } $(kit_form).find('.kit-form-item-products[data-item-position=' + item_position + ']').replaceWith(''); var widget_unique_id = $(kit_form).closest('.body-content').attr('data-widget-unique-id'); var widget = $('.kit-widget[data-widget-unique-id='+widget_unique_id+']').first(); if($(widget).length>0){ var widget_kit_item = $(widget).find('.kit-items .kit-item .kit-item-product[data-item-position='+item_position+'][data-product-id='+product_id+']'); bundle_expert.setWidgetUpdateTotalEnable(widget, false); if($(widget).hasClass('checkbox-mode')){ var check_box = $(widget_kit_item).find('.kit-item-in-checkbox input'); $(check_box).prop('checked', false); bundle_expert.on_checkbox_in_kit_changed(check_box, false); }else{ if($(widget).hasClass('kit-widget-carousel')){ var carousel_item = $(widget).find('.kit-item-product[data-item-position='+item_position+'][data-product-id='+product_id+']');; if($(carousel_item).length>0){ carousel_item = $(carousel_item).closest('.owl-item'); bundle_expert_form.removeFreeProductFromCarousel(carousel_item); } }else{ bundle_expert.on_click_remove_product_button(widget_kit_item, false); } } bundle_expert.setWidgetUpdateTotalEnable(widget, true); } if(is_free_product){ bundle_expert_form.update_kit_form_product_free_index(kit_form, item_position); } this.update_kit_form_total(kit_form); } } BundleExpertForm.set_item_product_selected = function (click_element){ var kit_form = $(click_element).closest('.kit-form'); var select_button = $(kit_form).find('.kit-form-item-products-buttons #button-set-item-product-selected'); var item_position = $(select_button).attr('data-item-position'); var item_position_free = $(select_button).attr('data-item-position-free'); var active_item_position = this._get_active_item_position(kit_form); var active_item = this._get_active_item(kit_form); var selected_item_product = $(kit_form).find('.kit-form-item-products[data-item-position=' + item_position + '] .kit-item-product.active').first(); var is_free_product = $(selected_item_product).find('input[data-id=input-is-free-product]').val(); var active_item_product = this._get_active_item_product(kit_form, item_position); var product_id = $(active_item_product).attr('data-product-id'); var kit_form_product_container = $(kit_form).find('.kit-form-product-container').first(); var product_forms = $(kit_form_product_container).find('.be-product-form[data-item-position=' + item_position + ']'); var product_form = $(kit_form_product_container).find('.be-product-form[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); if (is_free_product !== "1"){ $(product_forms).removeClass('be-selected'); $(product_form).addClass('be-selected'); }else{ $(product_form).addClass('be-selected'); } $(product_form).find('#content').removeClass('hidden'); $(product_form).find('#content-empty').addClass('hidden'); $(product_form).find('input#input-for-empty-mode-item-is-empty').val(0); if (is_free_product === "1") if (is_free_product === "1"){ } if (is_free_product === "1"){ var item_position_free = parseInt($(kit_form).find('.kit-form-widget-container').find('.kit-items .kit-item.free-product[data-item-position=' + item_position + ']').last().attr('data-item-position-free')); if (isNaN(item_position_free)){ item_position_free = 0; }else{ item_position_free++; } $(product_form).find('input[data-id=input-free-product-in-kit]').val(1); $(product_form).find('input[data-id=input-checkbox-in-kit-field]').val(1); $(product_form).attr('data-item-position-free', item_position_free); $(product_form).find('input[data-id=input-item-position-free]').val(item_position_free); $(product_form).find('input, textarea, select').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_free[0]', 'kit_items_free[' + item_position + '][' + item_position_free + ']'); }); var clone = $(selected_item_product).closest('.kit-item').clone(); $(clone).find('input[data-id=input-free-product-in-kit]').val(1); $(clone).find('input[data-id=input-checkbox-in-kit-field]').val(1); $(clone).attr('data-item-position-free', item_position_free); $(clone).find('.kit-item-product').attr('data-item-position-free', item_position_free); $(clone).find('input[data-id=input-item-position-free]').val(item_position_free); $(clone).find('input[data-id=input-checkbox-in-kit-field]').prop('checked', true); $(clone).find('.plus-symbol').first().removeClass('hidden'); this.addFreeProductToCarousel(kit_form, clone); }else{ var clone = $(selected_item_product).clone(); $(active_item).closest('.kit-item').attr('data-empty-item', 0); $(active_item).closest('.kit-item').find('.empty-kit-item-product').addClass('hidden'); $(clone).find('.selectable-item-container').removeClass('hidden'); $(active_item).replaceWith(clone); } var quantity = $(product_form).find('input.input-quantity-field').val(); $(product_form).find('input.input-quantity-field').val(quantity); $(clone).find('[data-id=input-quantity]').val(quantity); this.set_kit_form_product_free_index(kit_form, product_id, item_position, item_position_free); this.set_active_product($(clone).find('.be-product-thumb')); var is_main_product_position = $(active_item_product).closest('.kit-item').attr('data-is-main-product-position'); if (is_main_product_position === "1"){ $(kit_form).find('.kit-data').find('input[name=main_product_id]').val(product_id); } bundle_expert_form.update_product_quantity(kit_form, item_position, item_position_free, parseInt($(clone).find('input[data-id=input-quantity]').val())); bundle_expert_form.clear_items_products(kit_form); this.update_kit_form_total(kit_form); var hide = be_custom.point('029',{'product_form':product_form}); if (hide !== false){ this.hide_item_products(click_element); } if (hide !== false){ if ($(clone).hasClass('free-product')){ $(kit_form).find('.kit-form-item-products[data-item-position=' + item_position + ']').replaceWith(''); } } } BundleExpertForm.addFreeProductToCarousel = function (kit_form, item){ var item_position = $(item).attr('data-item-position'); var carousel = $(kit_form).find('#bundle-expert-form-widget-carousel.owl-carousel-bundle-expert').first(); var add_free_items = $(carousel).find('.free-product-template').closest('.owl-item'); var add_free_items_new = []; for (var i = 0;i < $(add_free_items).length;i++){ var add_free_item = add_free_items[i]; var add_free_button_position = $(carousel).find('.owl-item').index(add_free_item); add_free_items_new[i] = $(add_free_item).find('.kit-item').clone(); $(carousel).trigger('remove.owl.carousel', [add_free_button_position]); } $(carousel).trigger('add.owl.carousel', [item]).trigger('refresh.owl.carousel'); for (var i = 0;i < $(add_free_items_new).length;i++){ var add_free_item = add_free_items_new[i]; $(carousel).trigger('add.owl.carousel', [add_free_item]); } $(carousel).trigger('refresh.owl.carousel'); $(carousel).trigger('destroy.owl.carousel'); var container_width = $(kit_form).find('.kit-form-item-products-main-container').width(); bundle_expert.init_carousel(carousel, container_width); } BundleExpertForm.removeFreeProductFromCarousel = function (carousel_item){ var carousel = $(carousel_item).closest('.owl-carousel'); var owl_index = $(carousel).find('.owl-item').index(carousel_item); $(carousel).trigger('remove.owl.carousel', [owl_index]); $(carousel).trigger('destroy.owl.carousel'); $(carousel).removeClass('owl-hidden'); bundle_expert.init_carousel(carousel, -1); return; } BundleExpertForm.clear_items_products = function (form){ if (bundle_expert.reload_item_products === 1){ $(form).find('.kit-form-item-products-container').html(''); } } BundleExpertForm.hide_item_products = function (click_element){ this.select_item_products_mode = false; bundle_expert_form.enable_buttons_on_select_item_product(); var kit_form = $(click_element).closest('.kit-form'); var item_products_main_container = $(kit_form).find('.kit-form-item-products-main-container').first(); $(kit_form).find('.kit-form-widget-main-container').show(); $(item_products_main_container).hide(); var stored_container = $(kit_form).find('.stored-total-values-before-select-product'); $(stored_container).find('.stored-total-default').html(''); $(stored_container).find('.stored-total-default-new').html(''); $(stored_container).find('.stored-total-kit').html(''); $(stored_container).find('.stored-total-kit-old').html(''); if (this.open_mode === "select_product_mode"){ var widget_unique_id = $(kit_form).closest('.modal-content').attr('widget_unique_id'); bundle_expert_form.hide_kit_form(); var widget = $('.kit-widget[data-widget-unique-id=' + widget_unique_id + ']'); bundle_expert.update_widget_kit_total(widget); }else{ var active_item = this._get_active_item(kit_form); this.set_active_product(active_item); this.update_kit_form_total(kit_form); } } BundleExpertForm._get_kit_form_data = function (kit_form){ var data = $(kit_form).find('.kit-data').find('input[type=\'text\'], input[type=\'hidden\']'); var data_products = $(kit_form).find('.kit-form-product-container .be-product-form.be-selected:not(.product-form-free-product-plug)').find('input[type=\'text\'], input[type=\'hidden\'], input[type=\'radio\']:checked, input[type=\'checkbox\']:checked, select, textarea, .kit-data input[type=\'hidden\']'); var disabled = $(kit_form).find('.kit-form-product-container .be-product-form.be-selected').find('input:disabled, select:disabled, textarea:disabled'); disabled.prop('disabled', false); var serialized = $(data_products).serializeArray(); disabled.prop('disabled', true); data = $(data).add(serialized); return data } BundleExpertForm.show_form_error = function (kit_form, form_error){ var json = []; json = form_error; $(kit_form).find('.bottom-block-header').before('
' + json['error_text'] + '
'); setTimeout(function (){ $(kit_form).find('.bottom-block .alert').fadeOut(1000, 0); }, 8000); var j; var i; for (j in json['error']){ if (json['error'][j]['option']){ var item_position = json['error'][j]['item_position']; var item_position_free = json['error'][j]['item_position_free']; var active_product_form = $(kit_form).find('.kit-form-product-container .kit-form-product-item-conatiner .be-product-form.be-selected[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); ; $(kit_form).find('.kit-form-widget-main-container').find('.kit-item[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']').find('.alert-icon').show(); for (var k = 0;k < json['error'][j]['option'].length;k++){ var error_option = json['error'][j]['option'][k]; for (i in error_option){ var element = $(active_product_form).find('#input-option' + i.replace('_', '-')); if (element.parent().hasClass('input-group')){ element.parent().after('
' + error_option[i] + '
'); }else{ element.after('
' + error_option[i] + '
'); } } } } if (json['error'][j]['recurring']){ $(active_product_form).find('select[name=\'recurring_id\']').after('
' + json['error'][j]['recurring'] + '
'); } } bundle_expert_form.scroll_to_option_error(kit_form, json); this.form_error = ''; } BundleExpertForm.add_to_cart = function (element, update_mode){ var kit_form = $(element).closest('.kit-form'); var form_products_container = $(kit_form).find('.kit-form-product-container .be-product-form.be-selected:not(.product-form-free-product-plug)'); be_custom.point('032',{'kit_form':kit_form}); var data = bundle_expert_form._get_kit_form_data(kit_form) if (update_mode){ var kit_from_cart_unique_id = $(kit_form).find('.kit-data input[name=kit_from_cart_unique_id]').val(); data = $(data).add({'name':'kit_from_cart_unique_id', 'value':kit_from_cart_unique_id}); } if (!update_mode){ var widget_unique_id = $(kit_form).closest('.body-content').attr('data-widget-unique-id'); data = $(data).add({'name':'widget_unique_id', 'value':widget_unique_id}); } if (!update_mode){ if (bundle_expert_help.is_kit_form_for_product_as_kit(kit_form)){ var product_data = bundle_expert_help.get_product_page_data_for_send(); $(product_data).each(function (index, element){ data = $(data).add({'name':element.name, 'value':element.value}); }) var product_id = $(kit_form).attr('data-main-product-id'); data = $(data).add({'name':'product_as_kit_data[product_id]', 'value':product_id}); } } be_custom.point('033',{'kit_form':kit_form}); if (bundle_expert.admin_mode){ var order_edit_quantity_field_element = $('#tab-product [id=input-quantity]'); if($(order_edit_quantity_field_element).length>0){ var order_edit_quantity_field = $(order_edit_quantity_field_element).val(); data = $(data).add({'name':'order_edit_form_quantity_field', 'value':order_edit_quantity_field}); } } var url = ''; if (!bundle_expert.admin_mode){ url = 'index.php?route=checkout/bundle_expert/add_to_cart'; }else{ if (!bundle_expert.admin_mode_new_api){ url = 'index.php?route=catalog/bundle_expert/api&token=' + bundle_expert.admin_token + '&api=api/bundle_expert/addToCart'; }else{ url = bundle_expert.store_url + 'index.php?route=api/bundle_expert/addToCart&' + bundle_expert.api_token_name + bundle_expert.api_token_value; } if (bundle_expert.debug_mode) bundle_expert.setCookie('XDEBUG_SESSION', 'XDEBUG_ECLIPSE'); } $.ajax({ url:url, type:'post', data:data, dataType:'json', beforeSend:function (){ $(kit_form).find('.bottom-block .alert').remove(); bundle_expert_form.disable_buttons_on_load(); $(kit_form).find('.kit-form-widget-main-container .alert-icon').hide(); }, complete:function (){ $(element).button('reset'); bundle_expert_form.enable_buttons_on_load(); }, success:function (json){ bundle_expert_form.enable_buttons_on_load(); $('.alert, .text-danger').remove(); $('.form-group').removeClass('has-error'); if (json['redirect']){ location = json['redirect']; } if (json['error']){ if (json['error']['product_as_kit']){ var product_as_kit_error = json['error']['product_as_kit']; delete json['error']['product_as_kit']; }else{ } bundle_expert_form.show_form_error(kit_form, json); if (product_as_kit_error){ if (Object.keys(json['error']).length == 0){ bundle_expert_form.hide_kit_form(); bundle_expert.show_product_as_kit_error(product_as_kit_error); } } }else{ if (json['error_text']){ $(kit_form).find('.bottom-block-header').before('
' + json['error_text'] + '
'); } } if (json['success']){ if (bundle_expert.is_some_checkout_page){ location.reload(); return; } var widget_unique_id = $(kit_form).closest('.body-content').attr('data-widget-unique-id'); $('#bundle-expert-container .bundle-expert-forms-container [data-widget-unique-id=' + widget_unique_id + ']').replaceWith(''); bundle_expert_form.hide_kit_form(); if (!bundle_expert.admin_mode){ bundle_expert.update_cart_html(json) be_custom.point('003',{'json':json}); }else{ $('#content > .container-fluid').prepend('
' + json['success'] + '
'); $('#button-refresh').click(); be_custom.point('038',{'kit_form':kit_form}); } }else{ } if (json['kit_actuality_error']){ $(kit_form).find('.bottom-block-header').before('
' + json['kit_actuality_error_text'] + '
'); } if (json['kit_enable_status_error']){ $(kit_form).find('.bottom-block-header').before('
' + json['kit_enable_status_error_text'] + '
'); if (json['kit_enable_status_error']['error_items']){ for (i in json['kit_enable_status_error']['error_items']){ var item_position = json['kit_enable_status_error']['error_items'][i]; $(kit_form).find('.kit-form-widget-main-container').find('.kit-item[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']').find('.alert-icon').show(); } } } if (json['cart_merge_question']){ bundle_expert_form.show_cart_merge_question(json['cart_merge_question']); } } }); } BundleExpertForm.product_form_init_standart = function (product_form){ if ($.fn.datetimepicker){ $(product_form).find('.date').datetimepicker({ pickTime:false }); $(product_form).find('.datetime').datetimepicker({ pickDate:true, pickTime:true }); $(product_form).find('.time').datetimepicker({ pickDate:false }); } $(product_form).find('select[name=\'recurring_id\'], input[name="quantity"]').change(function (){ $.ajax({ url:'index.php?route=product/product/getRecurringDescription', type:'post', data:$('input[name=\'product_id\'], input[name=\'quantity\'], select[name=\'recurring_id\']'), dataType:'json', beforeSend:function (){ $('#recurring-description').html(''); }, success:function (json){ $('.alert, .text-danger').remove(); if (json['success']){ $('#recurring-description').html(json['success']); } } }); }); } BundleExpertForm.update_kit_form_total = function (kit_form){ var form_products_container = $(kit_form).find('.kit-form-product-container .be-product-form.be-selected:not(.product-form-free-product-plug)'); var data = $(kit_form).find('.kit-data').find('input[type=\'text\'], input[type=\'hidden\']'); var kit_from_cart_unique_id = $(kit_form).find('.kit-data input[name=kit_from_cart_unique_id]').val() if (bundle_expert_form.select_item_products_mode){ var active_product = $(kit_form).find('.be-product-form.active-form').first(); var active_product_id = $(active_product).attr('data-product-id'); var active_product_position = $(active_product).attr('data-item-position'); var active_product_position_free = $(active_product).attr('data-item-position-free'); var selected_product =$(kit_form).find('.be-product-form.be-selected[data-item-position='+active_product_position+'][data-item-position-free='+active_product_position_free+']').first(); var selected_product_position_free = $(selected_product).attr('data-item-position-free'); active_product_position_free = Number.parseInt(selected_product_position_free)+1; if(!$(selected_product).is(active_product)){ if ($(active_product).find('input[data-id=input-is-free-product]').val() !== '1'){ $(selected_product).removeClass('be-selected'); } if ($(active_product).find('input[data-id=input-is-free-product]').val() === '1'){ $(active_product).find('input, textarea, select').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_free[' + active_product_position + '][0]', 'kit_items_free[' + active_product_position + '][' + active_product_position_free + ']'); $(element).attr('name', attr_name); }); } $(active_product).addClass('be-selected'); } } var data_products = $(kit_form).find('.kit-form-product-container .be-product-form.be-selected:not(.product-form-free-product-plug)').find('input[type=\'text\'], input[type=\'hidden\'], input[type=\'radio\']:checked, input[type=\'checkbox\']:checked, select, textarea, .kit-data input[type=\'hidden\']'); var disabled = $(kit_form).find('.kit-form-product-container .be-product-form.be-selected').find('input:disabled, select:disabled, textarea:disabled'); disabled.prop('disabled', false); var serialized = $(data_products).serializeArray(); disabled.prop('disabled', true); data = $(data).add(serialized); data = $(data).add({'kit_from_cart_unique_id':kit_from_cart_unique_id}); if($(kit_form).closest('.modal-content').attr('kit_from_cart')!=="1"){ var widget_unique_id = $(kit_form).closest('.modal-content').attr('widget_unique_id'); var widget = $('.kit-widget[data-widget-unique-id='+widget_unique_id+']'); if ($(widget).length>0 && $(widget).hasClass('product-as-kit-mode')){ var product_data = bundle_expert_help.get_product_page_data_for_send(); var data = data.add(product_data); } } var url = ''; if (!bundle_expert.admin_mode){ url = 'index.php?route=checkout/bundle_expert/get_kit_total'; }else{ if (!bundle_expert.admin_mode_new_api){ url = 'index.php?route=catalog/bundle_expert/api&token=' + bundle_expert.admin_token + '&api=api/bundle_expert/getKitTotal'; }else{ url = bundle_expert.store_url + 'index.php?route=api/bundle_expert/getKitTotal&' + bundle_expert.api_token_name + bundle_expert.api_token_value; } } $.ajax({ url:url, type:'post', data:data, dataType:'json', beforeSend:function (){ $(kit_form).find('.modal-footer .total-row .total-kit, .modal-footer .total-row .total').addClass('loading'); $(kit_form).find('.modal-footer .total-row .total-loading-icon').show(); }, complete:function (){ $(kit_form).find('.modal-footer .total-row .total-kit, .modal-footer .total-row .total').removeClass('loading'); $(kit_form).find('.modal-footer .total-row .total-loading-icon').hide(); }, success:function (json){ if (json['error']){ } if (json['total_kit']){ $(kit_form).attr('total-kit', json['total_kit']); $(kit_form).attr('total-kit-old', json['total_kit_old']); $(kit_form).closest('.modal-content').find('.modal-footer .total-row .total-kit').html(json['total_kit']) $(kit_form).attr('total-default', json['total_default']); $(kit_form).attr('total-default-new', json['total_default_new']); if (json['total_kit'] === json['total_default']) $(kit_form).closest('.modal-content').find('.modal-footer .total-row .total').html('') else $(kit_form).closest('.modal-content').find('.modal-footer .total-row .total').html(json['total_default']) for (var i = 0;i < json['products_price_data'].length;i++){ var price_data = json['products_price_data'][i]; if (!bundle_expert_form.select_item_products_mode){ var kit_item_poduct = $(kit_form).find('.kit-form-widget-container').find('.kit-item-product[data-item-position=' + price_data['item_position'] + '][data-item-position-free=' + price_data['item_position_free'] + '][data-product-id=' + price_data['product_id'] + ']'); }else{ var kit_item_poduct = $(kit_form).find('.kit-form-item-products-container').find('.kit-item .kit-item-product[data-item-position=' + price_data['item_position'] + '][data-item-position-free=' + price_data['item_position_free'] + '][data-product-id=' + price_data['product_id'] + ']'); } var kit_poduct_form = $(kit_form).find('.be-product-form.be-selected[data-item-position=' + price_data['item_position'] + '][data-item-position-free=' + price_data['item_position_free'] + '][data-product-id=' + price_data['product_id'] + ']'); if (price_data['special']){ $(kit_item_poduct).find('.be-price .be-price-new').html(price_data['special']); $(kit_item_poduct).find('.be-price .be-price-old').html(price_data['price']); $(kit_poduct_form).find('.be-price-new h2').html(price_data['special']); $(kit_poduct_form).find('.be-price-old span').html(price_data['price']); }else{ $(kit_item_poduct).find('.be-price').html(price_data['price']); $(kit_poduct_form).find('.be-price h2').html(price_data['price']); } if (price_data['price_discount_text']){ $(kit_item_poduct).find('.item-price-discount').html(price_data['price_discount_text']); } } } if (bundle_expert_form.select_item_products_mode){ if(!$(selected_product).is(active_product)){ if ($(active_product).find('input[data-id=input-is-free-product]').val() !== '1'){ $(selected_product).addClass('be-selected'); } if ($(active_product).find('input[data-id=input-is-free-product]').val() === '1'){ $(active_product).find('input, textarea, select').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_free[' + active_product_position + ']['+active_product_position_free+']', 'kit_items_free[' + active_product_position + '][0]'); $(element).attr('name', attr_name); }); } $(active_product).removeClass('be-selected'); } } } }); } BundleExpertForm.show_cart_merge_question = function (){ var modal = $('#bundle-expert-form-modal'); $(modal).find('.cart-merge-popup-message').show(); } BundleExpertForm.hide_cart_merge_question = function (){ var modal = $('#bundle-expert-form-modal'); $(modal).find('.cart-merge-popup-message').hide(); } BundleExpertForm.set_cart_merge_mode = function (mode){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form').first(); $(kit_form).find('.kit-data input[name=cart_merge_confirm]').val(mode); bundle_expert_form.hide_cart_merge_question(); bundle_expert_form.add_to_cart($(kit_form).find('#add-to-cart-button').first(), false); } BundleExpertForm.fix_clone_select = function (clone_source, clone){ var selects = $(clone_source).find("select"); $(selects).each(function (i){ var select = this; $(clone).find("select").eq(i).val($(select).val()); }); } BundleExpertForm.fix_clone_select_in_widget = function (clone_source, clone){ var selects = $(clone_source).filter("select"); $(selects).each(function (i){ var select = this; var name = $(select).attr('name'); name = bundle_expert_help.normalize_option_name(name); var value = $(select).val(); $(clone).filter("select[name='" + name + "']").val(value); }); return clone; } BundleExpertForm.disable_kit_form_widget_items_on_product_load = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form').first(); $(kit_form).find('.kit-form-item-products-container .be-product-thumb').addClass('not-clickable'); } BundleExpertForm.enable_kit_form_widget_items_on_product_load = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form').first(); $(kit_form).find('.kit-form-item-products-container .be-product-thumb').removeClass('not-clickable'); } BundleExpertForm.disable_buttons_on_load = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form').first(); $(kit_form).find('#button-set-item-product-selected').prop('disabled', true); $(kit_form).find('#add-to-cart-button').prop('disabled', true); $(kit_form).find('#add-to-cart-button').addClass('disabled'); $(kit_form).find('.kit-form-arrows .btn').prop('disabled', true); } BundleExpertForm.enable_buttons_on_load = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form').first(); $(kit_form).find('#button-set-item-product-selected').prop('disabled', false); if (this.select_item_products_mode === false){ $(kit_form).find('#add-to-cart-button').prop('disabled', false); $(kit_form).find('#add-to-cart-button').removeClass('disabled'); } $(kit_form).find('.kit-form-arrows .btn').prop('disabled', false); } BundleExpertForm.disable_buttons_on_select_item_product = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form').first(); $(kit_form).find('#add-to-cart-button').prop('disabled', true); $(kit_form).find('#add-to-cart-button').removeClass('disabled'); } BundleExpertForm.enable_buttons_on_select_item_product = function (){ var modal = $('#bundle-expert-form-modal'); var kit_form = $(modal).find('.kit-form').first(); $(kit_form).find('#add-to-cart-button').removeClass('disabled'); $(kit_form).find('#add-to-cart-button').prop('disabled', false); } BundleExpertForm.init_upload_file = function (element){ var node = element; var kit_form = $(element).closest('.kit-form'); $(kit_form).find('#form-upload').remove(); $(kit_form).prepend(''); $(kit_form).find('#form-upload input[name=\'file\']').trigger('click'); if (typeof bundle_expert_form.file_timer !== 'undefined'){ clearInterval(bundle_expert_form.file_timer); } bundle_expert_form.file_timer = setInterval(function (){ if ($(kit_form).find('#form-upload input[name=\'file\']').val() != ''){ clearInterval(bundle_expert_form.file_timer); var url = bundle_expert.store_url + 'index.php?route=tool/upload'; $.ajax({ url:url, type:'post', dataType:'json', data:new FormData($(kit_form).find('#form-upload')[0]), cache:false, contentType:false, processData:false, beforeSend:function (){ $(node).button('loading'); }, complete:function (){ $(node).button('reset'); }, success:function (json){ $('.text-danger').remove(); if (json['error']){ $(node).parent().find('input').after('
' + json['error'] + '
'); } if (json['success']){ alert(json['success']); $(node).parent().find('input').attr('value', json['code']); } }, error:function (xhr, ajaxOptions, thrownError){ alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); } }); } }, 500); } BundleExpertForm.update_widget_by_form = function (kit_form){ if ($(kit_form).find('input[name=kit_from_cart]').val() !== "1"){ var modal = $('#bundle-expert-form-modal'); var widget_unique_id = $(modal).find('.modal-body .body-content').attr('data-widget-unique-id'); var widget = $('.kit-widget[data-widget-unique-id=' + widget_unique_id + ']'); var form_products_container = $(kit_form).find('.kit-form-product-item-conatiner .be-product-form.be-selected:not(.product-form-free-product-plug)'); var free_products_table_mode = parseInt($(widget).attr('data-free-products-table-mode')); if(bundle_expert.is_widget_checkbox_mode(widget) ){ $(widget).find('.kit-item[data-item-mode=select_product]').find('.kit-item-in-checkbox input').prop('checked', false) $(widget).find('.kit-item[data-item-mode=select_product] .kit-item-product').removeClass('product-selected'); } var products = $(kit_form).find('.kit-form-product-item-conatiner .be-product-form.be-selected:not(.product-form-free-product-plug)'); var j; for (j = 0;j < products.length;j++){ var product = products[j]; var item_position = $(product).attr('data-item-position'); var item_position_free = $(product).attr('data-item-position-free'); var options_data_container = $(product).find('.options-data-container'); var kit_items = $(kit_form).find('.kit-form-widget-container .kit-items'); var kit_item = $(kit_items).find('.kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); var product_id = $(kit_item).attr('data-product-id'); var title = $(kit_item).find('.be-product-title').html(); var image = $(kit_item).find('.be-image img').attr('src'); var price = $(kit_item).find('.be-price').html(); var item_quantity = parseInt($(kit_item).find('.item-quantity').html()); var item_price_discount = $(kit_item).find('.item-price-discount').html(); var quantity = $(kit_item).find('input[data-id=input-quantity]').val(); var is_free_product = $(kit_item).find('input[data-id=input-is-free-product]').val(); var free_product_in_kit = $(kit_item).find('input[data-id=input-free-product-in-kit]').val(); var checkbox_in_kit_field = $(kit_item).find('input[data-id=input-checkbox-in-kit-field]').prop('checked'); if (is_free_product === "1" && free_product_in_kit === "0") continue; if(bundle_expert.is_widget_checkbox_mode(widget) ){ var widget_product_item = $(widget).find('.kit-items .kit-item-product[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); }else{ var widget_product_item = $(widget).find('.kit-items .kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); } var widget_item = $(widget_product_item).closest('.kit-item'); if (is_free_product === "1" && free_product_in_kit === "1"){ if ($(widget).find('#kit-items-container .kit-item.free-product .kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '][data-product-id=' + product_id + ']').length > 0){ widget_product_item = $(widget).find('#kit-items-container .kit-item.free-product .kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '][data-product-id=' + product_id + ']'); widget_item = $(widget_product_item).closest('.kit-item'); }else{ if ($(widget).hasClass('kit-widget-carousel')){ var widget_product_item = $(widget).find('.kit-item-product[data-item-position=' + item_position + '][data-product-id='+product_id+']').first(); if($(widget_product_item.length>0)){ var free_product_add_item = $(widget).find('.free-product-add-button[data-item-position=' + item_position + ']').first(); var widget_item = free_product_add_item; var widget_product_item = $(widget_item).find('.kit-item-product'); continue; } }else{ if (free_products_table_mode === 0){ var free_product_add_item = $(widget).find('.free-product-add-button[data-item-position=' + item_position + ']').first(); var widget_item = free_product_add_item; var widget_product_item = $(widget_item).find('.kit-item-product'); var widget_item_template = widget_item; widget_item = $(widget_item).clone(); $(widget_item).removeClass('free-product-template').removeClass('free-product-add-button').addClass('free-product'); $(widget_item).find('.empty-kit-item-product').remove(); $(widget).find('.kit-items #kit-items-container').find('.free-product-container-in-kit[data-item-position=' + item_position + ']').append(widget_item); $(widget).find('.kit-items #kit-items-container').find('.free-product-container-in-kit[data-item-position=' + item_position + ']').show(); }else{ var widget_product_item = $(widget).find('#kit-items-container').find('.kit-item-product[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); if ($(widget_product_item).length == 0){ var widget_product_item = $(widget).find('#free-item-products-container').find('.kit-item-product[data-item-position=' + item_position + '][data-product-id=' + product_id + ']'); var widget_item = $(widget_product_item).closest('.kit-item'); $(widget).find('.kit-items #kit-items-container').find('.free-product-container-in-kit[data-item-position=' + item_position + ']').append(widget_item); $(widget).find('.kit-items #kit-items-container').find('.free-product-container-in-kit[data-item-position=' + item_position + ']').show(); if ($(widget).find('#free-item-products-container .free-items .kit-item[data-item-position=' + item_position + ']').length > 0){ $(widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').hide(); }else{ $(widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').show(); } }else{ } var widget_item = $(widget_product_item).closest('.kit-item'); $(widget_item).find('.product-options-list').html(''); $(widget_item).find('.product-options-values').html(''); } } $(widget_item).find('.kit-item-product input, .kit-item-product textarea, .kit-item-product select').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_w[' + item_position + ']', 'kit_items_free_w[' + item_position + '][' + item_position_free + ']'); $(element).attr('name', attr_name); }); widget_product_item = $(widget_item).find('.kit-item-product'); $(widget_product_item).addClass('product-selected'); if (free_products_table_mode === 0){ $(widget).find('.free-product-add-button').each(function (index, element){ $(element).remove(); $(widget).find('.kit-items #kit-items-container').append(element); }); } } $(widget_product_item).find('input, textarea, select').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items[' + item_position + ']', 'kit_items_free[' + item_position + '][' + item_position_free + ']'); $(element).attr('name', attr_name); }); if(bundle_expert.is_widget_checkbox_mode(widget)){ $(widget_product_item).find('.kit-item-in-checkbox input').prop('checked', true) $(widget_product_item).addClass('product-selected'); } if(bundle_expert.is_widget_checkbox_mode(widget)){ $(widget_item).find('.kit-item-product input, .kit-item-product textarea, .kit-item-product select').each(function (index, element){ var attr_name = $(element).attr('name'); attr_name = attr_name.replace('kit_items_w[' + item_position + ']', 'kit_items_free_w[' + item_position + '][' + item_position_free + ']'); $(element).attr('name', attr_name); }); } } if(bundle_expert.is_widget_checkbox_mode(widget) && $(widget_item).attr('data-item-mode')=='select_product' ){ $(widget_product_item).find('.kit-item-in-checkbox input').prop('checked', true) $(widget_product_item).addClass('product-selected'); } if(!bundle_expert.is_widget_checkbox_mode(widget) && $(widget_item).attr('data-item-mode')=='select_product' ){ $(widget_product_item).addClass('product-selected'); } var product_id_prev = $(widget_product_item).attr('data-product-id'); $(widget_item).attr('data-item-position', item_position); $(widget_item).attr('data-item-position-free', item_position_free); $(widget_product_item).attr('data-product-id', product_id); $(widget_product_item).attr('data-item-position', item_position); $(widget_product_item).attr('data-item-position-free', item_position_free); $(widget_product_item).find('input[data-id=input-product-id]').val(product_id); $(widget_product_item).find('input[data-id=input-quantity]').val(quantity); $(widget_product_item).find('input.input-quantity-field').val(quantity); $(widget_product_item).find('input[data-id=input-item-position-free]').val(item_position_free); $(widget_product_item).find('input[data-id=input-is-free-product]').val(is_free_product); $(widget_product_item).find('input[data-id=input-free-product-in-kit]').val(free_product_in_kit); if (checkbox_in_kit_field) $(widget_product_item).find('input[data-id=input-checkbox-in-kit-field]').prop('checked', true); else $(widget_product_item).find('input[data-id=input-checkbox-in-kit-field]').prop('checked', false); $(widget_product_item).find('.be-product-title').html(title); $(widget_product_item).find('.be-image img').attr('src', image); $(widget_product_item).find('.be-price').html(price); $(widget_product_item).find('.item-quantity').html('x' + item_quantity); $(widget_product_item).find('.table-item-quantity input').val(item_quantity); $(widget_product_item).find('.item-price-discount').html(item_price_discount); if (parseInt(item_quantity) === 1) $(widget_product_item).find('.item-quantity').addClass('hidden'); else $(widget_product_item).find('.item-quantity').removeClass('hidden'); if ($(kit_item).find('input[data-id=input-for-quantity-edit]').val() === "1"){ $(widget_product_item).find('input[data-id=input-for-quantity-edit]').val(1); $(widget_product_item).find('.edit-buttons-enable-container').removeClass('hidden'); $(widget_product_item).find('.edit-buttons-disable-container').addClass('hidden'); }else{ $(widget_product_item).find('input[data-id=input-for-quantity-edit]').val(0) $(widget_product_item).find('.edit-buttons-enable-container').addClass('hidden'); $(widget_product_item).find('.edit-buttons-disable-container').removeClass('hidden'); $(widget_product_item).find('.edit-buttons-disable-container').html('x ' + quantity); } if (item_price_discount === '') $(widget_product_item).find('.item-price-discount').addClass('hidden'); else $(widget_product_item).find('.item-price-discount').removeClass('hidden'); if ($(widget).hasClass('kit-widget-table')){ var price_new_element = $(widget_product_item).find('.be-price .be-price-new'); $(widget_product_item).find('.be-price').append(price_new_element); } var is_empty_item = parseInt($(kit_item).closest('.kit-item').attr('data-empty-item')); if (!bundle_expert_form.select_item_products_mode){ $(widget_item).closest('.kit-item').attr('data-empty-item', is_empty_item); if (is_empty_item === 1){ $(widget_product_item).addClass('hidden'); $(widget_product_item).closest('.kit-item').find('.empty-kit-item-product').removeClass('hidden'); }else{ $(widget_product_item).removeClass('hidden'); $(widget_product_item).closest('.kit-item').find('.empty-kit-item-product').addClass('hidden'); } } if ($(kit_item).closest('.kit-item').hasClass('selectable')){ $(widget_item).addClass('selectable'); $(widget_product_item).find('.selectable-item-container').removeClass('hidden') }else{ $(widget_item).removeClass('selectable'); $(widget_product_item).find('.selectable-item-container').addClass('hidden') } $(widget_product_item).find('input[data-id=input-is-item-is-empty]').val(is_empty_item); $(widget_product_item).find('.product-options-list').html(''); var product_form = $(kit_form).find('.be-product-form.be-selected[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); var product_data = $(product_form).find('input[type=\'text\'], input[type=\'radio\']:checked, input[type=\'checkbox\']:checked, select, textarea'); for (var i = 0;i < product_data.length;i++){ var input_name = $(product_data[i]).attr('name'); if (is_free_product === "1"){ var opt_str = 'kit_items_free[' + item_position + '][' + item_position_free + '][option]'; }else{ var opt_str = 'kit_items[' + item_position + '][option]'; } if (input_name.startsWith(opt_str)){ var option = product_data[i]; var option_id = $(product_data[i]).attr('product-option-id'); var product_option_value_id = ''; var option_type = $(product_data[i]).attr('type'); if(option_type==="radio" || option_type==="checkbox"){ var product_option_value_id = $(option).val(); } if( $(product_data[i]).is( "select" )){ var product_option_value_id = $(option).val(); } var option_title = '' if (product_option_value_id!=='') option_title = $(options_data_container).find('[product-option-id=' + option_id + '][product-option-value-id=' + product_option_value_id + ']').html(); else{ var value = $(option).val(); if (value !== ""){ var option_title_template = $(options_data_container).find('[product-option-id=' + option_id + ']'); $(option_title_template).find('.option-value').html(value); option_title = $(option_title_template).html(); } } if (option_title !== ''){ var option_html = '
-' + option_title + '
'; var option_input = ''; $(widget_product_item).find('.product-options-list').append(option_html); } } } var attr_table = $(product_form).find('[id^=tab-specification] table'); if ($(attr_table).length > 0){ attr_table = $(attr_table).clone(); $(attr_table).removeClass('table').removeClass('table-bordered').addClass('widdget-item-attribute-table'); $(widget_item).find('.attribute-table-container').html(attr_table); } var options_source = $(product_form).find('#options-container').contents(); var options_target_container = $(widget_product_item).find('.product-options-values'); bundle_expert_help.copy_options(options_source, options_target_container, 'to_widget') bundle_expert.init_time_field_in_widget_item(widget, item_position, item_position_free); be_custom.point('013',{'widget_item':widget_item, 'product_form':product_form}); } if(bundle_expert.is_widget_checkbox_mode(widget)){ $(widget).find('.kit-item.free-product').each(function (index, element){ var item_position = $(element).attr('data-item-position'); bundle_expert.free_products_update_input_index(widget, item_position); }) } var total_default = $(kit_form).attr('total-default'); var total_default_new = $(kit_form).attr('total-default-new'); var total_kit = $(kit_form).attr('total-kit'); var total_kit_old = $(kit_form).attr('total-kit-old'); if(total_default_new !== total_default){ $(widget).find('.total-default-container').removeClass('hidden').show(); $(widget).find('.total-default').show(); }else{ $(widget).find('.total-default-container').addClass('hidden').hide(); $(widget).find('.total-default').hide(); } if (total_default === total_default_new) total_default = ''; if (total_kit === total_kit_old || total_kit_old === "false") total_kit_old = ''; $(widget).find('.total-default').html(total_default) $(widget).find('.total-default-new').html(total_default_new) $(widget).find('.total-kit').html(total_kit) $(widget).find('.total-kit-old').html(total_kit_old) be_custom.point('020',{'widget':widget, 'kit_form':kit_form}); if ($(widget).hasClass('product-as-kit-mode') || $(widget).hasClass('product-as-kit-mode-light-mode')){ bundle_expert.update_product_page_price_html(widget); bundle_expert.update_widget_kit_total(widget); } if (free_products_table_mode === 1){ if ($(widget).find('#free-item-products-container .free-items .kit-item[data-item-position=' + item_position + ']').length > 0){ $(widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').hide(); }else{ $(widget).find('#free-item-products-container .empty-list-text[data-item-position=' + item_position + ']').show(); } } bundle_expert.init_upload_file_buttons_in_widget(widget); be_custom.point('011',{'widget':widget, 'product_form':product}); } } BundleExpertForm.update_product_quantity = function (kit_form, item_position, item_position_free, new_quantity){ var product_form = $(kit_form).find('.kit-form-product-item-conatiner .be-product-form[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '].active-form'); $(product_form).find('input.input-quantity-field').val(new_quantity); if (!bundle_expert_form.select_item_products_mode){ var kit_item = $(kit_form).find('.bottom-block .kit-form-widget-container .kit-items').find('.kit-item .kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); }else{ var kit_item = $(kit_form).find('.bottom-block .kit-form-item-products-container').find('.kit-item .kit-item-product[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '].active'); } $(kit_item).find('.item-quantity').html(new_quantity + 'x'); $(kit_item).find('input[data-id=input-quantity]').val(new_quantity); if (new_quantity > 1){ $(kit_item).find('.item-quantity').removeClass('hidden'); }else{ $(kit_item).find('.item-quantity').addClass('hidden'); } } BundleExpertForm.scroll_to_option_error = function (kit_form, json){ var j; var i; var scroll_complete = false; var product_forms = $(kit_form).find('.kit-form-product-container .kit-form-product-item-conatiner .be-product-form.be-selected'); for (j in json['error']){ if (json['error'][j]['option']){ var item_position = json['error'][j]['item_position']; var item_position_free = json['error'][j]['item_position_free']; var product_form = $(kit_form).find('.kit-form-product-container .kit-form-product-item-conatiner .be-product-form.be-selected[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + ']'); ; var active_item = $(kit_form).find('.kit-form-widget-container .kit-item[data-item-position=' + item_position + '][data-item-position-free=' + item_position_free + '] .be-product-thumb').first(); var option_element = ''; for (var k = 0;k < json['error'][j]['option'].length;k++){ var error_option = json['error'][j]['option'][k]; for (i in error_option){ option_element = $(product_form).find('#input-option' + i.replace('_', '-')).parent(); if (option_element !== ''){ bundle_expert_form.set_active_product(active_item); var screen_width = Math.round($('html').width()); ; if (screen_width >= 768) var right_mode = true; else var right_mode = false; if (right_mode){ var scroll_position_option = $(option_element).position().top; var scroll_position_parent = $(option_element).closest('#be-product').position().top; var scroll_position = scroll_position_option - scroll_position_parent + 140; $(kit_form).find('[id^=tab-main]').animate({ scrollTop:scroll_position }, 1000); }else{ var scroll_position_option = $(option_element).position().top; var scroll_position_parent = $(option_element).closest('#be-product').position().top; var scroll_position = scroll_position_option + scroll_position_parent + 40; $(kit_form).find('.be-product-form #content').animate({ scrollTop:scroll_position }, 1000); } scroll_complete = true; } if (scroll_complete) break; } if (scroll_complete) break; } if (scroll_complete) break; } } } var BundleExpertHelp ={}; BundleExpertHelp.constructor = function (){ if (!String.prototype.startsWith){ String.prototype.startsWith = function(searchString, position){ position = position || 0; return this.indexOf(searchString, position) === position; }; } } BundleExpertHelp.load_owl_carousel = function (source){ var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.id = 'be_owl_style_1'; link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'catalog/view/javascript/bundle-expert/owl.carousel.min.css'; link.media = 'all'; head.appendChild(link); var link = document.createElement('link'); link.id = 'be_owl_style_2'; link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'catalog/view/javascript/bundle-expert/owl.theme.default.min.css'; link.media = 'all'; head.appendChild(link); jQuery.ajax({ url:'catalog/view/javascript/bundle-expert/owl.carousel.js', dataType:'script', success:function (){ if(source=="kit_form"){ bundle_expert_form.show_kit_form(); }else{ bundle_expert_form.show_kit_form_from_cart(); } }, async:true }); } BundleExpertHelp.get_owl_carousel_status = function (){ var active = 1; if ($.fn.owlCarouselBundleExpert){ active = 1; }else{ active = 0; } return active; } BundleExpertHelp.get_product_page_data_for_send = function (){ var product_data = $(bundle_expert.selectors.product_page.product_data).find('input[type=\'text\'], input[type=\'number\'], input[type=\'hidden\'], input[type=\'radio\']:checked, input[type=\'checkbox\']:checked, select, textarea'); var product_data_serialized = $(product_data).serializeArray(); $(product_data_serialized).each(function (index, value){ var name = $(value).attr('name'); var n = name.indexOf("["); if (n >= 0) name = "[" + name.substring(0, n) + "]" + name.substring(n); else name = "[" + name + "]"; var new_name = 'product_as_kit_data' + name; $(value).attr('name', new_name); }); return product_data_serialized; } BundleExpertHelp.on_slideshow_change_item = function (event){ var element = event.target; if($(element).hasClass('bundle-expert-slideshow')){ var name = event.type; var namespace = event.namespace; var items = event.item.count; var item_index = event.item.index; var pages = event.page.count; var page = event.page.index; var size = event.page.size; var active_item = $(element).children('.owl-stage-outer').children('.owl-stage').children('.owl-item')[item_index]; var height = $(active_item).height(); var yy = $(element).children('.owl-nav').find('button'); $(element).children('.owl-nav').find('button').css({'height':height + "px"}); } } BundleExpertHelp.change_slideshow_side_buttons_height = function (widget){ var height = $(widget).height(); var slideshow = $(widget).closest('.bundle-expert-slideshow'); if($(slideshow).length>0){ var yy = $(slideshow).children('.owl-nav').find('button'); $(slideshow).children('.owl-nav').find('button').css({'height':height + "px"}); } } BundleExpertHelp.normalize_option_name = function (name){ if (typeof name !== 'undefined'){ name = name.replace('kit_items_w', 'kit_items'); name = name.replace('kit_items_free_w', 'kit_items_free'); } return name; } BundleExpertHelp.normalize_option_name_to_widget = function (name){ if (typeof name !== 'undefined'){ if (name.indexOf('kit_items_free') >= 0){ name = name.replace('kit_items_free', 'kit_items_free_w'); }else{ name = name.replace('kit_items', 'kit_items_w'); } } return name; } BundleExpertHelp.normalize_options_names = function (data){ $(data).each(function (index, element){ var name = $(element).attr('name'); if (typeof name !== 'undefined'){ name = name.replace('kit_items_w', 'kit_items'); name = name.replace('kit_items_free_w', 'kit_items_free'); $(element).attr('name', name); } }) return data; } BundleExpertHelp.normalize_options_names_2 = function (data){ $(data).find('input, select, textarea').each(function (index, element){ var name = $(element).attr('name'); if (typeof name !== 'undefined'){ name = name.replace('kit_items_w', 'kit_items'); name = name.replace('kit_items_free_w', 'kit_items_free'); $(element).attr('name', name); } }) return data; } BundleExpertHelp.normalize_options_names_to_widget = function (data){ $(data).find('input, select, textarea').each(function (index, element){ var name = $(element).attr('name'); if (typeof name !== 'undefined'){ if (name.indexOf('kit_items_free') >= 0){ name = name.replace('kit_items_free', 'kit_items_free_w'); }else{ name = name.replace('kit_items', 'kit_items_w'); } $(element).attr('name', name); } }) return data; } BundleExpertHelp.is_kit_form_for_product_as_kit = function (kit_form){ var is_product_as_kit = false; var widget_unique_id = $(kit_form).closest('.body-content').attr('data-widget-unique-id'); var widget = $('.kit-widget[data-widget-unique-id=' + widget_unique_id + ']'); if ($(widget).hasClass('product-as-kit-mode')){ is_product_as_kit = true; } return is_product_as_kit; } BundleExpertHelp.copy_options = function (options_source, options_target_container, direction){ if (direction === 'to_widget'){ var options_source_clone = $(options_source).clone(); bundle_expert_form.fix_clone_select(options_source, options_source_clone); options_source_clone = bundle_expert_help.normalize_options_names_to_widget(options_source_clone); $(options_target_container).html(''); $(options_target_container).append(options_source_clone); }else if (direction === 'to_form'){ } $(options_source).find('input[type=\'text\'], input[type=\'hidden\'], input[type=\'radio\']:checked, input[type=\'checkbox\'], select, textarea').each(function (index, element){ var input_name = $(element).attr('name'); if (direction === 'to_form'){ input_name = bundle_expert_help.normalize_option_name(input_name); }else if (direction === 'to_widget'){ input_name = bundle_expert_help.normalize_option_name_to_widget(input_name); } var input_val = $(element).val(); var target_element = ''; if ($(element).attr('type') === 'radio'){ var checked = $(element).prop('checked'); target_element = $(options_target_container).find('[name="' + input_name + '"][value=' + input_val + ']'); $(target_element).prop('checked', checked); }else if ($(element).attr('type') === 'checkbox'){ var checked = $(element).prop('checked'); target_element = $(options_target_container).find('[name="' + input_name + '"][value=' + input_val + ']'); $(target_element).prop('checked', checked); }else if ($(element).is('select')){ var value = $(element).val(); target_element = $(options_target_container).find('[name="' + input_name + '"]'); $(target_element).val(value); }else if ($(element).is('textarea')){ var value = $(element).val(); target_element = $(options_target_container).find('[name="' + input_name + '"]'); $(target_element).val(value); }else{ var value = $(element).val(); target_element = $(options_target_container).find('[name="' + input_name + '"]').val(value); $(target_element).val(value); } }); } BundleExpertHelp.uniqid = function (){ return '' + Math.random().toString(36).substr(2, 9); }; BundleExpertHelp.sameOptionsRemovePrefix = function (container){ $(container).find('input[type=\'text\'], input[type=\'hidden\'], input[type=\'radio\'], input[type=\'checkbox\'], select, textarea, .kit-data input[type=\'hidden\']').filter("[name*='option']").each(function (index, value){ var name = $(value).attr('name'); if (name.indexOf("option") >= 0){ var attr = $(value).attr('data-id'); if (typeof attr !== typeof undefined && attr !== false){ var id = $(value).attr('data-id'); name = name.replace('' + id + '_', ''); value.name = name; } } }); }; BundleExpertHelp.sameOptionsAddPrefix = function (container){ $(container).find('input[type=\'text\'], input[type=\'hidden\'], input[type=\'radio\'], input[type=\'checkbox\'], select, textarea, .kit-data input[type=\'hidden\']').filter("[name*='option']").each(function (index, value){ var name = $(value).attr('name'); if (name.indexOf("option") >= 0){ var attr = $(value).attr('data-id'); if (typeof attr !== typeof undefined && attr !== false){ var id = $(value).attr('data-id'); name = '' + id + '_' + name; value.name = name; } } }); }; BundleExpertHelp.sameOptionsPrefixCheck = function (widget){ var attr = $(widget).attr('data-has-options-prefix'); if (typeof attr !== typeof undefined && attr !== false){ return true; }else{ return false; } }; BundleExpertHelp.isInViewport = function (elem){ if( elem.length == 0 ){ return; } var $window = jQuery(window) var viewport_top = $window.scrollTop() var viewport_height = $window.height() var viewport_bottom = viewport_top + viewport_height var vis = $(elem).is(":visible"); if (!vis) $(elem).show(); var $elem = jQuery(elem) var top = $elem.offset().top var height = $elem.height() var bottom = top + height if (!vis) $(elem).hide(); return (top >= viewport_top && top < viewport_bottom) || (bottom > viewport_top && bottom <= viewport_bottom) || (height > viewport_height && top <= viewport_top && bottom >= viewport_bottom) }; var BundleExpertAnimatePrice ={}; BundleExpertAnimatePrice.constructor = function (){ this.animate_delay = 20; this.price_stop = 0; this.price_start = 0; this.price_step = 0; this.price_timer_id = 0; this.old_price_stop = 0; this.old_price_start = 0; this.old_step = 0; this.old_timer_id = 0; } BundleExpertAnimatePrice.format_price = function (price){ var string = ''; if (bundle_expert.currency.symbol_left!==''){ string += bundle_expert.currency.symbol_left; } string += be_animate_price.formatMoney(price, bundle_expert.currency.decimal_place, bundle_expert.currency.decimal_point, bundle_expert.currency.thousand_point);; if (bundle_expert.currency.symbol_right!==''){ string += bundle_expert.currency.symbol_right; } return string; } BundleExpertAnimatePrice.formatMoney = function (number, decPlaces, decSep, thouSep){ decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 :decPlaces, decSep = typeof decSep === "undefined" ? "." :decSep; thouSep = typeof thouSep === "undefined" ? "," :thouSep; var sign = number < 0 ? "-" :""; var i = String(parseInt(number = Math.abs(Number(number) || 0).toFixed(decPlaces))); var j = (j = i.length) > 3 ? j - 3 :0; var result = sign + (j ? i.substr(0, j) + thouSep :"") + i.substr(j).replace(/(\decSep{3})(?=\decSep)/g, "$1" + thouSep) + (decPlaces ? decSep + Math.abs(number - i).toFixed(decPlaces).slice(2) :""); return result; } BundleExpertAnimatePrice.animatePrice_callback = function (){ be_animate_price.price_start += be_animate_price.price_step; if ((be_animate_price.price_step > 0) && (be_animate_price.price_start > be_animate_price.price_stop)){ be_animate_price.price_start = be_animate_price.price_stop; }else if ((be_animate_price.price_step < 0) && (be_animate_price.price_start < be_animate_price.price_stop)){ be_animate_price.price_start = be_animate_price.price_stop; }else if (be_animate_price.price_step === 0){ be_animate_price.price_start = be_animate_price.price_stop; } $('.product-price-container .product-as-kit-price').html(be_animate_price.format_price(be_animate_price.price_start)); if (be_animate_price.price_start !== be_animate_price.price_stop){ be_animate_price.price_timer_id = setTimeout(be_animate_price.animatePrice_callback, be_animate_price.animate_delay); } } BundleExpertAnimatePrice.animatePrice = function (price){ var quantity = Number($(bundle_expert.selectors['product_page']['quantity']).val()); be_animate_price.price_start = be_animate_price.price_stop; be_animate_price.price_stop = parseFloat(price) * quantity; be_animate_price.price_step = (be_animate_price.price_stop - be_animate_price.price_start) / 10; clearTimeout(be_animate_price.price_timer_id); be_animate_price.price_timer_id = setTimeout(be_animate_price.animatePrice_callback, be_animate_price.animate_delay); } BundleExpertAnimatePrice.animateOldPrice_callback = function (){ be_animate_price.old_price_start += be_animate_price.old_step; if ((be_animate_price.old_step > 0) && (be_animate_price.old_price_start > be_animate_price.old_price_stop)){ be_animate_price.old_price_start = be_animate_price.old_price_stop; }else if ((be_animate_price.old_step < 0) && (be_animate_price.old_price_start < be_animate_price.old_price_stop)){ be_animate_price.old_price_start = be_animate_price.old_price_stop; }else if (be_animate_price.old_step === 0){ be_animate_price.old_price_start = be_animate_price.old_price_stop; } $('.product-price-container .product-as-kit-old-price').html(be_animate_price.format_price(be_animate_price.old_price_start)); if (be_animate_price.old_price_start !== be_animate_price.old_price_stop){ be_animate_price.old_timer_id = setTimeout(be_animate_price.animateOldPrice_callback, be_animate_price.animate_delay); } } BundleExpertAnimatePrice.animateOldPrice = function (price){ var quantity = Number($(bundle_expert.selectors['product_page']['quantity']).val()); be_animate_price.old_price_start = be_animate_price.old_price_stop; be_animate_price.old_price_stop = parseFloat(price) * quantity; be_animate_price.old_step = (be_animate_price.old_price_stop - be_animate_price.old_price_start) / 10; clearTimeout(be_animate_price.old_timer_id); be_animate_price.old_timer_id = setTimeout(be_animate_price.animateOldPrice_callback, be_animate_price.animate_delay); } var bundle_expert = ''; var bundle_expert_form = ''; var bundle_expert_help = ''; var be_animate_price = ''; var be_custom = ''; var BundleExpertCustomDefault ={}; BundleExpertCustomDefault.constructor = function (widgets){ } BundleExpertCustomDefault.point = function (v1, v2){ } var BundleExpertMainInit ={}; BundleExpertMainInit.constructor = function (){ } BundleExpertMainInit.init = function (){ BundleExpert.constructor(); bundle_expert = BundleExpert; BundleExpertForm.constructor(); bundle_expert_form = BundleExpertForm; BundleExpertHelp.constructor(); bundle_expert_help = BundleExpertHelp; be_animate_price = BundleExpertAnimatePrice; be_animate_price.constructor(); if (typeof BundleExpertCustom === 'function'){ be_custom = new BundleExpertCustom(); }else{ if (typeof BundleExpertCustom != "undefined"){ BundleExpertCustom.constructor(); be_custom = BundleExpertCustom; }else{ BundleExpertCustomDefault.constructor(); be_custom = BundleExpertCustomDefault; } } be_custom_header_cart = ''; if (typeof BundleExpertCustomHeaderCart === 'function'){ be_custom_header_cart = new BundleExpertCustomHeaderCart(); }else{ if (typeof BundleExpertCustomHeaderCart != "undefined"){ BundleExpertCustomHeaderCart.constructor(); be_custom_header_cart = BundleExpertCustomHeaderCart; } } if ($('#bundle-expert-container #bundle-expert-class-data').length > 0){ bundle_expert.reload_item_products = parseInt($('#becd-reload_item_products').html()); bundle_expert.is_some_checkout_page = $('#becd-is_some_checkout_page').html() === 'true'; bundle_expert.disable_cart_kit_edit_button = $('#becd-disable_cart_kit_edit_button').html() === 'true'; bundle_expert.animate_price = $('#becd-animate_price').html() === 'true'; bundle_expert.button_remove_kit = $('#becd-button_remove_kit').html(); bundle_expert.button_edit_kit = $('#becd-button_edit_kit').html(); var widgets_json = $('#bundle-expert-container #widgets-json-container').html(); var widgets = JSON.parse(widgets_json); var selectors_json = $('#bundle-expert-container #selectors-json-container').html(); var selectors = JSON.parse(selectors_json); bundle_expert.selectors = selectors; var currency_json = $('#bundle-expert-container #currency-json-container').html(); var currency = JSON.parse(currency_json); var category_products_json = $('#bundle-expert-container #category-products-json-container').html(); var category_products = JSON.parse(category_products_json); bundle_expert.category_products = category_products; bundle_expert.currency = currency; be_custom.point('024',{}); bundle_expert.add_widgets(widgets); } be_custom.point('025',{}); bundle_expert.init_bundle_expert(); bundle_expert.init_lazy_sliders(); $(window).on('resize scroll', function (){ bundle_expert.init_lazy_sliders(); }); if(bundle_expert.window_scroll_selector!==''){ $(bundle_expert.window_scroll_selector).on('resize scroll', function (){ bundle_expert.init_lazy_sliders(); }); } } BundleExpertMainInit.init_check = function (){ if(bundle_expert==''){ BundleExpertMainInit.init(); } } BundleExpertMainInit.init_cart_kit_edit_button = function (){ var disable_cart_kit_edit_button = $('#becd-disable_cart_kit_edit_button').html() === 'true' if (disable_cart_kit_edit_button){ $('#content').find('.eckb').each(function (index, element){ $(element).find('i').remove(); var str = $(element).html(); var parent = $(element).parent(); $(parent).find(element).remove(); $(parent).append(str); }) } var kit_unique_id_prev = ""; $('.eckb').each(function (index, element){ if ($(element).closest('#tab-total').length > 0){ $(element).find('i').remove(); var str = $(element).html(); var parent = $(element).parent(); $(parent).find(element).remove(); $(parent).append(str); } if (!$(element).hasClass('button-init-complete')){ var kit_unique_id = $(element).attr('uid'); var item_position = $(element).attr('pos'); var item_position_free = $(element).attr('pos-free'); $(element).attr('kit-unique-id', kit_unique_id); $(element).attr('data-item-position', item_position); $(element).attr('data-item-position-free', item_position_free); $(element).addClass('button-init-complete'); $(element).addClass('edit-cart-kit-button'); if (kit_unique_id_prev !== kit_unique_id){ $(element).find('b').replaceWith('
' + $('#becd-button_edit_kit').html() + '' + $('#becd-button_remove_kit').html() + '
') $(element).find('i').show(); }else{ $(element).find('b').replaceWith(''); } $(element).find('.edit-kit-button').attr('onclick', "BundleExpertMainInit.init_check();bundle_expert.show_kit_form_from_cart($(this).closest('.edit-cart-kit-button'));"); $(element).find('.remove-kit-button').attr('onclick', "BundleExpertMainInit.init_check();bundle_expert.show_remove_kit_from_cart_question(this)"); var parent = $(element).closest('a'); if ($(parent).length > 0) $(parent).after(element); var parent_row_selector = $('#becd-cart-product-parent-row-selector').html(); $(element).closest(parent_row_selector).find('img').each(function (index, el){ var img_alt = $(el).attr('alt'); if (typeof img_alt !== "undefined"){ img_alt = img_alt.replace(/<\/?[^>]+(>|$)/g, ""); } $(el).attr('alt', img_alt); var img_title = $(el).attr('title'); if (typeof img_title !== "undefined"){ img_title = img_title.replace(/<\/?[^>]+(>|$)/g, ""); } $(el).attr('title', img_title); }); $(element).show(); } }) }