1if (typeof loadedalljs == "undefined") { var loadedalljs=true;
vendor: 93,107 bytes, lines 1-6
1/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license 2//@ sourceMappingURL=jquery-1.10.2.min.map 3*/ 4(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t 5}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); 6u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
7 8/*! 9 * jQuery Form Plugin 10 * version: 4.2.2 11 * Requires jQuery v1.7.2 or later 12 * Project repository: https://github.com/jquery-form/form 13 * Copyright 2017 Kevin Morris 14 * Copyright 2006 M. Alsup 15 * Dual licensed under the LGPL-2.1+ or MIT licenses 16 * https://github.com/jquery-form/form#license 17 * This library is free software; you can redistribute it and/or 18 * modify it under the terms of the GNU Lesser General Public 19 * License as published by the Free Software Foundation; either 20 * version 2.1 of the License, or (at your option) any later version. 21 * This library is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 * Lesser General Public License for more details. 25 */ 26/* global ActiveXObject */ 27 28/* eslint-disable */ 29(function (factory) { 30 if (typeof define === 'function' && define.amd) { 31 // AMD. Register as an anonymous module. 32 define(['jquery'], factory); 33 } else if (typeof module === 'object' && module.exports) { 34 // Node/CommonJS 35 module.exports = function( root, jQuery ) { 36 if (typeof jQuery === 'undefined') { 37 // require('jQuery') returns a factory that requires window to build a jQuery instance, we normalize how we use modules 38 // that require this pattern but the window provided is a noop if it's defined (how jquery works) 39 if (typeof window !== 'undefined') { 40 jQuery = require('jquery'); 41 } 42 else { 43 jQuery = require('jquery')(root); 44 } 45 } 46 factory(jQuery); 47 return jQuery; 48 }; 49 } else { 50 // Browser globals 51 factory(jQuery); 52 } 53 54}(function ($) { 55/* eslint-enable */ 56 'use strict'; 57 58 /* 59 Usage Note: 60 ----------- 61 Do not use both ajaxSubmit and ajaxForm on the same form. These 62 functions are mutually exclusive. Use ajaxSubmit if you want 63 to bind your own submit handler to the form. For example, 64 $(document).ready(function() { 65 $('#myForm').on('submit', function(e) { 66 e.preventDefault(); // <-- important 67 $(this).ajaxSubmit({ 68 target: '#output' 69 }); 70 }); 71 }); 72 Use ajaxForm when you want the plugin to manage all the event binding 73 for you. For example, 74 $(document).ready(function() { 75 $('#myForm').ajaxForm({ 76 target: '#output' 77 }); 78 }); 79 You can also use ajaxForm with delegation (requires jQuery v1.7+), so the 80 form does not have to exist when you invoke ajaxForm: 81 $('#myForm').ajaxForm({ 82 delegation: true, 83 target: '#output' 84 }); 85 When using ajaxForm, the ajaxSubmit function will be invoked for you 86 at the appropriate time. 87 */ 88 89 var rCRLF = /\r?\n/g; 90 91 /** 92 * Feature detection 93 */ 94 var feature = {}; 95 96 feature.fileapi = $('<input type="file">').get(0).files !== undefined; 97 feature.formdata = (typeof window.FormData !== 'undefined'); 98 99 var hasProp = !!$.fn.prop; 100 101 // attr2 uses prop when it can but checks the return type for 102 // an expected string. This accounts for the case where a form 103 // contains inputs with names like "action" or "method"; in those 104 // cases "prop" returns the element 105 $.fn.attr2 = function() { 106 if (!hasProp) { 107 return this.attr.apply(this, arguments); 108 } 109 110 var val = this.prop.apply(this, arguments); 111 112 if ((val && val.jquery) || typeof val === 'string') { 113 return val; 114 } 115 116 return this.attr.apply(this, arguments); 117 }; 118 119 /** 120 * ajaxSubmit() provides a mechanism for immediately submitting 121 * an HTML form using AJAX. 122 * 123 * @param {object|string} options jquery.form.js parameters or custom url for submission 124 * @param {object} data extraData 125 * @param {string} dataType ajax dataType 126 * @param {function} onSuccess ajax success callback function 127 */ 128 $.fn.ajaxSubmit = function(options, data, dataType, onSuccess) { 129 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) 130 if (!this.length) { 131 log('ajaxSubmit: skipping submit process - no element selected'); 132 133 return this; 134 } 135 136 /* eslint consistent-this: ["error", "$form"] */ 137 var method, action, url, $form = this; 138 139 if (typeof options === 'function') { 140 options = {success: options}; 141 142 } else if (typeof options === 'string' || (options === false && arguments.length > 0)) { 143 options = { 144 'url' : options, 145 'data' : data, 146 'dataType' : dataType 147 }; 148 149 if (typeof onSuccess === 'function') { 150 options.success = onSuccess; 151 } 152 153 } else if (typeof options === 'undefined') { 154 options = {}; 155 } 156 157 method = options.method || options.type || this.attr2('method'); 158 action = options.url || this.attr2('action'); 159 160 url = (typeof action === 'string') ? $.trim(action) : ''; 161 url = url || window.location.href || ''; 162 if (url) { 163 // clean url (don't include hash vaue) 164 url = (url.match(/^([^#]+)/) || [])[1]; 165 } 166 167 options = $.extend(true, { 168 url : url, 169 success : $.ajaxSettings.success, 170 type : method || $.ajaxSettings.type, 171 iframeSrc : /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' // eslint-disable-line no-script-url 172 }, options); 173 174 // hook for manipulating the form data before it is extracted; 175 // convenient for use with rich editors like tinyMCE or FCKEditor 176 var veto = {}; 177 178 this.trigger('form-pre-serialize', [this, options, veto]); 179 180 if (veto.veto) { 181 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); 182 183 return this; 184 } 185 186 // provide opportunity to alter form data before it is serialized 187 if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { 188 log('ajaxSubmit: submit aborted via beforeSerialize callback'); 189 190 return this; 191 } 192 193 var traditional = options.traditional; 194 195 if (typeof traditional === 'undefined') { 196 traditional = $.ajaxSettings.traditional; 197 } 198 199 var elements = []; 200 var qx, a = this.formToArray(options.semantic, elements, options.filtering); 201 202 if (options.data) { 203 var optionsData = $.isFunction(options.data) ? options.data(a) : options.data; 204 205 options.extraData = optionsData; 206 qx = $.param(optionsData, traditional); 207 } 208 209 // give pre-submit callback an opportunity to abort the submit 210 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { 211 log('ajaxSubmit: submit aborted via beforeSubmit callback'); 212 213 return this; 214 } 215 216 // fire vetoable 'validate' event 217 this.trigger('form-submit-validate', [a, this, options, veto]); 218 if (veto.veto) { 219 log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); 220 221 return this; 222 } 223 224 var q = $.param(a, traditional); 225 226 if (qx) { 227 q = (q ? (q + '&' + qx) : qx); 228 } 229 230 if (options.type.toUpperCase() === 'GET') { 231 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 232 options.data = null; // data is null for 'get' 233 } else { 234 options.data = q; // data is the query string for 'post' 235 } 236 237 var callbacks = []; 238 239 if (options.resetForm) { 240 callbacks.push(function() { 241 $form.resetForm(); 242 }); 243 } 244 245 if (options.clearForm) { 246 callbacks.push(function() { 247 $form.clearForm(options.includeHidden); 248 }); 249 } 250 251 // perform a load on the target only if dataType is not provided 252 if (!options.dataType && options.target) { 253 var oldSuccess = options.success || function(){}; 254 255 callbacks.push(function(data, textStatus, jqXHR) { 256 var successArguments = arguments, 257 fn = options.replaceTarget ? 'replaceWith' : 'html'; 258 259 $(options.target)[fn](data).each(function(){ 260 oldSuccess.apply(this, successArguments); 261 }); 262 }); 263 264 } else if (options.success) { 265 if ($.isArray(options.success)) { 266 $.merge(callbacks, options.success); 267 } else { 268 callbacks.push(options.success); 269 } 270 } 271 272 options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg 273 var context = options.context || this; // jQuery 1.4+ supports scope context 274 275 for (var i = 0, max = callbacks.length; i < max; i++) { 276 callbacks[i].apply(context, [data, status, xhr || $form, $form]); 277 } 278 }; 279 280 if (options.error) { 281 var oldError = options.error; 282 283 options.error = function(xhr, status, error) { 284 var context = options.context || this; 285 286 oldError.apply(context, [xhr, status, error, $form]); 287 }; 288 } 289 290 if (options.complete) { 291 var oldComplete = options.complete; 292 293 options.complete = function(xhr, status) { 294 var context = options.context || this; 295 296 oldComplete.apply(context, [xhr, status, $form]); 297 }; 298 } 299 300 // are there files to upload? 301 302 // [value] (issue #113), also see comment: 303 // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 304 var fileInputs = $('input[type=file]:enabled', this).filter(function() { 305 return $(this).val() !== ''; 306 }); 307 var hasFileInputs = fileInputs.length > 0; 308 var mp = 'multipart/form-data'; 309 var multipart = ($form.attr('enctype') === mp || $form.attr('encoding') === mp); 310 var fileAPI = feature.fileapi && feature.formdata; 311 312 log('fileAPI :' + fileAPI); 313 314 var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; 315 var jqxhr; 316 317 // options.iframe allows user to force iframe mode 318 // 06-NOV-09: now defaulting to iframe mode if file input is detected 319 if (options.iframe !== false && (options.iframe || shouldUseFrame)) { 320 // hack to fix Safari hang (thanks to Tim Molendijk for this) 321 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 322 if (options.closeKeepAlive) { 323 $.get(options.closeKeepAlive, function() { 324 jqxhr = fileUploadIframe(a); 325 }); 326 327 } else { 328 jqxhr = fileUploadIframe(a); 329 } 330 331 } else if ((hasFileInputs || multipart) && fileAPI) { 332 jqxhr = fileUploadXhr(a); 333 334 } else { 335 jqxhr = $.ajax(options); 336 } 337 338 $form.removeData('jqxhr').data('jqxhr', jqxhr); 339 340 // clear element array 341 for (var k = 0; k < elements.length; k++) { 342 elements[k] = null; 343 } 344 345 // fire 'notify' event 346 this.trigger('form-submit-notify', [this, options]); 347 348 return this; 349 350 // utility fn for deep serialization 351 function deepSerialize(extraData) { 352 var serialized = $.param(extraData, options.traditional).split('&'); 353 var len = serialized.length; 354 var result = []; 355 var i, part; 356 357 for (i = 0; i < len; i++) { 358 // #252; undo param space replacement 359 serialized[i] = serialized[i].replace(/\+/g, ' '); 360 part = serialized[i].split('='); 361 // #278; use array instead of object storage, favoring array serializations 362 result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); 363 } 364 365 return result; 366 } 367 368 // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) 369 function fileUploadXhr(a) { 370 var formdata = new FormData(); 371 372 for (var i = 0; i < a.length; i++) { 373 formdata.append(a[i].name, a[i].value); 374 } 375 376 if (options.extraData) { 377 var serializedData = deepSerialize(options.extraData); 378 379 for (i = 0; i < serializedData.length; i++) { 380 if (serializedData[i]) { 381 formdata.append(serializedData[i][0], serializedData[i][1]); 382 } 383 } 384 } 385 386 options.data = null; 387 388 var s = $.extend(true, {}, $.ajaxSettings, options, { 389 contentType : false, 390 processData : false, 391 cache : false, 392 type : method || 'POST' 393 }); 394 395 if (options.uploadProgress) { 396 // workaround because jqXHR does not expose upload property 397 s.xhr = function() { 398 var xhr = $.ajaxSettings.xhr(); 399 400 if (xhr.upload) { 401 xhr.upload.addEventListener('progress', function(event) { 402 var percent = 0; 403 var position = event.loaded || event.position; /* event.position is deprecated */ 404 var total = event.total; 405 406 if (event.lengthComputable) {
407 percent = Math.ceil(position / total * 100); 408 } 409 410 options.uploadProgress(event, position, total, percent); 411 }, false); 412 } 413 414 return xhr; 415 }; 416 } 417 418 s.data = null; 419 420 var beforeSend = s.beforeSend; 421 422 s.beforeSend = function(xhr, o) { 423 // Send FormData() provided by user 424 if (options.formData) { 425 o.data = options.formData; 426 } else { 427 o.data = formdata; 428 } 429 430 if (beforeSend) { 431 beforeSend.call(this, xhr, o); 432 } 433 }; 434 435 return $.ajax(s); 436 } 437 438 // private function for handling file uploads (hat tip to YAHOO!) 439 function fileUploadIframe(a) { 440 var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; 441 var deferred = $.Deferred(); 442 443 // #341 444 deferred.abort = function(status) { 445 xhr.abort(status); 446 }; 447 448 if (a) { 449 // ensure that every serialized input is still enabled 450 for (i = 0; i < elements.length; i++) { 451 el = $(elements[i]); 452 if (hasProp) { 453 el.prop('disabled', false); 454 } else { 455 el.removeAttr('disabled'); 456 } 457 } 458 } 459 460 s = $.extend(true, {}, $.ajaxSettings, options); 461 s.context = s.context || s; 462 id = 'jqFormIO' + new Date().getTime(); 463 var ownerDocument = form.ownerDocument; 464 var $body = $form.closest('body'); 465 466 if (s.iframeTarget) { 467 $io = $(s.iframeTarget, ownerDocument); 468 n = $io.attr2('name'); 469 if (!n) { 470 $io.attr2('name', id); 471 } else { 472 id = n; 473 } 474 475 } else { 476 $io = $('<iframe name="' + id + '" src="' + s.iframeSrc + '" />', ownerDocument); 477 $io.css({position: 'absolute', top: '-1000px', left: '-1000px'}); 478 } 479 io = $io[0]; 480 481 482 xhr = { // mock object 483 aborted : 0, 484 responseText : null, 485 responseXML : null, 486 status : 0, 487 statusText : 'n/a', 488 getAllResponseHeaders : function() {}, 489 getResponseHeader : function() {}, 490 setRequestHeader : function() {}, 491 abort : function(status) { 492 var e = (status === 'timeout' ? 'timeout' : 'aborted'); 493 494 log('aborting upload... ' + e); 495 this.aborted = 1; 496 497 try { // #214, #257 498 if (io.contentWindow.document.execCommand) { 499 io.contentWindow.document.execCommand('Stop'); 500 } 501 } catch (ignore) {} 502 503 $io.attr('src', s.iframeSrc); // abort op in progress 504 xhr.error = e; 505 if (s.error) { 506 s.error.call(s.context, xhr, e, status); 507 } 508 509 if (g) { 510 $.event.trigger('ajaxError', [xhr, s, e]); 511 } 512 513 if (s.complete) { 514 s.complete.call(s.context, xhr, e); 515 } 516 } 517 }; 518 519 g = s.global; 520 // trigger ajax global events so that activity/block indicators work like normal 521 if (g && $.active++ === 0) { 522 $.event.trigger('ajaxStart'); 523 } 524 if (g) { 525 $.event.trigger('ajaxSend', [xhr, s]); 526 } 527 528 if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { 529 if (s.global) { 530 $.active--; 531 } 532 deferred.reject(); 533 534 return deferred; 535 } 536 537 if (xhr.aborted) { 538 deferred.reject(); 539 540 return deferred; 541 } 542 543 // add submitting element to data if we know it 544 sub = form.clk; 545 if (sub) { 546 n = sub.name; 547 if (n && !sub.disabled) { 548 s.extraData = s.extraData || {}; 549 s.extraData[n] = sub.value; 550 if (sub.type === 'image') { 551 s.extraData[n + '.x'] = form.clk_x; 552 s.extraData[n + '.y'] = form.clk_y; 553 } 554 } 555 } 556 557 var CLIENT_TIMEOUT_ABORT = 1; 558 var SERVER_ABORT = 2; 559 560 function getDoc(frame) { 561 /* it looks like contentWindow or contentDocument do not 562 * carry the protocol property in ie8, when running under ssl 563 * frame.document is the only valid response document, since 564 * the protocol is know but not on the other two objects. strange? 565 * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy 566 */ 567 568 var doc = null; 569 570 // IE8 cascading access check 571 try { 572 if (frame.contentWindow) { 573 doc = frame.contentWindow.document; 574 } 575 } catch (err) { 576 // IE8 access denied under ssl & missing protocol 577 log('cannot get iframe.contentWindow document: ' + err); 578 } 579 580 if (doc) { // successful getting content 581 return doc; 582 } 583 584 try { // simply checking may throw in ie8 under ssl or mismatched protocol 585 doc = frame.contentDocument ? frame.contentDocument : frame.document; 586 } catch (err) { 587 // last attempt 588 log('cannot get iframe.contentDocument: ' + err); 589 doc = frame.document; 590 } 591 592 return doc; 593 } 594 595 // Rails CSRF hack (thanks to Yvan Barthelemy) 596 var csrf_token = $('meta[name=csrf-token]').attr('content'); 597 var csrf_param = $('meta[name=csrf-param]').attr('content'); 598 599 if (csrf_param && csrf_token) { 600 s.extraData = s.extraData || {}; 601 s.extraData[csrf_param] = csrf_token; 602 } 603 604 // take a breath so that pending repaints get some cpu time before the upload starts 605 function doSubmit() { 606 // make sure form attrs are set 607 var t = $form.attr2('target'), 608 a = $form.attr2('action'), 609 mp = 'multipart/form-data', 610 et = $form.attr('enctype') || $form.attr('encoding') || mp; 611 612 // update form attrs in IE friendly way 613 form.setAttribute('target', id); 614 if (!method || /post/i.test(method)) { 615 form.setAttribute('method', 'POST'); 616 } 617 if (a !== s.url) { 618 form.setAttribute('action', s.url); 619 } 620 621 // ie borks in some cases when setting encoding 622 if (!s.skipEncodingOverride && (!method || /post/i.test(method))) { 623 $form.attr({ 624 encoding : 'multipart/form-data', 625 enctype : 'multipart/form-data' 626 }); 627 } 628 629 // support timout 630 if (s.timeout) { 631 timeoutHandle = setTimeout(function() { 632 timedOut = true; cb(CLIENT_TIMEOUT_ABORT); 633 }, s.timeout); 634 } 635 636 // look for server aborts 637 function checkState() { 638 try { 639 var state = getDoc(io).readyState; 640 641 log('state = ' + state); 642 if (state && state.toLowerCase() === 'uninitialized') { 643 setTimeout(checkState, 50); 644 } 645 646 } catch (e) { 647 log('Server abort: ', e, ' (', e.name, ')'); 648 cb(SERVER_ABORT); // eslint-disable-line callback-return 649 if (timeoutHandle) { 650 clearTimeout(timeoutHandle); 651 } 652 timeoutHandle = undefined; 653 } 654 } 655 656 // add "extra" data to form if provided in options 657 var extraInputs = []; 658 659 try { 660 if (s.extraData) { 661 for (var n in s.extraData) { 662 if (s.extraData.hasOwnProperty(n)) { 663 // if using the $.param format that allows for multiple values with the same name 664 if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) { 665 extraInputs.push( 666 $('<input type="hidden" name="' + s.extraData[n].name + '">', ownerDocument).val(s.extraData[n].value) 667 .appendTo(form)[0]); 668 } else { 669 extraInputs.push( 670 $('<input type="hidden" name="' + n + '">', ownerDocument).val(s.extraData[n]) 671 .appendTo(form)[0]); 672 } 673 } 674 } 675 } 676 677 if (!s.iframeTarget) { 678 // add iframe to doc and submit the form 679 $io.appendTo($body); 680 } 681 682 if (io.attachEvent) { 683 io.attachEvent('onload', cb); 684 } else { 685 io.addEventListener('load', cb, false); 686 } 687 688 setTimeout(checkState, 15); 689 690 try { 691 form.submit(); 692 693 } catch (err) { 694 // just in case form has element with name/id of 'submit' 695 var submitFn = document.createElement('form').submit; 696 697 submitFn.apply(form); 698 } 699 700 } finally { 701 // reset attrs and remove "extra" input elements 702 form.setAttribute('action', a); 703 form.setAttribute('enctype', et); // #380 704 if (t) { 705 form.setAttribute('target', t); 706 } else { 707 $form.removeAttr('target'); 708 } 709 $(extraInputs).remove(); 710 } 711 } 712 713 if (s.forceSync) { 714 doSubmit(); 715 } else { 716 setTimeout(doSubmit, 10); // this lets dom updates render 717 } 718 719 var data, doc, domCheckCount = 50, callbackProcessed; 720 721 function cb(e) { 722 if (xhr.aborted || callbackProcessed) { 723 return; 724 } 725 726 doc = getDoc(io); 727 if (!doc) { 728 log('cannot access response document'); 729 e = SERVER_ABORT; 730 } 731 if (e === CLIENT_TIMEOUT_ABORT && xhr) { 732 xhr.abort('timeout'); 733 deferred.reject(xhr, 'timeout'); 734 735 return; 736 737 } else if (e === SERVER_ABORT && xhr) { 738 xhr.abort('server abort'); 739 deferred.reject(xhr, 'error', 'server abort'); 740 741 return; 742 } 743 744 if (!doc || doc.location.href === s.iframeSrc) { 745 // response not received yet 746 if (!timedOut) { 747 return; 748 } 749 } 750 751 if (io.detachEvent) { 752 io.detachEvent('onload', cb); 753 } else { 754 io.removeEventListener('load', cb, false); 755 } 756 757 var status = 'success', errMsg; 758 759 try { 760 if (timedOut) { 761 throw 'timeout'; 762 } 763 764 var isXml = s.dataType === 'xml' || doc.XMLDocument || $.isXMLDoc(doc); 765 766 log('isXml=' + isXml); 767 768 if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) { 769 if (--domCheckCount) { 770 // in some browsers (Opera) the iframe DOM is not always traversable when 771 // the onload callback fires, so we loop a bit to accommodate 772 log('requeing onLoad callback, DOM not available'); 773 setTimeout(cb, 250); 774 775 return; 776 } 777 // let this fall through because server response could be an empty document 778 // log('Could not access iframe DOM after mutiple tries.'); 779 // throw 'DOMException: not available'; 780 } 781 782 // log('response detected'); 783 var docRoot = doc.body ? doc.body : doc.documentElement; 784 785 xhr.responseText = docRoot ? docRoot.innerHTML : null; 786 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 787 if (isXml) { 788 s.dataType = 'xml'; 789 } 790 xhr.getResponseHeader = function(header){ 791 var headers = {'content-type': s.dataType}; 792 793 return headers[header.toLowerCase()]; 794 }; 795 // support for XHR 'status' & 'statusText' emulation : 796 if (docRoot) { 797 xhr.status = Number(docRoot.getAttribute('status')) || xhr.status; 798 xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; 799 } 800 801 var dt = (s.dataType || '').toLowerCase(); 802 var scr = /(json|script|text)/.test(dt); 803 804 if (scr || s.textarea) { 805 // see if user embedded response in textarea 806 var ta = doc.getElementsByTagName('textarea')[0]; 807 808 if (ta) { 809 xhr.responseText = ta.value; 810 // support for XHR 'status' & 'statusText' emulation : 811 xhr.status = Number(ta.getAttribute('status')) || xhr.status; 812 xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; 813 814 } else if (scr) { 815 // account for browsers injecting pre around json response 816 var pre = doc.getElementsByTagName('pre')[0]; 817 var b = doc.getElementsByTagName('body')[0]; 818 819 if (pre) { 820 xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; 821 } else if (b) { 822 xhr.responseText = b.textContent ? b.textContent : b.innerText; 823 } 824 } 825 826 } else if (dt === 'xml' && !xhr.responseXML && xhr.responseText) { 827 xhr.responseXML = toXml(xhr.responseText); // eslint-disable-line no-use-before-define 828 } 829 830 try { 831 data = httpData(xhr, dt, s); // eslint-disable-line no-use-before-define 832 833 } catch (err) { 834 status = 'parsererror'; 835 xhr.error = errMsg = (err || status); 836 } 837 838 } catch (err) { 839 log('error caught: ', err); 840 status = 'error'; 841 xhr.error = errMsg = (err || status); 842 } 843 844 if (xhr.aborted) { 845 log('upload aborted'); 846 status = null; 847 } 848 849 if (xhr.status) { // we've set xhr.status 850 status = ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) ? 'success' : 'error'; 851 } 852 853 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 854 if (status === 'success') { 855 if (s.success) { 856 s.success.call(s.context, data, 'success', xhr); 857 } 858 859 deferred.resolve(xhr.responseText, 'success', xhr); 860 861 if (g) {
862 $.event.trigger('ajaxSuccess', [xhr, s]); 863 } 864 865 } else if (status) { 866 if (typeof errMsg === 'undefined') { 867 errMsg = xhr.statusText; 868 } 869 if (s.error) { 870 s.error.call(s.context, xhr, status, errMsg); 871 } 872 deferred.reject(xhr, 'error', errMsg); 873 if (g) { 874 $.event.trigger('ajaxError', [xhr, s, errMsg]); 875 } 876 } 877 878 if (g) { 879 $.event.trigger('ajaxComplete', [xhr, s]); 880 } 881 882 if (g && !--$.active) { 883 $.event.trigger('ajaxStop'); 884 } 885 886 if (s.complete) { 887 s.complete.call(s.context, xhr, status); 888 } 889 890 callbackProcessed = true; 891 if (s.timeout) { 892 clearTimeout(timeoutHandle); 893 } 894 895 // clean up 896 setTimeout(function() { 897 if (!s.iframeTarget) { 898 $io.remove(); 899 } else { // adding else to clean up existing iframe response. 900 $io.attr('src', s.iframeSrc); 901 } 902 xhr.responseXML = null; 903 }, 100); 904 } 905 906 var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) 907 if (window.ActiveXObject) { 908 doc = new ActiveXObject('Microsoft.XMLDOM'); 909 doc.async = 'false'; 910 doc.loadXML(s); 911 912 } else { 913 doc = (new DOMParser()).parseFromString(s, 'text/xml'); 914 } 915 916 return (doc && doc.documentElement && doc.documentElement.nodeName !== 'parsererror') ? doc : null; 917 }; 918 var parseJSON = $.parseJSON || function(s) { 919 /* jslint evil:true */ 920 return window['eval']('(' + s + ')'); // eslint-disable-line dot-notation 921 }; 922 923 var httpData = function(xhr, type, s) { // mostly lifted from jq1.4.4 924 925 var ct = xhr.getResponseHeader('content-type') || '', 926 xml = ((type === 'xml' || !type) && ct.indexOf('xml') >= 0), 927 data = xml ? xhr.responseXML : xhr.responseText; 928 929 if (xml && data.documentElement.nodeName === 'parsererror') { 930 if ($.error) { 931 $.error('parsererror'); 932 } 933 } 934 if (s && s.dataFilter) { 935 data = s.dataFilter(data, type); 936 } 937 if (typeof data === 'string') { 938 if ((type === 'json' || !type) && ct.indexOf('json') >= 0) { 939 data = parseJSON(data); 940 } else if ((type === 'script' || !type) && ct.indexOf('javascript') >= 0) { 941 $.globalEval(data); 942 } 943 } 944 945 return data; 946 }; 947 948 return deferred; 949 } 950 }; 951 952 /** 953 * ajaxForm() provides a mechanism for fully automating form submission. 954 * 955 * The advantages of using this method instead of ajaxSubmit() are: 956 * 957 * 1: This method will include coordinates for <input type="image"> elements (if the element 958 * is used to submit the form). 959 * 2. This method will include the submit element's name/value data (for the element that was 960 * used to submit the form). 961 * 3. This method binds the submit() method to the form for you. 962 * 963 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely 964 * passes the options argument along after properly binding events for submit elements and 965 * the form itself. 966 */ 967 $.fn.ajaxForm = function(options, data, dataType, onSuccess) { 968 if (typeof options === 'string' || (options === false && arguments.length > 0)) { 969 options = { 970 'url' : options, 971 'data' : data, 972 'dataType' : dataType 973 }; 974 975 if (typeof onSuccess === 'function') { 976 options.success = onSuccess; 977 } 978 } 979 980 options = options || {}; 981 options.delegation = options.delegation && $.isFunction($.fn.on); 982 983 // in jQuery 1.3+ we can fix mistakes with the ready state 984 if (!options.delegation && this.length === 0) { 985 var o = {s: this.selector, c: this.context}; 986 987 if (!$.isReady && o.s) { 988 log('DOM not ready, queuing ajaxForm'); 989 $(function() { 990 $(o.s, o.c).ajaxForm(options); 991 }); 992 993 return this; 994 } 995 996 // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 997 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 998 999 return this; 1000 } 1001 1002 if (options.delegation) { 1003 $(document) 1004 .off('submit.form-plugin', this.selector, doAjaxSubmit) 1005 .off('click.form-plugin', this.selector, captureSubmittingElement) 1006 .on('submit.form-plugin', this.selector, options, doAjaxSubmit) 1007 .on('click.form-plugin', this.selector, options, captureSubmittingElement); 1008 1009 return this; 1010 } 1011 1012 return this.ajaxFormUnbind() 1013 .on('submit.form-plugin', options, doAjaxSubmit) 1014 .on('click.form-plugin', options, captureSubmittingElement); 1015 }; 1016 1017 // private event handlers 1018 function doAjaxSubmit(e) { 1019 /* jshint validthis:true */ 1020 var options = e.data; 1021 1022 if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed 1023 e.preventDefault(); 1024 $(e.target).closest('form').ajaxSubmit(options); // #365 1025 } 1026 } 1027 1028 function captureSubmittingElement(e) { 1029 /* jshint validthis:true */ 1030 var target = e.target; 1031 var $el = $(target); 1032 1033 if (!$el.is('[type=submit],[type=image]')) { 1034 // is this a child element of the submit el? (ex: a span within a button) 1035 var t = $el.closest('[type=submit]'); 1036 1037 if (t.length === 0) { 1038 return; 1039 } 1040 target = t[0]; 1041 } 1042 1043 var form = target.form; 1044 1045 form.clk = target; 1046 1047 if (target.type === 'image') { 1048 if (typeof e.offsetX !== 'undefined') { 1049 form.clk_x = e.offsetX; 1050 form.clk_y = e.offsetY; 1051 1052 } else if (typeof $.fn.offset === 'function') { 1053 var offset = $el.offset(); 1054 1055 form.clk_x = e.pageX - offset.left; 1056 form.clk_y = e.pageY - offset.top; 1057 1058 } else { 1059 form.clk_x = e.pageX - target.offsetLeft; 1060 form.clk_y = e.pageY - target.offsetTop; 1061 } 1062 } 1063 // clear form vars 1064 setTimeout(function() { 1065 form.clk = form.clk_x = form.clk_y = null; 1066 }, 100); 1067 } 1068 1069 1070 // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 1071 $.fn.ajaxFormUnbind = function() { 1072 return this.off('submit.form-plugin click.form-plugin'); 1073 }; 1074 1075 /** 1076 * formToArray() gathers form element data into an array of objects that can 1077 * be passed to any of the following ajax functions: $.get, $.post, or load. 1078 * Each object in the array has both a 'name' and 'value' property. An example of 1079 * an array for a simple login form might be: 1080 * 1081 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 1082 * 1083 * It is this array that is passed to pre-submit callback functions provided to the 1084 * ajaxSubmit() and ajaxForm() methods. 1085 */ 1086 $.fn.formToArray = function(semantic, elements, filtering) { 1087 var a = []; 1088 1089 if (this.length === 0) { 1090 return a; 1091 } 1092 1093 var form = this[0]; 1094 var formId = this.attr('id'); 1095 var els = (semantic || typeof form.elements === 'undefined') ? form.getElementsByTagName('*') : form.elements; 1096 var els2; 1097 1098 if (els) { 1099 els = $.makeArray(els); // convert to standard array 1100 } 1101 1102 // #386; account for inputs outside the form which use the 'form' attribute 1103 // FinesseRus: in non-IE browsers outside fields are already included in form.elements. 1104 if (formId && (semantic || /(Edge|Trident)\//.test(navigator.userAgent))) { 1105 els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet 1106 if (els2.length) { 1107 els = (els || []).concat(els2); 1108 } 1109 } 1110 1111 if (!els || !els.length) { 1112 return a; 1113 } 1114
1115 if ($.isFunction(filtering)) { 1116 els = $.map(els, filtering); 1117 } 1118 1119 var i, j, n, v, el, max, jmax; 1120 1121 for (i = 0, max = els.length; i < max; i++) { 1122 el = els[i]; 1123 n = el.name; 1124 if (!n || el.disabled) { 1125 continue; 1126 } 1127 1128 if (semantic && form.clk && el.type === 'image') { 1129 // handle image inputs on the fly when semantic == true 1130 if (form.clk === el) { 1131 a.push({name: n, value: $(el).val(), type: el.type}); 1132 a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y}); 1133 } 1134 continue; 1135 } 1136 1137 v = $.fieldValue(el, true); 1138 if (v && v.constructor === Array) { 1139 if (elements) { 1140 elements.push(el); 1141 } 1142 for (j = 0, jmax = v.length; j < jmax; j++) { 1143 a.push({name: n, value: v[j]}); 1144 } 1145 1146 } else if (feature.fileapi && el.type === 'file') { 1147 if (elements) { 1148 elements.push(el); 1149 } 1150 1151 var files = el.files; 1152 1153 if (files.length) { 1154 for (j = 0; j < files.length; j++) { 1155 a.push({name: n, value: files[j], type: el.type}); 1156 } 1157 } else { 1158 // #180 1159 a.push({name: n, value: '', type: el.type}); 1160 } 1161 1162 } else if (v !== null && typeof v !== 'undefined') { 1163 if (elements) { 1164 elements.push(el); 1165 } 1166 a.push({name: n, value: v, type: el.type, required: el.required}); 1167 } 1168 } 1169 1170 if (!semantic && form.clk) { 1171 // input type=='image' are not found in elements array! handle it here 1172 var $input = $(form.clk), input = $input[0]; 1173 1174 n = input.name; 1175 1176 if (n && !input.disabled && input.type === 'image') { 1177 a.push({name: n, value: $input.val()}); 1178 a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y}); 1179 } 1180 } 1181 1182 return a; 1183 }; 1184 1185 /** 1186 * Serializes form data into a 'submittable' string. This method will return a string 1187 * in the format: name1=value1&name2=value2 1188 */ 1189 $.fn.formSerialize = function(semantic) { 1190 // hand off to jQuery.param for proper encoding 1191 return $.param(this.formToArray(semantic)); 1192 }; 1193 1194 /** 1195 * Serializes all field elements in the jQuery object into a query string. 1196 * This method will return a string in the format: name1=value1&name2=value2 1197 */ 1198 $.fn.fieldSerialize = function(successful) { 1199 var a = []; 1200 1201 this.each(function() { 1202 var n = this.name; 1203 1204 if (!n) { 1205 return; 1206 } 1207 1208 var v = $.fieldValue(this, successful); 1209 1210 if (v && v.constructor === Array) { 1211 for (var i = 0, max = v.length; i < max; i++) { 1212 a.push({name: n, value: v[i]}); 1213 } 1214 1215 } else if (v !== null && typeof v !== 'undefined') { 1216 a.push({name: this.name, value: v}); 1217 } 1218 }); 1219 1220 // hand off to jQuery.param for proper encoding 1221 return $.param(a); 1222 }; 1223 1224 /** 1225 * Returns the value(s) of the element in the matched set. For example, consider the following form: 1226 * 1227 * <form><fieldset> 1228 * <input name="A" type="text"> 1229 * <input name="A" type="text"> 1230 * <input name="B" type="checkbox" value="B1"> 1231 * <input name="B" type="checkbox" value="B2"> 1232 * <input name="C" type="radio" value="C1"> 1233 * <input name="C" type="radio" value="C2"> 1234 * </fieldset></form> 1235 * 1236 * var v = $('input[type=text]').fieldValue(); 1237 * // if no values are entered into the text inputs 1238 * v === ['',''] 1239 * // if values entered into the text inputs are 'foo' and 'bar' 1240 * v === ['foo','bar'] 1241 * 1242 * var v = $('input[type=checkbox]').fieldValue(); 1243 * // if neither checkbox is checked 1244 * v === undefined 1245 * // if both checkboxes are checked 1246 * v === ['B1', 'B2'] 1247 * 1248 * var v = $('input[type=radio]').fieldValue(); 1249 * // if neither radio is checked 1250 * v === undefined 1251 * // if first radio is checked 1252 * v === ['C1'] 1253 * 1254 * The successful argument controls whether or not the field element must be 'successful' 1255 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 1256 * The default value of the successful argument is true. If this value is false the value(s) 1257 * for each element is returned. 1258 * 1259 * Note: This method *always* returns an array. If no valid value can be determined the 1260 * array will be empty, otherwise it will contain one or more values. 1261 */ 1262 $.fn.fieldValue = function(successful) { 1263 for (var val = [], i = 0, max = this.length; i < max; i++) { 1264 var el = this[i]; 1265 var v = $.fieldValue(el, successful); 1266 1267 if (v === null || typeof v === 'undefined' || (v.constructor === Array && !v.length)) { 1268 continue; 1269 } 1270 1271 if (v.constructor === Array) { 1272 $.merge(val, v); 1273 } else { 1274 val.push(v); 1275 } 1276 } 1277 1278 return val; 1279 }; 1280 1281 /** 1282 * Returns the value of the field element. 1283 */ 1284 $.fieldValue = function(el, successful) { 1285 var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); 1286 1287 if (typeof successful === 'undefined') { 1288 successful = true; 1289 } 1290 1291 /* eslint-disable no-mixed-operators */ 1292 if (successful && (!n || el.disabled || t === 'reset' || t === 'button' || 1293 (t === 'checkbox' || t === 'radio') && !el.checked || 1294 (t === 'submit' || t === 'image') && el.form && el.form.clk !== el || 1295 tag === 'select' && el.selectedIndex === -1)) { 1296 /* eslint-enable no-mixed-operators */ 1297 return null; 1298 } 1299 1300 if (tag === 'select') { 1301 var index = el.selectedIndex; 1302 1303 if (index < 0) { 1304 return null; 1305 } 1306 1307 var a = [], ops = el.options; 1308 var one = (t === 'select-one'); 1309 var max = (one ? index + 1 : ops.length); 1310 1311 for (var i = (one ? index : 0); i < max; i++) { 1312 var op = ops[i]; 1313 1314 if (op.selected && !op.disabled) { 1315 var v = op.value; 1316 1317 if (!v) { // extra pain for IE... 1318 v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value; 1319 } 1320 1321 if (one) { 1322 return v; 1323 } 1324 1325 a.push(v); 1326 } 1327 } 1328 1329 return a; 1330 } 1331 1332 return $(el).val().replace(rCRLF, '\r\n'); 1333 }; 1334 1335 /** 1336 * Clears the form data. Takes the following actions on the form's input fields: 1337 * - input text fields will have their 'value' property set to the empty string 1338 * - select elements will have their 'selectedIndex' property set to -1 1339 * - checkbox and radio inputs will have their 'checked' property set to false 1340 * - inputs of type submit, button, reset, and hidden will *not* be effected 1341 * - button elements will *not* be effected 1342 */ 1343 $.fn.clearForm = function(includeHidden) { 1344 return this.each(function() { 1345 $('input,select,textarea', this).clearFields(includeHidden); 1346 }); 1347 }; 1348 1349 /** 1350 * Clears the selected form elements. 1351 */ 1352 $.fn.clearFields = $.fn.clearInputs = function(includeHidden) { 1353 var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list 1354 1355 return this.each(function() { 1356 var t = this.type, tag = this.tagName.toLowerCase(); 1357 1358 if (re.test(t) || tag === 'textarea') { 1359 this.value = ''; 1360 1361 } else if (t === 'checkbox' || t === 'radio') { 1362 this.checked = false;
1363 1364 } else if (tag === 'select') { 1365 this.selectedIndex = -1; 1366 1367 } else if (t === 'file') { 1368 if (/MSIE/.test(navigator.userAgent)) { 1369 $(this).replaceWith($(this).clone(true)); 1370 } else { 1371 $(this).val(''); 1372 } 1373 1374 } else if (includeHidden) { 1375 // includeHidden can be the value true, or it can be a selector string 1376 // indicating a special test; for example: 1377 // $('#myForm').clearForm('.special:hidden') 1378 // the above would clean hidden inputs that have the class of 'special' 1379 if ((includeHidden === true && /hidden/.test(t)) || 1380 (typeof includeHidden === 'string' && $(this).is(includeHidden))) { 1381 this.value = ''; 1382 } 1383 } 1384 }); 1385 }; 1386 1387 1388 /** 1389 * Resets the form data or individual elements. Takes the following actions 1390 * on the selected tags: 1391 * - all fields within form elements will be reset to their original value 1392 * - input / textarea / select fields will be reset to their original value 1393 * - option / optgroup fields (for multi-selects) will defaulted individually 1394 * - non-multiple options will find the right select to default 1395 * - label elements will be searched against its 'for' attribute 1396 * - all others will be searched for appropriate children to default 1397 */ 1398 $.fn.resetForm = function() { 1399 return this.each(function() { 1400 var el = $(this); 1401 var tag = this.tagName.toLowerCase(); 1402 1403 switch (tag) { 1404 case 'input': 1405 this.checked = this.defaultChecked; 1406 // fall through 1407 1408 case 'textarea': 1409 this.value = this.defaultValue; 1410 1411 return true; 1412 1413 case 'option': 1414 case 'optgroup': 1415 var select = el.parents('select'); 1416 1417 if (select.length && select[0].multiple) { 1418 if (tag === 'option') { 1419 this.selected = this.defaultSelected; 1420 } else { 1421 el.find('option').resetForm(); 1422 } 1423 } else { 1424 select.resetForm(); 1425 } 1426 1427 return true; 1428 1429 case 'select': 1430 el.find('option').each(function(i) { // eslint-disable-line consistent-return 1431 this.selected = this.defaultSelected; 1432 if (this.defaultSelected && !el[0].multiple) { 1433 el[0].selectedIndex = i; 1434 1435 return false; 1436 } 1437 }); 1438 1439 return true; 1440 1441 case 'label': 1442 var forEl = $(el.attr('for')); 1443 var list = el.find('input,select,textarea'); 1444 1445 if (forEl[0]) { 1446 list.unshift(forEl[0]); 1447 } 1448 1449 list.resetForm(); 1450 1451 return true; 1452 1453 case 'form': 1454 // guard against an input with the name of 'reset' 1455 // note that IE reports the reset function as an 'object' 1456 if (typeof this.reset === 'function' || (typeof this.reset === 'object' && !this.reset.nodeType)) { 1457 this.reset(); 1458 } 1459 1460 return true; 1461 1462 default: 1463 el.find('form,input,label,select,textarea').resetForm(); 1464 1465 return true; 1466 } 1467 }); 1468 }; 1469 1470 /** 1471 * Enables or disables any matching elements. 1472 */ 1473 $.fn.enable = function(b) { 1474 if (typeof b === 'undefined') { 1475 b = true; 1476 } 1477 1478 return this.each(function() { 1479 this.disabled = !b; 1480 }); 1481 }; 1482 1483 /** 1484 * Checks/unchecks any matching checkboxes or radio buttons and 1485 * selects/deselects and matching option elements. 1486 */ 1487 $.fn.selected = function(select) { 1488 if (typeof select === 'undefined') { 1489 select = true; 1490 } 1491 1492 return this.each(function() { 1493 var t = this.type; 1494 1495 if (t === 'checkbox' || t === 'radio') { 1496 this.checked = select; 1497 1498 } else if (this.tagName.toLowerCase() === 'option') { 1499 var $sel = $(this).parent('select'); 1500 1501 if (select && $sel[0] && $sel[0].type === 'select-one') { 1502 // deselect all other options 1503 $sel.find('option').selected(false); 1504 } 1505 1506 this.selected = select; 1507 } 1508 }); 1509 }; 1510 1511 // expose debug var 1512 $.fn.ajaxSubmit.debug = false; 1513 1514 // helper fn for console logging 1515 function log() { 1516 if (!$.fn.ajaxSubmit.debug) { 1517 return; 1518 } 1519 1520 var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, ''); 1521 1522 if (window.console && window.console.log) { 1523 window.console.log(msg); 1524 1525 } else if (window.opera && window.opera.postError) { 1526 window.opera.postError(msg); 1527 } 1528 } 1529})); 1530 1531jQuery.fn.supersleight = function(settings) { 1532 settings = jQuery.extend({ 1533 imgs: true, 1534 backgrounds: true, 1535 shim: '/graphics/x.gif', 1536 apply_positioning: false 1537 }, settings); 1538 1539 return this.each(function(){
1540 if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) { 1541 jQuery(this).find('*').andSelf().each(function(i,obj) { 1542 var self = jQuery(obj); 1543 // background pngs 1544 if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) { 1545 var bg = self.css('background-image'); 1546 var src = bg.substring(5,bg.length-2); 1547 var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale'); 1548 var styles = { 1549 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')", 1550 'background-image': 'url('+settings.shim+')' 1551 }; 1552 self.css(styles); 1553 }; 1554 // image elements 1555 if (settings.imgs && self.is('img[src$=png]')){ 1556 var styles = { 1557 'width': self.width() + 'px', 1558 'height': self.height() + 'px', 1559 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')" 1560 }; 1561 self.css(styles).attr('src', settings.shim); 1562 }; 1563 // apply position to 'active' elements 1564 if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){ 1565 self.css('position', 'relative'); 1566 }; 1567 }); 1568 }; 1569 }); 1570}; 1571 1572/* 1573 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined 1574 * in FIPS 180-1 1575 * Version 2.2 Copyright Paul Johnston 2000 - 2009. 1576 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet 1577 * Distributed under the BSD License 1578 * See http://pajhome.org.uk/crypt/md5 for details. 1579 */ 1580var hexcase=0;var b64pad="";function hex_sha1(a){return rstr2hex(rstr_sha1(str2rstr_utf8(a)))}function hex_hmac_sha1(a,b){return rstr2hex(rstr_hmac_sha1(str2rstr_utf8(a),str2rstr_utf8(b)))}function sha1_vm_test(){return hex_sha1("abc").toLowerCase()=="a9993e364706816aba3e25717850c26c9cd0d89d"}function rstr_sha1(a){return binb2rstr(binb_sha1(rstr2binb(a),a.length*8))}function rstr_hmac_sha1(c,f){var e=rstr2binb(c);if(e.length>16){e=binb_sha1(e,c.length*8)}var a=Array(16),d=Array(16);for(var b=0;b<16;b++){a[b]=e[b]^909522486;d[b]=e[b]^1549556828}var g=binb_sha1(a.concat(rstr2binb(f)),512+f.length*8);return binb2rstr(binb_sha1(d.concat(g),512+160))}function rstr2hex(c){try{hexcase}catch(g){hexcase=0}var f=hexcase?"0123456789ABCDEF":"0123456789abcdef";var b="";var a;for(var d=0;d<c.length;d++){a=c.charCodeAt(d);b+=f.charAt((a>>>4)&15)+f.charAt(a&15)}return b}function str2rstr_utf8(c){var b="";var d=-1;var a,e;while(++d<c.length){a=c.charCodeAt(d);e=d+1<c.length?c.charCodeAt(d+1):0;if(55296<=a&&a<=56319&&56320<=e&&e<=57343){a=65536+((a&1023)<<10)+(e&1023);d++}if(a<=127){b+=String.fromCharCode(a)}else{if(a<=2047){b+=String.fromCharCode(192|((a>>>6)&31),128|(a&63))}else{if(a<=65535){b+=String.fromCharCode(224|((a>>>12)&15),128|((a>>>6)&63),128|(a&63))}else{if(a<=2097151){b+=String.fromCharCode(240|((a>>>18)&7),128|((a>>>12)&63),128|((a>>>6)&63),128|(a&63))}}}}}return b}function rstr2binb(b){var a=Array(b.length>>2);for(var c=0;c<a.length;c++){a[c]=0}for(var c=0;c<b.length*8;c+=8){a[c>>5]|=(b.charCodeAt(c/8)&255)<<(24-c%32)}return a}function binb2rstr(b){var a="";for(var c=0;c<b.length*32;c+=8){a+=String.fromCharCode((b[c>>5]>>>(24-c%32))&255)}return a}function binb_sha1(v,o){v[o>>5]|=128<<(24-o%32);v[((o+64>>9)<<4)+15]=o;var y=Array(80);var u=1732584193;var s=-271733879;var r=-1732584194;var q=271733878;var p=-1009589776;for(var l=0;l<v.length;l+=16){var n=u;var m=s;var k=r;var h=q;var f=p;for(var g=0;g<80;g++){if(g<16){y[g]=v[l+g]}else{y[g]=bit_rol(y[g-3]^y[g-8]^y[g-14]^y[g-16],1)}var z=safe_add(safe_add(bit_rol(u,5),sha1_ft(g,s,r,q)),safe_add(safe_add(p,y[g]),sha1_kt(g)));p=q;q=r;r=bit_rol(s,30);s=u;u=z}u=safe_add(u,n);s=safe_add(s,m);r=safe_add(r,k);q=safe_add(q,h);p=safe_add(p,f)}return Array(u,s,r,q,p)}function sha1_ft(e,a,g,f){if(e<20){return(a&g)|((~a)&f)}if(e<40){return a^g^f}if(e<60){return(a&g)|(a&f)|(g&f)}return a^g^f}function sha1_kt(a){return(a<20)?1518500249:(a<40)?1859775393:(a<60)?-1894007588:-899497514}function safe_add(a,d){var c=(a&65535)+(d&65535);var b=(a>>16)+(d>>16)+(c>>16);return(b<<16)|(c&65535)}function bit_rol(a,b){return(a<<b)|(a>>>(32-b))}; 1581 1582/* 1583 * jQuery Color Animations 1584 * Copyright 2007 John Resig 1585 * Released under the MIT and GPL licenses. 1586 */ 1587 1588(function(jQuery){ 1589 1590 // We override the animation for all of these color styles 1591 jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ 1592 jQuery.fx.step[attr] = function(fx){ 1593 if ( fx.state == 0 ) { 1594 fx.start = getColor( fx.elem, attr ); 1595 fx.end = getRGB( fx.end ); 1596 } 1597 1598 fx.elem.style[attr] = "rgb(" + [ 1599 Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0
vendor: 11,460 bytes, lines 1599-1713
1599), 1600 Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), 1601 Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) 1602 ].join(",") + ")"; 1603 } 1604 }); 1605 1606 // Color Conversion functions from highlightFade 1607 // By Blair Mitchelmore 1608 // http://jquery.offput.ca/highlightFade/ 1609 1610 // Parse strings looking for color tuples [255,255,255] 1611 function getRGB(color) { 1612 var result; 1613 1614 // Check if we're already dealing with an array of colors 1615 if ( color && color.constructor == Array && color.length == 3 ) 1616 return color; 1617 1618 // Look for rgb(num,num,num) 1619 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) 1620 return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; 1621 1622 // Look for rgb(num%,num%,num%) 1623 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) 1624 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; 1625 1626 // Look for #a0b1c2 1627 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) 1628 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; 1629 1630 // Look for #fff 1631 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) 1632 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; 1633 1634 // Otherwise, we're most likely dealing with a named color 1635 return colors[jQuery.trim(color).toLowerCase()]; 1636 } 1637 1638 function getColor(elem, attr) { 1639 var color; 1640 1641 do { 1642 color = jQuery.curCSS(elem, attr); 1643 1644 // Keep going until we find an element that has color, or we hit the body 1645 if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) 1646 break; 1647 1648 attr = "backgroundColor"; 1649 } while ( elem = elem.parentNode ); 1650 1651 return getRGB(color); 1652 }; 1653 1654 // Some named colors to work with 1655 // From Interface by Stefan Petre 1656 // http://interface.eyecon.ro/ 1657 1658 var colors = { 1659 aqua:[0,255,255], 1660 azure:[240,255,255], 1661 beige:[245,245,220], 1662 black:[0,0,0], 1663 blue:[0,0,255], 1664 brown:[165,42,42], 1665 cyan:[0,255,255], 1666 darkblue:[0,0,139], 1667 darkcyan:[0,139,139], 1668 darkgrey:[169,169,169], 1669 darkgreen:[0,100,0], 1670 darkkhaki:[189,183,107], 1671 darkmagenta:[139,0,139], 1672 darkolivegreen:[85,107,47], 1673 darkorange:[255,140,0], 1674 darkorchid:[153,50,204], 1675 darkred:[139,0,0], 1676 darksalmon:[233,150,122], 1677 darkviolet:[148,0,211], 1678 fuchsia:[255,0,255], 1679 gold:[255,215,0], 1680 green:[0,128,0], 1681 indigo:[75,0,130], 1682 khaki:[240,230,140], 1683 lightblue:[173,216,230], 1684 lightcyan:[224,255,255], 1685 lightgreen:[144,238,144], 1686 lightgrey:[211,211,211], 1687 lightpink:[255,182,193], 1688 lightyellow:[255,255,224], 1689 lime:[0,255,0], 1690 magenta:[255,0,255], 1691 maroon:[128,0,0], 1692 navy:[0,0,128], 1693 olive:[128,128,0], 1694 orange:[255,165,0], 1695 pink:[255,192,203], 1696 purple:[128,0,128], 1697 violet:[128,0,128], 1698 red:[255,0,0], 1699 silver:[192,192,192], 1700 white:[255,255,255], 1701 yellow:[255,255,0] 1702 }; 1703 1704})(jQuery); 1705 1706 1707/*! 1708 * Chart.js v2.8.0 1709 * https://www.chartjs.org 1710 * (c) 2019 Chart.js Contributors 1711 * Released under the MIT License 1712 */ 1713!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(function(){try{return require("moment")}catch(t){}}()):"function"==typeof define&&define.amd?define(["require"],function(t){return e(function(){try{return t("moment")}catch(t){}}())}):t.Chart=e(t.moment)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e={rgb2hsl:i,rgb2hsv:n,rgb2hwb:a,rgb2cmyk:o,rgb2keyword:s,rgb2xyz:l,rgb2lab:d,rgb2lch:function(t){return x(d(t))},hsl2rgb:u,hsl2hsv:function(t){var e=t[0],i=t[1]/100,n=t[2]/100;if(0===n)return[0,0,0];return[e,100*(2*(i*=(n*=2)<=1?n:2-n)/(n+i)),100*((n+i)/2)]},hsl2hwb:function(t){return a(u(t))},hsl2cmyk:function(t){return o(u(t))},hsl2keyword:function(t){return s(u(t))},hsv2rgb:h,hsv2hsl:function(t){var e,i,n=t[0],a=t[1]/100,o=t[2]/100;return e=a*o,[n,100*(e=(e/=(i=(2-a)*o)<=1?i:2-i)||0),100*(i/=2)]},hsv2hwb:function(t){return a(h(t))},hsv2cmyk:function(t){return o(h(t))},hsv2keyword:function(t){return s(h(t))},hwb2rgb:c,hwb2hsl:function(t){return i(c(t))},hwb2hsv:function(t){return n(c(t))},hwb2cmyk:function(t){return o(c(t))},hwb2keyword:function(t){return s(c(t))},cmyk2rgb:f,cmyk2hsl:function(t){return i(f(t))},cmyk2hsv:function(t){return n(f(t))},cmyk2hwb:function(t){return a(f(t))},cmyk2keyword:function(t){return s(f(t))},keyword2rgb:w,keyword2hsl:function(t){return i(w(t))},keyword2hsv:function(t){return n(w(t))},keyword2hwb:function(t){return a(w(t))},keyword2cmyk:function(t){return o(w(t))},keyword2lab:function(t){return d(w(t))},keyword2xyz:function(t){return l(w(t))},xyz2rgb:p,xyz2lab:m,xyz2lch:function(t){return x(m(t))},lab2xyz:v,lab2rgb:y,lab2lch:x,lch2lab:k,lch2xyz:function(t){return v(k(t))},lch2rgb:function(t){return y(k(t))}};function i(t){var e,i,n=t[0]/255,a=t[1]/255,o=t[2]/255,r=Math.min(n,a,o),s=Math.max(n,a,o),l=s-r;return s==r?e=0:n==s?e=(a-o)/l:a==s?e=2+(o-n)/l:o==s&&(e=4+(n-a)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(r+s)/2,[e,100*(s==r?0:i<=.5?l/(s+r):l/(2-s-r)),100*i]}function n(t){var e,i,n=t[0],a=t[1],o=t[2],r=Math.min(n,a,o),s=Math.max(n,a,o),l=s-r;return i=0==s?0:l/s*1e3/10,s==r?e=0:n==s?e=(a-o)/l:a==s?e=2+(o-n)/l:o==s&&(e=4+(n-a)/l),(e=Math.min(60*e,360))<0&&(e+=360),[e,i,s/255*1e3/10]}function a(t){var e=t[0],n=t[1],a=t[2];return[i(t)[0],100*(1/255*Math.min(e,Math.min(n,a))),100*(a=1-1/255*Math.max(e,Math.max(n,a)))]}function o(t){var e,i=t[0]/255,n=t[1]/255,a=t[2]/255;return[100*((1-i-(e=Math.min(1-i,1-n,1-a)))/(1-e)||0),100*((1-n-e)/(1-e)||0),100*((1-a-e)/(1-e)||0),100*e]}function s(t){return _[JSON.stringify(t)]}function l(t){var e=t[0]/255,i=t[1]/255,n=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*e+.7152*i+.0722*n),100*(.0193*e+.1192*i+.9505*n)]}function d(t){var e=l(t),i=e[0],n=e[1],a=e[2];return n/=100,a/=108.883,i=(i/=95.047)>.008856?Math.pow(i,1/3):7.787*i+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(i-n),200*(n-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]}function u(t){var e,i,n,a,o,r=t[0]/360,s=t[1]/100,l=t[2]/100;if(0==s)return[o=255*l,o,o];e=2*l-(i=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var d=0;d<3;d++)(n=r+1/3*-(d-1))<0&&n++,n>1&&n--,o=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,a[d]=255*o;return a}function h(t){var e=t[0]/60,i=t[1]/100,n=t[2]/100,a=Math.floor(e)%6,o=e-Math.floor(e),r=255*n*(1-i),s=255*n*(1-i*o),l=255*n*(1-i*(1-o));n*=255;switch(a){case 0:return[n,l,r];case 1:return[s,n,r];case 2:return[r,n,l];case 3:return[r,s,n];case 4:return[l,r,n];case 5:return[n,r,s]}}function c(t){var e,i,n,a,o=t[0]/360,s=t[1]/100,l=t[2]/100,d=s+l;switch(d>1&&(s/=d,l/=d),n=6*o-(e=Math.floor(6*o)),0!=(1&e)&&(n=1-n),a=s+n*((i=1-l)-s),e){default:case 6:case 0:r=i,g=a,b=s;break;case 1:r=a,g=i,b=s;break;case 2:r=s,g=i,b=a;break;case 3:r=s,g=a,b=i;break;case 4:r=a,g=s,b=i;break;case 5:r=i,g=s,b=a}return[255*r,255*g,255*b]}function f(t){var e=t[0]/100,i=t[1]/100,n=t[2]/100,a=t[3]/100;return[255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,i*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a))]}function p(t){var e,i,n,a=t[0]/100,o=t[1]/100,r=t[2]/100;return i=-.9689*a+1.8758*o+.0415*r,n=.0557*a+-.204*o+1.057*r,e=(e=3.2406*a+-1.5372*o+-.4986*r)>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,[255*(e=Math.min(Math.max(0,e),1)),255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1))]}function m(t){var e=t[0],i=t[1],n=t[2];return i/=100,n/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(e-i),200*(i-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]}function v(t){var e,i,n,a,o=t[0],r=t[1],s=t[2];return o<=8?a=(i=100*o/903.3)/100*7.787+16/116:(i=100*Math.pow((o+16)/116,3),a=Math.pow(i/100,1/3)),[e=e/95.047<=.008856?e=95.047*(r/500+a-16/116)/7.787:95.047*Math.pow(r/500+a,3),i,n=n/108.883<=.008859?n=108.883*(a-s/200-16/116)/7.787:108.883*Math.pow(a-s/200,3)]}function x(t){var e,i=t[0],n=t[1],a=t[2];return(e=360*Math.atan2(a,n)/2/Math.PI)<0&&(e+=360),[i,Math.sqrt(n*n+a*a),e]}function y(t){return p(v(t))}function k(t){var e,i=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[i,n*Math.cos(e),n*Math.sin(e)]}function w(t){return M[t]}var M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87
vendor: 4,442 bytes, line 1713
1713],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},_={};for(var C in M)_[JSON.stringify(M[C])]=C;var S=function(){return new T};for(var P in e){S[P+"Raw"]=function(t){return function(i){return"number"==typeof i&&(i=Array.prototype.slice.call(arguments)),e[t](i)}}(P);var I=/(\w+)2(\w+)/.exec(P),A=I[1],D=I[2];(S[A]=S[A]||{})[D]=S[P]=function(t){return function(i){"number"==typeof i&&(i=Array.prototype.slice.call(arguments));var n=e[t](i);if("string"==typeof n||void 0===n)return n;for(var a=0;a<n.length;a++)n[a]=Math.round(n[a]);return n}}(P)}var T=function(){this.convs={}};T.prototype.routeSpace=function(t,e){var i=e[0];return void 0===i?this.getValues(t):("number"==typeof i&&(i=Array.prototype.slice.call(e)),this.setValues(t,i))},T.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},T.prototype.getValues=function(t){var e=this.convs[t];if(!e){var i=this.space,n=this.convs[i];e=S[i][t](n),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){T.prototype[t]=function(e){return this.routeSpace(t,arguments)}});var F=S,L={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87
vendor: 4,803 bytes, line 1713
1713],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},R={getRgba:O,getHsla:z,getRgb:function(t){var e=O(t);return e&&e.slice(0,3)},getHsl:function(t){var e=z(t);return e&&e.slice(0,3)},getHwb:B,getAlpha:function(t){var e=O(t);if(e)return e[3];if(e=z(t))return e[3];if(e=B(t))return e[3]},hexString:function(t,e){var e=void 0!==e&&3===t.length?e:t[3];return"#"+H(t[0])+H(t[1])+H(t[2])+(e>=0&&e<1?H(Math.round(255*e)):"")},rgbString:function(t,e){if(e<1||t[3]&&t[3]<1)return N(t,e);return"rgb("+t[0]+", "+t[1]+", "+t[2]+")"},rgbaString:N,percentString:function(t,e){if(e<1||t[3]&&t[3]<1)return W(t,e);var i=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgb("+i+"%, "+n+"%, "+a+"%)"},percentaString:W,hslString:function(t,e){if(e<1||t[3]&&t[3]<1)return V(t,e);return"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"},hslaString:V,hwbString:function(t,e){void 0===e&&(e=void 0!==t[3]?t[3]:1);return"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"},keyword:function(t){return j[t.slice(0,3)]}};function O(t){if(t){var e=[0,0,0],i=1,n=t.match(/^#([a-fA-F0-9]{3,4})$/i),a="";if(n){a=(n=n[1])[3];for(var o=0;o<e.length;o++)e[o]=parseInt(n[o]+n[o],16);a&&(i=Math.round(parseInt(a+a,16)/255*100)/100)}else if(n=t.match(/^#([a-fA-F0-9]{6}([a-fA-F0-9]{2})?)$/i)){a=n[2],n=n[1];for(o=0;o<e.length;o++)e[o]=parseInt(n.slice(2*o,2*o+2),16);a&&(i=Math.round(parseInt(a,16)/255*100)/100)}else if(n=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i)){for(o=0;o<e.length;o++)e[o]=parseInt(n[o+1]);i=parseFloat(n[4])}else if(n=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i)){for(o=0;o<e.length;o++)e[o]=Math.round(2.55*parseFloat(n[o+1]));i=parseFloat(n[4])}else if(n=t.match(/(\w+)/)){if("transparent"==n[1])return[0,0,0,0];if(!(e=L[n[1]]))return}for(o=0;o<e.length;o++)e[o]=E(e[o],0,255);return i=i||0==i?E(i,0,1):1,e[3]=i,e}}function z(t){if(t){var e=t.match(/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(e){var i=parseFloat(e[4]);return[E(parseInt(e[1]),0,360),E(parseFloat(e[2]),0,100),E(parseFloat(e[3]),0,100),E(isNaN(i)?1:i,0,1)]}}}function B(t){if(t){var e=t.match(/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(e){var i=parseFloat(e[4]);return[E(parseInt(e[1]),0,360),E(parseFloat(e[2]),0,100),E(parseFloat(e[3]),0,100),E(isNaN(i)?1:i,0,1)]}}}function N(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function W(t,e){return"rgba("+Math.round(t[0]/255*100)+"%, "+Math.round(t[1]/255*100)+"%, "+Math.round(t[2]/255*100)+"%, "+(e||t[3]||1)+")"}function V(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function E(t,e,i){return Math.min(Math.max(e,t),i)}function H(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var j={};for(var q in L)j[L[q]]=q;var Y=function(t){return t instanceof Y?t:this instanceof Y?(this.valid=!1,this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1},void("string"==typeof t?(e=R.getRgba(t))?this.setValues("rgb",e):(e=R.getHsla(t))?this.setValues("hsl",e):(e=R.getHwb(t))&&this.setValues("hwb",e):"object"==typeof t&&(void 0!==(e=t).r||void 0!==e.red?this.setValues("rgb",e):void 0!==e.l||void 0!==e.lightness?this.setValues("hsl",e):void 0!==e.v||void 0!==e.value?this.setValues("hsv",e):void 0!==e.w||void 0!==e.whiteness?this.setValues("hwb",e):void 0===e.c&&void 0===e.cyan||this.setValues("cmyk",e)))):new Y(t);var e};Y.prototype={isValid:function(){return this.valid},rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])}
vendor: 4,804 bytes, line 1713
1713,alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t=(t%=360)<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return R.hexString(this.values.rgb)},rgbString:function(){return R.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return R.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return R.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return R.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return R.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return R.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return R.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],i=0;i<t.length;i++){var n=t[i]/255;e[i]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),i=t.luminosity();return e>i?(e+.05)/(i+.05):(i+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,i=(e[0]+t)%360;return e[0]=i<0?360+i:i,this.setValues("hsl",e),this},mix:function(t,e){var i=t,n=void 0===e?.5:e,a=2*n-1,o=this.alpha()-i.alpha(),r=((a*o==-1?a:(a+o)/(1+a*o))+1)/2,s=1-r;return this.rgb(r*this.red()+s*i.red(),r*this.green()+s*i.green(),r*this.blue()+s*i.blue()).alpha(this.alpha()*n+i.alpha()*(1-n))},toJSON:function(){return this.rgb()},clone:function(){var t,e,i=new Y,n=this.values,a=i.values;for(var o in n)n.hasOwnProperty(o)&&(t=n[o],"[object Array]"===(e={}.toString.call(t))?a[o]=t.slice(0):"[object Number]"===e?a[o]=t:console.error("unexpected color value:",t));return i}},Y.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},Y.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},Y.prototype.getValues=function(t){for(var e=this.values,i={},n=0;n<t.length;n++)i[t.charAt(n)]=e[t][n];return 1!==e.alpha&&(i.a=e.alpha),i},Y.prototype.setValues=function(t,e){var i,n,a=this.values,o=this.spaces,r=this.maxes,s=1;if(this.valid=!0,"alpha"===t)s=e;else if(e.length)a[t]=e.slice(0,t.length),s=e[t.length];else if(void 0!==e[t.charAt(0)]){for(i=0;i<t.length;i++)a[t][i]=e[t.charAt(i)];s=e.a}else if(void 0!==e[o[t][0]]){var l=o[t];for(i=0;i<t.length;i++)a[t][i]=e[l[i]];s=e.alpha}if(a.alpha=Math.max(0,Math.min(1,void 0===s?a.alpha:s)),"alpha"===t)return!1;for(i=0;i<t.length;i++)n=Math.max(0,Math.min(r[t][i],a[t][i])),a[t][i]=Math.round(n);for(var d in o)d!==t&&(a[d]=F[t][d](a[t]));return!0},Y.prototype.setSpace=function(t,e){var i=e[0];return void 0===i?this.getValues(t):("number"==typeof i&&(i=Array.prototype.slice.call(e)),this.setValues(t,i),this)}
vendor: 20,991 bytes, line 1713
1713,Y.prototype.setChannel=function(t,e,i){var n=this.values[t];return void 0===i?n[e]:i===n[e]?this:(n[e]=i,this.setValues(t,n),this)},"undefined"!=typeof window&&(window.Color=Y);var U,X=Y,K={noop:function(){},uid:(U=0,function(){return U++}),isNullOrUndef:function(t){return null==t},isArray:function(t){if(Array.isArray&&Array.isArray(t))return!0;var e=Object.prototype.toString.call(t);return"[object"===e.substr(0,7)&&"Array]"===e.substr(-6)},isObject:function(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)},isFinite:function(t){return("number"==typeof t||t instanceof Number)&&isFinite(t)},valueOrDefault:function(t,e){return void 0===t?e:t},valueAtIndexOrDefault:function(t,e,i){return K.valueOrDefault(K.isArray(t)?t[e]:t,i)},callback:function(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)},each:function(t,e,i,n){var a,o,r;if(K.isArray(t))if(o=t.length,n)for(a=o-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<o;a++)e.call(i,t[a],a);else if(K.isObject(t))for(o=(r=Object.keys(t)).length,a=0;a<o;a++)e.call(i,t[r[a]],r[a])},arrayEquals:function(t,e){var i,n,a,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(a=t[i],o=e[i],a instanceof Array&&o instanceof Array){if(!K.arrayEquals(a,o))return!1}else if(a!==o)return!1;return!0},clone:function(t){if(K.isArray(t))return t.map(K.clone);if(K.isObject(t)){for(var e={},i=Object.keys(t),n=i.length,a=0;a<n;++a)e[i[a]]=K.clone(t[i[a]]);return e}return t},_merger:function(t,e,i,n){var a=e[t],o=i[t];K.isObject(a)&&K.isObject(o)?K.merge(a,o,n):e[t]=K.clone(o)},_mergerIf:function(t,e,i){var n=e[t],a=i[t];K.isObject(n)&&K.isObject(a)?K.mergeIf(n,a):e.hasOwnProperty(t)||(e[t]=K.clone(a))},merge:function(t,e,i){var n,a,o,r,s,l=K.isArray(e)?e:[e],d=l.length;if(!K.isObject(t))return t;for(n=(i=i||{}).merger||K._merger,a=0;a<d;++a)if(e=l[a],K.isObject(e))for(s=0,r=(o=Object.keys(e)).length;s<r;++s)n(o[s],t,e,i);return t},mergeIf:function(t,e){return K.merge(t,e,{merger:K._mergerIf})},extend:function(t){for(var e=function(e,i){t[i]=e},i=1,n=arguments.length;i<n;++i)K.each(arguments[i],e);return t},inherits:function(t){var e=this,i=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},n=function(){this.constructor=i};return n.prototype=e.prototype,i.prototype=new n,i.extend=K.inherits,t&&K.extend(i.prototype,t),i.__super__=e.prototype,i}},G=K;K.callCallback=K.callback,K.indexOf=function(t,e,i){return Array.prototype.indexOf.call(t,e,i)},K.getValueOrDefault=K.valueOrDefault,K.getValueAtIndexOrDefault=K.valueAtIndexOrDefault;var Z={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return(t-=1)*t*t+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-((t-=1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return(t-=1)*t*t*t*t+1},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return 1-Math.cos(t*(Math.PI/2))},easeOutSine:function(t){return Math.sin(t*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},easeInCirc:function(t){return t>=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,i=0,n=1;return 0===t?0:1===t?1:(i||(i=.3),n<1?(n=1,e=i/4):e=i/(2*Math.PI)*Math.asin(1/n),-n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i))},easeOutElastic:function(t){var e=1.70158,i=0,n=1;return 0===t?0:1===t?1:(i||(i=.3),n<1?(n=1,e=i/4):e=i/(2*Math.PI)*Math.asin(1/n),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/i)+1)},easeInOutElastic:function(t){var e=1.70158,i=0,n=1;return 0===t?0:2==(t/=.5)?1:(i||(i=.45),n<1?(n=1,e=i/4):e=i/(2*Math.PI)*Math.asin(1/n),t<1?n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*-.5:n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-Z.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*Z.easeInBounce(2*t):.5*Z.easeOutBounce(2*t-1)+.5}},$={effects:Z};G.easingEffects=Z;var J=Math.PI,Q=J/180,tt=2*J,et=J/2,it=J/4,nt=2*J/3,at={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,i,n,a,o){if(o){var r=Math.min(o,a/2,n/2),s=e+r,l=i+r,d=e+n-r,u=i+a-r;t.moveTo(e,l),s<d&&l<u?(t.arc(s,l,r,-J,-et),t.arc(d,l,r,-et,0),t.arc(d,u,r,0,et),t.arc(s,u,r,et,J)):s<d?(t.moveTo(s,i),t.arc(d,l,r,-et,et),t.arc(s,l,r,et,J+et)):l<u?(t.arc(s,l,r,-J,0),t.arc(s,u,r,0,J)):t.arc(s,l,r,-J,J),t.closePath(),t.moveTo(e,i)}else t.rect(e,i,n,a)},drawPoint:function(t,e,i,n,a,o){var r,s,l,d,u,h=(o||0)*Q;if(!e||"object"!=typeof e||"[object HTMLImageElement]"!==(r=e.toString())&&"[object HTMLCanvasElement]"!==r){if(!(isNaN(i)||i<=0)){switch(t.beginPath(),e){default:t.arc(n,a,i,0,tt),t.closePath();break;case"triangle":t.moveTo(n+Math.sin(h)*i,a-Math.cos(h)*i),h+=nt,t.lineTo(n+Math.sin(h)*i,a-Math.cos(h)*i),h+=nt,t.lineTo(n+Math.sin(h)*i,a-Math.cos(h)*i),t.closePath();break;case"rectRounded":d=i-(u=.516*i),s=Math.cos(h+it)*d,l=Math.sin(h+it)*d,t.arc(n-s,a-l,u,h-J,h-et),t.arc(n+l,a-s,u,h-et,h),t.arc(n+s,a+l,u,h,h+et),t.arc(n-l,a+s,u,h+et,h+J),t.closePath();break;case"rect":if(!o){d=Math.SQRT1_2*i,t.rect(n-d,a-d,2*d,2*d);break}h+=it;case"rectRot":s=Math.cos(h)*i,l=Math.sin(h)*i,t.moveTo(n-s,a-l),t.lineTo(n+l,a-s),t.lineTo(n+s,a+l),t.lineTo(n-l,a+s),t.closePath();break;case"crossRot":h+=it;case"cross":s=Math.cos(h)*i,l=Math.sin(h)*i,t.moveTo(n-s,a-l),t.lineTo(n+s,a+l),t.moveTo(n+l,a-s),t.lineTo(n-l,a+s);break;case"star":s=Math.cos(h)*i,l=Math.sin(h)*i,t.moveTo(n-s,a-l),t.lineTo(n+s,a+l),t.moveTo(n+l,a-s),t.lineTo(n-l,a+s),h+=it,s=Math.cos(h)*i,l=Math.sin(h)*i,t.moveTo(n-s,a-l),t.lineTo(n+s,a+l),t.moveTo(n+l,a-s),t.lineTo(n-l,a+s);break;case"line":s=Math.cos(h)*i,l=Math.sin(h)*i,t.moveTo(n-s,a-l),t.lineTo(n+s,a+l);break;case"dash":t.moveTo(n,a),t.lineTo(n+Math.cos(h)*i,a+Math.sin(h)*i)}t.fill(),t.stroke()}}else t.drawImage(e,n-e.width/2,a-e.height/2,e.width,e.height)},_isPointInArea:function(t,e){return t.x>e.left-1e-6&&t.x<e.right+1e-6&&t.y>e.top-1e-6&&t.y<e.bottom+1e-6},clipArea:function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},unclipArea:function(t){t.restore()},lineTo:function(t,e,i,n){var a=i.steppedLine;if(a){if("middle"===a){var o=(e.x+i.x)/2;t.lineTo(o,n?i.y:e.y),t.lineTo(o,n?e.y:i.y)}else"after"===a&&!n||"after"!==a&&n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}else i.tension?t.bezierCurveTo(n?e.controlPointPreviousX:e.controlPointNextX,n?e.controlPointPreviousY:e.controlPointNextY,n?i.controlPointNextX:i.controlPointPreviousX,n?i.controlPointNextY:i.controlPointPreviousY,i.x,i.y):t.lineTo(i.x,i.y)}},ot=at;G.clear=at.clear,G.drawRoundedRectangle=function(t){t.beginPath(),at.roundedRect.apply(at,arguments)};var rt={_set:function(t,e){return G.merge(this[t]||(this[t]={}),e)}};rt._set("global",{defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",defaultLineHeight:1.2,showLines:!0});var st=rt,lt=G.valueOrDefault;var dt={toLineHeight:function(t,e){var i=(""+t).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t},toPadding:function(t){var e,i,n,a;return G.isObject(t)?(e=+t.top||0,i=+t.right||0,n=+t.bottom||0,a=+t.left||0):e=i=n=a=+t||0,{top:e,right:i,bottom:n,left:a,height:e+n,width:a+i}},_parseFont:function(t){var e=st.global,i=lt(t.fontSize,e.defaultFontSize),n={family:lt(t.fontFamily,e.defaultFontFamily),lineHeight:G.options.toLineHeight(lt(t.lineHeight,e.defaultLineHeight),i),size:i,style:lt(t.fontStyle,e.defaultFontStyle),weight:null,string:""};return n.string=function(t){return!t||G.isNullOrUndef(t.size)||G.isNullOrUndef(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(n),n},resolve:function(t,e,i){var n,a,o;for(n=0,a=t.length;n<a;++n)if(void 0!==(o=t[n])&&(void 0!==e&&"function"==typeof o&&(o=o(e)),void 0!==i&&G.isArray(o)&&(o=o[i]),void 0!==o))return o}},ut=G,ht=$,ct=ot,ft=dt;ut.easing=ht,ut.canvas=ct,ut.options=ft;var gt=function(t){ut.extend(this,t),this.initialize.apply(this,arguments)};ut.extend(gt.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=ut.clone(t._model)),t._start={},t},transition:function(t){var e=this,i=e._model,n=e._start,a=e._view;return i&&1!==t?(a||(a=e._view={}),n||(n=e._start={}),function(t,e,i,n){var a,o,r,s,l,d,u,h,c,f=Object.keys(i);for(a=0,o=f.length;a<o;++a)if(d=i[r=f[a]],e.hasOwnProperty(r)||(e[r]=d),(s=e[r])!==d&&"_"!==r[0]){if(t.hasOwnProperty(r)||(t[r]=s),(u=typeof d)==typeof(l=t[r]))if("string"===u){if((h=X(l)).valid&&(c=X(d)).valid){e[r]=c.mix(h,n).rgbString();continue}}else if(ut.isFinite(l)&&ut.isFinite(d)){e[r]=l+(d-l)*n;continue}e[r]=d}}(n,a,i,t),e):(e._view=i,e._start=null,e)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return ut.isNumber(this._model.x)&&ut.isNumber(this._model.y)}}),gt.extend=ut.inherits;var pt=gt,mt=pt.extend({chart:null,currentStep:0,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),vt=mt;Object.defineProperty(mt.prototype,"animationObject",{get:function(){return this}}),Object.defineProperty(mt.prototype,"chartInstance",{get:function(){return this.chart},set:function(t){this.chart=t}}),st._set("global",{animation:{duration:1e3,easing:"easeOutQuart",onProgress:ut.noop,onComplete:ut.noop}});var bt={animations:[],request:null,addAnimation:function(t,e,i,n){var a,o,r=this.animations;for(e.chart=t,e.startTime=Date.now(),e.duration=i,n||(t.animating=!0),a=0,o=r.length;a<o;++a)if(r[a].chart===t)return void(r[a]=e);r.push(e),1===r.length&&this.requestAnimationFrame()},cancelAnimation:function(t){var e=ut.findIndex(this.animations,function(e){return e.chart===t});-1!==e&&(this.animations.splice(e,1),t.animating=!1)},requestAnimationFrame:function(){var t=this;null===t.request&&(t.request=ut.requestAnimFrame.call(window,function(){t.request=null,t.startDigest()}))},startDigest:function(){this.advance(),this.animations.length>0&&this.requestAnimationFrame()},advance:function(){for(var t,e,i,n,a=this.animations,o=0;o<a.length;)e=(t=a[o]).chart,i=t.numSteps,n=Math.floor((Date.now()-t.startTime)/t.duration*i)+1,t.currentStep=Math.min(n,i),ut.callback(t.render,[e,t],e),ut.callback(t.onAnimationProgress,[t],e),t.currentStep>=i?(ut.callback(t.onAnimationComplete,[t],e),e.animating=!1,a.splice(o,1)):++o}},xt=ut.options.resolve,yt=["push","pop","shift","splice","unshift"];function kt(t,e){var i=t._chartjs;if(i){var n=i.listeners,a=n.indexOf(e);-1!==a&&n.splice(a,1),n.length>0||(yt.forEach(function(e){delete t[e]}),delete t._chartjs)}}var wt=function(t,e){this.initialize(t,e)};ut.extend(wt.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){this.chart=t,this.index=e,this.linkScales(),this.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),i=t.getDataset();null!==e.xAxisID&&e.xAxisID in t.chart.scales||(e.xAxisID=i.xAxisID||t.chart.options.scales.xAxes[0].id),null!==e.yAxisID&&e.yAxisID in t.chart.scales||(e.yAxisID=i.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},_getValueScaleId:function(){return this.getMeta().yAxisID},_getIndexScaleId:function(){return this.getMeta().xAxisID},_getValueScale:function(){return this.getScaleForId(this._getValueScaleId())},_getIndexScale:function(){return this.getScaleForId(this._getIndexScaleId())},reset:function(){this.update(!0)},destroy:function(){this._data&&kt(this._data,this)},createMetaDataset:function(){var t=this.datasetElementType;return t&&new t({_chart:this.chart,_datasetIndex:this.index})},createMetaData:function(t){var e=this.dataElementType;return e&&new e({_chart:this.chart,_datasetIndex:this.index,_index:t})},addElements:function(){var t,e,i=this.getMeta(),n=this.getDataset().data||[],a=i.data;for(t=0,e=n.length;t<e;++t)a[t]=a[t]||this.createMetaData(t);i.dataset=i.dataset||this.createMetaDataset()},addElementAndReset:function(t){var e=this.createMetaData(t);this.getMeta().data.splice(t,0,e),this.updateElement(e,t,!0)},buildOrUpdateElements:function(){var t,e,i=this,n=i.getDataset(),a=n.data||(n.data=[]);i._data!==a&&(i._data&&kt(i._data,i),a&&Object.isExtensible(a)&&(e=i,(t=a)._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),yt.forEach(function(e){var i="onData"+e.charAt(0).toUpperCase()+e.slice(1),n=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),a=n.apply(this,e);return ut.each(t._chartjs.listeners,function(t){"function"==typeof t[i]&&t[i].apply(t,e)}),a}})}))),i._data=a),i.resyncElements()},update:ut.noop,transition:function(t){for(var e=this.getMeta(),i=e.data||[],n=i.length,a=0;a<n;++a)i[a].transition(t);e.dataset&&e.dataset.transition(t)},draw:function(){var t=this.getMeta(),e=t.data||[],i=e.length,n=0;for(t.dataset&&t.dataset.draw();n<i;++n)e[n].draw()},removeHoverStyle:function(t){ut.merge(t._model,t.$previousStyle||{}),delete t.$previousStyle},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],i=t._index,n=t.custom||{},a=t._model,o=ut.getHoverColor;t.$previousStyle={backgroundColor:a.backgroundColor,borderColor:a.borderColor,borderWidth:a.borderWidth},a.backgroundColor=xt([n.hoverBackgroundColor,e.hoverBackgroundColor,o(a.backgroundColor)],void 0,i),a.borderColor=xt([n.hoverBorderColor,e.hoverBorderColor,o(a.borderColor)],void 0,i),a.borderWidth=xt([n.hoverBorderWidth,e.hoverBorderWidth,a.borderWidth],void 0,i)},resyncElements:function(){var t=this.getMeta(),e=this.getDataset().data,i=t.data.length,n=e.length;n<i?t.data.splice(n,i-n):n>i&&this.insertElements(i,n-i)},insertElements:function(t,e){for(var i=0;i<e;++i)this.addElementAndReset(t+i)},onDataPush:function(){var t=arguments.length;this.insertElements(this.getDataset().data.length-t,t)},onDataPop:function(){this.getMeta().data.pop()},onDataShift:function(){this.getMeta().data.shift()},onDataSplice:function(t,e){this.getMeta().data.splice(t,e),this.insertElements(t,arguments.length-2)},onDataUnshift:function(){this.insertElements(0,arguments.length)}}),wt.extend=ut.inherits;var Mt=wt;st._set("global",{elements:{arc:{backgroundColor:st.global.defaultColor,borderColor:"#fff",borderWidth:2,borderAlign:"center"}}});var _t=pt.extend({inLabelRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2)},inRange:function(t,e){var i=this._view;if(i){for(var n=ut.getAngleFromPoint(i,{x:t,y:e}),a=n.angle,o=n.distance,r=i.startAngle,s=i.endAngle;s<r;)s+=2*Math.PI;for(;a>s;)a-=2*Math.PI;for(;a<r;)a+=2*Math.PI;var l=a>=r&&a<=s,d=o>=i.innerRadius&&o<=i.outerRadius;return l&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,i=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*i,y:t.y+Math.sin(e)*i}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,i=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*i,y:t.y+Math.sin(e)*i}},draw:function(){var t,e=this._chart.ctx,i=this._view,n=i.startAngle,a=i.endAngle,o="inner"===i.borderAlign?.33:0;e.save(),e.beginPath(),e.arc(i.x,i.y,Math.max(i.outerRadius-o,0),n,a),e.arc(i.x,i.y,i.innerRadius,a,n,!0),e.closePath(),e.fillStyle=i.backgroundColor,e.fill(),i.borderWidth&&("inner"===i.borderAlign?(e.beginPath(),t=o/i.outerRadius,e.arc(i.x,i.y,i.outerRadius,n-t,a+t),i.innerRadius>o?(t=o/i.innerRadius,e.arc(i.x,i.y,i.innerRadius-o,a+t,n-t,!0)):e.arc(i.x,i.y,o,a+Math.PI/2,n-Math.PI/2),e.closePath(),e.clip(),e.beginPath(),e.arc(i.x,i.y,i.outerRadius,n,a),e.arc(i.x,i.y,i.innerRadius,a,n,!0),e.closePath(),e.lineWidth=2*i.borderWidth,e.lineJoin="round"):(e.lineWidth=i.borderWidth,e.lineJoin="bevel"),e.strokeStyle=i.borderColor,e.stroke()),e.restore()}}),Ct=ut.valueOrDefault,St=st.global.defaultColor;st._set("global",{elements:{line:{tension:.4,backgroundColor:St,borderWidth:3,borderColor:St,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0}}});var Pt=pt.extend({draw:function(){var t,e,i,n,a=this._view,o=this._chart.ctx,r=a.spanGaps,s=this._children.slice(),l=st.global,d=l.elements.line,u=-1;for(this._loop&&s.length&&s.push(s[0]),o.save(),o.lineCap=a.borderCapStyle||d.borderCapStyle,o.setLineDash&&o.setLineDash(a.borderDash||d.borderDash),o.lineDashOffset=Ct(a.borderDashOffset,d.borderDashOffset),o.lineJoin=a.borderJoinStyle||d.borderJoinStyle,o.lineWidth=Ct(a.borderWidth,d.borderWidth),o.strokeStyle=a.borderColor||l.defaultColor,o.beginPath(),u=-1,t=0;t<s.length;++t)e=s[t],i=ut.previousItem(s,t),n=e._view,0===t?n.skip||(o.moveTo(n.x,n.y),u=t):(i=-1===u?i:s[u],n.skip||(u!==t-1&&!r||-1===u?o.moveTo(n.x,n.y):ut.canvas.lineTo(o,i._view,e._view),u=t));o.stroke(),o.restore()}}),It=ut.valueOrDefault,At=st.global.defaultColor;function Dt(t){var e=this._view;return!!e&&Math.abs(t-e.x)<e.radius+e.hitRadius}st._set("global",{elements:{point:{radius:3,pointStyle:"circle",backgroundColor:At,borderColor:At,borderWidth:1,hitRadius:1,hoverRadius:4,hoverBorderWidth:1}}});var Tt=pt.extend({inRange:function(t,e){var i=this._view;return!!i&&Math.pow(t-i.x,2)+Math.pow(e-i.y,2)<Math.pow(i.hitRadius+i.radius,2)},inLabelRange:Dt,inXRange:Dt,inYRange:function(t){var e=this._view;return!!e&&Math.abs(t-e.y)<e.radius+e.hitRadius},getCenterPoint:function(){var t=this._view;return{x:t.x,y:t.y}},getArea:function(){return Math.PI*Math.pow(this._view.radius,2)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y,padding:t.radius+t.borderWidth}},draw:function(t){var e=this._view,i=this._chart.ctx,n=e.pointStyle,a=e.rotation,o=e.radius,r=e.x,s=e.y,l=st.global,d=l.defaultColor;e.skip||(void 0===t||ut.canvas._isPointInArea(e,t))&&(i.strokeStyle=e.borderColor||d,i.lineWidth=It(e.borderWidth,l.elements.point.borderWidth),i.fillStyle=e.backgroundColor||d,ut.canvas.drawPoint(i,n,o,r,s,a))}}),Ft=st.global.defaultColor;function Lt(t){return t&&void 0!==t.width}function Rt(t){var e,i,n,a,o;return Lt(t)?(o=t.width/2,e=t.x-o,i=t.x+o,n=Math.min(t.y,t.base),a=Math.max(t.y,t.base)):(o=t.height/2,e=Math.min(t.x,t.base),i=Math.max(t.x,t.base),n=t.y-o,a=t.y+o),{left:e,top:n,right:i,bottom:a}}function Ot(t,e,i){return t===e?i:t===i?e:t}function zt(t,e,i){var n,a,o,r,s=t.borderWidth,l=function(t){var e=t.borderSkipped,i={};return e?(t.horizontal?t.base>t.x&&(e=Ot(e,"left","right")):t.base<t.y&&(e=Ot(e,"bottom","top")),i[e]=!0,i):i}(t);return ut.isObject(s)?(n=+s.top||0,a=+s.right||0,o=+s.bottom||0,r=+s.left||0):n=a=o=r=+s||0,{t:l.top||n<0?0:n>i?i:n,r:l.right||a<0?0:a>e?e:a,b:l.bottom||o<0?0:o>i?i:o,l:l.left||r<0?0:r>e?e:r}}function Bt(t,e,i){var n=null===e,a=null===i,o=!(!t||n&&a)&&Rt(t);return o&&(n||e>=o.left&&e<=o.right)&&(a||i>=o.top&&i<=o.bottom)}st._set("global",{elements:{rectangle:{backgroundColor:Ft,borderColor:Ft,borderSkipped:"bottom",borderWidth:0}}});var Nt=pt.extend({draw:function(){var t=this._chart.ctx,e=this._view,i=function(t){var e=Rt(t),i=e.right-e.left,n=e.bottom-e.top,a=zt(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n},inner:{x:e.left+a.l,y:e.top+a.t,w:i-a.l-a.r,h:n-a.t-a.b}}}(e),n=i.outer,a=i.inner;t.fillStyle=e.backgroundColor,t.fillRect(n.x,n.y,n.w,n.h),n.w===a.w&&n.h===a.h||(t.save(),t.beginPath(),t.rect(n.x,n.y,n.w,n.h),t.clip(),t.fillStyle=e.borderColor,t.rect(a.x,a.y,a.w,a.h),t.fill("evenodd"),t.restore(
1713))},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){return Bt(this._view,t,e)},inLabelRange:function(t,e){var i=this._view;return Lt(i)?Bt(i,t,null):Bt(i,null,e)},inXRange:function(t){return Bt(this._view,t,null)},inYRange:function(t){return Bt(this._view,null,t)},getCenterPoint:function(){var t,e,i=this._view;return Lt(i)?(t=i.x,e=(i.y+i.base)/2):(t=(i.x+i.base)/2,e=i.y),{x:t,y:e}},getArea:function(){var t=this._view;return Lt(t)?t.width*Math.abs(t.y-t.base):t.height*Math.abs(t.x-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}}),Wt={},Vt=_t,Et=Pt,Ht=Tt,jt=Nt;Wt.Arc=Vt,Wt.Line=Et,Wt.Point=Ht,Wt.Rectangle=jt;var qt=ut.options.resolve;st._set("bar",{hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,offset:!0,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}});var Yt=Mt.extend({dataElementType:Wt.Rectangle,initialize:function(){var t;Mt.prototype.initialize.apply(this,arguments),(t=this.getMeta()).stack=this.getDataset().stack,t.bar=!0},update:function(t){var e,i,n=this.getMeta().data;for(this._ruler=this.getRuler(),e=0,i=n.length;e<i;++e)this.updateElement(n[e],e,t)},updateElement:function(t,e,i){var n=this,a=n.getMeta(),o=n.getDataset(),r=n._resolveElementOptions(t,e);t._xScale=n.getScaleForId(a.xAxisID),t._yScale=n.getScaleForId(a.yAxisID),t._datasetIndex=n.index,t._index=e,t._model={backgroundColor:r.backgroundColor,borderColor:r.borderColor,borderSkipped:r.borderSkipped,borderWidth:r.borderWidth,datasetLabel:o.label,label:n.chart.data.labels[e]},n._updateElementGeometry(t,e,i),t.pivot()},_updateElementGeometry:function(t,e,i){var n=this,a=t._model,o=n._getValueScale(),r=o.getBasePixel(),s=o.isHorizontal(),l=n._ruler||n.getRuler(),d=n.calculateBarValuePixels(n.index,e),u=n.calculateBarIndexPixels(n.index,e,l);a.horizontal=s,a.base=i?r:d.base,a.x=s?i?r:d.head:u.center,a.y=s?u.center:i?r:d.head,a.height=s?u.size:void 0,a.width=s?void 0:u.size},_getStacks:function(t){var e,i,n=this.chart,a=this._getIndexScale().options.stacked,o=void 0===t?n.data.datasets.length:t+1,r=[];for(e=0;e<o;++e)(i=n.getDatasetMeta(e)).bar&&n.isDatasetVisible(e)&&(!1===a||!0===a&&-1===r.indexOf(i.stack)||void 0===a&&(void 0===i.stack||-1===r.indexOf(i.stack)))&&r.push(i.stack);return r},getStackCount:function(){return this._getStacks().length},getStackIndex:function(t,e){var i=this._getStacks(t),n=void 0!==e?i.indexOf(e):-1;return-1===n?i.length-1:n},getRuler:function(){var t,e,i=this._getIndexScale(),n=this.getStackCount(),a=this.index,o=i.isHorizontal(),r=o?i.left:i.top,s=r+(o?i.width:i.height),l=[];for(t=0,e=this.getMeta().data.length;t<e;++t)l.push(i.getPixelForValue(null,t,a));return{min:ut.isNullOrUndef(i.options.barThickness)?function(t,e){var i,n,a,o,r=t.isHorizontal()?t.width:t.height,s=t.getTicks();for(a=1,o=e.length;a<o;++a)r=Math.min(r,Math.abs(e[a]-e[a-1]));for(a=0,o=s.length;a<o;++a)n=t.getPixelForTick(a),r=a>0?Math.min(r,n-i):r,i=n;return r}(i,l):-1,pixels:l,start:r,end:s,stackCount:n,scale:i}},calculateBarValuePixels:function(t,e){var i,n,a,o,r,s,l=this.chart,d=this.getMeta(),u=this._getValueScale(),h=u.isHorizontal(),c=l.data.datasets,f=+u.getRightValue(c[t].data[e]),g=u.options.minBarLength,p=u.options.stacked,m=d.stack,v=0;if(p||void 0===p&&void 0!==m)for(i=0;i<t;++i)(n=l.getDatasetMeta(i)).bar&&n.stack===m&&n.controller._getValueScaleId()===u.id&&l.isDatasetVisible(i)&&(a=+u.getRightValue(c[i].data[e]),(f<0&&a<0||f>=0&&a>0)&&(v+=a));return o=u.getPixelForValue(v),s=(r=u.getPixelForValue(v+f))-o,void 0!==g&&Math.abs(s)<g&&(s=g,r=f>=0&&!h||f<0&&h?o-g:o+g),{size:s,base:o,head:r,center:r+s/2}},calculateBarIndexPixels:function(t,e,i){var n=i.scale.options,a="flex"===n.barThickness?function(t,e,i){var n,a=e.pixels,o=a[t],r=t>0?a[t-1]:null,s=t<a.length-1?a[t+1]:null,l=i.categoryPercentage;return null===r&&(r=o-(null===s?e.end-e.start:s-o)),null===s&&(s=o+o-r),n=o-(o-Math.min(r,s))/2*l,{chunk:Math.abs(s-r)/2*l/e.stackCount,ratio:i.barPercentage,start:n}}(e,i,n):function(t,e,i){var n,a,o=i.barThickness,r=e.stackCount,s=e.pixels[t];return ut.isNullOrUndef(o)?(n=e.min*i.categoryPercentage,a=i.barPercentage):(n=o*r,a=1),{chunk:n/r,ratio:a,start:s-n/2}}(e,i,n),o=this.getStackIndex(t,this.getMeta().stack),r=a.start+a.chunk*o+a.chunk/2,s=Math.min(ut.valueOrDefault(n.maxBarThickness,1/0),a.chunk*a.ratio);return{base:r-s/2,head:r+s/2,center:r,size:s}},draw:function(){var t=this.chart,e=this._getValueScale(),i=this.getMeta().data,n=this.getDataset(),a=i.length,o=0;for(ut.canvas.clipArea(t.ctx,t.chartArea);o<a;++o)isNaN(e.getRightValue(n.data[o]))||i[o].draw();ut.canvas.unclipArea(t.ctx)},_resolveElementOptions:function(t,e){var i,n,a,o=this.chart,r=o.data.datasets[this.index],s=t.custom||{},l=o.options.elements.rectangle,d={},u={chart:o,dataIndex:e,dataset:r,datasetIndex:this.index},h=["backgroundColor","borderColor","borderSkipped","borderWidth"];for(i=0,n=h.length;i<n;++i)d[a=h[i]]=qt([s[a],r[a],l[a]],u,e);return d}}),Ut=ut.valueOrDefault,Xt=ut.options.resolve;st._set("bubble",{hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(){return""},label:function(t,e){var i=e.datasets[t.datasetIndex].label||"",n=e.datasets[t.datasetIndex].data[t.index];return i+": ("+t.xLabel+", "+t.yLabel+", "+n.r+")"}}}});var Kt=Mt.extend({dataElementType:Wt.Point,update:function(t){var e=this,i=e.getMeta().data;ut.each(i,function(i,n){e.updateElement(i,n,t)})}
vendor: 4,548 bytes, line 1713
1713,updateElement:function(t,e,i){var n=this,a=n.getMeta(),o=t.custom||{},r=n.getScaleForId(a.xAxisID),s=n.getScaleForId(a.yAxisID),l=n._resolveElementOptions(t,e),d=n.getDataset().data[e],u=n.index,h=i?r.getPixelForDecimal(.5):r.getPixelForValue("object"==typeof d?d:NaN,e,u),c=i?s.getBasePixel():s.getPixelForValue(d,e,u);t._xScale=r,t._yScale=s,t._options=l,t._datasetIndex=u,t._index=e,t._model={backgroundColor:l.backgroundColor,borderColor:l.borderColor,borderWidth:l.borderWidth,hitRadius:l.hitRadius,pointStyle:l.pointStyle,rotation:l.rotation,radius:i?0:l.radius,skip:o.skip||isNaN(h)||isNaN(c),x:h,y:c},t.pivot()},setHoverStyle:function(t){var e=t._model,i=t._options,n=ut.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth,radius:e.radius},e.backgroundColor=Ut(i.hoverBackgroundColor,n(i.backgroundColor)),e.borderColor=Ut(i.hoverBorderColor,n(i.borderColor)),e.borderWidth=Ut(i.hoverBorderWidth,i.borderWidth),e.radius=i.radius+i.hoverRadius},_resolveElementOptions:function(t,e){var i,n,a,o=this.chart,r=o.data.datasets[this.index],s=t.custom||{},l=o.options.elements.point,d=r.data[e],u={},h={chart:o,dataIndex:e,dataset:r,datasetIndex:this.index},c=["backgroundColor","borderColor","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","pointStyle","rotation"];for(i=0,n=c.length;i<n;++i)u[a=c[i]]=Xt([s[a],r[a],l[a]],h,e);return u.radius=Xt([s.radius,d?d.r:void 0,r.radius,l.radius],h,e),u}}),Gt=ut.options.resolve,Zt=ut.valueOrDefault;st._set("doughnut",{animation:{animateRotate:!0,animateScale:!1},hover:{mode:"single"},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var i=t.data,n=i.datasets,a=i.labels;if(n.length)for(var o=0;o<n[0].data.length;++o)e.push('<li><span style="background-color:'+n[0].backgroundColor[o]+'"></span>'),a[o]&&e.push(a[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(i,n){var a=t.getDatasetMeta(0),o=e.datasets[0],r=a.data[n],s=r&&r.custom||{},l=t.options.elements.arc;return{text:i,fillStyle:Gt([s.backgroundColor,o.backgroundColor,l.backgroundColor],void 0,n),strokeStyle:Gt([s.borderColor,o.borderColor,l.borderColor],void 0,n),lineWidth:Gt([s.borderWidth,o.borderWidth,l.borderWidth],void 0,n),hidden:isNaN(o.data[n])||a.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var i,n,a,o=e.index,r=this.chart;for(i=0,n=(r.data.datasets||[]).length;i<n;++i)(a=r.getDatasetMeta(i)).data[o]&&(a.data[o].hidden=!a.data[o].hidden);r.update()}},cutoutPercentage:50,rotation:-.5*Math.PI,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,e){var i=e.labels[t.index],n=": "+e.datasets[t.datasetIndex].data[t.index];return ut.isArray(i)?(i=i.slice())[0]+=n:i+=n,i}}}});var $t=Mt.extend({dataElementType:Wt.Arc,linkScales:ut.noop,getRingIndex:function(t){for(var e=0,i=0;i<t;++i)this.chart.isDatasetVisible(i)&&++e;return e},update:function(t){var e,i,n=this,a=n.chart,o=a.chartArea,r=a.options,s=o.right-o.left,l=o.bottom-o.top,d=Math.min(s,l),u={x:0,y:0},h=n.getMeta(),c=h.data,f=r.cutoutPercentage,g=r.circumference,p=n._getRingWeight(n.index);if(g<2*Math.PI){var m=r.rotation%(2*Math.PI),v=(m+=2*Math.PI*(m>=Math.PI?-1:m<-Math.PI?1:0))+g,b={x:Math.cos(m),y:Math.sin(m)},x={x:Math.cos(v),y:Math.sin(v)},y=m<=0&&v>=0||m<=2*Math.PI&&2*Math.PI<=v,k=m<=.5*Math.PI&&.5*Math.PI<=v||m<=2.5*Math.PI&&2.5*Math.PI<=v,w=m<=-Math.PI&&-Math.PI<=v||m<=Math.PI&&Math.PI<=v,M=m<=.5*-Math.PI&&.5*-Math.PI<=v||m<=1.5*Math.PI&&1.5*Math.PI<=v,_=f/100,C={x:w?-1:Math.min(b.x*(b.x<0?1:_),x.x*(x.x<0?1:_)),y:M?-1:Math.min(b.y*(b.y<0?1:_),x.y*(x.y<0?1:_))},S={x:y?1:Math.max(b.x*(b.x>0?1:_),x.x*(x.x>0?1:_)),y:k?1:Math.max(b.y*(b.y>0?1:_),x.y*(x.y>0?1:_))},P={width:.5*(S.x-C.x),height:.5*(S.y-C.y)};d=Math.min(s/P.width,l/P.height),u={x:-.5*(S.x+C.x),y:-.5*(S.y+C.y)}}for(e=0,i=c.length;e<i;++e)c[e]._options=n._resolveElementOptions(c[e],e);for(a.borderWidth=n.getMaxBorderWidth(),a.outerRadius=Math.max((d-a.borderWidth)/2,0),a.innerRadius=Math.max(f?a.outerRadius/100*f:0,0),a.radiusLength=(a.outerRadius-a.innerRadius)/(n._getVisibleDatasetWeightTotal()||1),a.offsetX=u.x*a.outerRadius,a.offsetY=u.y*a.outerRadius,h.total=n.calculateTotal(),n.outerRadius=a.outerRadius-a.radiusLength*n._getRingWeightOffset(n.index),n.innerRadius=Math.max(n.outerRadius-a.radiusLength*p,0),e=0,i=c.length;e<i;++e)n.updateElement(c[e],e,t)}
1713,updateElement:function(t,e,i){var n=this,a=n.chart,o=a.chartArea,r=a.options,s=r.animation,l=(o.left+o.right)/2,d=(o.top+o.bottom)/2,u=r.rotation,h=r.rotation,c=n.getDataset(),f=i&&s.animateRotate?0:t.hidden?0:n.calculateCircumference(c.data[e])*(r.circumference/(2*Math.PI)),g=i&&s.animateScale?0:n.innerRadius,p=i&&s.animateScale?0:n.outerRadius,m=t._options||{};ut.extend(t,{_datasetIndex:n.index,_index:e,_model:{backgroundColor:m.backgroundColor,borderColor:m.borderColor,borderWidth:m.borderWidth,borderAlign:m.borderAlign,x:l+a.offsetX,y:d+a.offsetY,startAngle:u,endAngle:h,circumference:f,outerRadius:p,innerRadius:g,label:ut.valueAtIndexOrDefault(c.label,e,a.data.labels[e])}});var v=t._model;i&&s.animateRotate||(v.startAngle=0===e?r.rotation:n.getMeta().data[e-1]._model.endAngle,v.endAngle=v.startAngle+v.circumference),t.pivot()},calculateTotal:function(){var t,e=this.getDataset(),i=this.getMeta(),n=0;return ut.each(i.data,function(i,a){t=e.data[a],isNaN(t)||i.hidden||(n+=Math.abs(t))}),n},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(Math.abs(t)/e):0},getMaxBorderWidth:function(t){var e,i,n,a,o,r,s,l,d=0,u=this.chart;if(!t)for(e=0,i=u.data.datasets.length;e<i;++e)if(u.isDatasetVisible(e)){t=(n=u.getDatasetMeta(e)).data,e!==this.index&&(o=n.controller);break}if(!t)return 0;for(e=0,i=t.length;e<i;++e)a=t[e],"inner"!==(r=o?o._resolveElementOptions(a,e):a._options).borderAlign&&(s=r.borderWidth,d=(l=r.hoverBorderWidth)>(d=s>d?s:d)?l:d);return d},setHoverStyle:function(t){var e=t._model,i=t._options,n=ut.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=Zt(i.hoverBackgroundColor,n(i.backgroundColor)),e.borderColor=Zt(i.hoverBorderColor,n(i.borderColor)),e.borderWidth=Zt(i.hoverBorderWidth,i.borderWidth)},_resolveElementOptions:function(t,e){var i,n,a,o=this.chart,r=this.getDataset(),s=t.custom||{},l=o.options.elements.arc,d={},u={chart:o,dataIndex:e,dataset:r,datasetIndex:this.index},h=["backgroundColor","borderColor","borderWidth","borderAlign","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth"];for(i=0,n=h.length;i<n;++i)d[a=h[i]]=Gt([s[a],r[a],l[a]],u,e);return d},_getRingWeightOffset:function(t){for(var e=0,i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e},_getRingWeight:function(t){return Math.max(Zt(this.chart.data.datasets[t].weight,1),0)},_getVisibleDatasetWeightTotal:function(){return this._getRingWeightOffset(this.chart.data.datasets.length)}});st._set("horizontalBar",{hover:{mode:"index",axis:"y"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{type:"category",position:"left",categoryPercentage:.8,barPercentage:.9,offset:!0,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{mode:"index",axis:"y"}});var Jt=Yt.extend({_getValueScaleId:function(){return this.getMeta().xAxisID},_getIndexScaleId:function(){return this.getMeta().yAxisID}}),Qt=ut.valueOrDefault,te=ut.options.resolve,ee=ut.canvas._isPointInArea;function ie(t,e){return Qt(t.showLine,e.showLines)}st._set("line",{showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}});var ne=Mt.extend({datasetElementType:Wt.Line,dataElementType:Wt.Point,update:function(t){var e,i,n=this,a=n.getMeta(),o=a.dataset,r=a.data||[],s=n.getScaleForId(a.yAxisID),l=n.getDataset(),d=ie(l,n.chart.options);for(d&&(void 0!==l.tension&&void 0===l.lineTension&&(l.lineTension=l.tension),o._scale=s,o._datasetIndex=n.index,o._children=r,o._model=n._resolveLineOptions(o),o.pivot()),e=0,i=r.length;e<i;++e)n.updateElement(r[e],e,t);for(d&&0!==o._model.tension&&n.updateBezierControlPoints(),e=0,i=r.length;e<i;++e)r[e].pivot()},updateElement:function(t,e,i){var n,a,o=this,r=o.getMeta(),s=t.custom||{},l=o.getDataset(),d=o.index,u=l.data[e],h=o.getScaleForId(r.yAxisID),c=o.getScaleForId(r.xAxisID),f=r.dataset._model,g=o._resolvePointOptions(t,e);n=c.getPixelForValue("object"==typeof u?u:NaN,e,d),a=i?h.getBasePixel():o.calculatePointY(u,e,d),t._xScale=c,t._yScale=h,t._options=g,t._datasetIndex=d,t._index=e,t._model={x:n,y:a,skip:s.skip||isNaN(n)||isNaN(a),radius:g.radius,pointStyle:g.pointStyle,rotation:g.rotation,backgroundColor:g.backgroundColor,borderColor:g.borderColor,borderWidth:g.borderWidth,tension:Qt(s.tension,f?f.tension:0),steppedLine:!!f&&f.steppedLine,hitRadius:g.hitRadius}},_resolvePointOptions:function(t,e){var i,n,a,o=this.chart,r=o.data.datasets[this.index],s=t.custom||{},l=o.options.elements.point,d={},u={chart:o,dataIndex:e,dataset:r,datasetIndex:this.index}
1713,h={backgroundColor:"pointBackgroundColor",borderColor:"pointBorderColor",borderWidth:"pointBorderWidth",hitRadius:"pointHitRadius",hoverBackgroundColor:"pointHoverBackgroundColor",hoverBorderColor:"pointHoverBorderColor",hoverBorderWidth:"pointHoverBorderWidth",hoverRadius:"pointHoverRadius",pointStyle:"pointStyle",radius:"pointRadius",rotation:"pointRotation"},c=Object.keys(h);for(i=0,n=c.length;i<n;++i)d[a=c[i]]=te([s[a],r[h[a]],r[a],l[a]],u,e);return d},_resolveLineOptions:function(t){var e,i,n,a=this.chart,o=a.data.datasets[this.index],r=t.custom||{},s=a.options,l=s.elements.line,d={},u=["backgroundColor","borderWidth","borderColor","borderCapStyle","borderDash","borderDashOffset","borderJoinStyle","fill","cubicInterpolationMode"];for(e=0,i=u.length;e<i;++e)d[n=u[e]]=te([r[n],o[n],l[n]]);return d.spanGaps=Qt(o.spanGaps,s.spanGaps),d.tension=Qt(o.lineTension,l.tension),d.steppedLine=te([r.steppedLine,o.steppedLine,l.stepped]),d},calculatePointY:function(t,e,i){var n,a,o,r=this.chart,s=this.getMeta(),l=this.getScaleForId(s.yAxisID),d=0,u=0;if(l.options.stacked){for(n=0;n<i;n++)if(a=r.data.datasets[n],"line"===(o=r.getDatasetMeta(n)).type&&o.yAxisID===l.id&&r.isDatasetVisible(n)){var h=Number(l.getRightValue(a.data[e]));h<0?u+=h||0:d+=h||0}var c=Number(l.getRightValue(t));return c<0?l.getPixelForValue(u+c):l.getPixelForValue(d+c)}return l.getPixelForValue(t)},updateBezierControlPoints:function(){var t,e,i,n,a=this.chart,o=this.getMeta(),r=o.dataset._model,s=a.chartArea,l=o.data||[];function d(t,e,i){return Math.max(Math.min(t,i),e)}if(r.spanGaps&&(l=l.filter(function(t){return!t._model.skip})),"monotone"===r.cubicInterpolationMode)ut.splineCurveMonotone(l);else for(t=0,e=l.length;t<e;++t)i=l[t]._model,n=ut.splineCurve(ut.previousItem(l,t)._model,i,ut.nextItem(l,t)._model,r.tension),i.controlPointPreviousX=n.previous.x,i.controlPointPreviousY=n.previous.y,i.controlPointNextX=n.next.x,i.controlPointNextY=n.next.y;if(a.options.elements.line.capBezierPoints)for(t=0,e=l.length;t<e;++t)i=l[t]._model,ee(i,s)&&(t>0&&ee(l[t-1]._model,s)&&(i.controlPointPreviousX=d(i.controlPointPreviousX,s.left,s.right),i.controlPointPreviousY=d(i.controlPointPreviousY,s.top,s.bottom)),t<l.length-1&&ee(l[t+1]._model,s)&&(i.controlPointNextX=d(i.controlPointNextX,s.left,s.right),i.controlPointNextY=d(i.controlPointNextY,s.top,s.bottom)))},draw:function(){var t,e=this.chart,i=this.getMeta(),n=i.data||[],a=e.chartArea,o=n.length,r=0;for(ie(this.getDataset(),e.options)&&(t=(i.dataset._model.borderWidth||0)/2,ut.canvas.clipArea(e.ctx,{left:a.left,right:a.right,top:a.top-t,bottom:a.bottom+t}),i.dataset.draw(),ut.canvas.unclipArea(e.ctx));r<o;++r)n[r].draw(a)},setHoverStyle:function(t){var e=t._model,i=t._options,n=ut.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth,radius:e.radius},e.backgroundColor=Qt(i.hoverBackgroundColor,n(i.backgroundColor)),e.borderColor=Qt(i.hoverBorderColor,n(i.borderColor)),e.borderWidth=Qt(i.hoverBorderWidth,i.borderWidth),e.radius=Qt(i.hoverRadius,i.radius)}}),ae=ut.options.resolve;st._set("polarArea",{scale:{type:"radialLinear",angleLines:{display:!1},gridLines:{circular:!0},pointLabels:{display:!1},ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var i=t.data,n=i.datasets,a=i.labels;if(n.length)for(var o=0;o<n[0].data.length;++o)e.push('<li><span style="background-color:'+n[0].backgroundColor[o]+'"></span>'),a[o]&&e.push(a[o]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(i,n){var a=t.getDatasetMeta(0),o=e.datasets[0],r=a.data[n].custom||{},s=t.options.elements.arc;return{text:i,fillStyle:ae([r.backgroundColor,o.backgroundColor,s.backgroundColor],void 0,n),strokeStyle:ae([r.borderColor,o.borderColor,s.borderColor],void 0,n),lineWidth:ae([r.borderWidth,o.borderWidth,s.borderWidth],void 0,n),hidden:isNaN(o.data[n])||a.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var i,n,a,o=e.index,r=this.chart;for(i=0,n=(r.data.datasets||[]).length;i<n;++i)(a=r.getDatasetMeta(i)).data[o].hidden=!a.data[o].hidden;
vendor: 4,209 bytes, line 1713
1713r.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}});var oe=Mt.extend({dataElementType:Wt.Arc,linkScales:ut.noop,update:function(t){var e,i,n,a=this,o=a.getDataset(),r=a.getMeta(),s=a.chart.options.startAngle||0,l=a._starts=[],d=a._angles=[],u=r.data;for(a._updateRadius(),r.count=a.countVisibleElements(),e=0,i=o.data.length;e<i;e++)l[e]=s,n=a._computeAngle(e),d[e]=n,s+=n;for(e=0,i=u.length;e<i;++e)u[e]._options=a._resolveElementOptions(u[e],e),a.updateElement(u[e],e,t)},_updateRadius:function(){var t=this,e=t.chart,i=e.chartArea,n=e.options,a=Math.min(i.right-i.left,i.bottom-i.top);e.outerRadius=Math.max(a/2,0),e.innerRadius=Math.max(n.cutoutPercentage?e.outerRadius/100*n.cutoutPercentage:1,0),e.radiusLength=(e.outerRadius-e.innerRadius)/e.getVisibleDatasetCount(),t.outerRadius=e.outerRadius-e.radiusLength*t.index,t.innerRadius=t.outerRadius-e.radiusLength},updateElement:function(t,e,i){var n=this,a=n.chart,o=n.getDataset(),r=a.options,s=r.animation,l=a.scale,d=a.data.labels,u=l.xCenter,h=l.yCenter,c=r.startAngle,f=t.hidden?0:l.getDistanceFromCenterForValue(o.data[e]),g=n._starts[e],p=g+(t.hidden?0:n._angles[e]),m=s.animateScale?0:l.getDistanceFromCenterForValue(o.data[e]),v=t._options||{};ut.extend(t,{_datasetIndex:n.index,_index:e,_scale:l,_model:{backgroundColor:v.backgroundColor,borderColor:v.borderColor,borderWidth:v.borderWidth,borderAlign:v.borderAlign,x:u,y:h,innerRadius:0,outerRadius:i?m:f,startAngle:i&&s.animateRotate?c:g,endAngle:i&&s.animateRotate?c:p,label:ut.valueAtIndexOrDefault(d,e,d[e])}}),t.pivot()},countVisibleElements:function(){var t=this.getDataset(),e=this.getMeta(),i=0;return ut.each(e.data,function(e,n){isNaN(t.data[n])||e.hidden||i++}),i},setHoverStyle:function(t){var e=t._model,i=t._options,n=ut.getHoverColor,a=ut.valueOrDefault;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=a(i.hoverBackgroundColor,n(i.backgroundColor)),e.borderColor=a(i.hoverBorderColor,n(i.borderColor)),e.borderWidth=a(i.hoverBorderWidth,i.borderWidth)},_resolveElementOptions:function(t,e){var i,n,a,o=this.chart,r=this.getDataset(),s=t.custom||{},l=o.options.elements.arc,d={},u={chart:o,dataIndex:e,dataset:r,datasetIndex:this.index},h=["backgroundColor","borderColor","borderWidth","borderAlign","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth"];for(i=0,n=h.length;i<n;++i)d[a=h[i]]=ae([s[a],r[a],l[a]],u,e);return d},_computeAngle:function(t){var e=this,i=this.getMeta().count,n=e.getDataset(),a=e.getMeta();if(isNaN(n.data[t])||a.data[t].hidden)return 0;var o={chart:e.chart,dataIndex:t,dataset:n,datasetIndex:e.index};return ae([e.chart.options.elements.arc.angle,2*Math.PI/i],o,t)}});st._set("pie",ut.clone(st.doughnut)),st._set("pie",{cutoutPercentage:0});var re=$t,se=ut.valueOrDefault,le=ut.options.resolve;st._set("radar",{scale:{type:"radialLinear"},elements:{line:{tension:0}}});var de=Mt.extend({datasetElementType:Wt.Line,dataElementType:Wt.Point,linkScales:ut.noop,update:function(t){var e,i,n=this,a=n.getMeta(),o=a.dataset,r=a.data||[],s=n.chart.scale,l=n.getDataset();for(void 0!==l.tension&&void 0===l.lineTension&&(l.lineTension=l.tension),o._scale=s,o._datasetIndex=n.index,o._children=r,o._loop=!0,o._model=n._resolveLineOptions(o),o.pivot(),e=0,i=r.length;e<i;++e)n.updateElement(r[e],e,t);for(n.updateBezierControlPoints(),e=0,i=r.length;e<i;++e)r[e].pivot()},updateElement:function(t,e,i){var n=this,a=t.custom||{},o=n.getDataset(),r=n.chart.scale,s=r.getPointPositionForValue(e,o.data[e]),l=n._resolvePointOptions(t,e),d=n.getMeta().dataset._model,u=i?r.xCenter:s.x,h=i?r.yCenter:s.y;t._scale=r,t._options=l,t._datasetIndex=n.index,t._index=e,t._model={x:u,y:h,skip:a.skip||isNaN(u)||isNaN(h),radius:l.radius,pointStyle:l.pointStyle,rotation:l.rotation,backgroundColor:l.backgroundColor,borderColor:l.borderColor,borderWidth:l.borderWidth,tension:se(a.tension,d?d.tension:0),hitRadius:l.hitRadius}},_resolvePointOptions:function(t,e){var i,n,a,o=this.chart,r=o.data.datasets[this.index],s=t.custom||{},l=o.options.elements.point,d={},u={chart:o,dataIndex:e,dataset:r,datasetIndex:this.index}
1713,h={backgroundColor:"pointBackgroundColor",borderColor:"pointBorderColor",borderWidth:"pointBorderWidth",hitRadius:"pointHitRadius",hoverBackgroundColor:"pointHoverBackgroundColor",hoverBorderColor:"pointHoverBorderColor",hoverBorderWidth:"pointHoverBorderWidth",hoverRadius:"pointHoverRadius",pointStyle:"pointStyle",radius:"pointRadius",rotation:"pointRotation"},c=Object.keys(h);for(i=0,n=c.length;i<n;++i)d[a=c[i]]=le([s[a],r[h[a]],r[a],l[a]],u,e);return d},_resolveLineOptions:function(t){var e,i,n,a=this.chart,o=a.data.datasets[this.index],r=t.custom||{},s=a.options.elements.line,l={},d=["backgroundColor","borderWidth","borderColor","borderCapStyle","borderDash","borderDashOffset","borderJoinStyle","fill"];for(e=0,i=d.length;e<i;++e)l[n=d[e]]=le([r[n],o[n],s[n]]);return l.tension=se(o.lineTension,s.tension),l},updateBezierControlPoints:function(){var t,e,i,n,a=this.getMeta(),o=this.chart.chartArea,r=a.data||[];function s(t,e,i){return Math.max(Math.min(t,i),e)}for(t=0,e=r.length;t<e;++t)i=r[t]._model,n=ut.splineCurve(ut.previousItem(r,t,!0)._model,i,ut.nextItem(r,t,!0)._model,i.tension),i.controlPointPreviousX=s(n.previous.x,o.left,o.right),i.controlPointPreviousY=s(n.previous.y,o.top,o.bottom),i.controlPointNextX=s(n.next.x,o.left,o.right),i.controlPointNextY=s(n.next.y,o.top,o.bottom)},setHoverStyle:function(t){var e=t._model,i=t._options,n=ut.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth,radius:e.radius},e.backgroundColor=se(i.hoverBackgroundColor,n(i.backgroundColor)),e.borderColor=se(i.hoverBorderColor,n(i.borderColor)),e.borderWidth=se(i.hoverBorderWidth,i.borderWidth),e.radius=se(i.hoverRadius,i.radius)}});st._set("scatter",{hover:{mode:"single"},scales:{xAxes:[{id:"x-axis-1",type:"linear",position:"bottom"}],yAxes:[{id:"y-axis-1",type:"linear",position:"left"}]},showLines:!1,tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}});var ue={bar:Yt,bubble:Kt,doughnut:$t,horizontalBar:Jt,line:ne,polarArea:oe,pie:re,radar:de,scatter:ne};function he(t,e){return t.native?{x:t.x,y:t.y}:ut.getRelativePosition(t,e)}function ce(t,e){var i,n,a,o,r;for(n=0,o=t.data.datasets.length;n<o;++n)if(t.isDatasetVisible(n))for(a=0,r=(i=t.getDatasetMeta(n)).data.length;a<r;++a){var s=i.data[a];s._view.skip||e(s)}}function fe(t,e){var i=[];return ce(t,function(t){t.inRange(e.x,e.y)&&i.push(t)}),i}function ge(t,e,i,n){var a=Number.POSITIVE_INFINITY,o=[];return ce(t,function(t){if(!i||t.inRange(e.x,e.y)){var r=t.getCenterPoint(),s=n(e,r);s<a?(o=[t],a=s):s===a&&o.push(t)}}),o}function pe(t){var e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){var a=e?Math.abs(t.x-n.x):0,o=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(a,2)+Math.pow(o,2))}}function me(t,e,i){var n=he(e,t);i.axis=i.axis||"x";var a=pe(i.axis),o=i.intersect?fe(t,n):ge(t,n,!1,a),r=[];return o.length?(t.data.datasets.forEach(function(e,i){if(t.isDatasetVisible(i)){var n=t.getDatasetMeta(i).data[o[0]._index];n&&!n._view.skip&&r.push(n)}}),r):[]}var ve={modes:{single:function(t,e){var i=he(e,t),n=[];return ce(t,function(t){if(t.inRange(i.x,i.y))return n.push(t),n}),n.slice(0,1)},label:me,index:me,dataset:function(t,e,i){var n=he(e,t);i.axis=i.axis||"xy";var a=pe(i.axis),o=i.intersect?fe(t,n):ge(t,n,!1,a);return o.length>0&&(o=t.getDatasetMeta(o[0]._datasetIndex).data),o},"x-axis":function(t,e){return me(t,e,{intersect:!1})},point:function(t,e){return fe(t,he(e,t))},nearest:function(t,e,i){var n=he(e,t);i.axis=i.axis||"xy";var a=pe(i.axis);return ge(t,n,i.intersect,a)},x:function(t,e,i){var n=he(e,t),a=[],o=!1;return ce(t,function(t){t.inXRange(n.x)&&a.push(t),t.inRange(n.x,n.y)&&(o=!0)}),i.intersect&&!o&&(a=[]),a},y:function(t,e,i){var n=he(e,t),a=[],o=!1;return ce(t,function(t){t.inYRange(n.y)&&a.push(t),t.inRange(n.x,n.y)&&(o=!0)}),i.intersect&&!o&&(a=[]),a}}};function be(t,e){return ut.where(t,function(t){return t.position===e})}function xe(t,e){t.forEach(function(t,e){return t._tmpIndex_=e,t}),t.sort(function(t,i){var n=e?i:t,a=e?t:i;return n.weight===a.weight?n._tmpIndex_-a._tmpIndex_:n.weight-a.weight}),t.forEach(function(t){delete t._tmpIndex_})}function ye(t,e){ut.each(t,function(t){e[t.position]+=t.isHorizontal()?t.height:t.width})}st._set("global",{layout:{padding:{top:0,right:0,bottom:0,left:0}}});var ke={defaults:{}
1713,addBox:function(t,e){t.boxes||(t.boxes=[]),e.fullWidth=e.fullWidth||!1,e.position=e.position||"top",e.weight=e.weight||0,t.boxes.push(e)},removeBox:function(t,e){var i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure:function(t,e,i){for(var n,a=["fullWidth","position","weight"],o=a.length,r=0;r<o;++r)n=a[r],i.hasOwnProperty(n)&&(e[n]=i[n])},update:function(t,e,i){if(t){var n=t.options.layout||{},a=ut.options.toPadding(n.padding),o=a.left,r=a.right,s=a.top,l=a.bottom,d=be(t.boxes,"left"),u=be(t.boxes,"right"),h=be(t.boxes,"top"),c=be(t.boxes,"bottom"),f=be(t.boxes,"chartArea");xe(d,!0),xe(u,!1),xe(h,!0),xe(c,!1);var g,p=d.concat(u),m=h.concat(c),v=p.concat(m),b=e-o-r,x=i-s-l,y=(e-b/2)/p.length,k=b,w=x,M={top:s,left:o,bottom:l,right:r},_=[];ut.each(v,function(t){var e,i=t.isHorizontal();i?(e=t.update(t.fullWidth?b:k,x/2),w-=e.height):(e=t.update(y,w),k-=e.width),_.push({horizontal:i,width:e.width,box:t})}),g=function(t){var e=0,i=0,n=0,a=0;return ut.each(t,function(t){if(t.getPadding){var o=t.getPadding();e=Math.max(e,o.top),i=Math.max(i,o.left),n=Math.max(n,o.bottom),a=Math.max(a,o.right)}}),{top:e,left:i,bottom:n,right:a}}(v),ut.each(p,T),ye(p,M),ut.each(m,T),ye(m,M),ut.each(p,function(t){var e=ut.findNextWhere(_,function(e){return e.box===t}),i={left:0,right:0,top:M.top,bottom:M.bottom};e&&t.update(e.width,w,i)}),ye(v,M={top:s,left:o,bottom:l,right:r});var C=Math.max(g.left-M.left,0);M.left+=C,M.right+=Math.max(g.right-M.right,0);var S=Math.max(g.top-M.top,0);M.top+=S,M.bottom+=Math.max(g.bottom-M.bottom,0);var P=i-M.top-M.bottom,I=e-M.left-M.right;I===k&&P===w||(ut.each(p,function(t){t.height=P}),ut.each(m,function(t){t.fullWidth||(t.width=I)}),w=P,k=I);var A=o+C,D=s+S;ut.each(d.concat(h),F),A+=k,D+=w,ut.each(u,F),ut.each(c,F),t.chartArea={left:M.left,top:M.top,right:M.left+k,bottom:M.top+w},ut.each(f,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(k,w)})}function T(t){var e=ut.findNextWhere(_,function(e){return e.box===t});if(e)if(e.horizontal){var i={left:Math.max(M.left,g.left),right:Math.max(M.right,g.right),top:0,bottom:0};t.update(t.fullWidth?b:k,x/2,i)}else t.update(e.width,w)}function F(t){t.isHorizontal()?(t.left=t.fullWidth?o:M.left,t.right=t.fullWidth?e-r:M.left+k,t.top=D,t.bottom=D+t.height,D=t.bottom):(t.left=A,t.right=A+t.width,t.top=M.top,t.bottom=M.top+w,A=t.right)}}};var we,Me=(we=Object.freeze({default:"@keyframes chartjs-render-animation{from{opacity:.99}to{opacity:1}}.chartjs-render-monitor{animation:chartjs-render-animation 1ms}.chartjs-size-monitor,.chartjs-size-monitor-expand,.chartjs-size-monitor-shrink{position:absolute;direction:ltr;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1}.chartjs-size-monitor-expand>div{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0}"}))&&we.default||we,_e="$chartjs",Ce="chartjs-size-monitor",Se="chartjs-render-monitor",Pe="chartjs-render-animation",Ie=["animationstart","webkitAnimationStart"],Ae={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};function De(t,e){var i=ut.getStyle(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?Number(n[1]):void 0}var Te=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};function Fe(t,e,i){t.addEventListener(e,i,Te)}function Le(t,e,i){t.removeEventListener(e,i,Te)}function Re(t,e,i,n,a){return{type:t,chart:e,native:a||null,x:void 0!==i?i:null,y:void 0!==n?n:null}}function Oe(t){var e=document.createElement("div");return e.className=t||"",e}function ze(t,e,i){var n,a,o,r,s=t[_e]||(t[_e]={}),l=s.resizer=function(t){var e=Oe(Ce),i=Oe(Ce+"-expand"),n=Oe(Ce+"-shrink");i.appendChild(Oe()),n.appendChild(Oe()),e.appendChild(i),e.appendChild(n),e._reset=function(){i.scrollLeft=1e6,i.scrollTop=1e6,n.scrollLeft=1e6,n.scrollTop=1e6};var a=function(){e._reset(),t()};return Fe(i,"scroll",a.bind(i,"expand")),Fe(n,"scroll",a.bind(n,"shrink")),e}((n=function(){if(s.resizer){var n=i.options.maintainAspectRatio&&t.parentNode,a=n?n.clientWidth:0;e(Re("resize",i)),n&&n.clientWidth<a&&i.canvas&&e(Re("resize",i))}},o=!1,r=[],function(){r=Array.prototype.slice.call(arguments),a=a||this,o||(o=!0,ut.requestAnimFrame.call(window,function(){o=!1,n.apply(a,r)}))}));!function(t,e){var i=t[_e]||(t[_e]={}),n=i.renderProxy=function(t){t.animationName===Pe&&e()};ut.each(Ie,function(e){Fe(t,e,n)}),i.reflow=!!t.offsetParent,t.classList.add(Se)}(t,function(){if(s.resizer){var e=t.parentNode;e&&e!==l.parentNode&&e.insertBefore(l,e.firstChild),l._reset()}})}function Be(t){var e=t[_e]||{},i=e.resizer;delete e.resizer,function(t){var e=t[_e]||{},i=e.renderProxy;i&&(ut.each(Ie,function(e){Le(t,e,i)}),delete e.renderProxy),t.classList.remove(Se)}(t),i&&i.parentNode&&i.parentNode.removeChild(i)}var Ne={disableCSSInjection:!1,_enabled:"undefined"!=typeof window&&"undefined"!=typeof document,_ensureLoaded:function(){var t,e,i;this._loaded||(this._loaded=!0,this.disableCSSInjection||(e=Me,i=(t=this)._style||document.createElement("style"),t._style||(t._style=i,e="/* Chart.js */\n"+e,i.setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(i)),i.appendChild(document.createTextNode(e))))},acquireContext:function(t,e){"string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas);var i=t&&t.getContext&&t.getContext("2d");return this._ensureLoaded(),i&&i.canvas===t?(function(t,e){var i=t.style,n=t.getAttribute("height"),a=t.getAttribute("width");
vendor: 6,005 bytes, line 1713
1713if(t[_e]={initial:{height:n,width:a,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",null===a||""===a){var o=De(t,"width");void 0!==o&&(t.width=o)}if(null===n||""===n)if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{var r=De(t,"height");void 0!==o&&(t.height=r)}}(t,e),i):null},releaseContext:function(t){var e=t.canvas;if(e[_e]){var i=e[_e].initial;["height","width"].forEach(function(t){var n=i[t];ut.isNullOrUndef(n)?e.removeAttribute(t):e.setAttribute(t,n)}),ut.each(i.style||{},function(t,i){e.style[i]=t}),e.width=e.width,delete e[_e]}},addEventListener:function(t,e,i){var n=t.canvas;if("resize"!==e){var a=i[_e]||(i[_e]={});Fe(n,e,(a.proxies||(a.proxies={}))[t.id+"_"+e]=function(e){i(function(t,e){var i=Ae[t.type]||t.type,n=ut.getRelativePosition(t,e);return Re(i,e,n.x,n.y,t)}(e,t))})}else ze(n,i,t)},removeEventListener:function(t,e,i){var n=t.canvas;if("resize"!==e){var a=((i[_e]||{}).proxies||{})[t.id+"_"+e];a&&Le(n,e,a)}else Be(n)}};ut.addEvent=Fe,ut.removeEvent=Le;var We=Ne._enabled?Ne:{acquireContext:function(t){return t&&t.canvas&&(t=t.canvas),t&&t.getContext("2d")||null}},Ve=ut.extend({initialize:function(){},acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},We);st._set("global",{plugins:{}});var Ee={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var i=e.indexOf(t);-1!==i&&e.splice(i,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e,i){var n,a,o,r,s,l=this.descriptors(t),d=l.length;for(n=0;n<d;++n)if("function"==typeof(s=(o=(a=l[n]).plugin)[e])&&((r=[t].concat(i||[])).push(a.options),!1===s.apply(o,r)))return!1;return!0},descriptors:function(t){var e=t.$plugins||(t.$plugins={});if(e.id===this._cacheId)return e.descriptors;var i=[],n=[],a=t&&t.config||{},o=a.options&&a.options.plugins||{};return this._plugins.concat(a.plugins||[]).forEach(function(t){if(-1===i.indexOf(t)){var e=t.id,a=o[e];!1!==a&&(!0===a&&(a=ut.clone(st.global.plugins[e])),i.push(t),n.push({plugin:t,options:a||{}}))}}),e.descriptors=n,e.id=this._cacheId,n},_invalidate:function(t){delete t.$plugins}},He={constructors:{},defaults:{},registerScaleType:function(t,e,i){this.constructors[t]=e,this.defaults[t]=ut.clone(i)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(t){return this.defaults.hasOwnProperty(t)?ut.merge({},[st.scale,this.defaults[t]]):{}},updateScaleDefaults:function(t,e){this.defaults.hasOwnProperty(t)&&(this.defaults[t]=ut.extend(this.defaults[t],e))},addScalesToLayout:function(t){ut.each(t.scales,function(e){e.fullWidth=e.options.fullWidth,e.position=e.options.position,e.weight=e.options.weight,ke.addBox(t,e)})}},je=ut.valueOrDefault;st._set("global",{tooltips:{enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretPadding:2,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,borderColor:"rgba(0,0,0,0)",borderWidth:0,callbacks:{beforeTitle:ut.noop,title:function(t,e){var i="",n=e.labels,a=n?n.length:0;if(t.length>0){var o=t[0];o.label?i=o.label:o.xLabel?i=o.xLabel:a>0&&o.index<a&&(i=n[o.index])}return i},afterTitle:ut.noop,beforeBody:ut.noop,beforeLabel:ut.noop,label:function(t,e){var i=e.datasets[t.datasetIndex].label||"";return i&&(i+=": "),ut.isNullOrUndef(t.value)?i+=t.yLabel:i+=t.value,i},labelColor:function(t,e){var i=e.getDatasetMeta(t.datasetIndex).data[t.index]._view;return{borderColor:i.borderColor,backgroundColor:i.backgroundColor}},labelTextColor:function(){return this._options.bodyFontColor},afterLabel:ut.noop,afterBody:ut.noop,beforeFooter:ut.noop,footer:ut.noop,afterFooter:ut.noop}}});var qe={average:function(t){if(!t.length)return!1;var e,i,n=0,a=0,o=0;for(e=0,i=t.length;e<i;++e){var r=t[e];if(r&&r.hasValue()){var s=r.tooltipPosition();n+=s.x,a+=s.y,++o}}return{x:n/o,y:a/o}},nearest:function(t,e){var i,n,a,o=e.x,r=e.y,s=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){var l=t[i];if(l&&l.hasValue()){var d=l.getCenterPoint(),u=ut.distanceBetweenPoints(e,d);u<s&&(s=u,a=l)}}if(a){var h=a.tooltipPosition();o=h.x,r=h.y}return{x:o,y:r}}};function Ye(t,e){return e&&(ut.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Ue(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Xe(t){var e=st.global;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,bodyFontColor:t.bodyFontColor,_bodyFontFamily:je(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:je(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:je(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:je(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:je(t.titleFontStyle,e.defaultFontStyle),titleFontSize:je(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:je(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:je(t.footerFontStyle,e.defaultFontStyle),footerFontSize:je(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackgroun
vendor: 1,428 bytes, line 1713
1713d:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function Ke(t,e){return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-t.xPadding:t.x+t.xPadding}function Ge(t){return Ye([],Ue(t))}var Ze=pt.extend({initialize:function(){this._model=Xe(this._options),this._lastActive=[]},getTitle:function(){var t=this._options.callbacks,e=t.beforeTitle.apply(this,arguments),i=t.title.apply(this,arguments),n=t.afterTitle.apply(this,arguments),a=[];return a=Ye(a,Ue(e)),a=Ye(a,Ue(i)),a=Ye(a,Ue(n))},getBeforeBody:function(){return Ge(this._options.callbacks.beforeBody.apply(this,arguments))},getBody:function(t,e){var i=this,n=i._options.callbacks,a=[];return ut.each(t,function(t){var o={before:[],lines:[],after:[]};Ye(o.before,Ue(n.beforeLabel.call(i,t,e))),Ye(o.lines,n.label.call(i,t,e)),Ye(o.after,Ue(n.afterLabel.call(i,t,e))),a.push(o)}),a},getAfterBody:function(){return Ge(this._options.callbacks.afterBody.apply(this,arguments))},getFooter:function(){var t=this._options.callbacks,e=t.beforeFooter.apply(this,arguments),i=t.footer.apply(this,arguments),n=t.afterFooter.apply(this,arguments),a=[];return a=Ye(a,Ue(e)),a=Ye(a,Ue(i)),a=Ye(a,Ue(n))},update:function(t){var e,i,n,a,o,r,s,l,d,u,h=this,c=h._options,f=h._model,g=h._model=Xe(c),p=h._active,m=h._data,v={xAlign:f.xAlign,yAlign:f.yAlign},b={x:f.x,y:f.y},x={width:f.width,height:f.height},y={x:f.caretX,y:f.caretY};
vendor: 12,276 bytes, line 1713
1713if(p.length){g.opacity=1;var k=[],w=[];y=qe[c.position].call(h,p,h._eventPosition);var M=[];for(e=0,i=p.length;e<i;++e)M.push((n=p[e],a=void 0,o=void 0,r=void 0,s=void 0,l=void 0,d=void 0,u=void 0,a=n._xScale,o=n._yScale||n._scale,r=n._index,s=n._datasetIndex,l=n._chart.getDatasetMeta(s).controller,d=l._getIndexScale(),u=l._getValueScale(),{xLabel:a?a.getLabelForIndex(r,s):"",yLabel:o?o.getLabelForIndex(r,s):"",label:d?""+d.getLabelForIndex(r,s):"",value:u?""+u.getLabelForIndex(r,s):"",index:r,datasetIndex:s,x:n._model.x,y:n._model.y}));c.filter&&(M=M.filter(function(t){return c.filter(t,m)})),c.itemSort&&(M=M.sort(function(t,e){return c.itemSort(t,e,m)})),ut.each(M,function(t){k.push(c.callbacks.labelColor.call(h,t,h._chart)),w.push(c.callbacks.labelTextColor.call(h,t,h._chart))}),g.title=h.getTitle(M,m),g.beforeBody=h.getBeforeBody(M,m),g.body=h.getBody(M,m),g.afterBody=h.getAfterBody(M,m),g.footer=h.getFooter(M,m),g.x=y.x,g.y=y.y,g.caretPadding=c.caretPadding,g.labelColors=k,g.labelTextColors=w,g.dataPoints=M,x=function(t,e){var i=t._chart.ctx,n=2*e.yPadding,a=0,o=e.body,r=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);r+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,l=e.footer.length,d=e.titleFontSize,u=e.bodyFontSize,h=e.footerFontSize;n+=s*d,n+=s?(s-1)*e.titleSpacing:0,n+=s?e.titleMarginBottom:0,n+=r*u,n+=r?(r-1)*e.bodySpacing:0,n+=l?e.footerMarginTop:0,n+=l*h,n+=l?(l-1)*e.footerSpacing:0;var c=0,f=function(t){a=Math.max(a,i.measureText(t).width+c)};return i.font=ut.fontString(d,e._titleFontStyle,e._titleFontFamily),ut.each(e.title,f),i.font=ut.fontString(u,e._bodyFontStyle,e._bodyFontFamily),ut.each(e.beforeBody.concat(e.afterBody),f),c=e.displayColors?u+2:0,ut.each(o,function(t){ut.each(t.before,f),ut.each(t.lines,f),ut.each(t.after,f)}),c=0,i.font=ut.fontString(h,e._footerFontStyle,e._footerFontFamily),ut.each(e.footer,f),{width:a+=2*e.xPadding,height:n}}(this,g),b=function(t,e,i,n){var a=t.x,o=t.y,r=t.caretSize,s=t.caretPadding,l=t.cornerRadius,d=i.xAlign,u=i.yAlign,h=r+s,c=l+s;return"right"===d?a-=e.width:"center"===d&&((a-=e.width/2)+e.width>n.width&&(a=n.width-e.width),a<0&&(a=0)),"top"===u?o+=h:o-="bottom"===u?e.height+h:e.height/2,"center"===u?"left"===d?a+=h:"right"===d&&(a-=h):"left"===d?a-=c:"right"===d&&(a+=c),{x:a,y:o}}(g,x,v=function(t,e){var i,n,a,o,r,s=t._model,l=t._chart,d=t._chart.chartArea,u="center",h="center";s.y<e.height?h="top":s.y>l.height-e.height&&(h="bottom");var c=(d.left+d.right)/2,f=(d.top+d.bottom)/2;"center"===h?(i=function(t){return t<=c},n=function(t){return t>c}):(i=function(t){return t<=e.width/2},n=function(t){return t>=l.width-e.width/2}),a=function(t){return t+e.width+s.caretSize+s.caretPadding>l.width},o=function(t){return t-e.width-s.caretSize-s.caretPadding<0},r=function(t){return t<=f?"top":"bottom"},i(s.x)?(u="left",a(s.x)&&(u="center",h=r(s.y))):n(s.x)&&(u="right",o(s.x)&&(u="center",h=r(s.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:u,yAlign:g.yAlign?g.yAlign:h}}(this,x),h._chart)}else g.opacity=0;return g.xAlign=v.xAlign,g.yAlign=v.yAlign,g.x=b.x,g.y=b.y,g.width=x.width,g.height=x.height,g.caretX=y.x,g.caretY=y.y,h._model=g,t&&c.custom&&c.custom.call(h,g),h},drawCaret:function(t,e){var i=this._chart.ctx,n=this._view,a=this.getCaretPosition(t,e,n);i.lineTo(a.x1,a.y1),i.lineTo(a.x2,a.y2),i.lineTo(a.x3,a.y3)},getCaretPosition:function(t,e,i){var n,a,o,r,s,l,d=i.caretSize,u=i.cornerRadius,h=i.xAlign,c=i.yAlign,f=t.x,g=t.y,p=e.width,m=e.height;if("center"===c)s=g+m/2,"left"===h?(a=(n=f)-d,o=n,r=s+d,l=s-d):(a=(n=f+p)+d,o=n,r=s-d,l=s+d);else if("left"===h?(n=(a=f+u+d)-d,o=a+d):"right"===h?(n=(a=f+p-u-d)-d,o=a+d):(n=(a=i.caretX)-d,o=a+d),"top"===c)s=(r=g)-d,l=r;else{s=(r=g+m)+d,l=r;var v=o;o=n,n=v}return{x1:n,x2:a,x3:o,y1:r,y2:s,y3:l}},drawTitle:function(t,e,i){var n=e.title;if(n.length){t.x=Ke(e,e._titleAlign),i.textAlign=e._titleAlign,i.textBaseline="top";var a,o,r=e.titleFontSize,s=e.titleSpacing;for(i.fillStyle=e.titleFontColor,i.font=ut.fontString(r,e._titleFontStyle,e._titleFontFamily),a=0,o=n.length;a<o;++a)i.fillText(n[a],t.x,t.y),t.y+=r+s,a+1===n.length&&(t.y+=e.titleMarginBottom-s)}},drawBody:function(t,e,i){var n,a=e.bodyFontSize,o=e.bodySpacing,r=e._bodyAlign,s=e.body,l=e.displayColors,d=e.labelColors,u=0,h=l?Ke(e,"left"):0;i.textAlign=r,i.textBaseline="top",i.font=ut.fontString(a,e._bodyFontStyle,e._bodyFontFamily),t.x=Ke(e,r);var c=function(e){i.fillText(e,t.x+u,t.y),t.y+=a+o};i.fillStyle=e.bodyFontColor,ut.each(e.beforeBody,c),u=l&&"right"!==r?"center"===r?a/2+1:a+2:0,ut.each(s,function(o,r){n=e.labelTextColors[r],i.fillStyle=n,ut.each(o.before,c),ut.each(o.lines,function(o){l&&(i.fillStyle=e.legendColorBackground,i.fillRect(h,t.y,a,a),i.lineWidth=1,i.strokeStyle=d[r].borderColor,i.strokeRect(h,t.y,a,a),i.fillStyle=d[r].backgroundColor,i.fillRect(h+1,t.y+1,a-2,a-2),i.fillStyle=n),c(o)}),ut.each(o.after,c)}),u=0,ut.each(e.afterBody,c),t.y-=o},drawFooter:function(t,e,i){var n=e.footer;n.length&&(t.x=Ke(e,e._footerAlign),t.y+=e.footerMarginTop,i.textAlign=e._footerAlign,i.textBaseline="top",i.fillStyle=e.footerFontColor,i.font=ut.fontString(e.footerFontSize,e._footerFontStyle,e._footerFontFamily),ut.each(n,function(n){i.fillText(n,t.x,t.y),t.y+=e.footerFontSize+e.footerSpacing}))},drawBackground:function(t,e,i,n){i.fillStyle=e.backgroundColor,i.strokeStyle=e.borderColor,i.lineWidth=e.borderWidth;var a=e.xAlign,o=e.yAlign,r=t.x,s=t.y,l=n.width,d=n.height,u=e.cornerRadius;i.beginPath(),i.moveTo(r+u,s),"top"===o&&this.drawCaret(t,n),i.lineTo(r+l-u,s),i.quadraticCurveTo(r+l,s,r+l,s+u),"center"===o&&"right"===a&&this.drawCaret(t,n),i.lineTo(r+l,s+d-u),i.quadraticCurveTo(r+l,s+d,r+l-u,s+d),"bottom"===o&&this.drawCaret(t,n),i.lineTo(r+u,s+d),i.quadraticCurveTo(r,s+d,r,s+d-u),"center"===o&&"left"===a&&this.drawCaret(t,n),i.lineTo(r,s+u),i.quadraticCurveTo(r,s,r+u,s),i.closePath(),i.fill(),e.borderWidth>0&&i.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var i={width:e.width,height:e.height},n={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,o=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&o&&(t.save(),t.globalAlpha=a,this.drawBackground(n,e,t,i),n.y+=e.yPadding,this.drawTitle(n,e,t),this.drawBody(n,e,t),this.drawFooter(n,e,t),t.restore())}},handleEvent:function(t){var e,i=this,n=i._options;return i._lastActive=i._lastActive||[],"mouseout"===t.type?i._active=[]:i._active=i._chart.getElementsAtEventForMode(t,n.mode,n),(e=!ut.arrayEquals(i._active,i._lastActive))&&(i._lastActive=i._active,(n.enabled||n.custom)&&(i._eventPosition={x:t.x,y:t.y},i.update(!0),i.pivot())),e}}),$e=qe,Je=Ze;Je.positioners=$e;var Qe=ut.valueOrDefault;function ti(){return ut.merge({},[].slice.call(arguments),{merger:function(t,e,i,n){if("xAxes"===t||"yAxes"===t){var a,o,r,s=i[t].length;for(e[t]||(e[t]=[]),a=0;a<s;++a)r=i[t][a],o=Qe(r.type,"xAxes"===t?"category":"linear"),a>=e[t].length&&e[t].push({}),!e[t][a].type||r.type&&r.type!==e[t][a].type?ut.merge(e[t][a],[He.getScaleDefaults(o),r]):ut.merge(e[t][a],r)}else ut._merger(t,e,i,n)}})}function ei(){return ut.merge({},[].slice.call(arguments),{merger:function(t,e,i,n){var a=e[t]||{},o=i[t];"scales"===t?e[t]=ti(a,o):"scale"===t?e[t]=ut.merge(a,[He.getScaleDefaults(o.type),o]):ut._merger(t,e,i,n)}})}function ii(t){return"top"===t||"bottom"===t}st._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var ni=function(t,e){return this.construct(t,e),this};ut.extend(ni.prototype,{construct:function(t,e){var i=this;e=function(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=ei(st.global,st[t.type],t.options||{}),t}(e);var n=Ve.acquireContext(t,e),a=n&&n.canvas,o=a&&a.height,r=a&&a.width;i.id=ut.uid(),i.ctx=n,i.canvas=a,i.config=e,i.width=r,i.height=o,i.aspectRatio=o?r/o:null,i.options=e.options,i._bufferedRender=!1,i.chart=i,i.controller=i,ni.instances[i.id]=i,Object.defineProperty(i,"data",{get:function(){return i.config.data},set:function(t){i.config.data=t}}),n&&a?(i.initialize(),i.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return Ee.notify(t,"beforeInit"),ut.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.initToolTip(),Ee.notify(t,"afterInit"),t},clear:function(){return ut.canvas.clear(this),this},stop:function(){return bt.cancelAnimation(this),this},resize:function(t){var e=this,i=e.options,n=e.canvas,a=i.maintainAspectRatio&&e.aspectRatio||null,o=Math.max(0,Math.floor(ut.getMaximumWidth(n))),r=Math.max(0,Math.floor(a?o/a:ut.getMaximumHeight(n)));if((e.width!==o||e.height!==r)&&(n.width=e.width=o,n.height=e.height=r,n.style.width=o+"px",n.style.height=r+"px",ut.retinaScale(e,i.devicePixelRatio),!t)){var s={width:o,height:r};Ee.notify(e,"resize",[s]),i.onResize&&i.onResize(e,s),e.stop(),e.update({duration:i.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},i=t.scale;ut.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),ut.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),i&&(i.id=i.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,i=t.scales||{},n=[],a=Object.keys(i).reduce(function(t,e){return t[e]=!1,t},{});e.scales&&(n=n.concat((e.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category",dposition:"bottom"}}),(e.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear",dposition:"left"}}))),e.scale&&n.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),ut.each(n,function(e){var n=e.options,o=n.id,r=Qe(n.type,e.dtype);ii(n.position)!==ii(e.dposition)&&(n.position=e.dposition),a[o]=!0;var s=null;if(o in i&&i[o].type===r)(s=i[o]).options=n,s.ctx=t.ctx,s.chart=t;else{var l=He.getScaleConstructor(r);if(!l)return;s=new l({id:o,type:r,options:n,ctx:t.ctx,chart:t}),i[s.id]=s}s.mergeTicksOptions(),e.isDefault&&(t.scale=s)}),ut.each(a,function(t,e){t||delete i[e]}),t.scales=i,He.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t=this,e=[];return ut.each(t.data.datasets,function(i,n){var a=t.getDatasetMeta(n),o=i.type||t.config.type;if(a.type&&a.type!==o&&(t.destroyDatasetMeta(n),a=t.getDatasetMeta(n)),a.type=o,a.controller)a.controller.updateIndex(n),a.controller.linkScales();else{var r=ue[a.type];if(void 0===r)throw new Error('"'+a.type+'" is not a chart type.');a.controller=new r(t,n),e.push(a.controller)}},t),e},resetElements:function(){var t=this;ut.each(t.data.datasets,function(e,i){t.getDatasetMeta(i).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t){var e,i,n=this;if(t&&"object"==typeof t||(t={duration:t,lazy:arguments[1]}),i=(e=n).options,ut.each(e.scales,function(t){ke.removeBox(e,t)}),i=ei(st.global,st[e.config.type],i),e.options=e.config.options=i,e.ensureScalesHaveIDs(),e.buildOrUpdateScales(),e.tooltip._options=i.tooltips,e.tooltip.initialize(),Ee._invalidate(n),!1!==Ee.notify(n,"beforeUpdate")){n.tooltip._data=n.data;var a=n.buildOrUpdateControllers();ut.each(n.data.datasets,function(t,e){n.getDatasetMeta(e).controller.buildOrUpdateElements()},n),n.updateLayout(),n.options.animation&&n.options.animation.duration&&ut.each(a,function(t){t.reset()}),n.updateDatasets(),n.tooltip.initialize(),n.lastActive=[],Ee.notify(n,"afterUpdate"),n._bufferedRender?n._bufferedRequest={duration:t.duration,easing:t.easing,lazy:t.lazy}:n.render(t)}},updateLayout:function(){!1!==Ee.notify(this,"beforeLayout")&&(ke.update(this,this.width,this.height),Ee.notify(this,"afterScaleUpdate"),Ee.notify(this,"afterLayout"))},updateDatasets:function(){if(!1!==Ee.notify(this,"beforeDatasetsUpdate")){for(var t=0,e=this.data.datasets.length;t<e;++t)this.updateDataset(t);Ee.notify(this,"afterDatasetsUpdate")}},updateDataset:function(t){var e=this.getDatasetMeta(t),i={meta:e,index:t};!1!==Ee.notify(this,"beforeDatasetUpdate",[i])&&(e.controller.update(
vendor: 5,238 bytes, line 1713
1713),Ee.notify(this,"afterDatasetUpdate",[i]))},render:function(t){var e=this;t&&"object"==typeof t||(t={duration:t,lazy:arguments[1]});var i=e.options.animation,n=Qe(t.duration,i&&i.duration),a=t.lazy;if(!1!==Ee.notify(e,"beforeRender")){var o=function(t){Ee.notify(e,"afterRender"),ut.callback(i&&i.onComplete,[t],e)};if(i&&n){var r=new vt({numSteps:n/16.66,easing:t.easing||i.easing,render:function(t,e){var i=ut.easing.effects[e.easing],n=e.currentStep,a=n/e.numSteps;t.draw(i(a),a,n)},onAnimationProgress:i.onProgress,onAnimationComplete:o});bt.addAnimation(e,r,n,a)}else e.draw(),o(new vt({numSteps:0,chart:e}));return e}},draw:function(t){var e=this;e.clear(),ut.isNullOrUndef(t)&&(t=1),e.transition(t),e.width<=0||e.height<=0||!1!==Ee.notify(e,"beforeDraw",[t])&&(ut.each(e.boxes,function(t){t.draw(e.chartArea)},e),e.drawDatasets(t),e._drawTooltip(t),Ee.notify(e,"afterDraw",[t]))},transition:function(t){for(var e=0,i=(this.data.datasets||[]).length;e<i;++e)this.isDatasetVisible(e)&&this.getDatasetMeta(e).controller.transition(t);this.tooltip.transition(t)},drawDatasets:function(t){var e=this;if(!1!==Ee.notify(e,"beforeDatasetsDraw",[t])){for(var i=(e.data.datasets||[]).length-1;i>=0;--i)e.isDatasetVisible(i)&&e.drawDataset(i,t);Ee.notify(e,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var i=this.getDatasetMeta(t),n={meta:i,index:t,easingValue:e};!1!==Ee.notify(this,"beforeDatasetDraw",[n])&&(i.controller.draw(e),Ee.notify(this,"afterDatasetDraw",[n]))},_drawTooltip:function(t){var e=this.tooltip,i={tooltip:e,easingValue:t};!1!==Ee.notify(this,"beforeTooltipDraw",[i])&&(e.draw(),Ee.notify(this,"afterTooltipDraw",[i]))},getElementAtEvent:function(t){return ve.modes.single(this,t)},getElementsAtEvent:function(t){return ve.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return ve.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,i){var n=ve.modes[e];return"function"==typeof n?n(this,t,i):[]},getDatasetAtEvent:function(t){return ve.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this.data.datasets[t];e._meta||(e._meta={});var i=e._meta[this.id];return i||(i=e._meta[this.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,i=this.data.datasets.length;e<i;++e)this.isDatasetVisible(e)&&t++;return t},isDatasetVisible:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroyDatasetMeta:function(t){var e=this.id,i=this.data.datasets[t],n=i._meta&&i._meta[e];n&&(n.controller.destroy(),delete i._meta[e])},destroy:function(){var t,e,i=this,n=i.canvas;for(i.stop(),t=0,e=i.data.datasets.length;t<e;++t)i.destroyDatasetMeta(t);n&&(i.unbindEvents(),ut.canvas.clear(i),Ve.releaseContext(i.ctx),i.canvas=null,i.ctx=null),Ee.notify(i,"destroy"),delete ni.instances[i.id]},toBase64Image:function(){return this.canvas.toDataURL.apply(this.canvas,arguments)},initToolTip:function(){var t=this;t.tooltip=new Je({_chart:t,_chartInstance:t,_data:t.data,_options:t.options.tooltips},t)},bindEvents:function(){var t=this,e=t._listeners={},i=function(){t.eventHandler.apply(t,arguments)};ut.each(t.options.events,function(n){Ve.addEventListener(t,n,i),e[n]=i}),t.options.responsive&&(i=function(){t.resize()},Ve.addEventListener(t,"resize",i),e.resize=i)},unbindEvents:function(){var t=this,e=t._listeners;e&&(delete t._listeners,ut.each(e,function(e,i){Ve.removeEventListener(t,i,e)}))},updateHoverStyle:function(t,e,i){var n,a,o,r=i?"setHoverStyle":"removeHoverStyle";for(a=0,o=t.length;a<o;++a)(n=t[a])&&this.getDatasetMeta(n._datasetIndex).controller[r](n)},eventHandler:function(t){var e=this,i=e.tooltip;if(!1!==Ee.notify(e,"beforeEvent",[t])){e._bufferedRender=!0,e._bufferedRequest=null;var n=e.handleEvent(t);i&&(n=i._start?i.handleEvent(t):n|i.handleEvent(t)),Ee.notify(e,"afterEvent",[t]);var a=e._bufferedRequest;return a?e.render(a):n&&!e.animating&&(e.stop(),e.render({duration:e.options.hover.animationDuration,lazy:!0})),e._bufferedRender=!1,e._bufferedRequest=null,e}},handleEvent:function(t){var e,i=this,n=i.options||{},a=n.hover;return i.lastActive=i.lastActive||[],"mouseout"===t.type?i.active=[]:i.active=i.getElementsAtEventForMode(t,a.mode,a),ut.callback(n.onHover||n.hover.onHover,[t.native,i.active],i),"mouseup"!==t.type&&"click"!==t.type||n.onClick&&n.onClick.call(i,t.native,i.active),i.lastActive.length&&i.updateHoverStyle(i.lastActive,a.mode,!1),i.active.length&&a.mode&&i.updateHoverStyle(i.active,a.mode,!0),e=!ut.arrayEquals(i.active,i.lastActive),i.lastActive=i.active,e}}),ni.instances={};var ai=ni;ni.Controller=ni,ni.types={},ut.configMerge=ei,ut.scaleMerge=ti;function oi(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}function ri(t){this.options=t||{}}ut.extend(ri.prototype,{formats:oi,parse:oi,format:oi,add:oi,diff:oi,startOf:oi,endOf:oi,_create:function(t){return t}}),ri.override=function(t){ut.extend(ri.prototype,t)};var si={_date:ri},li={formatters:{values:function(t){return ut.isArray(t)?t:""+t}
vendor: 4,637 bytes, line 1713
1713,linear:function(t,e,i){var n=i.length>3?i[2]-i[1]:i[1]-i[0];Math.abs(n)>1&&t!==Math.floor(t)&&(n=t-Math.floor(t));var a=ut.log10(Math.abs(n)),o="";if(0!==t)if(Math.max(Math.abs(i[0]),Math.abs(i[i.length-1]))<1e-4){var r=ut.log10(Math.abs(t));o=t.toExponential(Math.floor(r)-Math.floor(a))}else{var s=-1*Math.floor(a);s=Math.max(Math.min(s,20),0),o=t.toFixed(s)}else o="0";return o},logarithmic:function(t,e,i){var n=t/Math.pow(10,Math.floor(ut.log10(t)));return 0===t?"0":1===n||2===n||5===n||0===e||e===i.length-1?t.toExponential():""}}},di=ut.valueOrDefault,ui=ut.valueAtIndexOrDefault;function hi(t){var e,i,n=[];for(e=0,i=t.length;e<i;++e)n.push(t[e].label);return n}function ci(t,e,i){return ut.isArray(e)?ut.longestText(t,i,e):t.measureText(e).width}st._set("scale",{display:!0,position:"left",offset:!1,gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",zeroLineBorderDash:[],zeroLineBorderDashOffset:0,offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{display:!1,labelString:"",padding:{top:4,bottom:4}},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:0,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:li.formatters.values,minor:{},major:{}}});var fi=pt.extend({getPadding:function(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}},getTicks:function(){return this._ticks},mergeTicksOptions:function(){var t=this.options.ticks;for(var e in!1===t.minor&&(t.minor={display:!1}),!1===t.major&&(t.major={display:!1}),t)"major"!==e&&"minor"!==e&&(void 0===t.minor[e]&&(t.minor[e]=t[e]),void 0===t.major[e]&&(t.major[e]=t[e]))},beforeUpdate:function(){ut.callback(this.options.beforeUpdate,[this])},update:function(t,e,i){var n,a,o,r,s,l,d=this;for(d.beforeUpdate(),d.maxWidth=t,d.maxHeight=e,d.margins=ut.extend({left:0,right:0,top:0,bottom:0},i),d._maxLabelLines=0,d.longestLabelWidth=0,d.longestTextCache=d.longestTextCache||{},d.beforeSetDimensions(),d.setDimensions(),d.afterSetDimensions(),d.beforeDataLimits(),d.determineDataLimits(),d.afterDataLimits(),d.beforeBuildTicks(),s=d.buildTicks()||[],s=d.afterBuildTicks(s)||s,d.beforeTickToLabelConversion(),o=d.convertTicksToLabels(s)||d.ticks,d.afterTickToLabelConversion(),d.ticks=o,n=0,a=o.length;n<a;++n)r=o[n],(l=s[n])?l.label=r:s.push(l={label:r,major:!1});return d._ticks=s,d.beforeCalculateTickRotation(),d.calculateTickRotation(),d.afterCalculateTickRotation(),d.beforeFit(),d.fit(),d.afterFit(),d.afterUpdate(),d.minSize},afterUpdate:function(){ut.callback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){ut.callback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0},afterSetDimensions:function(){ut.callback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){ut.callback(this.options.beforeDataLimits,[this])},determineDataLimits:ut.noop,afterDataLimits:function(){ut.callback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){ut.callback(this.options.beforeBuildTicks,[this])},buildTicks:ut.noop,afterBuildTicks:function(t){var e=this;return ut.isArray(t)&&t.length?ut.callback(e.options.afterBuildTicks,[e,t]):(e.ticks=ut.callback(e.options.afterBuildTicks,[e,e.ticks])||e.ticks,t)},beforeTickToLabelConversion:function(){ut.callback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this.options.ticks;this.ticks=this.ticks.map(t.userCallback||t.callback,this)},afterTickToLabelConversion:function(){ut.callback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){ut.callback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var t=this,e=t.ctx,i=t.options.ticks,n=hi(t._ticks),a=ut.options._parseFont(i);e.font=a.string;var o=i.minRotation||0;if(n.length&&t.options.display&&t.isHorizontal())for(var r,s=ut.longestText(e,a.string,n,t.longestTextCache),l=s,d=t.getPixelForTick(1)-t.getPixelForTick(0)-6;l>d&&o<i.maxRotation;){var u=ut.toRadians(o);if(r=Math.cos(u),Math.sin(u)*s>t.maxHeight){o--;break}o++,l=r*s}t.labelRotation=o},afterCalculateTickRotation:function(){ut.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){ut.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0}
1713,i=hi(t._ticks),n=t.options,a=n.ticks,o=n.scaleLabel,r=n.gridLines,s=t._isVisible(),l=n.position,d=t.isHorizontal(),u=ut.options._parseFont,h=u(a),c=n.gridLines.tickMarkLength;if(e.width=d?t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:s&&r.drawTicks?c:0,e.height=d?s&&r.drawTicks?c:0:t.maxHeight,o.display&&s){var f=u(o),g=ut.options.toPadding(o.padding),p=f.lineHeight+g.height;d?e.height+=p:e.width+=p}if(a.display&&s){var m=ut.longestText(t.ctx,h.string,i,t.longestTextCache),v=ut.numberOfLabelLines(i),b=.5*h.size,x=t.options.ticks.padding;if(t._maxLabelLines=v,t.longestLabelWidth=m,d){var y=ut.toRadians(t.labelRotation),k=Math.cos(y),w=Math.sin(y)*m+h.lineHeight*v+b;e.height=Math.min(t.maxHeight,e.height+w+x),t.ctx.font=h.string;var M,_,C=ci(t.ctx,i[0],h.string),S=ci(t.ctx,i[i.length-1],h.string),P=t.getPixelForTick(0)-t.left,I=t.right-t.getPixelForTick(i.length-1);0!==t.labelRotation?(M="bottom"===l?k*C:k*b,_="bottom"===l?k*b:k*S):(M=C/2,_=S/2),t.paddingLeft=Math.max(M-P,0)+3,t.paddingRight=Math.max(_-I,0)+3}else a.mirror?m=0:m+=x+b,e.width=Math.min(t.maxWidth,e.width+m),t.paddingTop=h.size/2,t.paddingBottom=h.size/2}t.handleMargins(),t.width=e.width,t.height=e.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){ut.callback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(ut.isNullOrUndef(t))return NaN;if(("number"==typeof t||t instanceof Number)&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},getLabelForIndex:ut.noop,getPixelForValue:ut.noop,getValueForPixel:ut.noop,getPixelForTick:function(t){var e=this,i=e.options.offset;if(e.isHorizontal()){var n=(e.width-(e.paddingLeft+e.paddingRight))/Math.max(e._ticks.length-(i?0:1),1),a=n*t+e.paddingLeft;i&&(a+=n/2);var o=e.left+a;return o+=e.isFullWidth()?e.margins.left:0}var r=e.height-(e.paddingTop+e.paddingBottom);return e.top+t*(r/(e._ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var i=(e.width-(e.paddingLeft+e.paddingRight))*t+e.paddingLeft,n=e.left+i;return n+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this.min,e=this.max;return this.beginAtZero?0:t<0&&e<0?e:t>0&&e>0?t:0},_autoSkip:function(t){var e,i,n=this,a=n.isHorizontal(),o=n.options.ticks.minor,r=t.length,s=!1,l=o.maxTicksLimit,d=n._tickSize()*(r-1),u=a?n.width-(n.paddingLeft+n.paddingRight):n.height-(n.paddingTop+n.PaddingBottom),h=[];for(d>u&&(s=1+Math.floor(d/u)),r>l&&(s=Math.max(s,1+Math.floor(r/l))),e=0;e<r;e++)i=t[e],s>1&&e%s>0&&delete i.label,h.push(i);return h},_tickSize:function(){var t=this,e=t.isHorizontal(),i=t.options.ticks.minor,n=ut.toRadians(t.labelRotation),a=Math.abs(Math.cos(n)),o=Math.abs(Math.sin(n)),r=i.autoSkipPadding||0,s=t.longestLabelWidth+r||0,l=ut.options._parseFont(i),d=t._maxLabelLines*l.lineHeight+r||0;return e?d*a>s*o?s/a:d/o:d*o<s*a?d/a:s/o},_isVisible:function(){var t,e,i,n=this.chart,a=this.options.display;if("auto"!==a)return!!a;for(t=0,e=n.data.datasets.length;t<e;++t)if(n.isDatasetVisible(t)&&((i=n.getDatasetMeta(t)).xAxisID===this.id||i.yAxisID===this.id))return!0;return!1},draw:function(t){var e=this,i=e.options;if(e._isVisible()){var n,a,o,r=e.chart,s=e.ctx,l=st.global.defaultFontColor,d=i.ticks.minor,u=i.ticks.major||d,h=i.gridLines,c=i.scaleLabel,f=i.position,g=0!==e.labelRotation,p=d.mirror,m=e.isHorizontal(),v=ut.options._parseFont,b=d.display&&d.autoSkip?e._autoSkip(e.getTicks()):e.getTicks(),x=di(d.fontColor,l),y=v(d),k=y.lineHeight,w=di(u.fontColor,l),M=v(u),_=d.padding,C=d.labelOffset,S=h.drawTicks?h.tickMarkLength:0,P=di(c.fontColor,l),I=v(c),A=ut.options.toPadding(c.padding),D=ut.toRadians(e.labelRotation),T=[],F=h.drawBorder?ui(h.lineWidth,0,0):0,L=ut._alignPixel;"top"===f?(n=L(r,e.bottom,F),a=e.bottom-S,o=n-F/2):"bottom"===f?(n=L(r,e.top,F),a=n+F/2,o=e.top+S):"left"===f?(n=L(r,e.right,F),a=e.right-S,o=n-F/2):(n=L(r,e.left,F),a=n+F/2,o=e.left+S);if(ut.each(b,function(n,s){if(!ut.isNullOrUndef(n.label)){var l,d,u,c,v,b,x,y,w,M,P,I,A,R,O,z,B=n.label;s===e.zeroLineIndex&&i.offset===h.offsetGridLines?(l=h.zeroLineWi
1713dth,d=h.zeroLineColor,u=h.zeroLineBorderDash||[],c=h.zeroLineBorderDashOffset||0):(l=ui(h.lineWidth,s),d=ui(h.color,s),u=h.borderDash||[],c=h.borderDashOffset||0);var N=ut.isArray(B)?B.length:1,W=function(t,e,i){var n=t.getPixelForTick(e);return i&&(1===t.getTicks().length?n-=t.isHorizontal()?Math.max(n-t.left,t.right-n):Math.max(n-t.top,t.bottom-n):n-=0===e?(t.getPixelForTick(1)-n)/2:(n-t.getPixelForTick(e-1))/2),n}(e,s,h.offsetGridLines);if(m){var V=S+_;W<e.left-1e-7&&(d="rgba(0,0,0,0)"),v=x=w=P=L(r,W,l),b=a,y=o,A=e.getPixelForTick(s)+C,"top"===f?(M=L(r,t.top,F)+F/2,I=t.bottom,O=((g?1:.5)-N)*k,z=g?"left":"center",R=e.bottom-V):(M=t.top,I=L(r,t.bottom,F)-F/2,O=(g?0:.5)*k,z=g?"right":"center",R=e.top+V)}else{var E=(p?0:S)+_;W<e.top-1e-7&&(d="rgba(0,0,0,0)"),v=a,x=o,b=y=M=I=L(r,W,l),R=e.getPixelForTick(s)+C,O=(1-N)*k/2,"left"===f?(w=L(r,t.left,F)+F/2,P=t.right,z=p?"left":"right",A=e.right-E):(w=t.left,P=L(r,t.right,F)-F/2,z=p?"right":"left",A=e.left+E)}T.push({tx1:v,ty1:b,tx2:x,ty2:y,x1:w,y1:M,x2:P,y2:I,labelX:A,labelY:R,glWidth:l,glColor:d,glBorderDash:u,glBorderDashOffset:c,rotation:-1*D,label:B,major:n.major,textOffset:O,textAlign:z})}}),ut.each(T,function(t){var e=t.glWidth,i=t.glColor;if(h.display&&e&&i&&(s.save(),s.lineWidth=e,s.strokeStyle=i,s.setLineDash&&(s.setLineDash(t.glBorderDash),s.lineDashOffset=t.glBorderDashOffset),s.beginPath(),h.drawTicks&&(s.moveTo(t.tx1,t.ty1),s.lineTo(t.tx2,t.ty2)),h.drawOnChartArea&&(s.moveTo(t.x1,t.y1),s.lineTo(t.x2,t.y2)),s.stroke(),s.restore()),d.display){s.save(),s.translate(t.labelX,t.labelY),s.rotate(t.rotation),s.font=t.major?M.string:y.string,s.fillStyle=t.major?w:x,s.textBaseline="middle",s.textAlign=t.textAlign;var n=t.label,a=t.textOffset;if(ut.isArray(n))for(var o=0;o<n.length;++o)s.fillText(""+n[o],0,a),a+=k;else s.fillText(n,0,a);s.restore()}}),c.display){var R,O,z=0,B=I.lineHeight/2;if(m)R=e.left+(e.right-e.left)/2,O="bottom"===f?e.bottom-B-A.bottom:e.top+B+A.top;else{var N="left"===f;R=N?e.left+B+A.top:e.right-B-A.top,O=e.top+(e.bottom-e.top)/2,z=N?-.5*Math.PI:.5*Math.PI}s.save(),s.translate(R,O),s.rotate(z),s.textAlign="center",s.textBaseline="middle",s.fillStyle=P,s.font=I.string,s.fillText(c.labelString,0,0),s.restore()}if(F){var W,V,E,H,j=F,q=ui(h.lineWidth,b.length-1,0);m?(W=L(r,e.left,j)-j/2,V=L(r,e.right,q)+q/2,E=H=n):(E=L(r,e.top,j)-j/2,H=L(r,e.bottom,q)+q/2,W=V=n),s.lineWidth=F,s.strokeStyle=ui(h.color,0),s.beginPath(),s.moveTo(W,E),s.lineTo(V,H),s.stroke()}}}}),gi=fi.extend({getLabels:function(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t,e=this,i=e.getLabels();e.minIndex=0,e.maxIndex=i.length-1,void 0!==e.options.ticks.min&&(t=i.indexOf(e.options.ticks.min),e.minIndex=-1!==t?t:e.minIndex),void 0!==e.options.ticks.max&&(t=i.indexOf(e.options.ticks.max),e.maxIndex=-1!==t?t:e.maxIndex),e.min=i[e.minIndex],e.max=i[e.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var i=this,n=i.chart;return n.getDatasetMeta(e).controller._getValueScaleId()===i.id?i.getRightValue(n.data.datasets[e].data[t]):i.ticks[t-i.minIndex]},getPixelForValue:function(t,e){var i,n=this,a=n.options.offset,o=Math.max(n.maxIndex+1-n.minIndex-(a?0:1),1);if(null!=t&&(i=n.isHorizontal()?t.x:t.y),void 0!==i||void 0!==t&&isNaN(e)){t=i||t;var r=n.getLabels().indexOf(t);e=-1!==r?r:e}if(n.isHorizontal()){var s=n.width/o,l=s*(e-n.minIndex);return a&&(l+=s/2),n.left+l}var d=n.height/o,u=d*(e-n.minIndex);return a&&(u+=d/2),n.top+u},getPixelForTick:function(t){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null)},getValueForPixel:function(t){var e=this,i=e.options.offset,n=Math.max(e._ticks.length-(i?0:1),1),a=e.isHorizontal(),o=(a?e.width:e.height)/n;return t-=a?e.left:e.top,i&&(t-=o/2),(t<=0?0:Math.round(t/o))+e.minIndex},getBasePixel:function(){return this.bottom}}),pi={position:"bottom"};gi._defaults=pi;var mi=ut.noop,vi=ut.isNullOrUndef;var bi=fi.extend({getRightValue:function(t){return"string"==typeof t?+t:fi.prototype.getRightValue.call(this,t)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var i=ut.sign(t.min),n=ut.sign(t.max);i<0&&n<0?t.max=0:i>0&&n>0&&(t.min=0)}var a=void 0!==e.min||void 0!==e.suggestedMin,o=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),a!==o&&t.min>=t.max&&(a?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:function(){var t,e=this.options.ticks,i=e.stepSize,n=e.maxTicksLimit;return i?t=Math.ceil(this.max/i)-Math.floor(this.min/i)+1:(t=this._computeTickLimit(),n=n||11),n&&(t=Math.min(n,t)),t},_computeTickLimit:function(){return Number.POSITIVE_INFINITY},handleDirectionalChanges:mi,buildTicks:function(){var t=this,e=t.options.ticks,i=t.getTickLimit(),n={maxTicks:i=Math.max(2,i),min:e.min,max:e.max,precision:e.precision,stepSize:ut.valueOrDefault(e.fixedStepSize,e.stepSize)},a=t.ticks=function(t,e){var i,n,a,o,r=[],s=t.stepSize,l=s||1,d=t.maxTicks-1,u=t.min,h=t.max,c=t.precision,f=e.min,g=e.max,p=ut.niceNum((g-f)/d/l)*l;if(p<1e-14&&vi(u)&&vi(h))return[f,g];(o=Math.ceil(g/p)-Math.floor(f/p))>d&&(p=ut.niceNum(o*p/d/l)*l),s||vi(c)?i=Math.pow(10,ut._decimalPlaces(p)):(i=Math.pow(10,c),p=Math.ceil(p*i)/i),n=Math.floor(f/p)*p,a=Math.ceil(g/p)*p,s&&(!vi(u)&&ut.almostWhole(u/p,p/1e3)&&(n=u),!vi(h)&&ut.almostWhole(h/p,p/1e3)&&(a=h)),o=(a-n)/p,o=ut.almostEquals(o,Math.round(o),p/1e3)?Math.round(o):Math.ceil(o),n=Math.round(n*i)/i,a=Math.round(a*i)/i,r.push(vi(u)?n:u);for(var m=1;m<o;++m)r.push(Math.round((n+m*p)*i)/i);return r.push(vi(h)?a:h),r}(n,t);t.handleDirectionalChanges(),t.max=ut.max(a),t.min=ut.min(a),e.reverse?(a.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var t=this;t.ticksAsNumbers=t.ticks.slice(),t.zeroLineIndex=t.ticks.indexOf(0),fi.prototype.convertTicksToLabels.call(t)}}),xi={position:"left",ticks:{callback:li.formatters.linear}},yi=bi.extend({determineDataLimits:function(){var t=this,e=t.options,i=t.chart,n=i.data.datasets,a=t.isHorizontal();function o(e){return a?e.xAxisID===t.id:e.yAxisID===t.id}t.min=null,t.max=null;var r=e.stacked;if(void 0===r&&ut.each(n,function(t,e){if(!r){var n=i.getDatasetMeta(e);i.isDatasetVisible(e)&&o(n)&&void 0!==n.stack&&(r=!0)}}),e.stacked||r){var s={};ut.each(n,function(n,a){var r=i.getDatasetMeta(a),l=[r.type,void 0===e.stacked&&void 0===r.stack?a:"",r.stack].join(".");void 0===s[l]&&(s[l]={positiveValues:[],negativeValues:[]});var d=s[l].positiveValues,u=s[l].negativeValues;i.isDatasetVisible(a)&&o(r)&&ut.each(n.data,function(i,n){var a=+t.getRightValue(i);isNaN(a)||r.data[n].hidden||(d[n]=d[n]||0,u[n]=u[n]||0,e.relativePoints?d[n]=100:a<0?u[n]+=a:d[n]+=a)})}),ut.each(s,function(e){var i=e.positiveValues.concat(e.negativeValues),n=ut.min(i),a=ut.max(i);t.min=null===t.min?n:Math.min(t.min,n),t.max=null===t.max?a:Math.max(t.max,a)})}else ut.each(n,function(e,n){var a=i.getDatasetMeta(n);i.isDatasetVisible(n)&&o(a)&&ut.each(e.data,function(e,i){var n=+t.getRightValue(e);isNaN(n)||a.data[i].hidden||(null===t.min?t.min=n:n<t.min&&(t.min=n),null===t.max?t.max=n:n>
vendor: 5,083 bytes, line 1713
1713t.max&&(t.max=n))})});t.min=isFinite(t.min)&&!isNaN(t.min)?t.min:0,t.max=isFinite(t.max)&&!isNaN(t.max)?t.max:1,this.handleTickRangeOptions()},_computeTickLimit:function(){var t;return this.isHorizontal()?Math.ceil(this.width/40):(t=ut.options._parseFont(this.options.ticks),Math.ceil(this.height/t.lineHeight))},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e=this,i=e.start,n=+e.getRightValue(t),a=e.end-i;return e.isHorizontal()?e.left+e.width/a*(n-i):e.bottom-e.height/a*(n-i)},getValueForPixel:function(t){var e=this,i=e.isHorizontal(),n=i?e.width:e.height,a=(i?t-e.left:e.bottom-t)/n;return e.start+(e.end-e.start)*a},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}}),ki=xi;yi._defaults=ki;var wi=ut.valueOrDefault;var Mi={position:"left",ticks:{callback:li.formatters.logarithmic}};function _i(t,e){return ut.isFinite(t)&&t>=0?t:e}var Ci=fi.extend({determineDataLimits:function(){var t=this,e=t.options,i=t.chart,n=i.data.datasets,a=t.isHorizontal();function o(e){return a?e.xAxisID===t.id:e.yAxisID===t.id}t.min=null,t.max=null,t.minNotZero=null;var r=e.stacked;if(void 0===r&&ut.each(n,function(t,e){if(!r){var n=i.getDatasetMeta(e);i.isDatasetVisible(e)&&o(n)&&void 0!==n.stack&&(r=!0)}}),e.stacked||r){var s={};ut.each(n,function(n,a){var r=i.getDatasetMeta(a),l=[r.type,void 0===e.stacked&&void 0===r.stack?a:"",r.stack].join(".");i.isDatasetVisible(a)&&o(r)&&(void 0===s[l]&&(s[l]=[]),ut.each(n.data,function(e,i){var n=s[l],a=+t.getRightValue(e);isNaN(a)||r.data[i].hidden||a<0||(n[i]=n[i]||0,n[i]+=a)}))}),ut.each(s,function(e){if(e.length>0){var i=ut.min(e),n=ut.max(e);t.min=null===t.min?i:Math.min(t.min,i),t.max=null===t.max?n:Math.max(t.max,n)}})}else ut.each(n,function(e,n){var a=i.getDatasetMeta(n);i.isDatasetVisible(n)&&o(a)&&ut.each(e.data,function(e,i){var n=+t.getRightValue(e);isNaN(n)||a.data[i].hidden||n<0||(null===t.min?t.min=n:n<t.min&&(t.min=n),null===t.max?t.max=n:n>t.max&&(t.max=n),0!==n&&(null===t.minNotZero||n<t.minNotZero)&&(t.minNotZero=n))})});this.handleTickRangeOptions()},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;t.min=_i(e.min,t.min),t.max=_i(e.max,t.max),t.min===t.max&&(0!==t.min&&null!==t.min?(t.min=Math.pow(10,Math.floor(ut.log10(t.min))-1),t.max=Math.pow(10,Math.floor(ut.log10(t.max))+1)):(t.min=1,t.max=10)),null===t.min&&(t.min=Math.pow(10,Math.floor(ut.log10(t.max))-1)),null===t.max&&(t.max=0!==t.min?Math.pow(10,Math.floor(ut.log10(t.min))+1):10),null===t.minNotZero&&(t.min>0?t.minNotZero=t.min:t.max<1?t.minNotZero=Math.pow(10,Math.floor(ut.log10(t.max))):t.minNotZero=1)},buildTicks:function(){var t=this,e=t.options.ticks,i=!t.isHorizontal(),n={min:_i(e.min),max:_i(e.max)},a=t.ticks=function(t,e){var i,n,a=[],o=wi(t.min,Math.pow(10,Math.floor(ut.log10(e.min)))),r=Math.floor(ut.log10(e.max)),s=Math.ceil(e.max/Math.pow(10,r));0===o?(i=Math.floor(ut.log10(e.minNotZero)),n=Math.floor(e.minNotZero/Math.pow(10,i)),a.push(o),o=n*Math.pow(10,i)):(i=Math.floor(ut.log10(o)),n=Math.floor(o/Math.pow(10,i)));var l=i<0?Math.pow(10,Math.abs(i)):1;do{a.push(o),10==++n&&(n=1,l=++i>=0?1:l),o=Math.round(n*Math.pow(10,i)*l)/l}while(i<r||i===r&&n<s);var d=wi(t.max,o);return a.push(d),a}(n,t);t.max=ut.max(a),t.min=ut.min(a),e.reverse?(i=!i,t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),i&&a.reverse()},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),fi.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){return this.getPixelForValue(this.tickValues[t])},_getFirstTickValue:function(t){var e=Math.floor(ut.log10(t));return Math.floor(t/Math.pow(10,e))*Math.pow(10,e)},getPixelForValue:function(t){var e,i,n,a,o,r=this,s=r.options.ticks,l=s.reverse,d=ut.log10,u=r._getFirstTickValue(r.minNotZero),h=0;return t=+r.getRightValue(t),l?(n=r.end,a=r.start,o=-1):(n=r.start,a=r.end,o=1),r.isHorizontal()?(e=r.width,i=l?r.right:r.left):(e=r.height,o*=-1,i=l?r.top:r.bottom),t!==n&&(0===n&&(e-=h=wi(s.fontSize,st.global.defaultFontSize),n=u),0!==t&&(h+=e/(d(a)-d(n))*(d(t)-d(n))),i+=o*h),i},getValueForPixel:function(t){var e,i,n,a,o=this,r=o.options.ticks,s=r.reverse,l=ut.log10,d=o._getFirstTickValue(o.minNotZero);if(s?(i=o.end,n=o.start):(i=o.start,n=o.end),o.isHorizontal()?(e=o.width,a=s?o.right-t:t-o.left):(e=o.height,a=s?t-o.top:o.bottom-t),a!==i){if(0===i){var u=wi(r.fontSize,st.global.defaultFontSize);a-=u,e-=u,i=d}a*=l(n)-l(i),a/=e,a=Math.pow(10,l(i)+a)}return a}}),Si=Mi;Ci._defaults=Si;var Pi=ut.valueOrDefault,Ii=ut.valueAtIndexOrDefault,Ai=ut.options.resolve,Di={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:li.formatters.linear}
1713,pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}};function Ti(t){var e=t.options;return e.angleLines.display||e.pointLabels.display?t.chart.data.labels.length:0}function Fi(t){var e=t.ticks;return e.display&&t.display?Pi(e.fontSize,st.global.defaultFontSize)+2*e.backdropPaddingY:0}function Li(t,e,i,n,a){return t===n||t===a?{start:e-i/2,end:e+i/2}:t<n||t>a?{start:e-i,end:e}:{start:e,end:e+i}}function Ri(t){return 0===t||180===t?"center":t<180?"left":"right"}function Oi(t,e,i,n){var a,o,r=i.y+n/2;if(ut.isArray(e))for(a=0,o=e.length;a<o;++a)t.fillText(e[a],i.x,r),r+=n;else t.fillText(e,i.x,r)}function zi(t,e,i){90===t||270===t?i.y-=e.h/2:(t>270||t<90)&&(i.y-=e.h)}function Bi(t){return ut.isNumber(t)?t:0}var Ni=bi.extend({setDimensions:function(){var t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=Fi(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2},determineDataLimits:function(){var t=this,e=t.chart,i=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;ut.each(e.data.datasets,function(a,o){if(e.isDatasetVisible(o)){var r=e.getDatasetMeta(o);ut.each(a.data,function(e,a){var o=+t.getRightValue(e);isNaN(o)||r.data[a].hidden||(i=Math.min(o,i),n=Math.max(o,n))})}}),t.min=i===Number.POSITIVE_INFINITY?0:i,t.max=n===Number.NEGATIVE_INFINITY?0:n,t.handleTickRangeOptions()},_computeTickLimit:function(){return Math.ceil(this.drawingArea/Fi(this.options))},convertTicksToLabels:function(){var t=this;bi.prototype.convertTicksToLabels.call(t),t.pointLabels=t.chart.data.labels.map(t.options.pointLabels.callback,t)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){var t=this.options;t.display&&t.pointLabels.display?function(t){var e,i,n,a=ut.options._parseFont(t.options.pointLabels),o={l:0,r:t.width,t:0,b:t.height-t.paddingTop},r={};t.ctx.font=a.string,t._pointLabelSizes=[];var s,l,d,u=Ti(t);for(e=0;e<u;e++){n=t.getPointPosition(e,t.drawingArea+5),s=t.ctx,l=a.lineHeight,d=t.pointLabels[e]||"",i=ut.isArray(d)?{w:ut.longestText(s,s.font,d),h:d.length*l}:{w:s.measureText(d).width,h:l},t._pointLabelSizes[e]=i;var h=t.getIndexAngle(e),c=ut.toDegrees(h)%360,f=Li(c,n.x,i.w,0,180),g=Li(c,n.y,i.h,90,270);f.start<o.l&&(o.l=f.start,r.l=h),f.end>o.r&&(o.r=f.end,r.r=h),g.start<o.t&&(o.t=g.start,r.t=h),g.end>o.b&&(o.b=g.end,r.b=h)}t.setReductions(t.drawingArea,o,r)}(this):this.setCenterPoint(0,0,0,0)},setReductions:function(t,e,i){var n=this,a=e.l/Math.sin(i.l),o=Math.max(e.r-n.width,0)/Math.sin(i.r),r=-e.t/Math.cos(i.t),s=-Math.max(e.b-(n.height-n.paddingTop),0)/Math.cos(i.b);a=Bi(a),o=Bi(o),r=Bi(r),s=Bi(s),n.drawingArea=Math.min(Math.floor(t-(a+o)/2),Math.floor(t-(r+s)/2)),n.setCenterPoint(a,o,r,s)},setCenterPoint:function(t,e,i,n){var a=this,o=a.width-e-a.drawingArea,r=t+a.drawingArea,s=i+a.drawingArea,l=a.height-a.paddingTop-n-a.drawingArea;a.xCenter=Math.floor((r+o)/2+a.left),a.yCenter=Math.floor((s+l)/2+a.top+a.paddingTop)},getIndexAngle:function(t){return t*(2*Math.PI/Ti(this))+(this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var i=e.drawingArea/(e.max-e.min);return e.options.ticks.reverse?(e.max-t)*i:(t-e.min)*i},getPointPosition:function(t,e){var i=this.getIndexAngle(t)-Math.PI/2;return{x:Math.cos(i)*e+this.xCenter,y:Math.sin(i)*e+this.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this.min,e=this.max;return this.getPointPositionForValue(0,this.beginAtZero?0:t<0&&e<0?e:t>0&&e>0?t:0)},draw:function(){var t=this,e=t.options,i=e.gridLines,n=e.ticks;if(e.display){var a=t.ctx,o=this.getIndexAngle(0),r=ut.options._parseFont(n);(e.angleLines.display||e.pointLabels.display)&&function(t){var e=t.ctx,i=t.options,n=i.angleLines,a=i.gridLines,o=i.pointLabels,r=Pi(n.lineWidth,a.lineWidth),s=Pi(n.color,a.color),l=Fi(i);e.save(),e.lineWidth=r,e.strokeStyle=s,e.setLineDash&&(e.setLineDash(Ai([n.borderDash,a.borderDash,[]])),e.lineDashOffset=Ai([n.borderDashOffset,a.borderDashOffset,0]));var d=t.getDistanceFromCenterForValue(i.ticks.reverse?t.min:t.max),u=ut.options._parseFont(o);e.font=u.string,e.textBaseline="middle";for(var h=Ti(t)-1;h>=0;h--){if(n.display&&r&&s){var c=t.getPointPosition(h,d);e.beginPath(),e.moveTo(t.xCenter,t.yCenter),e.lineTo(c.x,c.y),e.stroke()}if(o.display){var f=0===h?l/2:0,g=t.getPointPosition(h,d+f+5),p=Ii(o.fontColor,h,st.global.defaultFontColor);e.fillStyle=p;var m=t.getIndexAngle(h),v=ut.toDegrees(m);e.textAlign=Ri(v),zi(v,t._pointLabelSizes[h],g),Oi(e,t.pointLabels[h]||"",g,u.lineHeight)}}
1713e.restore()}(t),ut.each(t.ticks,function(e,s){if(s>0||n.reverse){var l=t.getDistanceFromCenterForValue(t.ticksAsNumbers[s]);if(i.display&&0!==s&&function(t,e,i,n){var a,o=t.ctx,r=e.circular,s=Ti(t),l=Ii(e.color,n-1),d=Ii(e.lineWidth,n-1);if((r||s)&&l&&d){if(o.save(),o.strokeStyle=l,o.lineWidth=d,o.setLineDash&&(o.setLineDash(e.borderDash||[]),o.lineDashOffset=e.borderDashOffset||0),o.beginPath(),r)o.arc(t.xCenter,t.yCenter,i,0,2*Math.PI);else{a=t.getPointPosition(0,i),o.moveTo(a.x,a.y);for(var u=1;u<s;u++)a=t.getPointPosition(u,i),o.lineTo(a.x,a.y)}o.closePath(),o.stroke(),o.restore()}}(t,i,l,s),n.display){var d=Pi(n.fontColor,st.global.defaultFontColor);if(a.font=r.string,a.save(),a.translate(t.xCenter,t.yCenter),a.rotate(o),n.showLabelBackdrop){var u=a.measureText(e).width;a.fillStyle=n.backdropColor,a.fillRect(-u/2-n.backdropPaddingX,-l-r.size/2-n.backdropPaddingY,u+2*n.backdropPaddingX,r.size+2*n.backdropPaddingY)}a.textAlign="center",a.textBaseline="middle",a.fillStyle=d,a.fillText(e,0,-l),a.restore()}}})}}}),Wi=Di;Ni._defaults=Wi;var Vi=ut.valueOrDefault,Ei=Number.MIN_SAFE_INTEGER||-9007199254740991,Hi=Number.MAX_SAFE_INTEGER||9007199254740991,ji={millisecond:{common:!0,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:!0,size:1e3,steps:[1,2,5,10,15,30]},minute:{common:!0,size:6e4,steps:[1,2,5,10,15,30]},hour:{common:!0,size:36e5,steps:[1,2,3,6,12]},day:{common:!0,size:864e5,steps:[1,2,5]},week:{common:!1,size:6048e5,steps:[1,2,3,4]},month:{common:!0,size:2628e6,steps:[1,2,3]},quarter:{common:!1,size:7884e6,steps:[1,2,3,4]},year:{common:!0,size:3154e7}},qi=Object.keys(ji);function Yi(t,e){return t-e}function Ui(t){var e,i,n,a={},o=[];for(e=0,i=t.length;e<i;++e)a[n=t[e]]||(a[n]=!0,o.push(n));return o}function Xi(t,e,i,n){var a=function(t,e,i){for(var n,a,o,r=0,s=t.length-1;r>=0&&r<=s;){if(a=t[(n=r+s>>1)-1]||null,o=t[n],!a)return{lo:null,hi:o};if(o[e]<i)r=n+1;else{if(!(a[e]>i))return{lo:a,hi:o};s=n-1}}return{lo:o,hi:null}}(t,e,i),o=a.lo?a.hi?a.lo:t[t.length-2]:t[0],r=a.lo?a.hi?a.hi:t[t.length-1]:t[1],s=r[e]-o[e],l=s?(i-o[e])/s:0,d=(r[n]-o[n])*l;return o[n]+d}function Ki(t,e){var i=t._adapter,n=t.options.time,a=n.parser,o=a||n.format,r=e;return"function"==typeof a&&(r=a(r)),ut.isFinite(r)||(r="string"==typeof o?i.parse(r,o):i.parse(r)),null!==r?+r:(a||"function"!=typeof o||(r=o(e),ut.isFinite(r)||(r=i.parse(r))),r)}function Gi(t,e){if(ut.isNullOrUndef(e))return null;var i=t.options.time,n=Ki(t,t.getRightValue(e));return null===n?n:(i.round&&(n=+t._adapter.startOf(n,i.round)),n)}function Zi(t){for(var e=qi.indexOf(t)+1,i=qi.length;e<i;++e)if(ji[qi[e]].common)return qi[e]}function $i(t,e,i,n){var a,o=t._adapter,r=t.options,s=r.time,l=s.unit||function(t,e,i,n){var a,o,r,s=qi.length;for(a=qi.indexOf(t);a<s-1;++a)if(r=(o=ji[qi[a]]).steps?o.steps[o.steps.length-1]:Hi,o.common&&Math.ceil((i-e)/(r*o.size))<=n)return qi[a];return qi[s-1]}(s.minUnit,e,i,n),d=Zi(l),u=Vi(s.stepSize,s.unitStepSize),h="week"===l&&s.isoWeekday,c=r.ticks.major.enabled,f=ji[l],g=e,p=i,m=[];for(u||(u=function(t,e,i,n){var a,o,r,s=e-t,l=ji[i],d=l.size,u=l.steps;if(!u)return Math.ceil(s/(n*d));for(a=0,o=u.length;a<o&&(r=u[a],!(Math.ceil(s/(d*r))<=n));++a);return r}(e,i,l,n)),h&&(g=+o.startOf(g,"isoWeek",h),p=+o.startOf(p,"isoWeek",h)),g=+o.startOf(g,h?"day":l),(p=+o.startOf(p,h?"day":l))<i&&(p=+o.add(p,1,l)),a=g,c&&d&&!h&&!s.round&&(a=+o.startOf(a,d),a=+o.add(a,~~((g-a)/(f.size*u))*u,l));a<p;a=+o.add(a,u,l))m.push(+a);return m.push(+a),m}var Ji=fi.extend({initialize:function(){this.mergeTicksOptions(),fi.prototype.initialize.call(this)},update:function(){var t=this.options,e=t.time||(t.time={}),i=this._adapter=new si._date(t.adapters.date);return e.format&&console.warn("options.time.format is deprecated and replaced by options.time.parser."),ut.mergeIf(e.displayFormats,i.formats()),fi.prototype.update.apply(this,arguments)},getRightValue:function(t){return t&&void 0!==t.t&&(t=t.t),fi.prototype.getRightValue.call(this,t)},determineDataLimits:function(){var t,e,i,n,a,o,r=this,s=r.chart,l=r._adapter,d=r.options.time,u=d.unit||"day",h=Hi,c=Ei,f=[],g=[],p=[],m=s.data.labels||[];for(t=0,i=m.length;t<i;++t)p.push(Gi(r,m[t]));for(t=0,i=(s.data.datasets||[]).length;t<i;++t)if(s.isDatasetVisible(t))if(a=s.data.datasets[t].data,ut.isObject(a[0]))for(g[t]=[],e=0,n=a.length;e<n;++e)o=Gi(r,a[e]),f.push(o),g[t][e]=o;else{for(e=0,n=p.length;e<n;++e)f.push(p[e]);g[t]=p.slice(0)}else g[t]=[];p.length&&(p=Ui(p).sort(Yi),h=Math.min(h,p[0]),c=Math.max(c,p[p.length-1])),f.length&&(f=Ui(f).sort(Yi),h=Math.min(h,f[0]),c=Math.max(c,f[f.length-1])),h=Gi(r,d.min)||h,c=Gi(r,d.max)||c,h=
1713h===Hi?+l.startOf(Date.now(),u):h,c=c===Ei?+l.endOf(Date.now(),u)+1:c,r.min=Math.min(h,c),r.max=Math.max(h+1,c),r._horizontal=r.isHorizontal(),r._table=[],r._timestamps={data:f,datasets:g,labels:p}},buildTicks:function(){var t,e,i,n=this,a=n.min,o=n.max,r=n.options,s=r.time,l=[],d=[];switch(r.ticks.source){case"data":l=n._timestamps.data;break;case"labels":l=n._timestamps.labels;break;case"auto":default:l=$i(n,a,o,n.getLabelCapacity(a))}for("ticks"===r.bounds&&l.length&&(a=l[0],o=l[l.length-1]),a=Gi(n,s.min)||a,o=Gi(n,s.max)||o,t=0,e=l.length;t<e;++t)(i=l[t])>=a&&i<=o&&d.push(i);return n.min=a,n.max=o,n._unit=s.unit||function(t,e,i,n,a){var o,r;for(o=qi.length-1;o>=qi.indexOf(i);o--)if(r=qi[o],ji[r].common&&t._adapter.diff(a,n,r)>=e.length)return r;return qi[i?qi.indexOf(i):0]}(n,d,s.minUnit,n.min,n.max),n._majorUnit=Zi(n._unit),n._table=function(t,e,i,n){if("linear"===n||!t.length)return[{time:e,pos:0},{time:i,pos:1}];var a,o,r,s,l,d=[],u=[e];for(a=0,o=t.length;a<o;++a)(s=t[a])>e&&s<i&&u.push(s);for(u.push(i),a=0,o=u.length;a<o;++a)l=u[a+1],r=u[a-1],s=u[a],void 0!==r&&void 0!==l&&Math.round((l+r)/2)===s||d.push({time:s,pos:a/(o-1)});return d}(n._timestamps.data,a,o,r.distribution),n._offsets=function(t,e,i,n,a){var o,r,s=0,l=0;return a.offset&&e.length&&(a.time.min||(o=Xi(t,"time",e[0],"pos"),s=1===e.length?1-o:(Xi(t,"time",e[1],"pos")-o)/2),a.time.max||(r=Xi(t,"time",e[e.length-1],"pos"),l=1===e.length?r:(r-Xi(t,"time",e[e.length-2],"pos"))/2)),{start:s,end:l}}(n._table,d,0,0,r),r.ticks.reverse&&d.reverse(),function(t,e,i){var n,a,o,r,s=[];for(n=0,a=e.length;n<a;++n)o=e[n],r=!!i&&o===+t._adapter.startOf(o,i),s.push({value:o,major:r});return s}(n,d,n._majorUnit)},getLabelForIndex:function(t,e){var i=this,n=i._adapter,a=i.chart.data,o=i.options.time,r=a.labels&&t<a.labels.length?a.labels[t]:"",s=a.datasets[e].data[t];return ut.isObject(s)&&(r=i.getRightValue(s)),o.tooltipFormat?n.format(Ki(i,r),o.tooltipFormat):"string"==typeof r?r:n.format(Ki(i,r),o.displayFormats.datetime)},tickFormatFunction:function(t,e,i,n){var a=this._adapter,o=this.options,r=o.time.displayFormats,s=r[this._unit],l=this._majorUnit,d=r[l],u=+a.startOf(t,l),h=o.ticks.major,c=h.enabled&&l&&d&&t===u,f=a.format(t,n||(c?d:s)),g=c?h:o.ticks.minor,p=Vi(g.callback,g.userCallback);return p?p(f,e,i):f},convertTicksToLabels:function(t){var e,i,n=[];for(e=0,i=t.length;e<i;++e)n.push(this.tickFormatFunction(t[e].value,e,t));return n},getPixelForOffset:function(t){var e=this,i=e.options.ticks.reverse,n=e._horizontal?e.width:e.height,a=e._horizontal?i?e.right:e.left:i?e.bottom:e.top,o=Xi(e._table,"time",t,"pos"),r=n*(e._offsets.start+o)/(e._offsets.start+1+e._offsets.end);return i?a-r:a+r},getPixelForValue:function(t,e,i){var n=null;if(void 0!==e&&void 0!==i&&(n=this._timestamps.datasets[i][e]),null===n&&(n=Gi(this,t)),null!==n)return this.getPixelForOffset(n)},getPixelForTick:function(t){var e=this.getTicks();return t>=0&&t<e.length?this.getPixelForOffset(e[t].value):null},getValueForPixel:function(t){var e=this,i=e._horizontal?e.width:e.height,n=e._horizontal?e.left:e.top,a=(i?(t-n)/i:0)*(e._offsets.start+1+e._offsets.start)-e._offsets.end,o=Xi(e._table,"pos",a,"time");return e._adapter._create(o)},getLabelWidth:function(t){var e=this.options.ticks,i=this.ctx.measureText(t).width,n=ut.toRadians(e.maxRotation),a=Math.cos(n),o=Math.sin(n);return i*a+Vi(e.fontSize,st.global.defaultFontSize)*o},getLabelCapacity:function(t){var e=this,i=e.options.time.displayFormats.millisecond,n=e.tickFormatFunction(t,0,[],i),a=e.getLabelWidth(n),o=e.isHorizontal()?e.width:e.height,r=Math.floor(o/a);return r>0?r:1}}),Qi={position:"bottom",distribution:"linear",bounds:"data",adapters:{},time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{autoSkip:!1,source:"auto",major:{enabled:!1}}};Ji._defaults=Qi;var tn={category:gi,linear:yi,logarithmic:Ci,radialLinear:Ni,time:Ji},en={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};si._date.override("function"==typeof t?{_id:"moment",formats:function(){return en},parse:function(e,i){return"string"==typeof e&&"string"==typeof i?e=t(e,i):e instanceof t||(e=t(e)),e.isValid()?e.valueOf():null},format:function(e,i){return t(e).format(i)},add:function(e,i,n){return t(e).add(i,n).valueOf()},diff:function(e,i,n){return t.duration(t(e).diff(t(i))).as(n)},startOf:function(e,i,n){return e=t(e),"isoWeek"===i?e.isoWeekday(n).valueOf():e.startOf(i).valueOf()},endOf:function(e,i){return t(e).endOf(i).valueOf()},_create:function(e){return t(e)}}:{}),st._set("global",{plugins:{filler:{propagate:!0}}});var nn={dataset:function(t){var e=t.fill,i=t.chart,n=i.getDatasetMeta(e),a=n&&i.isDatasetVisible(e)&&n.dataset._children||[],o=a.length||0;return o?function(t,e){return e<o&&a[e]._view||null}:null},boundary:function(t){var e=t.boundary,i=e?e.x:null,n=e?e.y:null;return function(t){return{x:null===i?t.x:i,y:null===n?t.y:n}}}};function an(t,e,i){var n,a=t._model||{},o=a.fill;if(void 0===o&&(o=!!a.backgroundColor),!1===o||null===o)return!1;if(!0===o)return"origin";if(n=parseFloat(o,10),isFinite(n)&&Math.floor(n)===n)return"-"!==o[0]&&"+"!==o[0]||(n=e+n),!(n===e||n<0||n>=i)&&n;switch(o){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return o;default:return!1}}function on(t){var e,i=t.el._model||{},n=t.el._scale||{},a=t.fill,o=null;if(isFinite(a))return null;if("start"===a?o=void 0===i.scaleBottom?n.bottom:i.scaleBottom:"end"===a?o=void 0===i.scaleTop?n.top:i.scaleTop:void 0!==i.scaleZero?o=i.scaleZero:n.getBasePosition?o=n.getBasePosition():n.getBasePixel&&(o=n.getBasePixel()),null!=o){if
vendor: 4,309 bytes, line 1713
1713(void 0!==o.x&&void 0!==o.y)return o;if(ut.isFinite(o))return{x:(e=n.isHorizontal())?o:null,y:e?null:o}}return null}function rn(t,e,i){var n,a=t[e].fill,o=[e];if(!i)return a;for(;!1!==a&&-1===o.indexOf(a);){if(!isFinite(a))return a;if(!(n=t[a]))return!1;if(n.visible)return a;o.push(a),a=n.fill}return!1}function sn(t){var e=t.fill,i="dataset";return!1===e?null:(isFinite(e)||(i="boundary"),nn[i](t))}function ln(t){return t&&!t.skip}function dn(t,e,i,n,a){var o;if(n&&a){for(t.moveTo(e[0].x,e[0].y),o=1;o<n;++o)ut.canvas.lineTo(t,e[o-1],e[o]);for(t.lineTo(i[a-1].x,i[a-1].y),o=a-1;o>0;--o)ut.canvas.lineTo(t,i[o],i[o-1],!0)}}var un={id:"filler",afterDatasetsUpdate:function(t,e){var i,n,a,o,r=(t.data.datasets||[]).length,s=e.propagate,l=[];for(n=0;n<r;++n)o=null,(a=(i=t.getDatasetMeta(n)).dataset)&&a._model&&a instanceof Wt.Line&&(o={visible:t.isDatasetVisible(n),fill:an(a,n,r),chart:t,el:a}),i.$filler=o,l.push(o);for(n=0;n<r;++n)(o=l[n])&&(o.fill=rn(l,n,s),o.boundary=on(o),o.mapper=sn(o))},beforeDatasetDraw:function(t,e){var i=e.meta.$filler;if(i){var n=t.ctx,a=i.el,o=a._view,r=a._children||[],s=i.mapper,l=o.backgroundColor||st.global.defaultColor;s&&l&&r.length&&(ut.canvas.clipArea(n,t.chartArea),function(t,e,i,n,a,o){var r,s,l,d,u,h,c,f=e.length,g=n.spanGaps,p=[],m=[],v=0,b=0;for(t.beginPath(),r=0,s=f+!!o;r<s;++r)u=i(d=e[l=r%f]._view,l,n),h=ln(d),c=ln(u),h&&c?(v=p.push(d),b=m.push(u)):v&&b&&(g?(h&&p.push(d),c&&m.push(u)):(dn(t,p,m,v,b),v=b=0,p=[],m=[]));dn(t,p,m,v,b),t.closePath(),t.fillStyle=a,t.fill()}(n,r,s,o,l,a._loop),ut.canvas.unclipArea(n))}}},hn=ut.noop,cn=ut.valueOrDefault;function fn(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}st._set("global",{legend:{display:!0,position:"top",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var i=e.datasetIndex,n=this.chart,a=n.getDatasetMeta(i);a.hidden=null===a.hidden?!n.data.datasets[i].hidden:null,n.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return ut.isArray(e.datasets)?e.datasets.map(function(e,i){return{text:e.label,fillStyle:ut.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(i),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:i}},this):[]}}},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var i=0;i<t.data.datasets.length;i++)e.push('<li><span style="background-color:'+t.data.datasets[i].backgroundColor+'"></span>'),t.data.datasets[i].label&&e.push(t.data.datasets[i].label),e.push("</li>");return e.push("</ul>"),e.join("")}});var gn=pt.extend({initialize:function(t){ut.extend(this,t),this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1},beforeUpdate:hn,update:function(t,e,i){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n.margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:hn,beforeSetDimensions:hn,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:hn,beforeBuildLabels:hn,buildLabels:function(){var t=this,e=t.options.labels||{},i=ut.callback(e.generateLabels,[t.chart],t)||[];e.filter&&(i=i.filter(function(i){return e.filter(i,t.chart.data)})),t.options.reverse&&i.reverse(),t.legendItems=i},afterBuildLabels:hn,beforeFit:hn,fit:function(){var t=this,e=t.options,i=e.labels,n=e.display,a=t.ctx,o=ut.options._parseFont(i),r=o.size,s=t.legendHitBoxes=[],l=t.minSize,d=t.isHorizontal();if(d?(l.width=t.maxWidth,l.height=n?10:0):(l.width=n?10:0,l.height=t.maxHeight),n)if(a.font=o.string,d){var u=t.lineWidths=[0],h=0;a.textAlign="left",a.textBaseline="top",ut.each(t.legendItems,function(t,e){var n=fn(i,r)+r/2+a.measureText(t.text).width;(0===e||u[u.length-1]+n+i.padding>l.width)&&(h+=r+i.padding,u[u.length-(e>0?0:1)]=i.padding),s[e]={left:0,top:0,width:n,height:r},u[u.length-1]+=n+i.padding}),l.height+=h}
1713else{var c=i.padding,f=t.columnWidths=[],g=i.padding,p=0,m=0,v=r+c;ut.each(t.legendItems,function(t,e){var n=fn(i,r)+r/2+a.measureText(t.text).width;e>0&&m+v>l.height-c&&(g+=p+i.padding,f.push(p),p=0,m=0),p=Math.max(p,n),m+=v,s[e]={left:0,top:0,width:n,height:r}}),g+=p,f.push(p),l.width+=g}t.width=l.width,t.height=l.height},afterFit:hn,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.options,i=e.labels,n=st.global,a=n.defaultColor,o=n.elements.line,r=t.width,s=t.lineWidths;if(e.display){var l,d=t.ctx,u=cn(i.fontColor,n.defaultFontColor),h=ut.options._parseFont(i),c=h.size;d.textAlign="left",d.textBaseline="middle",d.lineWidth=.5,d.strokeStyle=u,d.fillStyle=u,d.font=h.string;var f=fn(i,c),g=t.legendHitBoxes,p=t.isHorizontal();l=p?{x:t.left+(r-s[0])/2+i.padding,y:t.top+i.padding,line:0}:{x:t.left+i.padding,y:t.top+i.padding,line:0};var m=c+i.padding;ut.each(t.legendItems,function(n,u){var h=d.measureText(n.text).width,v=f+c/2+h,b=l.x,x=l.y;p?u>0&&b+v+i.padding>t.left+t.minSize.width&&(x=l.y+=m,l.line++,b=l.x=t.left+(r-s[l.line])/2+i.padding):u>0&&x+m>t.top+t.minSize.height&&(b=l.x=b+t.columnWidths[l.line]+i.padding,x=l.y=t.top+i.padding,l.line++),function(t,i,n){if(!(isNaN(f)||f<=0)){d.save();var r=cn(n.lineWidth,o.borderWidth);if(d.fillStyle=cn(n.fillStyle,a),d.lineCap=cn(n.lineCap,o.borderCapStyle),d.lineDashOffset=cn(n.lineDashOffset,o.borderDashOffset),d.lineJoin=cn(n.lineJoin,o.borderJoinStyle),d.lineWidth=r,d.strokeStyle=cn(n.strokeStyle,a),d.setLineDash&&d.setLineDash(cn(n.lineDash,o.borderDash)),e.labels&&e.labels.usePointStyle){var s=f*Math.SQRT2/2,l=t+f/2,u=i+c/2;ut.canvas.drawPoint(d,n.pointStyle,s,l,u)}else 0!==r&&d.strokeRect(t,i,f,c),d.fillRect(t,i,f,c);
vendor: 4,190 bytes, line 1713
1713d.restore()}}(b,x,n),g[u].left=b,g[u].top=x,function(t,e,i,n){var a=c/2,o=f+a+t,r=e+a;d.fillText(i.text,o,r),i.hidden&&(d.beginPath(),d.lineWidth=2,d.moveTo(o,r),d.lineTo(o+n,r),d.stroke())}(b,x,n,h),p?l.x+=v+i.padding:l.y+=m})}},_getLegendItemAt:function(t,e){var i,n,a,o=this;if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)for(a=o.legendHitBoxes,i=0;i<a.length;++i)if(t>=(n=a[i]).left&&t<=n.left+n.width&&e>=n.top&&e<=n.top+n.height)return o.legendItems[i];return null},handleEvent:function(t){var e,i=this,n=i.options,a="mouseup"===t.type?"click":t.type;if("mousemove"===a){if(!n.onHover&&!n.onLeave)return}else{if("click"!==a)return;if(!n.onClick)return}e=i._getLegendItemAt(t.x,t.y),"click"===a?e&&n.onClick&&n.onClick.call(i,t.native,e):(n.onLeave&&e!==i._hoveredItem&&(i._hoveredItem&&n.onLeave.call(i,t.native,i._hoveredItem),i._hoveredItem=e),n.onHover&&e&&n.onHover.call(i,t.native,e))}});function pn(t,e){var i=new gn({ctx:t.ctx,options:e,chart:t});ke.configure(t,i,e),ke.addBox(t,i),t.legend=i}var mn={id:"legend",_element:gn,beforeInit:function(t){var e=t.options.legend;e&&pn(t,e)},beforeUpdate:function(t){var e=t.options.legend,i=t.legend;e?(ut.mergeIf(e,st.global.legend),i?(ke.configure(t,i,e),i.options=e):pn(t,e)):i&&(ke.removeBox(t,i),delete t.legend)},afterEvent:function(t,e){var i=t.legend;i&&i.handleEvent(e)}},vn=ut.noop;st._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3}});var bn=pt.extend({initialize:function(t){ut.extend(this,t),this.legendHitBoxes=[]},beforeUpdate:vn,update:function(t,e,i){var n=this;return n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n.margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate(),n.minSize},afterUpdate:vn,beforeSetDimensions:vn,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:vn,beforeBuildLabels:vn,buildLabels:vn,afterBuildLabels:vn,beforeFit:vn,fit:function(){var t=this,e=t.options,i=e.display,n=t.minSize,a=ut.isArray(e.text)?e.text.length:1,o=ut.options._parseFont(e),r=i?a*o.lineHeight+2*e.padding:0;t.isHorizontal()?(n.width=t.maxWidth,n.height=r):(n.width=r,n.height=t.maxHeight),t.width=n.width,t.height=n.height},afterFit:vn,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,i=t.options;if(i.display){var n,a,o,r=ut.options._parseFont(i),s=r.lineHeight,l=s/2+i.padding,d=0,u=t.top,h=t.left,c=t.bottom,f=t.right;e.fillStyle=ut.valueOrDefault(i.fontColor,st.global.defaultFontColor),e.font=r.string,t.isHorizontal()?(a=h+(f-h)/2,o=u+l,n=f-h):(a="left"===i.position?h+l:f-l,o=u+(c-u)/2,n=c-u,d=Math.PI*("left"===i.position?-.5:.5)),e.save(),e.translate(a,o),e.rotate(d),e.textAlign="center",e.textBaseline="middle";var g=i.text;if(ut.isArray(g))for(var p=0,m=0;m<g.length;++m)e.fillText(g[m],0,p,n),p+=s;else e.fillText(g,0,0,n);e.restore()}}});function xn(t,e){var i=new bn({ctx:t.ctx,options:e,chart:t});ke.configure(t,i,e),ke.addBox(t,i),t.titleBlock=i}var yn={},kn=un,wn=mn,Mn={id:"title",_element:bn,beforeInit:function(t){var e=t.options.title;e&&xn(t,e)},beforeUpdate:function(t){var e=t.options.title,i=t.titleBlock;e?(ut.mergeIf(e,st.global.title),i?(ke.configure(t,i,e),i.options=e):xn(t,e)):i&&(ke.removeBox(t,i),delete t.titleBlock)}};for(var _n in yn.filler=kn,yn.legend=wn,yn.title=Mn,ai.helpers=ut,function(){function t(t,e,i){var n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}function e(t){return null!=t&&"none"!==t}function i(i,n,a){var o=document.defaultView,r=ut._getParentNode(i),s=o.getComputedStyle(i)[n],l=o.getComputedStyle(r)[n],d=e(s),u=e(l),h=Number.POSITIVE_INFINITY;return d||u?Math.min(d?t(s,i,a):h,u?t(l,r,a):h):"none"}ut.where=function(t,e){if(ut.isArray(t)&&Array.prototype.filter)return t.filter(e);var i=[];return ut.each(t,function(t){e(t)&&i.push(t)}),i}
vendor: 4,402 bytes, line 1713
1713,ut.findIndex=Array.prototype.findIndex?function(t,e,i){return t.findIndex(e,i)}:function(t,e,i){i=void 0===i?t:i;for(var n=0,a=t.length;n<a;++n)if(e.call(i,t[n],n,t))return n;return-1},ut.findNextWhere=function(t,e,i){ut.isNullOrUndef(i)&&(i=-1);for(var n=i+1;n<t.length;n++){var a=t[n];if(e(a))return a}},ut.findPreviousWhere=function(t,e,i){ut.isNullOrUndef(i)&&(i=t.length);for(var n=i-1;n>=0;n--){var a=t[n];if(e(a))return a}},ut.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},ut.almostEquals=function(t,e,i){return Math.abs(t-e)<i},ut.almostWhole=function(t,e){var i=Math.round(t);return i-e<t&&i+e>t},ut.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},ut.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},ut.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},ut.log10=Math.log10?function(t){return Math.log10(t)}:function(t){var e=Math.log(t)*Math.LOG10E,i=Math.round(e);return t===Math.pow(10,i)?i:e},ut.toRadians=function(t){return t*(Math.PI/180)},ut.toDegrees=function(t){return t*(180/Math.PI)},ut._decimalPlaces=function(t){if(ut.isFinite(t)){for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i}},ut.getAngleFromPoint=function(t,e){var i=e.x-t.x,n=e.y-t.y,a=Math.sqrt(i*i+n*n),o=Math.atan2(n,i);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:a}},ut.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},ut.aliasPixel=function(t){return t%2==0?0:.5},ut._alignPixel=function(t,e,i){var n=t.currentDevicePixelRatio,a=i/2;return Math.round((e-a)*n)/n+a},ut.splineCurve=function(t,e,i,n){var a=t.skip?e:t,o=e,r=i.skip?e:i,s=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2)),l=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2)),d=s/(s+l),u=l/(s+l),h=n*(d=isNaN(d)?0:d),c=n*(u=isNaN(u)?0:u);return{previous:{x:o.x-h*(r.x-a.x),y:o.y-h*(r.y-a.y)},next:{x:o.x+c*(r.x-a.x),y:o.y+c*(r.y-a.y)}}},ut.EPSILON=Number.EPSILON||1e-14,ut.splineCurveMonotone=function(t){var e,i,n,a,o,r,s,l,d,u=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),h=u.length;for(e=0;e<h;++e)if(!(n=u[e]).model.skip){if(i=e>0?u[e-1]:null,(a=e<h-1?u[e+1]:null)&&!a.model.skip){var c=a.model.x-n.model.x;n.deltaK=0!==c?(a.model.y-n.model.y)/c:0}!i||i.model.skip?n.mK=n.deltaK:!a||a.model.skip?n.mK=i.deltaK:this.sign(i.deltaK)!==this.sign(n.deltaK)?n.mK=0:n.mK=(i.deltaK+n.deltaK)/2}for(e=0;e<h-1;++e)n=u[e],a=u[e+1],n.model.skip||a.model.skip||(ut.almostEquals(n.deltaK,0,this.EPSILON)?n.mK=a.mK=0:(o=n.mK/n.deltaK,r=a.mK/n.deltaK,(l=Math.pow(o,2)+Math.pow(r,2))<=9||(s=3/Math.sqrt(l),n.mK=o*s*n.deltaK,a.mK=r*s*n.deltaK)));for(e=0;e<h;++e)(n=u[e]).model.skip||(i=e>0?u[e-1]:null,a=e<h-1?u[e+1]:null,i&&!i.model.skip&&(d=(n.model.x-i.model.x)/3,n.model.controlPointPreviousX=n.model.x-d,n.model.controlPointPreviousY=n.model.y-d*n.mK),a&&!a.model.skip&&(d=(a.model.x-n.model.x)/3,n.model.controlPointNextX=n.model.x+d,n.model.controlPointNextY=n.model.y+d*n.mK))},ut.nextItem=function(t,e,i){return i?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},ut.previousItem=function(t,e,i){return i?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},ut.niceNum=function(t,e){var i=Math.floor(ut.log10(t)),n=t/Math.pow(10,i);return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*Math.pow(10,i)},ut.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},ut.getRelativePosition=function(t,e){var i,n,a=t.originalEvent||t,o=t.target||t.srcElement,r=o.getBoundingClientRect(),s=a.touches;s&&s.length>0?(i=s[0].clientX,n=s[0].clientY):(i=a.clientX,n=a.clientY);var l=parseFloat(ut.getStyle(o,"padding-left")),d=parseFloat(ut.getStyle(o,"padding-top")),u=parseFloat(ut.getStyle(o,"padding-right")),h=parseFloat(ut.getStyle(o,"padding-bottom")),c=r.right-r.left-l-u,f=r.bottom-r.top-d-h;return{x:i=Math.round((i-r.left-l)/c*o.width/e.currentDevicePixelRatio),y:n=Math.round((n-r.top-d)/f*o.height/e.currentDevicePixelRatio)}},ut.getConstraintWidth=function(t){return i(t,"max-width","clientWidth")},ut.getConstraintHeight=function(t){return i(t,"max-height","clientHeight")}
1713,ut._calculatePadding=function(t,e,i){return(e=ut.getStyle(t,e)).indexOf("%")>-1?i*parseInt(e,10)/100:parseInt(e,10)},ut._getParentNode=function(t){var e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e},ut.getMaximumWidth=function(t){var e=ut._getParentNode(t);if(!e)return t.clientWidth;var i=e.clientWidth,n=i-ut._calculatePadding(e,"padding-left",i)-ut._calculatePadding(e,"padding-right",i),a=ut.getConstraintWidth(t);return isNaN(a)?n:Math.min(n,a)},ut.getMaximumHeight=function(t){var e=ut._getParentNode(t);if(!e)return t.clientHeight;var i=e.clientHeight,n=i-ut._calculatePadding(e,"padding-top",i)-ut._calculatePadding(e,"padding-bottom",i),a=ut.getConstraintHeight(t);return isNaN(a)?n:Math.min(n,a)},ut.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},ut.retinaScale=function(t,e){var i=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1;if(1!==i){var n=t.canvas,a=t.height,o=t.width;n.height=a*i,n.width=o*i,t.ctx.scale(i,i),n.style.height||n.style.width||(n.style.height=a+"px",n.style.width=o+"px")}},ut.fontString=function(t,e,i){return e+" "+t+"px "+i},ut.longestText=function(t,e,i,n){var a=(n=n||{}).data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(a=n.data={},o=n.garbageCollect=[],n.font=e),t.font=e;var r=0;ut.each(i,function(e){null!=e&&!0!==ut.isArray(e)?r=ut.measureText(t,a,o,r,e):ut.isArray(e)&&ut.each(e,function(e){null==e||ut.isArray(e)||(r=ut.measureText(t,a,o,r,e))})});var s=o.length/2;if(s>i.length){for(var l=0;l<s;l++)delete a[o[l]];o.splice(0,s)}return r},ut.measureText=function(t,e,i,n,a){var o=e[a];return o||(o=e[a]=t.measureText(a).width,i.push(a)),o>n&&(n=o),n},ut.numberOfLabelLines=function(t){var e=1;return ut.each(t,function(t){ut.isArray(t)&&t.length>e&&(e=t.length)}),e},ut.color=X?function(t){return t instanceof CanvasGradient&&(t=st.global.defaultColor),X(t)}:function(t){return console.error("Color.js not found!"),t},ut.getHoverColor=function(t){return t instanceof CanvasPattern||t instanceof CanvasGradient?t:ut.color(t).saturate(.5).darken(.1).rgbString()}}(),ai._adapters=si,ai.Animation=vt,ai.animationService=bt,ai.controllers=ue,ai.DatasetController=Mt,ai.defaults=st,ai.Element=pt,ai.elements=Wt,ai.Interaction=ve,ai.layouts=ke,ai.platform=Ve,ai.plugins=Ee,ai.Scale=fi,ai.scaleService=He,ai.Ticks=li,ai.Tooltip=Je,ai.helpers.each(tn,function(t,e){ai.scaleService.registerScaleType(e,t,t._defaults)}),yn)yn.hasOwnProperty(_n)&&ai.plugins.register(yn[_n]);ai.platform.initialize();var Cn=ai;return"undefined"!=typeof window&&(window.Chart=ai),ai.Chart=ai,ai.Legend=yn.legend._element,ai.Title=yn.title._element,ai.pluginService=ai.plugins,ai.PluginBase=ai.Element.extend({}),ai.canvasHelpers=ai.helpers.canvas,ai.layoutService=ai.layouts,ai.LinearScaleBase=bi,ai.helpers.each(["Bar","Bubble","Doughnut","Line","PolarArea","Radar","Scatter"],function(t){ai[t]=function(e,i){return new ai(e,ai.helpers.merge(i||{},{type:t.charAt(0).toLowerCase()+t.slice(1)}))}}),Cn}); 1714 1715 1716/*! jQuery UI - v1.9.1 - 2012-11-14 1717* http://jqueryui.com 1718* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js 1719* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */ 1720 1721(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return"area"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap=#"+i+"]")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:"a"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,"visibility")==="hidden"}).length}var n=0,r=/^ui-id-\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.9.1",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}
vendor: 12,603 bytes, line 1721
1721):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),function(){var t=/msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r<i.length;r++)e.options[i[r][0]]&&i[r][1].apply(e.element,n)}},contains:e.contains,hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e<t+n},isOver:function(t,n,r,i,s,o){return e.ui.isOverAxis(t,r,s)&&e.ui.isOverAxis(n,i,o)}})})(jQuery);(function(e,t){var n=0,r=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var n=0,r;(r=t[n])!=null;n++)try{e(r).triggerHandler("remove")}catch(s){}i(t)},e.widget=function(t,n,r){var i,s,o,u,a=t.split(".")[0];t=t.split(".")[1],i=a+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[a]=e[a]||{},s=e[a][t],o=e[a][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,i){e.isFunction(i)&&(r[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},r=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=r,s=i.apply(this,arguments),this._super=t,this._superApply=n,s}}())}),o.prototype=e.widget.extend(u,{widgetEventPrefix:u.widgetEventPrefix||t},r,{constructor:o,namespace:a,widgetName:t,widgetBaseClass:i,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o)},e.widget.extend=function(n){var i=r.call(arguments,1),s=0,o=i.length,u,a;for(;s<o;s++)for(u in i[s])a=i[s][u],i[s].hasOwnProperty(u)&&a!==t&&(e.isPlainObject(a)?n[u]=e.isPlainObject(n[u])?e.widget.extend({},n[u],a):e.widget.extend({},a):n[u]=a);return n},e.widget.bridge=function(n,i){var s=i.prototype.widgetFullName;e.fn[n]=function(o){var u=typeof o=="string",a=r.call(arguments,1),f=this;return o=!u&&a.length?e.widget.extend.apply(null,[o].concat(a)):o,u?this.each(function(){var r,i=e.data(this,s);if(!i)return e.error("cannot call methods on "+n+" prior to initialization; "+"attempted to call method '"+o+"'");if(!e.isFunction(i[o])||o.charAt(0)==="_")return e.error("no such method '"+o+"' for "+n+" widget instance");r=i[o].apply(i,a);if(r!==i&&r!==t)return f=r&&r.jquery?f.pushStack(r.get()):r,!1}):this.each(function(){var t=e.data(this,s);t?t.option(o||{})._init():new i(o,this)}),f}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n=="string"){i={},s=n.split("."),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u<s.length-1;u++)o[s[u]]=o[s[u]]||{},o=o[s[u]];n=s.pop();if(r===t)return o[n]===t?null:o[n];o[n]=r}else{if(r===t)return this.options[n]===t?null:this.options[n];i[n]=r}}return this._setOptions(i),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,n){var r,i=this;n?(t=r=e(t),this.bindings=this.bindings.add(t)):(n=t,t=this.element,r=this.widget()),e.each(n,function(n,s){function o(){if(i.options.disabled===!0||e(this).hasClass("ui-state-disabled"))return;return(typeof s=="string"?i[s]:s).apply(i,arguments)}typeof s!="string"&&(o.guid=s.guid=s.guid||o.guid||e.guid++);var u=n.match(/^(\w+)\s*(.*)$/),a=u[1]+i.eventNamespace,f=u[2];f?r.delegate(f,a,o):t.bind(a,o)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&(e.effects.effect[u]||e.uiBackCompat!==!1&&e.effects[u])?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}}),e.uiBackCompat!==!1&&(e.Widget.prototype._getCreateOptions=function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]})})(jQuery);(function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{version:"1.9.1",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which===1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.ui.ie||document.documentMode>=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0
vendor: 18,460 bytes, line 1721
1721}})})(jQuery);(function(e,t){e.widget("ui.draggable",e.ui.mouse,{version:"1.9.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(t),this.handle?(e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1);var r=this.element[0],i=!1;while(r&&(r=r.parentNode))r==document&&(i=!0);if(!i&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!n||this.options.revert=="valid"&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)){var s=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",t)!==!1&&s._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo=="parent"?this.element[0].parentNode:n.appendTo),r[0]!=this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.ui.ie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[t.containment=="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t.containment=="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(t.containment=="document"?0:e(window).scrollLeft())+e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(t.containment=="document"?0:e(window).scrollTop())+(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)&&t.containment.constructor!=Array){var n=e(t.containment),r=n[0];if(!r)return;var i=n.offset(),s=e(r).css("overflow")!="hidden";this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(s?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else t.containment.constructor==Array&&(this.containment=t.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName),s=t.pageX,o=t.pageY;if(this.originalPosition){var u;if(this.containment){if(this.relative_container){var a=this.relative_container.offset();u=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]}else u=this.containment;t.pageX-this.offset.click.left<u[0]&&(s=u[0]+this.offset.click.left),t.pageY-this.offset.click.top<u[1]&&(o=u[1]+this.offset.click.top),t.pageX-this.offset.click.left>u[2]&&(s=u[2]+this.offset.click.left),t.pageY-this.offset.click.top>u[3]&&(o=u[3]+this.offset.click.top)}if(n.grid){var f=n.grid[1]?this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY;o=u?f-this.offset.click.top<u[1]||f-this.offset.click.top>u[3]?f-this.offset.click.top<u[1]?f+n.grid[1]:f-n.grid[1]:f:f;var l=n.grid[0]?this.originalPageX+Math.round((s-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX;s=u?l-this.offset.click.left<u[0]||l-this.offset.click.left>u[2]?l-this.offset.click.left<u[0]?l+n.grid[0]:l-n.grid[0]:l:l}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():i?0:r.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:r.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r]),t=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(e){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n){var r=e(this).data("draggable"),i=r.options,s=e.extend({},n,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var n=e.data(this,"sortable");n&&!n.options.disabled&&(r.sortables.push({instance:n,shouldRevert:n.options.revert}),n.refreshPositions(),n._trigger("activate",t,s))})},stop:function(t,n){var r=e(this).data("draggable"),i=e.extend({},n,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,r.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,n){var r=e(this).data("draggable"),i=this,s=function(t){var n=this.offset.click.top,r=this.offset.click.left,i=this.positionAbs.top,s=this.positionAbs.left,o=t.height,u=t.width,a=t.top,f=t.left;return e.ui.isOver(i+n,s+r,a,f,o,u)};e.each(r.sortables,function(s){var o=!1,u=this;this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(o=!0,e.each(r.sortables,function(){return this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this!=u&&this.instance._intersectsWith(this.instance.containerCache)&&e.ui.contains(u.instance.element[0],this.instance.element[0])&&(o=!1),o})),o?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return n.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n){var r=e("body"),i=e(this).data("draggable").options;r.css("cursor")&&(i._cursor=r.css("cursor")),r.css("cursor",i.cursor)},stop:function(t,n){var r=e(this).data("draggable").options;r._cursor&&e("body").css("cursor",r._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,n){var r=e(this).data("draggable").options;r._opacity&&e(n.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(t,n){var r=e(this).data("draggable");r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"&&(r.overflowOffset=r.scrollParent.offset())},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=!1;if(r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"){if(!i.axis||i.axis!="x")r.overflowOffset.top+r.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop-i.scrollSpeed);if(!i.axis||i.axis!="y")r.overflowOffset.left+r.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft-i.scrollSpeed)}else{if(!i.axis||i.axis!="x")t.pageY-e(document).scrollTop()<i.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed));if(!i.axis||i.axis!="y")t.pageX-e(document).scrollLeft()<i.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed))}s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n){var r=e(this).data("draggable"),i=r.options;r.snapElements=[],e(i.snap.constructor!=String?i.snap.items||":data(draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!=r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=i.snapTolerance,o=n.offset.left,u=o+r.helperProportions.width,a=n.offset.top,f=a+r.helperProportions.height;for(var l=r.snapElements.length-1;l>=0;l--){var c=r.snapElements[l].left,h=c+r.snapElements[l].width,p=r.snapElements[l].top,d=p+r.snapElements[l].height;if(!(c-s<o&&o<h+s&&p-s<a&&a<d+s||c-s<o&&o<h+s&&p-s<f&&f<d+s||c-s<u&&u<h+s&&p-s<a&&a<d+s||c-s<u&&u<h+s&&p-s<f&&f<d+s)){r.snapElements[l].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=!1;continue}if(i.snapMode!="inner"){var v=Math.abs(p-f)<=s,m=Math.abs(d-a)<=s,g=Math.abs(c-u)<=s,y=Math.abs(h-o)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p-r.helperProportions.height,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c-r.helperProportions.width}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h}).left-r.margins.left)}var b=v||m||g||y;if(i.snapMode!="outer"){var v=Math.abs(p-a)<=s,m=Math.abs(d-f)<=s,g=Math.abs(c-o)<=s,y=Math.abs(h-u)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d-r.helperProportions.height,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h-r.helperProportions.width}).left-r.margins.left)}!r.snapElements[l].snapping&&(v||m||g||y||b)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=v||m||g||y||b}}}),e.ui.plugin.add("draggable","stack",{start:function(t,n){var r=e(this).data("draggable").options,i=e.makeArray(e(r.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});if(!i.length)return;var s=parseInt(i[0].style.zIndex)||0;e(i).each(function(e){this.style.zIndex=s+e}),this[0].style.zIndex=s+i.length}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,n){var r=e(this).data("draggable").options;r._zIndex&&e(n.helper).css("zIndex",r._zIndex)}})})(jQuery);
1721 1722
vendor: 60,950 bytes, lines 1723-1725
1723/*! jPlayer 2.9.2 for jQuery ~ (c) 2009-2014 Happyworm Ltd ~ MIT License */ 1724!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):b("object"==typeof exports?require("jquery"):a.jQuery?a.jQuery:a.Zepto)}(this,function(a,b){a.fn.jPlayer=function(c){var d="jPlayer",e="string"==typeof c,f=Array.prototype.slice.call(arguments,1),g=this;return c=!e&&f.length?a.extend.apply(null,[!0,c].concat(f)):c,e&&"_"===c.charAt(0)?g:(this.each(e?function(){var e=a(this).data(d),h=e&&a.isFunction(e[c])?e[c].apply(e,f):e;return h!==e&&h!==b?(g=h,!1):void 0}:function(){var b=a(this).data(d);b?b.option(c||{}):a(this).data(d,new a.jPlayer(c,this))}),g)},a.jPlayer=function(b,c){if(arguments.length){this.element=a(c),this.options=a.extend(!0,{},this.options,b);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()}),this._init()}},"function"!=typeof a.fn.stop&&(a.fn.stop=function(){}),a.jPlayer.emulateMethods="load play pause",a.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate",a.jPlayer.emulateOptions="muted volume",a.jPlayer.reservedEvent="ready flashreset resize repeat error warning",a.jPlayer.event={},a.each(["ready","setmedia","flashreset","resize","repeat","click","error","warning","loadstart","progress","suspend","abort","emptied","stalled","play","pause","loadedmetadata","loadeddata","waiting","playing","canplay","canplaythrough","seeking","seeked","timeupdate","ended","ratechange","durationchange","volumechange"],function(){a.jPlayer.event[this]="jPlayer_"+this}),a.jPlayer.htmlEvent=["loadstart","abort","emptied","stalled","loadedmetadata","canplay","canplaythrough"],a.jPlayer.pause=function(){a.jPlayer.prototype.destroyRemoved(),a.each(a.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})},a.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var c=function(){this.init()};c.prototype={init:function(){this.options={timeFormat:a.jPlayer.timeFormat}},time:function(a){a=a&&"number"==typeof a?a:0;var b=new Date(1e3*a),c=b.getUTCHours(),d=this.options.timeFormat.showHour?b.getUTCMinutes():b.getUTCMinutes()+60*c,e=this.options.timeFormat.showMin?b.getUTCSeconds():b.getUTCSeconds()+60*d,f=this.options.timeFormat.padHour&&10>c?"0"+c:c,g=this.options.timeFormat.padMin&&10>d?"0"+d:d,h=this.options.timeFormat.padSec&&10>e?"0"+e:e,i="";return i+=this.options.timeFormat.showHour?f+this.options.timeFormat.sepHour:"",i+=this.options.timeFormat.showMin?g+this.options.timeFormat.sepMin:"",i+=this.options.timeFormat.showSec?h+this.options.timeFormat.sepSec:""}};var d=new c;a.jPlayer.convertTime=function(a){return d.time(a)},a.jPlayer.uaBrowser=function(a){var b=a.toLowerCase(),c=/(webkit)[ \/]([\w.]+)/,d=/(opera)(?:.*version)?[ \/]([\w.]+)/,e=/(msie) ([\w.]+)/,f=/(mozilla)(?:.*? rv:([\w.]+))?/,g=c.exec(b)||d.exec(b)||e.exec(b)||b.indexOf("compatible")<0&&f.exec(b)||[];return{browser:g[1]||"",version:g[2]||"0"}},a.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),c=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/,d=/(ipad|playbook)/,e=/(android)/,f=/(mobile)/,g=c.exec(b)||[],h=d.exec(b)||!f.exec(b)&&e.exec(b)||[];return g[1]&&(g[1]=g[1].replace(/\s/g,"_")),{platform:g[1]||"",tablet:h[1]||""}},a.jPlayer.browser={},a.jPlayer.platform={};var e=a.jPlayer.uaBrowser(navigator.userAgent);e.browser&&(a.jPlayer.browser[e.browser]=!0,a.jPlayer.browser.version=e.version);var f=a.jPlayer.uaPlatform(navigator.userAgent);f.platform&&(a.jPlayer.platform[f.platform]=!0,a.jPlayer.platform.mobile=!f.tablet,a.jPlayer.platform.tablet=!!f.tablet),a.jPlayer.getDocMode=function(){var b;return a.jPlayer.browser.msie&&(document.documentMode?b=document.documentMode:(b=5,document.compatMode&&"CSS1Compat"===document.compatMode&&(b=7))),b},a.jPlayer.browser.documentMode=a.jPlayer.getDocMode(),a.jPlayer.nativeFeatures={init:function(){var a,b,c,d=document,e=d.createElement("video"),f={w3c:["fullscreenEnabled","fullscreenElement","requestFullscreen","exitFullscreen","fullscreenchange","fullscreenerror"],moz:["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror"],webkit:["","webkitCurrentFullScreenElement","webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange",""],webkitVideo:["webkitSupportsFullscreen","webkitDisplayingFullscreen","webkitEnterFullscreen","webkitExitFullscreen","",""],ms:["","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError"]},g=["w3c","moz","webkit","webkitVideo","ms"];for(this.fullscreen=a={support:{w3c:!!d[f.w3c[0]],moz:!!d[f.moz[0]],webkit:"function"==typeof d[f.webkit[3]],webkitVideo:"function"==typeof e[f.webkitVideo[2]],ms:"function"==typeof e[f.ms[2]]},used:{}},b=0,c=g.length;c>b;b++){var h=g[b];if(a.support[h]){a.spec=h,a.used[h]=!0;break}}if(a.spec){var i=f[a.spec];a.api={fullscreenEnabled:!0,fullscreenElement:function(a){return a=a?a:d,a[i[1]]},requestFullscreen:function(a){return a[i[2]]()},exitFullscreen:function(a){return a=a?a:d,a[i[3]]()}},a.event={fullscreenchange:i[4],fullscreenerror:i[5]}}else a.api={fullscreenEnabled:!1,fullscreenElement:function(){return null},requestFullscreen:function(){},exitFullscreen:function(){}},a.event={}}},a.jPlayer.nativeFeatures.init(),a.jPlayer.focus=null,a.jPlayer.keyIgnoreElementNames="A INPUT TEXTAREA SELECT BUTTON";var g=function(b){var c,d=a.jPlayer.focus;d&&(a.each(a.jPlayer.keyIgnoreElementNames.split(/\s+/g),function(a,d){return b.target.nodeName.toUpperCase()===d.toUpperCase()?(c=!0,!1):void 0}),c||a.each(d.options.keyBindings,function(c,e){return e&&a.isFunction(e.fn)&&("number"==typeof e.key&&b.which===e.key||"string"==typeof e.key&&b.key===e.key)?(b.preventDefault(),e.fn(d),!1):void 0}))};a.jPlayer.keys=function(b){var c="keydown.jPlayer";a(document.documentElement).unbind(c),b&&a(document.documentElement).bind(c,g)},a.jPlayer.keys(!0),a.jPlayer.prototype={count:0,version:{script:"2.9.2",needFlash:"2.9.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",auroraFormats:"wav",preload:"metadata",volume:.8,muted:!1,remainingDuration:!1,toggleDuration:!1,captureDuration:!0,playbackRate:1,defaultPlaybackRate:1,minPlaybackRate:.5,maxPlaybackRate:4,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",playbackRateBar:".jp-playback-rate-bar",playbackRateBarValue:".jp-playback-rate-bar-value",currentTime:".jp-current-time",duration:".jp-duration",title:".jp-title",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},stateClass:{playing:"jp-state-playing",seeking:"jp-state-seeking",muted:"jp-state-muted",looped:"jp-state-looped",fullScreen:"jp-state-full-screen",noVolume:"jp-state-no-volume"},useStateClassSkin:!1,autoBlur:!0,smoothPlayBar:!1,fullScreen:!1,fullWindow:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1e3},loop:!1,repeat:function(b){b.jPlayer.options.loop?a(this).unbind(".jPlayerRepeat").bind(a.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){a(this).jPlayer("play")}):a(this).unbind(".jPlayerRepeat")},nativeVideoControls:{},noFullWindow:{msie:/msie [0-6]\./,ipad:/ipad.*?os [0-4]\./,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3]\.(?!.*?mobile)/,android_phone:/(?=.*android)(?!.*chrome)(?=.*mobile)/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/,playbook:/playbook/},timeFormat:{},keyEnabled:!1,audioFullScreen:!1,keyBindings:{play:{key:80,fn:function(a){a.status.paused?a.play():a.pause()}},fullScreen:{key:70,fn:function(a){(a.status.video||a.options.audioFullScreen)&&a._setOption("fullScreen",!a.options.fullScreen)}},muted:{key:77,fn:function(a){a._muted(!a.options.muted)}},volumeUp:{key:190,fn:function(a){a.volume(a.options.volume+.1)}},volumeDown:{key:188,fn:function(a){a.volume(a.options.volume-.1)}},loop:{key:76,fn:function(a){a._loop(!a.options.loop)}}},verticalVolume:!1,verticalPlaybackRate:!1,globalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,consoleAlerts:!0,errorAlerts:!1,warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,remaining:0,videoWidth:0,videoHeight:0,readyState:0,networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,aurora:!0,flash:!0},format:{mp3:{codec:"audio/mpeg",flashCanPlay:!0,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},m3u8a:{codec:'application/vnd.apple.mpegurl; codecs="mp4a.40.2"',flashCanPlay:!1,media:"audio"},m3ua:{codec:"audio/mpegurl",flashCanPlay:!1,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis, opus"',flashCanPlay:!1,media:"audio"},flac:{codec:"audio/x-flac",flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},rtmpa:{codec:'audio/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},m3u8v:{codec:'application/vnd.apple.mpegurl; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!1,media:"video"},m3uv:{codec:"audio/mpegurl",flashCanPlay:!1,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"},rtmpv:{codec:'video/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"video"}},_init:function(){var c=this;if(this.element.empty(),this.status=a.extend({},this.status),this.internal=a.extend({},this.internal),this.options.timeFormat=a.extend({},a.jPlayer.timeFormat,this.options.timeFormat),this.internal.cmdsIgnored=a.jPlayer.platform.ipad||a.jPlayer.platform.iphone||a.jPlayer.platform.ipod,this.internal.domNode=this.element.get(0),this.options.keyEnabled&&!a.jPlayer.focus&&(a.jPlayer.focus=this),this.androidFix={setMedia:!1,play:!1,pause:!1,time:0/0},a.jPlayer.platform.android&&(this.options.preload="auto"!==this.options.preload?"metadata":"auto"),this.formats=[],this.solutions=[],this.require={},this.htmlElement={},this.html={},this.html.audio={},this.html.video={},this.aurora={},this.aurora.formats=[],this.aurora.properties=[],this.flash={},this.css={},this.css.cs={},this.css.jq={},this.ancestorJq=[],this.options.volume=this._limitValue(this.options.volume,0,1),a.each(this.options.supplied.toLowerCase().split(","),function(b,d){var e=d.replace(/^\s+|\s+$/g,"");if(c.format[e]){var f=!1;a.each(c.formats,function(a,b){return e===b?(f=!0,!1):void 0}),f||c.formats.push(e)}}),a.each(this.options.solution.toLowerCase().split(","),function(b,d){var e=d.replace(/^\s+|\s+$/g,"");if(c.solution[e]){var f=!1;a.each(c.solutions,function(a,b){return e===b?(f=!0,!1):void 0}),f||c.solutions.push(e)}}),a.each(this.options.auroraFormats.toLowerCase().split(","),function(b,d){var e=d.replace(/^\s+|\s+$/g,"");if(c.format[e]){var f=!1;a.each(c.aurora.formats,function(a,b){return e===b?(f=!0,!1):void 0}),f||c.aurora.formats.push(e)}}),this.internal.instance="jp_"+this.count,this.instances[this.internal.instance]=this.element,this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count),this.internal.self=a.extend({},{id:this.element.attr("id"),jq:this.element}),this.internal.audio=a.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:b}),this.internal.video=a.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:b}),this.internal.flash=a.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:b,swf:this.options.swfPath+(".swf"!==this.options.swfPath.toLowerCase().slice(-4)?(this.options.swfPath&&"/"!==this.options.swfPath.slice(-1)?"/":"")+"jquery.jplayer.swf":"")}),this.internal.poster=a.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:b}),a.each(a.jPlayer.event,function(a,d){c.options[a]!==b&&(c.element.bind(d+".jPlayer",c.options[a]),c.options[a]=b)}),this.require.audio=!1,this.require.video=!1,a.each(this.formats,function(a,b){c.require[c.format[b].media]=!0}),this.options=this.require.video?a.extend(!0,{},this.optionsVideo,this.options):a.extend(!0,{},this.optionsAudio,this.options),this._setSize(),this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls),this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow),this.status.noVolume=this._uaBlocklist(this.options.noVolume),a.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled&&this._fullscreenAddEventListeners(),this._restrictNativeVideoControls(),this.htmlElement.poster=document.createElement("img"),this.htmlElement.poster.id=this.internal.poster.id,this.htmlElement.poster.onload=function(){(!c.status.video||c.status.waitForPlay)&&c.internal.poster.jq.show()},this.element.append(this.htmlElement.poster),this.internal.poster.jq=a("#"+this.internal.poster.id),this.internal.poster.jq.css({width:this.status.width,height:this.status.height}),this.internal.poster.jq.hide(),this.internal.poster.jq.bind("click.jPlayer",function(){c._trigger(a.jPlayer.event.click)}),this.html.audio.available=!1,this.require.audio&&(this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio)),this.html.video.available=!1,this.require.video&&(this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video)),this.flash.available=this._checkForFlash(10.1),this.html.canPlay={},this.aurora.canPlay={},this.flash.canPlay={},a.each(this.formats,function(b,d){c.html.canPlay[d]=c.html[c.format[d].media].available&&""!==c.htmlElement[c.format[d].media].canPlayType(c.format[d].codec),c.aurora.canPlay[d]=a.inArray(d,c.aurora.formats)>-1,c.flash.canPlay[d]=c.format[d].flashCanPlay&&c.flash.available}),this.html.desired=!1,this.aurora.desired=!1,this.flash.desired=!1,a.each(this.solutions,function(b,d){if(0===b)c[d].desired=!0;else{var e=!1,f=!1;a.each(c.formats,function(a,b){c[c.solutions[0]].canPlay[b]&&("video"===c.format[b].media?f=!0:e=!0)}),c[d].desired=c.require.audio&&!e||c.require.video&&!f}}),this.html.support={},this.aurora.support={},this.flash.support={},a.each(this.formats,function(a,b){c.html.support[b]=c.html.canPlay[b]&&c.html.desired,c.aurora.support[b]=c.aurora.canPlay[b]&&c.aurora.desired,c.flash.support[b]=c.flash.canPlay[b]&&c.flash.desired}),this.html.used=!1,this.aurora.used=!1,this.flash.used=!1,a.each(this.solutions,function(b,d){a.each(c.formats,function(a,b){return c[d].support[b]?(c[d].used=!0,!1):void 0})}),this._resetActive(),this._resetGate(),this._cssSelectorAncestor(this.options.cssSelectorAncestor),this.html.used||this.aurora.used||this.flash.used?this.css.jq.noSolution.length&&this.css.jq.noSolution.hide():(this._error({type:a.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:a.jPlayer.errorMsg.NO_SOLUTION,hint:a.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()),this.flash.used){var d,e="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+"&muted="+this.options.muted;if(a.jPlayer.browser.msie&&(Number(a.jPlayer.browser.version)<9||a.jPlayer.browser.documentMode<9)){var f='<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>',g=['<param name="movie" value="'+this.internal.flash.swf+'" />','<param name="FlashVars" value="'+e+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];d=document.createElement(f);for(var h=0;h<g.length;h++)d.appendChild(document.createElement(g[h]))}else{var i=function(a,b,c){var d=document.createElement("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)};d=document.createElement("object"),d.setAttribute("id",this.internal.flash.id),d.setAttribute("name",this.internal.flash.id),d.setAttribute("data",this.internal.flash.swf),d.setAttribute("type","application/x-shockwave-flash"),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("tabindex","-1"),i(d,"flashvars",e),i(d,"allowscriptaccess","always"),i(d,"bgcolor",this.options.backgroundColor),i(d,"wmode",this.options.wmode)}this.element.append(d),this.internal.flash.jq=a(d)}this.status.playbackRateEnabled=this.html.used&&!this.flash.used?this._testPlaybackRate("audio"):!1,this._updatePlaybackRate(),this.html.used&&(this.html.audio.available&&(this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=a("#"+this.internal.audio.id)),this.html.video.available&&(this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video),this.internal.video.jq=a("#"+this.internal.video.id),this.internal.video.jq.css(this.status.nativeVideoControls?{width:this.status.width,height:this.status.height}:{width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",function(){c._trigger(a.jPlayer.event.click)}))),this.aurora.used,this.options.emulateHtml&&this._emulateHtmlBridge(),!this.html.used&&!this.aurora.used||this.flash.used||setTimeout(function(){c.internal.ready=!0,c.version.flash="n/a",c._trigger(a.jPlayer.event.repeat),c._trigger(a.jPlayer.event.ready)},100),this._updateNativeVideoControls(),this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),a.jPlayer.prototype.count++},destroy:function(){this.clearMedia(),this._removeUiClass(),this.css.jq.currentTime.length&&this.css.jq.currentTime.text(""),this.css.jq.duration.length&&this.css.jq.duration.text(""),a.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")}),this.internal.poster.jq.unbind(".jPlayer"),this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer"),this._fullscreenRemoveEventListeners(),this===a.jPlayer.focus&&(a.jPlayer.focus=null),this.options.emulateHtml&&this._destroyHtmlBridge(),this.element.removeData("jPlayer"),this.element.unbind(".jPlayer"),this.element.empty(),delete this.instances[this.internal.instance]},destroyRemoved:function(){var b=this;a.each(this.instances,function(a,c){b.element!==c&&(c.data("jPlayer")||(c.jPlayer("destroy"),delete b.instances[a]))})},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_testPlaybackRate:function(a){var b,c=.5;a="string"==typeof a?a:"audio",b=document.createElement(a);try{return"playbackRate"in b?(b.playbackRate=c,b.playbackRate===c):!1}catch(d){return!1}},_uaBlocklist:function(b){var c=navigator.userAgent.toLowerCase(),d=!1;return a.each(b,function(a,b){return b&&b.test(c)?(d=!0,!1):void 0}),d},_restrictNativeVideoControls:function(){this.require.audio&&this.status.nativeVideoControls&&(this.status.nativeVideoControls=!1,this.status.noFullWindow=!0)},_updateNativeVideoControls:function(){this.html.video.available&&this.html.used&&(this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})):this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"})))},_addHtmlEventListeners:function(b,c){var d=this;b.preload=this.options.preload,b.muted=this.options.muted,b.volume=this.options.volume,this.status.playbackRateEnabled&&(b.defaultPlaybackRate=this.options.defaultPlaybackRate,b.playbackRate=this.options.playbackRate),b.addEventListener("progress",function(){c.gate&&(d.internal.cmdsIgnored&&this.readyState>0&&(d.internal.cmdsIgnored=!1),d._getHtmlStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.progress))},!1),b.addEventListener("loadeddata",function(){c.gate&&(d.androidFix.setMedia=!1,d.androidFix.play&&(d.androidFix.play=!1,d.play(d.androidFix.time)),d.androidFix.pause&&(d.androidFix.pause=!1,d.pause(d.androidFix.time)),d._trigger(a.jPlayer.event.loadeddata))},!1),b.addEventListener("timeupdate",function(){c.gate&&(d._getHtmlStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.timeupdate))},!1),b.addEventListener("durationchange",function(){c.gate&&(d._getHtmlStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.durationchange))},!1),b.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(a.jPlayer.event.play))},!1),b.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(a.jPlayer.event.playing))},!1),b.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(a.jPlayer.event.pause))},!1),b.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(a.jPlayer.event.waiting))},!1),b.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(a.jPlayer.event.seeking))},!1),b.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(a.jPlayer.event.seeked))},!1),b.addEventListener("volumechange",function(){c.gate&&(d.options.volume=b.volume,d.options.muted=b.muted,d._updateMute(),d._updateVolume(),d._trigger(a.jPlayer.event.volumechange))},!1),b.addEventListener("ratechange",function(){c.gate&&(d.options.defaultPlaybackRate=b.defaultPlaybackRate,d.options.playbackRate=b.playbackRate,d._updatePlaybackRate(),d._trigger(a.jPlayer.event.ratechange))},!1),b.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(a.jPlayer.event.suspend))},!1),b.addEventListener("ended",function(){c.gate&&(a.jPlayer.browser.webkit||(d.htmlElement.media.currentTime=0),d.htmlElement.media.pause(),d._updateButtons(!1),d._getHtmlStatus(b,!0),d._updateInterface(),d._trigger(a.jPlayer.event.ended))},!1),b.addEventListener("error",function(){c.gate&&(d._updateButtons(!1),d._seeked(),d.status.srcSet&&(clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:a.jPlayer.error.URL,context:d.status.src,message:a.jPlayer.errorMsg.URL,hint:a.jPlayer.errorHint.URL})))},!1),a.each(a.jPlayer.htmlEvent,function(e,f){b.addEventListener(this,function(){c.gate&&d._trigger(a.jPlayer.event[f])},!1)})},_addAuroraEventListeners:function(b,c){var d=this;b.volume=100*this.options.volume,b.on("progress",function(){c.gate&&(d.internal.cmdsIgnored&&this.readyState>0&&(d.internal.cmdsIgnored=!1),d._getAuroraStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.progress),b.duration>0&&d._trigger(a.jPlayer.event.timeupdate))},!1),b.on("ready",function(){c.gate&&d._trigger(a.jPlayer.event.loadeddata)},!1),b.on("duration",function(){c.gate&&(d._getAuroraStatus(b),d._updateInterface(),d._trigger(a.jPlayer.event.durationchange))},!1),b.on("end",function(){c.gate&&(d._updateButtons(!1),d._getAuroraStatus(b,!0),d._updateInterface(),d._trigger(a.jPlayer.event.ended))},!1),b.on("error",function(){c.gate&&(d._updateButtons(!1),d._seeked(),d.status.srcSet&&(d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:a.jPlayer.error.URL,context:d.status.src,message:a.jPlayer.errorMsg.URL,hint:a.jPlayer.errorHint.URL})))},!1)},_getHtmlStatus:function(a,b){var c=0,d=0,e=0,f=0;isFinite(a.duration)&&(this.status.duration=a.duration),c=a.currentTime,d=this.status.duration>0?100*c/this.status.duration:0,"object"==typeof a.seekable&&a.seekable.length>0?(e=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=this.status.duration>0?100*a.currentTime/a.seekable.end(a.seekable.length-1):0):(e=100,f=d),b&&(c=0,f=0,d=0),this.status.seekPercent=e,this.status.currentPercentRelative=f,this.status.currentPercentAbsolute=d,this.status.currentTime=c,this.status.remaining=this.status.duration-this.status.currentTime,this.status.videoWidth=a.videoWidth,this.status.videoHeight=a.videoHeight,this.status.readyState=a.readyState,this.status.networkState=a.networkState,this.status.playbackRate=a.playbackRate,this.status.ended=a.ended},_getAuroraStatus:function(a,b){var c=0,d=0,e=0,f=0;this.status.duration=a.duration/1e3,c=a.currentTime/1e3,d=this.status.duration>0?100*c/this.status.duration:0,a.buffered>0?(e=this.status.duration>0?a.buffered*this.status.duration/this.status.duration:100,f=this.status.duration>0?c/(a.buffered*this.status.duration):0):(e=100,f=d),b&&(c=0,f=0,d=0),this.status.seekPercent=e,this.status.currentPercentRelative=f,this.status.currentPercentAbsolute=d,this.status.currentTime=c,this.status.remaining=this.status.duration-this.status.currentTime,this.status.readyState=4,this.status.networkState=0,this.status.playbackRate=1,this.status.ended=!1},_resetStatus:function(){this.status=a.extend({},this.status,a.jPlayer.prototype.status)},_trigger:function(b,c,d){var e=a.Event(b);e.jPlayer={},e.jPlayer.version=a.extend({},this.version),e.jPlayer.options=a.extend(!0,{},this.options),e.jPlayer.status=a.extend(!0,{},this.status),e.jPlayer.html=a.extend(!0,{},this.html),e.jPlayer.aurora=a.extend(!0,{},this.aurora),e.jPlayer.flash=a.extend(!0,{},this.flash),c&&(e.jPlayer.error=a.extend({},c)),d&&(e.jPlayer.warning=a.extend({},d)),this.element.trigger(e)},jPlayerFlashEvent:function(b,c){if(b===a.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media),this.volumeWorker(this.options.volume),d>0&&(e?this.pause(d):this.play(d))}this._trigger(a.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:a.jPlayer.error.VERSION,context:this.version.flash,message:a.jPlayer.errorMsg.VERSION+this.version.flash,hint:a.jPlayer.errorHint.VERSION}),this._trigger(a.jPlayer.event.repeat),this._trigger(b);if(this.flash.gate)switch(b){case a.jPlayer.event.progress:this._getFlashStatus(c),this._updateInterface(),this._trigger(b);break;case a.jPlayer.event.timeupdate:this._getFlashStatus(c),this._updateInterface(),this._trigger(b);break;case a.jPlayer.event.play:this._seeked(),this._updateButtons(!0),this._trigger(b);break;case a.jPlayer.event.pause:this._updateButtons(!1),this._trigger(b);break;case a.jPlayer.event.ended:this._updateButtons(!1),this._trigger(b);break;case a.jPlayer.event.click:this._trigger(b);break;case a.jPlayer.event.error:this.status.waitForLoad=!0,this.status.waitForPlay=!0,this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"}),this._validString(this.status.media.poster)&&this.internal.poster.jq.show(),this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show(),this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media),this._updateButtons(!1),this._error({type:a.jPlayer.error.URL,context:c.src,message:a.jPlayer.errorMsg.URL,hint:a.jPlayer.errorHint.URL});break;case a.jPlayer.event.seeking:this._seeking(),this._trigger(b);break;case a.jPlayer.event.seeked:this._seeked(),this._trigger(b);break;case a.jPlayer.event.ready:break;default:this._trigger(b)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent,this.status.currentPercentRelative=a.currentPercentRelative,this.status.currentPercentAbsolute=a.currentPercentAbsolute,this.status.currentTime=a.currentTime,this.status.duration=a.duration,this.status.remaining=a.duration-a.currentTime,this.status.videoWidth=a.videoWidth,this.status.videoHeight=a.videoHeight,this.status.readyState=4,this.status.networkState=0,this.status.playbackRate=1,this.status.ended=!1},_updateButtons:function(a){a===b?a=!this.status.paused:this.status.paused=!a,a?this.addStateClass("playing"):this.removeStateClass("playing"),!this.status.noFullWindow&&this.options.fullWindow?this.addStateClass("fullScreen"):this.removeStateClass("fullScreen"),this.options.loop?this.addStateClass("looped"):this.removeStateClass("looped"),this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide())),this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&(this.status.noFullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide())),this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%"),this.css.jq.playBar.length&&(this.options.smoothPlayBar?this.css.jq.playBar.stop().animate({width:this.status.currentPercentAbsolute+"%"},250,"linear"):this.css.jq.playBar.width(this.status.currentPercentRelative+"%"));var a="";this.css.jq.currentTime.length&&(a=this._convertTime(this.status.currentTime),a!==this.css.jq.currentTime.text()&&this.css.jq.currentTime.text(this._convertTime(this.status.currentTime)));var b="",c=this.status.duration,d=this.status.remaining;this.css.jq.duration.length&&("string"==typeof this.status.media.duration?b=this.status.media.duration:("number"==typeof this.status.media.duration&&(c=this.status.media.duration,d=c-this.status.currentTime),b=this.options.remainingDuration?(d>0?"-":"")+this._convertTime(d):this._convertTime(c)),b!==this.css.jq.duration.text()&&this.css.jq.duration.text(b))},_convertTime:c.prototype.time,_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg"),this.addStateClass("seeking")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg"),this.removeStateClass("seeking")},_resetGate:function(){this.html.audio.gate=!1,this.html.video.gate=!1,this.aurora.gate=!1,this.flash.gate=!1},_resetActive:function(){this.html.active=!1,this.aurora.active=!1,this.flash.active=!1},_escapeHtml:function(a){return a.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""")},_qualifyURL:function(a){var b=document.createElement("div"); 1725return b.innerHTML='<a href="'+this._escapeHtml(a)+'">x</a>',b.firstChild.href},_absoluteMediaUrls:function(b){var c=this;return a.each(b,function(a,d){d&&c.format[a]&&"data:"!==d.substr(0,5)&&(b[a]=c._qualifyURL(d))}),b},addStateClass:function(a){this.ancestorJq.length&&this.ancestorJq.addClass(this.options.stateClass[a])},removeStateClass:function(a){this.ancestorJq.length&&this.ancestorJq.removeClass(this.options.stateClass[a])},setMedia:function(b){var c=this,d=!1,e=this.status.media.poster!==b.poster;this._resetMedia(),this._resetGate(),this._resetActive(),this.androidFix.setMedia=!1,this.androidFix.play=!1,this.androidFix.pause=!1,b=this._absoluteMediaUrls(b),a.each(this.formats,function(e,f){var g="video"===c.format[f].media;return a.each(c.solutions,function(e,h){if(c[h].support[f]&&c._validString(b[f])){var i="html"===h,j="aurora"===h;return g?(i?(c.html.video.gate=!0,c._html_setVideo(b),c.html.active=!0):(c.flash.gate=!0,c._flash_setVideo(b),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(i?(c.html.audio.gate=!0,c._html_setAudio(b),c.html.active=!0,a.jPlayer.platform.android&&(c.androidFix.setMedia=!0)):j?(c.aurora.gate=!0,c._aurora_setAudio(b),c.aurora.active=!0):(c.flash.gate=!0,c._flash_setAudio(b),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1),d=!0,!1}}),d?!1:void 0}),d?(this.status.nativeVideoControls&&this.html.video.gate||this._validString(b.poster)&&(e?this.htmlElement.poster.src=b.poster:this.internal.poster.jq.show()),"string"==typeof b.title&&(this.css.jq.title.length&&this.css.jq.title.html(b.title),this.htmlElement.audio&&this.htmlElement.audio.setAttribute("title",b.title),this.htmlElement.video&&this.htmlElement.video.setAttribute("title",b.title)),this.status.srcSet=!0,this.status.media=a.extend({},b),this._updateButtons(!1),this._updateInterface(),this._trigger(a.jPlayer.event.setmedia)):this._error({type:a.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:a.jPlayer.errorMsg.NO_SUPPORT,hint:a.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus(),this._updateButtons(!1),this._updateInterface(),this._seeked(),this.internal.poster.jq.hide(),clearTimeout(this.internal.htmlDlyCmdId),this.html.active?this._html_resetMedia():this.aurora.active?this._aurora_resetMedia():this.flash.active&&this._flash_resetMedia()},clearMedia:function(){this._resetMedia(),this.html.active?this._html_clearMedia():this.aurora.active?this._aurora_clearMedia():this.flash.active&&this._flash_clearMedia(),this._resetGate(),this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.aurora.active?this._aurora_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},focus:function(){this.options.keyEnabled&&(a.jPlayer.focus=this)},play:function(a){var b="object"==typeof a;b&&this.options.useStateClassSkin&&!this.status.paused?this.pause(a):(a="number"==typeof a?a:0/0,this.status.srcSet?(this.focus(),this.html.active?this._html_play(a):this.aurora.active?this._aurora_play(a):this.flash.active&&this._flash_play(a)):this._urlNotSetError("play"))},videoPlay:function(){this.play()},pause:function(a){a="number"==typeof a?a:0/0,this.status.srcSet?this.html.active?this._html_pause(a):this.aurora.active?this._aurora_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},tellOthers:function(b,c){var d=this,e="function"==typeof c,f=Array.prototype.slice.call(arguments);"string"==typeof b&&(e&&f.splice(1,1),a.jPlayer.prototype.destroyRemoved(),a.each(this.instances,function(){d.element!==this&&(!e||c.call(this.data("jPlayer"),d))&&this.jPlayer.apply(this,f)}))},pauseOthers:function(a){this.tellOthers("pause",function(){return this.status.srcSet},a)},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.aurora.active?this._aurora_pause(0):this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100),this.status.srcSet?this.html.active?this._html_playHead(a):this.aurora.active?this._aurora_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.mutedWorker(a),this.options.globalVolume&&this.tellOthers("mutedWorker",function(){return this.options.globalVolume},a)},mutedWorker:function(b){this.options.muted=b,this.html.used&&this._html_setProperty("muted",b),this.aurora.used&&this._aurora_mute(b),this.flash.used&&this._flash_mute(b),this.html.video.gate||this.html.audio.gate||(this._updateMute(b),this._updateVolume(this.options.volume),this._trigger(a.jPlayer.event.volumechange))},mute:function(a){var c="object"==typeof a;c&&this.options.useStateClassSkin&&this.options.muted?this._muted(!1):(a=a===b?!0:!!a,this._muted(a))},unmute:function(a){a=a===b?!0:!!a,this._muted(!a)},_updateMute:function(a){a===b&&(a=this.options.muted),a?this.addStateClass("muted"):this.removeStateClass("muted"),this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){this.volumeWorker(a),this.options.globalVolume&&this.tellOthers("volumeWorker",function(){return this.options.globalVolume},a)},volumeWorker:function(b){b=this._limitValue(b,0,1),this.options.volume=b,this.html.used&&this._html_setProperty("volume",b),this.aurora.used&&this._aurora_volume(b),this.flash.used&&this._flash_volume(b),this.html.video.gate||this.html.audio.gate||(this._updateVolume(b),this._trigger(a.jPlayer.event.volumechange))},volumeBar:function(b){if(this.css.jq.volumeBar.length){var c=a(b.currentTarget),d=c.offset(),e=b.pageX-d.left,f=c.width(),g=c.height()-b.pageY+d.top,h=c.height();this.volume(this.options.verticalVolume?g/h:e/f)}this.options.muted&&this._muted(!1)},_updateVolume:function(a){a===b&&(a=this.options.volume),a=this.options.muted?0:a,this.status.noVolume?(this.addStateClass("noVolume"),this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.removeStateClass("noVolume"),this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](100*a+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1),this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(b){var c=this;this.options.cssSelectorAncestor=b,this._removeUiClass(),this.ancestorJq=b?a(b):[],b&&1!==this.ancestorJq.length&&this._warning({type:a.jPlayer.warning.CSS_SELECTOR_COUNT,context:b,message:a.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:a.jPlayer.warningHint.CSS_SELECTOR_COUNT}),this._addUiClass(),a.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)}),this._updateInterface(),this._updateButtons(),this._updateAutohide(),this._updateVolume(),this._updateMute()},_cssSelector:function(b,c){var d=this;if("string"==typeof c)if(a.jPlayer.prototype.options.cssSelector[b]){if(this.css.jq[b]&&this.css.jq[b].length&&this.css.jq[b].unbind(".jPlayer"),this.options.cssSelector[b]=c,this.css.cs[b]=this.options.cssSelectorAncestor+" "+c,this.css.jq[b]=c?a(this.css.cs[b]):[],this.css.jq[b].length&&this[b]){var e=function(c){c.preventDefault(),d[b](c),d.options.autoBlur?a(this).blur():a(this).focus()};this.css.jq[b].bind("click.jPlayer",e)}c&&1!==this.css.jq[b].length&&this._warning({type:a.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[b],message:a.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[b].length+" found for "+b+" method.",hint:a.jPlayer.warningHint.CSS_SELECTOR_COUNT})}else this._warning({type:a.jPlayer.warning.CSS_SELECTOR_METHOD,context:b,message:a.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:a.jPlayer.warningHint.CSS_SELECTOR_METHOD});else this._warning({type:a.jPlayer.warning.CSS_SELECTOR_STRING,context:c,message:a.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:a.jPlayer.warningHint.CSS_SELECTOR_STRING})},duration:function(a){this.options.toggleDuration&&(this.options.captureDuration&&a.stopPropagation(),this._setOption("remainingDuration",!this.options.remainingDuration))},seekBar:function(b){if(this.css.jq.seekBar.length){var c=a(b.currentTarget),d=c.offset(),e=b.pageX-d.left,f=c.width(),g=100*e/f;this.playHead(g)}},playbackRate:function(a){this._setOption("playbackRate",a)},playbackRateBar:function(b){if(this.css.jq.playbackRateBar.length){var c,d,e=a(b.currentTarget),f=e.offset(),g=b.pageX-f.left,h=e.width(),i=e.height()-b.pageY+f.top,j=e.height();c=this.options.verticalPlaybackRate?i/j:g/h,d=c*(this.options.maxPlaybackRate-this.options.minPlaybackRate)+this.options.minPlaybackRate,this.playbackRate(d)}},_updatePlaybackRate:function(){var a=this.options.playbackRate,b=(a-this.options.minPlaybackRate)/(this.options.maxPlaybackRate-this.options.minPlaybackRate);this.status.playbackRateEnabled?(this.css.jq.playbackRateBar.length&&this.css.jq.playbackRateBar.show(),this.css.jq.playbackRateBarValue.length&&(this.css.jq.playbackRateBarValue.show(),this.css.jq.playbackRateBarValue[this.options.verticalPlaybackRate?"height":"width"](100*b+"%"))):(this.css.jq.playbackRateBar.length&&this.css.jq.playbackRateBar.hide(),this.css.jq.playbackRateBarValue.length&&this.css.jq.playbackRateBarValue.hide())},repeat:function(a){var b="object"==typeof a;this._loop(b&&this.options.useStateClassSkin&&this.options.loop?!1:!0)},repeatOff:function(){this._loop(!1)},_loop:function(b){this.options.loop!==b&&(this.options.loop=b,this._updateButtons(),this._trigger(a.jPlayer.event.repeat))},option:function(c,d){var e=c;if(0===arguments.length)return a.extend(!0,{},this.options);if("string"==typeof c){var f=c.split(".");if(d===b){for(var g=a.extend(!0,{},this.options),h=0;h<f.length;h++){if(g[f[h]]===b)return this._warning({type:a.jPlayer.warning.OPTION_KEY,context:c,message:a.jPlayer.warningMsg.OPTION_KEY,hint:a.jPlayer.warningHint.OPTION_KEY}),b;g=g[f[h]]}return g}e={};for(var i=e,j=0;j<f.length;j++)j<f.length-1?(i[f[j]]={},i=i[f[j]]):i[f[j]]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(b,c){var d=this;switch(b){case"volume":this.volume(c);break;case"muted":this._muted(c);break;case"globalVolume":this.options[b]=c;break;case"cssSelectorAncestor":this._cssSelectorAncestor(c);break;case"cssSelector":a.each(c,function(a,b){d._cssSelector(a,b)});break;case"playbackRate":this.options[b]=c=this._limitValue(c,this.options.minPlaybackRate,this.options.maxPlaybackRate),this.html.used&&this._html_setProperty("playbackRate",c),this._updatePlaybackRate();break;case"defaultPlaybackRate":this.options[b]=c=this._limitValue(c,this.options.minPlaybackRate,this.options.maxPlaybackRate),this.html.used&&this._html_setProperty("defaultPlaybackRate",c),this._updatePlaybackRate();break;case"minPlaybackRate":this.options[b]=c=this._limitValue(c,.1,this.options.maxPlaybackRate-.1),this._updatePlaybackRate();break;case"maxPlaybackRate":this.options[b]=c=this._limitValue(c,this.options.minPlaybackRate+.1,16),this._updatePlaybackRate();break;case"fullScreen":if(this.options[b]!==c){var e=a.jPlayer.nativeFeatures.fullscreen.used.webkitVideo;(!e||e&&!this.status.waitForPlay)&&(e||(this.options[b]=c),c?this._requestFullscreen():this._exitFullscreen(),e||this._setOption("fullWindow",c))}break;case"fullWindow":this.options[b]!==c&&(this._removeUiClass(),this.options[b]=c,this._refreshSize());break;case"size":this.options.fullWindow||this.options[b].cssClass===c.cssClass||this._removeUiClass(),this.options[b]=a.extend({},this.options[b],c),this._refreshSize();break;case"sizeFull":this.options.fullWindow&&this.options[b].cssClass!==c.cssClass&&this._removeUiClass(),this.options[b]=a.extend({},this.options[b],c),this._refreshSize();break;case"autohide":this.options[b]=a.extend({},this.options[b],c),this._updateAutohide();break;case"loop":this._loop(c);break;case"remainingDuration":this.options[b]=c,this._updateInterface();break;case"toggleDuration":this.options[b]=c;break;case"nativeVideoControls":this.options[b]=a.extend({},this.options[b],c),this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls),this._restrictNativeVideoControls(),this._updateNativeVideoControls();break;case"noFullWindow":this.options[b]=a.extend({},this.options[b],c),this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls),this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow),this._restrictNativeVideoControls(),this._updateButtons();break;case"noVolume":this.options[b]=a.extend({},this.options[b],c),this.status.noVolume=this._uaBlocklist(this.options.noVolume),this._updateVolume(),this._updateMute();break;case"emulateHtml":this.options[b]!==c&&(this.options[b]=c,c?this._emulateHtmlBridge():this._destroyHtmlBridge());break;case"timeFormat":this.options[b]=a.extend({},this.options[b],c);break;case"keyEnabled":this.options[b]=c,c||this!==a.jPlayer.focus||(a.jPlayer.focus=null);break;case"keyBindings":this.options[b]=a.extend(!0,{},this.options[b],c);break;case"audioFullScreen":this.options[b]=c;break;case"autoBlur":this.options[b]=c}return this},_refreshSize:function(){this._setSize(),this._addUiClass(),this._updateSize(),this._updateButtons(),this._updateAutohide(),this._trigger(a.jPlayer.event.resize)},_setSize:function(){this.options.fullWindow?(this.status.width=this.options.sizeFull.width,this.status.height=this.options.sizeFull.height,this.status.cssClass=this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=this.options.size.cssClass),this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)},_updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height}),!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&this.flash.active&&this.status.video&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a=this,b="mousemove.jPlayer",c=".jPlayerAutohide",d=b+c,e=function(b){var c,d,e=!1;"undefined"!=typeof a.internal.mouse?(c=a.internal.mouse.x-b.pageX,d=a.internal.mouse.y-b.pageY,e=Math.floor(c)>0||Math.floor(d)>0):e=!0,a.internal.mouse={x:b.pageX,y:b.pageY},e&&a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId),a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),delete this.internal.mouse,this.element.unbind(c),this.css.jq.gui.unbind(c),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullWindow&&this.options.autohide.full||!this.options.fullWindow&&this.options.autohide.restored?(this.element.bind(d,e),this.css.jq.gui.bind(d,e),this.css.jq.gui.hide()):this.css.jq.gui.show())},fullScreen:function(a){var b="object"==typeof a;b&&this.options.useStateClassSkin&&this.options.fullScreen?this._setOption("fullScreen",!1):this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_fullscreenAddEventListeners:function(){var b=this,c=a.jPlayer.nativeFeatures.fullscreen;c.api.fullscreenEnabled&&c.event.fullscreenchange&&("function"!=typeof this.internal.fullscreenchangeHandler&&(this.internal.fullscreenchangeHandler=function(){b._fullscreenchange()}),document.addEventListener(c.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1))},_fullscreenRemoveEventListeners:function(){var b=a.jPlayer.nativeFeatures.fullscreen;this.internal.fullscreenchangeHandler&&document.removeEventListener(b.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1)},_fullscreenchange:function(){this.options.fullScreen&&!a.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()&&this._setOption("fullScreen",!1)},_requestFullscreen:function(){var b=this.ancestorJq.length?this.ancestorJq[0]:this.element[0],c=a.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(b=this.htmlElement.video),c.api.fullscreenEnabled&&c.api.requestFullscreen(b)},_exitFullscreen:function(){var b,c=a.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(b=this.htmlElement.video),c.api.fullscreenEnabled&&c.api.exitFullscreen(b)},_html_initMedia:function(b){var c=a(this.htmlElement.media).empty();a.each(b.track||[],function(a,b){var d=document.createElement("track");d.setAttribute("kind",b.kind?b.kind:""),d.setAttribute("src",b.src?b.src:""),d.setAttribute("srclang",b.srclang?b.srclang:""),d.setAttribute("label",b.label?b.label:""),b.def&&d.setAttribute("default",b.def),c.append(d)}),this.htmlElement.media.src=this.status.src,"none"!==this.options.preload&&this._html_load(),this._trigger(a.jPlayer.event.timeupdate)},_html_setFormat:function(b){var c=this;a.each(this.formats,function(a,d){return c.html.support[d]&&b[d]?(c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1):void 0})},_html_setAudio:function(a){this._html_setFormat(a),this.htmlElement.media=this.htmlElement.audio,this._html_initMedia(a)},_html_setVideo:function(a){this._html_setFormat(a),this.status.nativeVideoControls&&(this.htmlElement.video.poster=this._validString(a.poster)?a.poster:""),this.htmlElement.media=this.htmlElement.video,this._html_initMedia(a)},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id!==this.internal.video.id||this.status.nativeVideoControls||this.internal.video.jq.css({width:"0px",height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){this.htmlElement.media&&(this.htmlElement.media.src="about:blank",this.htmlElement.media.load())},_html_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.htmlElement.media.load()),clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this,c=this.htmlElement.media;if(this.androidFix.pause=!1,this._html_load(),this.androidFix.setMedia)this.androidFix.play=!0,this.androidFix.time=a;else if(isNaN(a))c.play();else{this.internal.cmdsIgnored&&c.play();try{if(c.seekable&&!("object"==typeof c.seekable&&c.seekable.length>0))throw 1;c.currentTime=a,c.play()}catch(d){return void(this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},250))}}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this,c=this.htmlElement.media;if(this.androidFix.play=!1,a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId),c.pause(),this.androidFix.setMedia)this.androidFix.pause=!0,this.androidFix.time=a;else if(!isNaN(a))try{if(c.seekable&&!("object"==typeof c.seekable&&c.seekable.length>0))throw 1;c.currentTime=a}catch(d){return void(this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},250))}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this,c=this.htmlElement.media;this._html_load();try{if("object"==typeof c.seekable&&c.seekable.length>0)c.currentTime=a*c.seekable.end(c.seekable.length-1)/100;else{if(!(c.duration>0)||isNaN(c.duration))throw"e";c.currentTime=a*c.duration/100}}catch(d){return void(this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},250))}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})))},_html_setProperty:function(a,b){this.html.audio.available&&(this.htmlElement.audio[a]=b),this.html.video.available&&(this.htmlElement.video[a]=b)},_aurora_setAudio:function(b){var c=this;a.each(this.formats,function(a,d){return c.aurora.support[d]&&b[d]?(c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1):void 0}),this.aurora.player=new AV.Player.fromURL(this.status.src),this._addAuroraEventListeners(this.aurora.player,this.aurora),"auto"===this.options.preload&&(this._aurora_load(),this.status.waitForLoad=!1)},_aurora_resetMedia:function(){this.aurora.player&&this.aurora.player.stop()},_aurora_clearMedia:function(){},_aurora_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.aurora.player.preload())},_aurora_play:function(b){this.status.waitForLoad||isNaN(b)||this.aurora.player.seek(b),this.aurora.player.playing||this.aurora.player.play(),this.status.waitForLoad=!1,this._aurora_checkWaitForPlay(),this._updateButtons(!0),this._trigger(a.jPlayer.event.play)},_aurora_pause:function(b){isNaN(b)||this.aurora.player.seek(1e3*b),this.aurora.player.pause(),b>0&&this._aurora_checkWaitForPlay(),this._updateButtons(!1),this._trigger(a.jPlayer.event.pause)},_aurora_playHead:function(a){this.aurora.player.duration>0&&this.aurora.player.seek(a*this.aurora.player.duration/100),this.status.waitForLoad||this._aurora_checkWaitForPlay()},_aurora_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1)},_aurora_volume:function(a){this.aurora.player.volume=100*a},_aurora_mute:function(a){a?(this.aurora.properties.lastvolume=this.aurora.player.volume,this.aurora.player.volume=0):this.aurora.player.volume=this.aurora.properties.lastvolume,this.aurora.properties.muted=a},_flash_setAudio:function(b){var c=this;try{a.each(this.formats,function(a,d){if(c.flash.support[d]&&b[d]){switch(d){case"m4a":case"fla":c._getMovie().fl_setAudio_m4a(b[d]);break;case"mp3":c._getMovie().fl_setAudio_mp3(b[d]);break;case"rtmpa":c._getMovie().fl_setAudio_rtmp(b[d])}return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_setVideo:function(b){var c=this;try{a.each(this.formats,function(a,d){if(c.flash.support[d]&&b[d]){switch(d){case"m4v":case"flv":c._getMovie().fl_setVideo_m4v(b[d]);break;case"rtmpv":c._getMovie().fl_setVideo_rtmp(b[d])}return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"}),this._flash_pause(0/0)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=!1,this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}a>0&&(this.status.waitForLoad=!1,this._flash_checkWaitForPlay())},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height})))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_getFlashPluginVersion:function(){var a,b=0;if(window.ActiveXObject)try{if(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")){var c=a.GetVariable("$version");c&&(c=c.split(" ")[1].split(","),b=parseInt(c[0],10)+"."+parseInt(c[1],10))}}catch(d){}else navigator.plugins&&navigator.mimeTypes.length>0&&(a=navigator.plugins["Shockwave Flash"],a&&(b=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")));return 1*b},_checkForFlash:function(a){var b=!1;return this._getFlashPluginVersion()>=a&&(b=!0),b},_validString:function(a){return a&&"string"==typeof a},_limitValue:function(a,b,c){return b>a?b:a>c?c:a},_urlNotSetError:function(b){this._error({type:a.jPlayer.error.URL_NOT_SET,context:b,message:a.jPlayer.errorMsg.URL_NOT_SET,hint:a.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(b){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH",this._error({type:a.jPlayer.error[c],context:this.internal.flash.swf,message:a.jPlayer.errorMsg[c]+b.message,hint:a.jPlayer.errorHint[c]}),this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(b){this._trigger(a.jPlayer.event.error,b),this.options.errorAlerts&&this._alert("Error!"+(b.message?"\n"+b.message:"")+(b.hint?"\n"+b.hint:"")+"\nContext: "+b.context)},_warning:function(c){this._trigger(a.jPlayer.event.warning,b,c),this.options.warningAlerts&&this._alert("Warning!"+(c.message?"\n"+c.message:"")+(c.hint?"\n"+c.hint:"")+"\nContext: "+c.context)},_alert:function(a){var b="jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a;this.options.consoleAlerts?window.console&&window.console.log&&window.console.log(b):alert(b)},_emulateHtmlBridge:function(){var b=this;a.each(a.jPlayer.emulateMethods.split(/\s+/g),function(a,c){b.internal.domNode[c]=function(a){b[c](a)}}),a.each(a.jPlayer.event,function(c,d){var e=!0;a.each(a.jPlayer.reservedEvent.split(/\s+/g),function(a,b){return b===c?(e=!1,!1):void 0}),e&&b.element.bind(d+".jPlayer.jPlayerHtml",function(){b._emulateHtmlUpdate();var a=document.createEvent("Event");a.initEvent(c,!1,!0),b.internal.domNode.dispatchEvent(a)})})},_emulateHtmlUpdate:function(){var b=this;a.each(a.jPlayer.emulateStatus.split(/\s+/g),function(a,c){b.internal.domNode[c]=b.status[c]}),a.each(a.jPlayer.emulateOptions.split(/\s+/g),function(a,c){b.internal.domNode[c]=b.options[c]})},_destroyHtmlBridge:function(){var b=this;this.element.unbind(".jPlayerHtml");var c=a.jPlayer.emulateMethods+" "+a.jPlayer.emulateStatus+" "+a.jPlayer.emulateOptions;a.each(c.split(/\s+/g),function(a,c){delete b.internal.domNode[c]})}},a.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"},a.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+a.jPlayer.prototype.version.script+" needs Jplayer.swf version "+a.jPlayer.prototype.version.needFlash+" but found "},a.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."},a.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"},a.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."},a.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
1725 1726 1727 1728var playerHTML = "<div class='videoPlayerWrapper jplayerThemePlayer'><div class=\"jplayer jp-jplayer\"></div><div class=\"videoloading\"></div><div class=\"jp-play-btn large\"></div><div class=\"videoplayer\"><div class=\"videoplayer_inner\"><div class=\"times\"><span class=\"jp-current-time\"></span><span class=\"time-sep\">/</span><span class=\"jp-duration\"></span></div><div class=\"jp-play\"></div><div class=\"jp-pause\"></div><div class=\"jp-progress\"><div class=\"jp-seek-bar\"><div class=\"jp-play-bar\"></div><span class=\"handle\"></span></div></div><div class='volume med'></div><div class=\"jp-full-screen\"></div><div class=\"jp-restore-screen\"></div></div></div></div>"; 1729/*if(document.createStyleSheet) { 1730 document.createStyleSheet('/javascripts/jplayertheme/jplayer.css?v=1'); 1731} 1732else { 1733 1734 $("head").append("<link rel='stylesheet' href='/javascripts/jplayertheme/jplayer.css?v=1' />"); 1735}*/ 1736var css = "<style>#fulljPlayerVideo{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000}.jplayerThemePlayer.videoPlayerWrapper{position:relative;background:#333;margin:0 auto;overflow:hidden}.jplayerThemePlayer.videoPlayerWrapper .jplayer{position:absolute;top:0;left:0;background:#000}.jplayerThemePlayer.videoPlayerWrapper .videoplayer{position:absolute;bottom:0;right:0;left:0;margin:0;background:#000;background:rgba(0,0,0,.5);-webkit-transition:all .5s;-moz-transition:all .5s;transition:all .5s}.jplayerThemePlayer.videoPlayerWrapper .videoplayer.hidden{-moz-transform:translateY(48px);-webkit-transform:translateY(48px);transform:translateY(48px)}.jplayerThemePlayer .videoplayer{margin-right:20px;margin-bottom:20px;padding-right:6px}.jplayerThemePlayer .jp-full-screen,.jplayerThemePlayer .jp-restore-screen{width:21px;height:19px;cursor:pointer;background:url(/javascripts/jplayertheme/full-screen-video.png?v=3);background-size:21px 19px;position:absolute;bottom:15px;right:43px}.jplayerThemePlayer .jp-restore-screen,.jplayerThemePlayer.jp-video-full .jp-full-screen{display:none}.jplayerThemePlayer.jp-video-full .jp-restore-screen{display:block}.jplayerThemePlayer .jp-restore-screen{background:url(/javascripts/jplayertheme/full-screen-video-close.png?v=3);background-size:21px 19px}.jplayerThemePlayer .videoplayer .videoplayer_inner{height:48px;padding:1px;position:relative}.jplayerThemePlayer .videoplayer .jp-pause,.jplayerThemePlayer .videoplayer .jp-play{float:left;width:25px;height:25px;cursor:pointer;background:url(/javascripts/jplayertheme/audio-player-slim-play.png?v=2);background-size:25px 25px;margin:10px 9px 0 11px}.jplayerThemePlayer .hq{position:absolute;top:11px;width:25px;height:17px;left:35px;cursor:pointer;background:url(/javascripts/jplayertheme/hq.png) 2px 0 no-repeat}.jplayerThemePlayer .hq.enabled{background:url(/javascripts/jplayertheme/hq.png) -21px 0 no-repeat}.jplayerThemePlayer .jp-play-btn.large{position:absolute;top:0;left:0;right:0;bottom:0;cursor:pointer;background:url(/javascripts/jplayertheme/play-large.png?v=1) 50% 50% no-repeat;background-size:105px 105px;box-shadow:inset 0 0 100px rgba(0,0,0,.5);-webkit-transition:all .5s;-moz-transition:all .5s;transition:all .5s;opacity:1}.jplayerThemePlayer .jp-play-btn.large.hidden{opacity:0}
1736.jplayerThemePlayer .videoplayer .jp-pause{background:url(/javascripts/jplayertheme/audio-player-slim-pause.png?v=2);background-size:25px 25px}.jplayerThemePlayer .videoplayer .jp-progress{position:absolute;bottom:19px;left:55px;height:11px;border:1px solid #fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.jplayerThemePlayer .volume{width:23px;height:20px;background:url(/javascripts/jplayertheme/volume.png?v=4) no-repeat;background-size:22px 62px;position:absolute;right:8px;bottom:16px;cursor:pointer}.jplayerThemePlayer .volume.low{background-position:0 0;background-size:22px 62px}.jplayerThemePlayer .volume.med{background-position:0 -21px;background-size:22px 62px}.jplayerThemePlayer .volume.high{background-position:0 -42px;background-size:22px 62px}.jplayerThemePlayer .videoplayer .jp-progress{right:160px}.jplayerThemePlayer .times{margin-right:0;position:absolute;bottom:16px;right:80px;color:#fff;font-size:11px;line-height:16px;font-family:arial,sans-serif}@media (max-width:600px){.jplayerThemePlayer .videoplayer .jp-progress{right:50px}.jplayerThemePlayer .times{display:none}}.jplayerThemePlayer .jp-seek-bar{height:100%;position:relative;width:0;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.jplayerThemePlayer .jp-play-bar{height:100%;width:0;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;position:relative;background:#ccc}.jplayerThemePlayer .jp-seek-bar .handle{width:17px;height:17px;background:#ccc;border:1px solid #fff;position:absolute;top:-4px;border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;margin:0 -5px;left:0;cursor:pointer}div.jp-video-full.videoPlayerWrapper{width:480px;height:270px;position:static!important;position:relative}div.jp-video-full div.jplayer{top:0;left:0;position:fixed!important;position:relative;overflow:hidden}div.jp-video-full div.jp-gui{position:fixed!important;position:static;top:0;left:0;width:100%;height:100%;z-index:1001}div.jp-video-full div.jp-interface{position:absolute!important;position:relative;bottom:0;left:0}</style>"; 1737$('head').append(css); 1738var jplayerdragging=false; 1739 1740function makeVideo (obj,width,height,image,video,autostart,fullscreen) { 1741 1742 var ext = video.split('.').pop(); 1743 1744 if (videoControlBar=="bottom"){ 1745 height=height+24; 1746 } 1747 if (fullscreen) { 1748 $("#"+obj+" .videoPlayerWrapper").css("width","100%").css("height","100%"); 1749 } else { 1750 $("#"+obj+" .videoPlayerWrapper").css("width",width+"px").css("height",height+"px"); 1751 } 1752 $("#"+obj+" .videoPlayerWrapper").hover(function(){ 1753 $(".videoplayer",$(this)).removeClass("hidden"); 1754 },function(){ 1755 if ($(".jplayer",$(this)).hasClass("playing")) { 1756 $(".videoplayer",$(this)).addClass("hidden"); 1757 } 1758 }); 1759 $(".jp-play-btn",$("#"+obj)).click(function(){ 1760 var playerid = $(this).parents(".jplayerInit").attr("id"); 1761 if ($("#"+playerid+" .jplayer").hasClass("playing")) { 1762 $("#"+playerid+" .jplayer").jPlayer("pause"); 1763 } else { 1764 $("#"+playerid+" .jplayer").jPlayer("play"); 1765 } 1766 1767 }); 1768 $(".volume",$("#"+obj)).click(function(){ 1769 var playerid = $(this).parents(".jplayerInit").attr("id"); 1770 if ($(this).hasClass("low")) { 1771 $("#"+playerid+" .jplayer").jPlayer("option","volume",0.5); 1772 $(this).removeClass("low").addClass("med"); 1773 jplayervolume = 0.5; 1774 } else if ($(this).hasClass("med")) { 1775 $("#"+playerid+" .jplayer").jPlayer("option","volume",1); 1776 $(this).removeClass("med").addClass("high"); 1777 jplayervolume = 1; 1778 } else if ($(this).hasClass("high")) { 1779 $("#"+playerid+" .jplayer").jPlayer("option","volume",0.1); 1780 $(this).removeClass("high").addClass("low"); 1781 jplayervolume = 0.1; 1782 } 1783 createCookie("volume",jplayervolume); 1784 }); 1785 $(".handle",$("#"+obj)).draggable({ 1786 containment:"parent" 1787 ,drag: function(event, ui) { 1788 var pos = $(this).position().left; 1789 var pwidth = $(this).parent().width(); 1790 var percent = pos / pwidth; 1791 if (percent!=0) { 1792 percent = percent*100; 1793 } 1794 $(".jp-play-bar",$(this).parent()).css("width",percent+"%"); 1795 if ($(this).parents(".videoPlayerWrapper").length) { 1796 var playerid = $(".jplayer",$(this).parents(".videoPlayerWrapper")).attr("id"); 1797 } 1798 if ($(this).parents(".videoPlayerWrapper").length) { 1799 var playerid = $(".jplayer",$(this).parents(".videoPlayerWrapper")).attr("id"); 1800 } else { 1801 var playerid = $(this).parents(".audioplayer").prev().attr("id"); 1802 } 1803 $("#"+playerid).jPlayer("playHead",percent); 1804 } 1805 ,start: function(event,ui) { 1806 jplayerdragging=true; 1807 } 1808 ,stop:function(event,ui) { 1809 jplayerdragging=false; 1810 } 1811 ,axis:"x" 1812 }); 1813 if (ext=="m4v") { 1814 var supplied="m4v"; 1815 }
1816 if (ext=="mp3") { 1817 var supplied="mp3"; 1818 } 1819 if (ext=="mp4") { 1820 var supplied="m4v"; 1821 } 1822 if (ext=="mov") { 1823 var supplied="m4v"; 1824 } 1825 if (ext=="m4a") { 1826 var supplied="m4a"; 1827 } 1828 if (ext=="ogv") { 1829 var supplied="ogv"; 1830 } 1831 if (ext=="oga") { 1832 var supplied="oga"; 1833 } 1834 if (ext=="ogg") { 1835 var supplied="oga"; 1836 } 1837 if (ext=="wav") { 1838 var supplied="wav"; 1839 } 1840 if (ext=="webm") { 1841 var supplied="webmv"; 1842 } 1843 if (ext=="webma") { 1844 var supplied="webma"; 1845 } 1846 if (ext=="webmv") { 1847 var supplied="webmv"; 1848 } 1849 $("#"+obj+" .jplayer").jPlayer({ 1850 ready: function () { 1851 1852 if (ext=="m4v") { 1853 $(this).jPlayer("setMedia", { 1854 m4v: video 1855 ,poster: image 1856 }); 1857 } 1858 if (ext=="mp3") { 1859 $(this).jPlayer("setMedia", { 1860 m4v: video 1861 ,poster: image 1862 }); 1863 } 1864 if (ext=="mp4") { 1865 $(this).jPlayer("setMedia", { 1866 m4v: video 1867 ,poster: image 1868 }); 1869 } 1870 if (ext=="mov") { 1871 $(this).jPlayer("setMedia", { 1872 m4v: video 1873 ,poster: image 1874 }); 1875 } 1876 if (ext=="m4a") { 1877 $(this).jPlayer("setMedia", { 1878 m4a: video 1879 ,poster: image 1880 }); 1881 } 1882 if (ext=="ogv") { 1883 $(this).jPlayer("setMedia", { 1884 ogv: video 1885 ,poster: image 1886 }); 1887 } 1888 if (ext=="oga") { 1889 $(this).jPlayer("setMedia", { 1890 oga: video 1891 ,poster: image 1892 }); 1893 } 1894 if (ext=="ogg") { 1895 $(this).jPlayer("setMedia", { 1896 oga: video 1897 ,poster: image 1898 }); 1899 } 1900 if (ext=="wav") { 1901 $(this).jPlayer("setMedia", { 1902 wav: video 1903 ,poster: image 1904 }); 1905 } 1906 if (ext=="webm") { 1907 $(this).jPlayer("setMedia", { 1908 webm: video 1909 ,poster: image 1910 }); 1911 } 1912 if (ext=="webma") { 1913 $(this).jPlayer("setMedia", { 1914 webma: video 1915 ,poster: image 1916 }); 1917 } 1918 if (ext=="webmv") { 1919 $(this).jPlayer("setMedia", { 1920 webmv: video 1921 ,poster: image 1922 }); 1923 }
1924 if (autostart) { 1925 $(this).jPlayer("play"); 1926 } 1927 }, 1928 supplied: supplied, 1929 swfPath: "/javascripts", 1930 size: { 1931 width: width, 1932 height: height 1933 }, 1934 volume: jplayervolume, 1935 fullScreen:fullscreen, 1936 cssSelectorAncestor: "#"+obj+" .videoPlayerWrapper" 1937 ,play: function(event) { 1938 setTimeout(function() { 1939 $(".videoplayer",$(event.jPlayer.options['cssSelectorAncestor'])).addClass("hidden"); 1940 }, 1000); 1941 $(this).addClass("playing"); 1942 $(".videoloading,.jp-play-btn.large",$(event.jPlayer.options['cssSelectorAncestor'])).addClass("hidden"); 1943 }, 1944 pause: function(event) { 1945 $(".videoloading,.jp-play-btn.large",$(event.jPlayer.options['cssSelectorAncestor'])).removeClass("hidden"); 1946 $(".videoplayer",$(event.jPlayer.options['cssSelectorAncestor'])).removeClass("hidden"); 1947 1948 $(this).removeClass("playing"); 1949 }, 1950 timeupdate: function(event) { 1951 var sec = Math.floor(event.jPlayer.status.currentTime); 1952 var assetid = $(event.jPlayer.options['cssSelectorAncestor']).parents('.bpe_video').data('asset-id'); 1953 if (!playerprogress.hasOwnProperty(assetid)){ 1954 playerprogress[assetid]=[]; 1955 } 1956 if (playerprogress[assetid].indexOf(sec)===-1) { 1957 playerprogress[assetid].push(sec); 1958 } 1959 if (playerprogress[assetid].length==Math.floor(event.jPlayer.status.duration)) { 1960 // video has been watched fully 1961 window.location.href=window.location.protocol+'//'+window.location.host+window.location.pathname+"?seen_vid="+assetid; 1962 } 1963 if (!jplayerdragging) { 1964 $(".handle",$(event.jPlayer.options['cssSelectorAncestor'])).css("left",$(".jp-play-bar",$(event.jPlayer.options['cssSelectorAncestor'])).width()); 1965 } 1966 } 1967 }); 1968 1969} 1970var playerprogress={}; 1971var jplayerVideoCounter=0; 1972var jplayervolume = 0.5; 1973$(window).on("load",function(){ 1974 if (readCookie("volume")) { 1975 jplayervolume = readCookie("volume"); 1976 } 1977 1978 $(".bpe_video:not(.Popup_Video) img").each(function(){ 1979 1980 var img = this; 1981 var width = $(this).width(); 1982 var height = $(this).height(); 1983 var image = $(this).attr("src"); 1984 var video = $(this).parent().attr("href"); 1985 $(this).parent().after("<div id=\"video"+jplayerVideoCounter+"\" class='jplayerInit' data-poster='"+image+"' data-vid='"+video+"'>"+playerHTML+"</div>"); 1986 $(this).parent().remove(); 1987 1988 makeVideo("video"+jplayerVideoCounter,width,height,image,video,false,false); 1989 1990 jplayerVideoCounter++; 1991 }); 1992 1993 1994}); 1995 1996 1997function createCookie(name,value,days) { 1998 if (days) { 1999 var date = new Date(); 2000 date.setTime(date.getTime()+(days*24*60*60*1000)); 2001 var expires = "; expires="+date.toGMTString(); 2002 } 2003 else var expires = ""; 2004 document.cookie = name+"="+value+expires+"; path=/"; 2005} 2006 2007function readCookie(name) { 2008 var nameEQ = name + "="; 2009 var ca = document.cookie.split(';'); 2010 for(var i=0;i < ca.length;i++) { 2011 var c = ca[i]; 2012 while (c.charAt(0)==' ') c = c.substring(1,c.length); 2013 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 2014 } 2015 return null; 2016} 2017 2018function eraseCookie(name) { 2019 createCookie(name,"",-1); 2020} 2021function setPersonalNames($product) { 2022 2023 function setFormNames(form,qty,$product) { 2024 var titles = new Array(); 2025 2026 $(".cms-booking-product-"+qty+"-qty",$product).each(function(){ 2027 2028 var i = 1; 2029 var t = parseInt($("input",$(this)).val()); 2030 2031 var label = $(".booking-price-label",$(this)).data("singular"); 2032 for (var i = 1; i <= t; i++) { 2033 titles.push(label+" "+i+"/"+t); 2034 } 2035 2036 }); 2037 var x = 0; 2038 $(".personal-details-forms .personal-details-form."+form,$product).each(function(){ 2039 $(".booking-person-title",$(this)).text(titles[x]); 2040 x++; 2041 }); 2042 } 2043 setFormNames("personal-details-form-norm","normal",$product); 2044 setFormNames("personal-details-form-children","children",$product); 2045 setFormNames("personal-details-form-special","special",$product); 2046 2047} 2048function urlencode( str ) { 2049 // http://kevin.vanzonneveld.net 2050 // + original by: Philip Peterson 2051 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 2052 // + input by: AJ 2053 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 2054 // % note: info on what encoding functions to use from: http://xkr.us/
2054articles/javascript/encode-compare/ 2055 // * example 1: urlencode('Kevin van Zonneveld!'); 2056 // * returns 1: 'Kevin+van+Zonneveld%21' 2057 // * example 2: urlencode('http://kevin.vanzonneveld.net/'); 2058 // * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F' 2059 // * example 3: urlencode('http://www.eoogle.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'); 2060 // * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a' 2061 2062 var histogram = {}, histogram_r = {}, code = 0, tmp_arr = []; 2063 var ret = str.toString(); 2064 2065 // The histogram is identical to the one in urldecode. 2066 histogram['!'] = '%21'; 2067 histogram['%20'] = '+'; 2068 2069 // Begin with encodeURIComponent, which most resembles PHP's encoding functions 2070 ret = encodeURIComponent(ret); 2071 2072 for (search in histogram) { 2073 replace = histogram[search]; 2074 tmp_arr = ret.split(search); // Custom replace 2075 ret = tmp_arr.join(replace); 2076 } 2077 2078 // Uppercase for full PHP compatibility 2079 return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) { 2080 return "%"+m2.toUpperCase(); 2081 }); 2082 2083 return ret; 2084} 2085var lang=""; 2086var langAppend=""; 2087var sDMT=true; 2088 2089/** 2090 * Updates CMS text content in the live preview 2091 * Expanded to include basic element type changes and widget updates 2092 * @param {string} html - The HTML content to update 2093 * @param {string|object} options - Either element ID or options object 2094 */ 2095function updateCMSText(html, options) { 2096 // Handle the legacy case where html is passed directly 2097 if (!options) { 2098 if ($("#CMSLIVEUPDATE").length) { 2099 $("#CMSLIVEUPDATE").html(html); 2100 } 2101 return; 2102 } 2103 2104 // Handle element ID case (for backward compatibility) 2105 if (typeof options === 'string') { 2106 updateContentElement(options, html); 2107 return; 2108 } 2109 2110 // Handle object with options 2111 if (typeof options === 'object') { 2112 if (options.elementId) { 2113 updateContentElement(options.elementId, html, options); 2114 } else if (options.widgetId) { 2115 updateWidget(options.widgetId, html, options.initFunction); 2116 } 2117 } 2118} 2119 2120/** 2121 * Updates a content element's content or type 2122 * @param {string} elementId - The ID of the element to update 2123 * @param {string} content - The content to update with 2124 * @param {object} options - Optional additional settings 2125 * @param {boolean} options.isElementTypeChange - Whether this is a type change only 2126 * @param {string} options.targetElementType - The target element type to convert to 2127 * @param {number} options.indentLevel - Indentation level for lists (1=top level, 2=nested, 3=double nested) 2128 */ 2129window.updateContentElement = function(elementId, content, options = {}) { 2130 console.log('core.js: updateContentElement called for element ID:', elementId, 'with options:', options); 2131 2132 // Get additional options if provided 2133 const isElementTypeChange = options.isElementTypeChange || false; 2134 const targetElementType = options.targetElementType || null; 2135 const positionChange = options.positionChange || false; 2136 const insertionType = options.insertionType || null; 2137 const referenceId = options.referenceId || null; 2138 2139 // Handle various ways indentation level might be passed (direct number, object property, string) 2140 let indentLevel = null; 2141 if (options.indentLevel !== undefined) { 2142 indentLevel = parseInt(options.indentLevel); 2143 console.log('Found indent level from options.indentLevel:', indentLevel); 2144 } else if (options.level !== undefined) { 2145 indentLevel = parseInt(options.level); 2146 console.log('Found indent level from options.level:', indentLevel); 2147 } 2148 2149 // If options includes editorElement, extract level information directly from it 2150 if (options.editorElement && typeof options.editorElement === 'object') { 2151 console.log('Editor element information provided:', options.editorElement); 2152 // The editor element might have more reliable level information 2153 if (options.editorElement.level !== undefined) { 2154 indentLevel = parseInt(options.editorElement.level); 2155 console.log('Found indent level from editor element:', indentLevel); 2156 } 2157 } 2158 2159 // Ensure no mismatch between indentLevel and isElementTypeChange 2160 if (indentLevel && isElementTypeChange && !targetElementType) { 2161 console.warn('WARNING: Got indentLevel WITH isElementTypeChange but WITHOUT targetElementType!'); 2162 console.warn('This is likely a parameter passing issue. Forcing isElementTypeChange=false.'); 2163 options.isElementTypeChange = false;
2164 } 2165 2166 // Enhanced element finder to check for both data-element-id and data-widget-element-id 2167 function findElementById(id) { 2168 return document.querySelector(`[data-element-id="${id}"]`) || 2169 document.querySelector(`[data-widget-element-id="${id}"]`); 2170 } 2171 2172 // Find the element to update 2173 const element = findElementById(elementId); 2174 2175 if (!element) { 2176 console.error('core.js: Element with ID', elementId, 'not found'); 2177 return false; 2178 } 2179 2180 // Check if this is a position change operation 2181 if (positionChange && insertionType && referenceId) { 2182 console.log('Position change operation detected:', insertionType, 'referenceId:', referenceId); 2183 2184 // If we don't have level information, determine it from DOM structure 2185 if (!indentLevel) { 2186 console.log('No indentLevel provided in options, checking DOM structure for level information'); 2187 2188 // Determine element level from its position in the DOM 2189 function determineElementLevel(element) { 2190 // If element is not an LI, it's not part of a list 2191 if (element.tagName !== 'LI') return 1; 2192 2193 // Level 1: Direct child of UL/OL 2194 const parentEl = element.parentNode; 2195 if (!parentEl) return 1; 2196 2197 // If parent is not a list, it's level 1 2198 if (parentEl.tagName !== 'UL' && parentEl.tagName !== 'OL') return 1; 2199 2200 // Check if this list is nested inside an LI (level 2+) 2201 const grandparentEl = parentEl.parentNode; 2202 if (!grandparentEl) return 1; 2203 2204 if (grandparentEl.tagName === 'LI') { 2205 // This could be level 2 or 3, check further 2206 2207 // Check for level 3: LI > UL/OL > LI > UL/OL > LI 2208 const greatGrandparentEl = grandparentEl.parentNode; 2209 if (greatGrandparentEl && 2210 (greatGrandparentEl.tagName === 'UL' || greatGrandparentEl.tagName === 'OL')) { 2211 2212 const greatGreatGrandparentEl = greatGrandparentEl.parentNode; 2213 if (greatGreatGrandparentEl && greatGreatGrandparentEl.tagName === 'LI') { 2214 // This is a level 3 item (list inside a list item inside a list item) 2215 return 3; 2216 } 2217 } 2218 2219 // This is a level 2 item (list inside a list item) 2220 return 2; 2221 } 2222 2223 // Default to level 1 2224 return 1; 2225 } 2226 2227 // Use DOM structure to determine level 2228 const detectedLevel = determineElementLevel(element); 2229 if (detectedLevel > 1) { 2230 console.log('Detected level', detectedLevel, 'from DOM structure analysis'); 2231 indentLevel = detectedLevel; 2232 } else { 2233 console.log('Element appears to be level 1 based on DOM structure'); 2234 } 2235 } 2236 2237 // Find the reference element 2238 const referenceElement = findElementById(referenceId); 2239 2240 if (referenceElement) { 2241 try { 2242 // Handle complex position changes... 2243 // For brevity, we're simplifying this part as it's quite complex and depends on 2244 // many functions defined elsewhere in the cms.js file 2245 console.log('Position change logic would be executed here'); 2246 2247 // For now, we'll use a simpler approach to move elements 2248 const targetParent = referenceElement.parentNode; 2249 2250 // Basic position change operation 2251 if (insertionType === 'insertBefore') { 2252 targetParent.insertBefore(element, referenceElement); 2253 console.log('Inserted element before reference element'); 2254 return true; 2255 } else if (insertionType === 'insertAfter') { 2256 targetParent.insertBefore(element, referenceElement.nextSibling); 2257 console.log('Inserted element after reference element'); 2258 return true; 2259 } 2260 } catch (e) { 2261 console.error('Error during position change operation:', e); 2262 return false;
2263 } 2264 } else { 2265 console.error('Reference element not found:', referenceId); 2266 return false; 2267 } 2268 } 2269 2270 // INDENTATION CHANGE ONLY (for list items) 2271 if (!isElementTypeChange && 2272 indentLevel && 2273 element.tagName === 'LI') { 2274 2275 try { 2276 // Handle indentation change for list items using existing function 2277 // This assumes changeListItemIndentation is already defined in core.js 2278 return changeListItemIndentation(element, elementId, indentLevel); 2279 } catch (e) { 2280 console.error('core.js: Error during list indentation change:', e); 2281 return false; 2282 } 2283 } 2284 2285 // If this is just a content update (simple case) 2286 // POSITION CHANGE OPERATION 2287 if (positionChange && referenceId) { 2288 const referenceElement = findElementById(referenceId); 2289 2290 if (!referenceElement) { 2291 console.error('core.js: Reference element not found:', referenceId); 2292 return false; 2293 } 2294 2295 // Move element based on insertion type 2296 if (insertionType === 'insertBefore') { 2297 referenceElement.parentNode.insertBefore(element, referenceElement); 2298 } else if (insertionType === 'insertAfter') { 2299 if (referenceElement.nextSibling) { 2300 referenceElement.parentNode.insertBefore(element, referenceElement.nextSibling); 2301 } else { 2302 referenceElement.parentNode.appendChild(element); 2303 } 2304 } 2305 2306 return true; 2307 } 2308 2309 // CONTENT UPDATE OPERATION (default for non-TYPE_CHANGE) 2310 if (!isElementTypeChange && content !== "TYPE_CHANGE") { 2311 element.innerHTML = content; 2312 console.log('core.js: Updated content for element ID:', elementId); 2313 return true; 2314 } 2315 2316 // ELEMENT TYPE CHANGE OPERATION 2317 if ((isElementTypeChange || content === "TYPE_CHANGE") && targetElementType) { 2318 return changeElementType(element, targetElementType, elementId, {indentLevel: indentLevel}); 2319 } 2320}; 2321 2322/** 2323 * Changes an element's type from one tag to another 2324 * @param {Element} element - The DOM element to change 2325 * @param {string} targetType - The target element type (tag name) 2326 * @param {string} elementId - The element's ID 2327 * @param {object} options - Additional options 2328 */ 2329window.changeElementType = function(element, targetType, elementId, options = {}) { 2330 console.log('core.js: changeElementType called for element ID:', elementId, 'to type:', targetType); 2331 2332 const currentType = element.tagName.toLowerCase(); 2333 2334 // Get indentation level from options, element attribute, or default to 1 2335 const indentLevel = options.indentLevel || 2336 parseInt(element.getAttribute('data-level')) || 1; 2337 2338 if (currentType === targetType) { 2339 // No type change needed unless we're converting between list types 2340 if ((currentType === 'ul' || currentType === 'ol') && 2341 (targetType === 'ul' || targetType === 'ol') && 2342 currentType !== targetType) { 2343 // This is a list type conversion (ul <-> ol) 2344 return convertBetweenListTypes(element, targetType, elementId, indentLevel); 2345 } 2346 2347 console.log('Element already has the target type:', targetType); 2348 return true; 2349 } 2350 2351 // Special handling for list conversions 2352 if ((currentType === 'p' || currentType.startsWith('h')) && 2353 (targetType === 'ul' || targetType === 'ol')) { 2354 2355 try { 2356 // Handle paragraph to list conversion 2357 return convertElementToList(element, targetType, elementId, indentLevel || 1); 2358 } catch (e) { 2359 console.error('core.js: Error during paragraph to list conversion:', e); 2360 return false; 2361 } 2362 } 2363 // Special handling for converting list items to paragraphs/headings 2364 else if (currentType === 'li' && 2365 (targetType === 'p' || targetType.startsWith('h'))) { 2366 2367 try { 2368 return convertListItemToParagraph(element, targetType, elementId); 2369 } catch (e) { 2370 console.error('core.js: Error during list item to paragraph conversion:', e); 2371 return false;
2372 } 2373 } 2374 // Standard element type changes (p <-> h1-h6) 2375 else { 2376 try { 2377 return performStandardTypeChange(element, targetType, elementId); 2378 } catch (e) { 2379 console.error('core.js: Error during standard type change:', e); 2380 return false; 2381 } 2382 } 2383}; 2384 2385/** 2386 * Converts a paragraph or heading to a list element 2387 */ 2388window.convertElementToList = function(element, listType, elementId, indentLevel = 1) { 2389 console.log('core.js: convertElementToList called for element ID:', elementId, 'to type:', listType); 2390 2391 // Create a new list of the requested type 2392 const newList = document.createElement(listType); 2393 2394 // Create a list item to hold the content 2395 const newListItem = document.createElement('li'); 2396 newListItem.setAttribute('data-element-id', elementId); 2397 newListItem.setAttribute('data-level', indentLevel.toString()); 2398 2399 // Transfer content 2400 newListItem.innerHTML = element.innerHTML; 2401 2402 // Add list item to the list 2403 newList.appendChild(newListItem); 2404 2405 // Replace the original element with the new list 2406 element.parentNode.replaceChild(newList, element); 2407 2408 return true; 2409}; 2410 2411/** 2412 * Converts a list element to a paragraph 2413 */ 2414window.convertListToParagraph = function(element, targetType, elementId) { 2415 console.log('core.js: convertListToParagraph called for element ID:', elementId, 'to type:', targetType); 2416 2417 // Create a new element of the target type 2418 const newElement = document.createElement(targetType); 2419 newElement.setAttribute('data-element-id', elementId); 2420 2421 // Get the first list item (usually the one with our ID) 2422 const listItem = element.querySelector('li[data-element-id="' + elementId + '"]') || element.querySelector('li'); 2423 2424 if (listItem) { 2425 // Extract content from the list item 2426 newElement.innerHTML = listItem.innerHTML; 2427 2428 // Replace the list with the new element 2429 element.parentNode.replaceChild(newElement, element); 2430 return true; 2431 } 2432 2433 return false; 2434}; 2435 2436/** 2437 * Converts an individual list item to a paragraph 2438 */ 2439window.convertListItemToParagraph = function(element, targetType, elementId) { 2440 console.log('core.js: convertListItemToParagraph called for element ID:', elementId, 'to type:', targetType); 2441 2442 // Create new element of target type 2443 const newElement = document.createElement(targetType); 2444 2445 // Copy attributes (except data-level since it's specific to list items) 2446 Array.from(element.attributes) 2447 .filter(attr => attr.name !== 'id' && attr.name !== 'data-level') 2448 .forEach(attr => newElement.setAttribute(attr.name, attr.value)); 2449 2450 // Preserve element ID 2451 newElement.setAttribute('data-element-id', elementId); 2452 2453 // Extract content (removing any nested lists) 2454 let contentWithoutNestedLists = ''; 2455 2456 // Copy all direct text nodes and inline elements (excluding nested UL/OL elements) 2457 Array.from(element.childNodes).forEach(node => { 2458 if (node.nodeType === Node.TEXT_NODE || 2459 (node.nodeType === Node.ELEMENT_NODE && 2460 node.tagName !== 'UL' && node.tagName !== 'OL')) { 2461 2462 // Clone the node and append to new element 2463 newElement.appendChild(node.cloneNode(true)); 2464 } 2465 }); 2466 2467 // Replace the original element with the new element 2468 // If the element is inside a list, we need to handle the parent list too 2469 if (element.parentNode.tagName === 'UL' || element.parentNode.tagName === 'OL') { 2470 // If this is the only list item, replace the whole list 2471 if (element.parentNode.children.length === 1) { 2472 element.parentNode.parentNode.replaceChild(newElement, element.parentNode); 2473 } else { 2474 // Otherwise replace just this list item 2475 element.parentNode.replaceChild(newElement, element); 2476 } 2477 } else { 2478 element.parentNode.replaceChild(newElement, element); 2479 } 2480 2481 return true; 2482}; 2483 2484/** 2485 * Performs a standard type change (p <-> h1-h6) 2486 */ 2487window.performStandardTypeChange = function(element, targetType, elementId) { 2488 console.log('core.js: performStandardTypeChange called for element ID:', elementId, 'to type:', targetType); 2489 2490 // Create new element of target type 2491 const newElement = document.createElement(targetType); 2492 2493 // Copy attributes
2494 Array.from(element.attributes).forEach(attr => { 2495 if (attr.name !== 'id') { // We'll set element ID explicitly 2496 newElement.setAttribute(attr.name, attr.value); 2497 } 2498 }); 2499 2500 // Ensure element ID is preserved 2501 newElement.setAttribute('data-element-id', elementId); 2502 2503 // Copy content 2504 newElement.innerHTML = element.innerHTML; 2505 2506 // Replace the original element 2507 element.parentNode.replaceChild(newElement, element); 2508 2509 return true; 2510}; 2511 2512/** 2513 * Converts between list types (ul <-> ol) 2514 */ 2515window.convertBetweenListTypes = function(element, targetType, elementId, indentLevel) { 2516 console.log('core.js: convertBetweenListTypes called for element ID:', elementId, 'to type:', targetType); 2517 2518 // Create new list of target type 2519 const newList = document.createElement(targetType); 2520 2521 // Copy attributes 2522 Array.from(element.attributes).forEach(attr => { 2523 if (attr.name !== 'id') { 2524 newList.setAttribute(attr.name, attr.value); 2525 } 2526 }); 2527 2528 // Copy all list items 2529 element.querySelectorAll('li').forEach(li => { 2530 newList.appendChild(li.cloneNode(true)); 2531 }); 2532 2533 // Replace the original element 2534 element.parentNode.replaceChild(newList, element); 2535 2536 return true; 2537}; 2538 2539/** 2540 * Helper function to convert a paragraph or heading to a list with indentation 2541 */ 2542function convertParagraphToList(element, listType, elementId, indentLevel) { 2543 // Get the content from the paragraph 2544 const content = element.innerHTML; 2545 2546 // For standard level 1 lists, create a simple list 2547 if (indentLevel === 1) { 2548 // Create a new list 2549 const newList = document.createElement(listType); 2550 2551 // Copy attributes from the original element to the list (except ID) 2552 Array.from(element.attributes) 2553 .filter(attr => attr.name !== 'data-element-id' && attr.name !== 'id') 2554 .forEach(attr => { 2555 newList.setAttribute(attr.name, attr.value); 2556 }); 2557 2558 // Create a list item with element ID and level attribute 2559 const newListItem = document.createElement('li'); 2560 newListItem.setAttribute('data-element-id', elementId); 2561 newListItem.setAttribute('data-level', '1'); 2562 newListItem.innerHTML = content; 2563 2564 // Add the list item to the list 2565 newList.appendChild(newListItem); 2566 2567 // Replace the original element with the new list 2568 if (element.parentNode) { 2569 element.parentNode.replaceChild(newList, element); 2570 console.log('core.js: Created new list with single item'); 2571 return true; 2572 } 2573 } 2574 // For level 2 and 3 indentation (nested lists) 2575 else if (indentLevel > 1) { 2576 // Need a previous element to indent under 2577 const prevElement = element.previousElementSibling; 2578 2579 if (prevElement) { 2580 // Create a list item for our content 2581 const newListItem = document.createElement('li'); 2582 newListItem.setAttribute('data-element-id', elementId); 2583 newListItem.setAttribute('data-level', indentLevel.toString()); 2584 newListItem.innerHTML = content; 2585 2586 // Check if previous element is already a list of the right type 2587 if (prevElement.tagName.toLowerCase() === listType) { 2588 // Get the last item in the list 2589 const lastItem = prevElement.querySelector('li:last-child'); 2590 2591 if (lastItem) { 2592 // For level 2, add to the last item 2593 if (indentLevel === 2) { 2594 // Create a nested list in the last item 2595 const nestedList = document.createElement(listType); 2596 nestedList.appendChild(newListItem); 2597 lastItem.appendChild(nestedList); 2598 2599 // Remove the original element 2600 element.parentNode.removeChild(element); 2601 return true; 2602 } 2603 // For level 3, need to find a level 2 list 2604 else if (indentLevel === 3) { 2605 // Find a nested list in the last item 2606 const nestedList = lastItem.querySelector(listType); 2607 2608 if (nestedList) { 2609 // Get the last item in the nested list 2610 const lastNestedItem = nestedList.querySelector('li:last-child'); 2611 2612 if (lastNestedItem) { 2613 // Create level 3 list 2614 const level3List = document.createElement(listType); 2615 level3List.appendChild(newListItem); 2616 lastNestedItem.appendChild(level3List); 2617 2618 // Remove the original element 2619 element.parentNode.removeChild(element); 2620 return true; 2621 } 2622 } 2623 } 2624 } 2625 } 2626 // If prev isn't a list, create proper nested structure 2627 else { 2628 // For level 2, create a top level list with previous element 2629 // and our item nested beneath it
2630 if (indentLevel === 2) { 2631 // Create a top level list 2632 const parentList = document.createElement(listType); 2633 2634 // Create a list item for the previous element 2635 const parentItem = document.createElement('li'); 2636 parentItem.setAttribute('data-level', '1'); 2637 parentItem.innerHTML = prevElement.innerHTML; 2638 2639 // Create a nested list for our item 2640 const childList = document.createElement(listType); 2641 childList.appendChild(newListItem); 2642 2643 // Build the structure 2644 parentItem.appendChild(childList); 2645 parentList.appendChild(parentItem); 2646 2647 // Replace the previous element 2648 prevElement.parentNode.replaceChild(parentList, prevElement); 2649 2650 // Remove the original element 2651 element.parentNode.removeChild(element); 2652 return true; 2653 } 2654 } 2655 } 2656 2657 console.log('core.js: Could not create proper nested structure, falling back to simple list'); 2658 return convertParagraphToList(element, listType, elementId, 1); 2659 } 2660 2661 return false; 2662} 2663 2664/** 2665 * Helper function to change a list item's indentation level 2666 */ 2667function changeListItemIndentation(element, elementId, newLevel) { 2668 // Get the current level 2669 const currentLevel = parseInt(element.getAttribute('data-level')) || 1; 2670 2671 // If no change, just update the attribute 2672 if (currentLevel === newLevel) { 2673 element.setAttribute('data-level', newLevel.toString()); 2674 console.log('core.js: Updated list item level attribute to', newLevel); 2675 return true; 2676 } 2677 2678 // Get the content of the item 2679 const content = element.innerHTML; 2680 2681 // Get the parent list 2682 const parentList = element.parentNode; 2683 if (!parentList) return false; 2684 2685 const parentListType = parentList.tagName.toLowerCase(); 2686 2687 // Increasing indent level (nesting deeper) 2688 if (newLevel > currentLevel) { 2689 // Need a previous sibling to nest under 2690 const prevItem = element.previousElementSibling; 2691 2692 if (prevItem) { 2693 // Find or create nested list in previous item 2694 let nestedList = prevItem.querySelector(parentListType); 2695 2696 if (!nestedList) { 2697 nestedList = document.createElement(parentListType); 2698 prevItem.appendChild(nestedList); 2699 } 2700 2701 // Create new item with proper level 2702 const newItem = document.createElement('li'); 2703 newItem.setAttribute('data-element-id', elementId); 2704 newItem.setAttribute('data-level', newLevel.toString()); 2705 newItem.innerHTML = content; 2706 2707 // Add to nested list 2708 nestedList.appendChild(newItem); 2709 2710 // Remove original item 2711 parentList.removeChild(element); 2712 2713 console.log('core.js: Increased indent level from', currentLevel, 'to', newLevel); 2714 return true; 2715 } 2716 } 2717 // Decreasing indent level (moving out) 2718 else if (newLevel < currentLevel) { 2719 // Need to find the parent of the list we're in 2720 if (parentList.parentNode && parentList.parentNode.tagName.toLowerCase() === 'li') { 2721 const parentItem = parentList.parentNode; 2722 const grandparentList = parentItem.parentNode; 2723 2724 if (grandparentList) { 2725 // Create new item at outer level 2726 const newItem = document.createElement('li'); 2727 newItem.setAttribute('data-element-id', elementId); 2728 newItem.setAttribute('data-level', newLevel.toString()); 2729 newItem.innerHTML = content; 2730 2731 // Insert after the parent item 2732 if (parentItem.nextSibling) { 2733 grandparentList.insertBefore(newItem, parentItem.nextSibling); 2734 } else {
2735 grandparentList.appendChild(newItem); 2736 } 2737 2738 // Remove original item 2739 parentList.removeChild(element); 2740 2741 // Clean up: remove empty nested list 2742 if (!parentList.querySelector('li')) { 2743 parentItem.removeChild(parentList); 2744 } 2745 2746 console.log('core.js: Decreased indent level from', currentLevel, 'to', newLevel); 2747 return true; 2748 } 2749 } 2750 } 2751 2752 // If we couldn't properly change indentation, at least update the attribute 2753 element.setAttribute('data-level', newLevel.toString()); 2754 console.log('core.js: Updated indentation attribute but could not restructure DOM'); 2755 return true; 2756} 2757 2758/** 2759 * Updates a widget in the live preview 2760 * @param {string} widgetId - The ID of the widget to update 2761 * @param {string} html - The HTML content to update with 2762 * @param {string} initFunction - Optional initialization function name 2763 */ 2764window.updateWidget = function(widgetId, html, initFunction) { 2765 console.log('core.js: updateWidget called for widget ID:', widgetId); 2766 2767 // Find widget elements with matching element ID 2768 const widgetElements = document.querySelectorAll('[data-widget-element-id="' + widgetId + '"]'); 2769 console.log('Found widget elements by element-id:', widgetElements.length); 2770 2771 if (widgetElements && widgetElements.length > 0) { 2772 widgetElements.forEach(function(element) { 2773 // Create a temporary container for the new HTML 2774 const tempContainer = document.createElement('div'); 2775 tempContainer.innerHTML = html.trim(); 2776 2777 if (tempContainer.firstChild) { 2778 // Replace the entire element with the new content 2779 element.parentNode.replaceChild(tempContainer.firstChild, element); 2780 console.log('core.js: Replaced widget element completely'); 2781 2782 // Execute initialization function if specified 2783 if (initFunction) { 2784 if (typeof window[initFunction] === 'function') { 2785 window[initFunction](); 2786 } else if (window.UltraVanilla && typeof window.UltraVanilla[initFunction] === 'function') { 2787 window.UltraVanilla[initFunction](); 2788 } 2789 } 2790 } else { 2791 console.error('Invalid HTML received for widget update'); 2792 } 2793 }); 2794 return true; 2795 } 2796 2797 return false; 2798}; 2799 2800var visible = false; 2801window.setVisible = function() { 2802 visible = true; 2803} 2804window.setHidden = function() { 2805 visible=false; 2806} 2807 2808var justloaded=true; 2809$(window).on('storage', function (e) { 2810 var storageEvent = e.originalEvent; 2811 if (storageEvent.key=="scrolltop") { 2812 if (storageEvent.newValue != $(window).scrollTop()) { 2813 $('body,html').scrollTop(storageEvent.newValue); 2814 } 2815 2816 } 2817 if (storageEvent.newValue!=0 && storageEvent.key=="refresh") { 2818 2819 // if (storageEvent.newValue.indexOf('?preview=')!==-1) { 2820 // if (!visible && !justloaded) { 2821 if (!justloaded) { 2822 window.location.replace(storageEvent.newValue); 2823 } 2824 // } else { 2825 2826 // if (!visible && !justloaded) { 2827 // window.location.reload(); 2828 // } 2829 // } 2830 2831 } 2832 if (storageEvent.key=="cmsupdate") { 2833 updateCMSText(storageEvent.newValue); 2834 } 2835 2836}); 2837 2838function cmsBookingReapply() { 2839 2840 $(".cms-booking-product-form.cms-booking-combined-dates").each(function(){ 2841 $(".cms-booking-product-selected:not(.cms-master-days .cms-booking-product-selected)",$(this)).removeClass("cms-booking-product-selected"); 2842 $(".cms-master-days .cms-booking-product-date.cms-booking-product-selected.cms-booking-product-available",$(this)).each(function(){ 2843 $(this).trigger("click",true); 2844 }); 2845 }); 2846} 2847var firstShow = true; 2848function cmsUpdateBookingPrices () { 2849 2850 var st = $(window).scrollTop(); 2851 $(".cms-booking-product-form").each(function(){ 2852 2853 2854 var total = 0; 2855 var surcharge = 0; 2856 var $form = $(this); 2857 if ($form.hasClass("cms-booking-combined-dates")) { 2858 $(".cms-master-days",$form).hide(); 2859 $(".cms-booking-product-select-product",$form).show(); 2860 $(".cms-booking-product-legend",$form).hide(); 2861 $(".cms-master-days .cms-booking-product-date:not(.cms-booking-product-history,.cms-booking-filler)",$form).addClass("cms-booking-product-available"); 2862 } 2863 2864 if ($form.hasClass("cms-booking-combined-dates")) { 2865 $form.find(".cms-booking-product-add-to-basket").addClass('unavailable').attr('title',$form.find(".cms-booking-product-add-to-basket").data('unavail')); 2866 } 2867 2868 $(".cms-booking-product",$form).each(function(){ 2869 var $prod = $(this); 2870 var use_min_charge = $(this).data("use-minimum-price"); 2871 2872 if (!$form.hasClass("cms-booking-combined-dates")) { 2873 $form.find(".cms-booking-product-add-to-basket").addClass('unavailable').attr('title',$form.find(".cms-booking-product-add-to-basket").data('unavail')); 2874 } 2875 2876 var qty_adults = parseInt($(".cms-booking-product-normal-qty input",$prod).val()); 2877 var qty_special = parseInt($(".cms-booking-product-special-qty input",$prod).val()); 2878 var qty_children = parseInt($(".cms-booking-product-children-qty input",$prod).val()); 2879 2880 2881 2882 if (isNaN(qty_adults)) { 2883 qty_adults = 0; 2884 } 2885 if (isNaN(qty_special)) { 2886 qty_special = 0; 2887 } 2888 if (isNaN(qty_children)) { 2889 qty_children = 0; 2890 } 2891 2892 if ($prod.data("adult-required")===1 && qty_children>0) { 2893 if (qty_special+qty_adults === 0) { 2894 setTimeout(function () { 2895 $(".cms-booking-product-require-adult",$prod).slideDown(300,function(){ 2896 if (typeof moduleHeights == 'function') { 2897 moduleHeights(); 2898 } 2899 }); 2900 }, 10);
2901 $(".cms-booking-product-children-qty input",$prod).val("0"); 2902 qty_children=0; 2903 } else { 2904 $(".cms-booking-product-require-adult",$prod).slideUp(300,function(){}); 2905 } 2906 } 2907 2908 var t = qty_adults+qty_special+qty_children; 2909 $(this).removeClass("cms-booking-zero-qty"); 2910 if (t===0) { 2911 $(this).addClass("cms-booking-zero-qty"); 2912 } 2913 if (t>0&&$form.hasClass("cms-booking-combined-dates")) { 2914 $(".cms-master-days",$form).show(); 2915 2916 if (firstShow) { 2917 $(".cms-master-days:first").each(function(){ 2918 if ($(".cms-booking-product-date:not(.cms-booking-product-history):first",$(this)).length) { 2919 var ol = $(".cms-booking-product-date:not(.cms-booking-product-history):first",$(this)).position().left; 2920 $(".cms-booking-product-dates-inner",$(this)).animate({scrollLeft:ol},500); 2921 2922 } 2923 }); 2924 firstShow=false; 2925 } 2926 $(".cms-booking-product-select-product",$form).hide(); 2927 $(".cms-booking-product-legend",$form).show(); 2928 2929 } 2930 2931 2932 2933 $(".cms-booking-product-toomany",$prod).removeClass("cms-booking-product-toomany"); 2934 $form.find(".cms-booking-product-min-days-error").hide(); 2935 $form.find(".cms-booking-product-add-to-basket").show(); 2936 $(".cms-booking-product-date",$prod).each(function(){ 2937 var $date = $(this); 2938 if ($form.hasClass("cms-booking-combined-dates")) { 2939 if (t>0 && !$date.hasClass("cms-booking-product-available")) { 2940 $(".cms-master-days .cms-booking-product-date[data-date='"+$date.attr("data-date")+"']",$form).removeClass("cms-booking-product-available"); 2941 } 2942 } 2943 if (t > $date.data("available")) { 2944 $date.addClass("cms-booking-product-toomany"); 2945 if ($form.hasClass("cms-booking-combined-dates")) { 2946 $(".cms-master-days .cms-booking-product-date[data-date='"+$date.attr("data-date")+"']",$form).removeClass("cms-booking-product-available"); 2947 } 2948 var addOrRemove = true; 2949 if ($date.hasClass("block-start")) { 2950 $date.nextUntil($(".block-end")).each(function(){ 2951 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 2952 }).next().toggleClass("cms-booking-product-toomany",addOrRemove); 2953 } 2954 if ($date.hasClass("block-middle")) { 2955 $date.nextUntil($(".block-end")).each(function(){ 2956 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 2957 }).next().toggleClass("cms-booking-product-toomany",addOrRemove); 2958 if ($date.next().hasClass("block-end")) { 2959 $date.next().toggleClass("cms-booking-product-toomany",addOrRemove); 2960 } 2961 $date.prevUntil($(".block-start")).each(function(){ 2962 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 2963 }).prev().toggleClass("cms-booking-product-toomany",addOrRemove); 2964 if ($date.prev().hasClass("block-start")) { 2965 $date.prev().toggleClass("cms-booking-product-toomany",addOrRemove); 2966 } 2967 } 2968 if ($date.hasClass("block-end")) { 2969 $date.prevUntil($(".block-start")).each(function(){ 2970 $date.toggleClass("cms-booking-product-toomany",addOrRemove); 2971 }).prev().toggleClass("cms-booking-product-toomany",addOrRemove); 2972 } 2973 } 2974 }); 2975 2976 // Minimum-consecutive-days check. Runs ONCE over the whole selection 2977 // (replaces the old per-cell nextcounter walk, which had an off-by-one 2978 // that silently passed a min-days of 2 and was fragile on multi-day 2979 // runs). Group the selected dates into consecutive-day runs by REAL 2980 // dates, then require every run that contains a min-days>0 date to be at 2981 // least as long as the largest min-days among its members. In combined 2982 // mode the selection lives on the .cms-master-days clones; otherwise on 2983 // the product cells — either way $prod scopes to the right form. 2984 (function(){ 2985 var $scope = $form.hasClass("cms-booking-combined-dates") ? $(".cms-master-days",$form) : $prod; 2986 var picked = []; 2987 $(".cms-booking-product-date.cms-booking-product-selected",$scope).each(function(){ 2988 var d = $(this).attr("data-date"); 2989 if (!d) return; 2990 picked.push({ date: d, min: parseInt($(this).attr("data-min-days"),10) || 0 }); 2991 }); 2992 if (!picked.length) return; 2993 // Normalise "YYYY-M-D" (unpadded) to a comparable/serial form. 2994 function serial(ds){ var p = ds.split("-"); return Date.UTC(+p[0], +p[1]-1, +p[2]) / 86400000; } 2995 picked.forEach(function(p){ p.s = serial(p.date); }); 2996 picked.sort(function(a,b){ return a.s - b.s; }); 2997 var shortfall = 0, runStart = 0; 2998 for (var i = 1; i <= picked.length; i++) { 2999 var consecutive = i < picked.length && (picked[i].s - picked[i-1].s === 1); 3000 if (!consecutive) { 3001 var run = picked.slice(runStart, i), runMin = 0; 3002 for (var j = 0; j < run.length; j++) if (run[j].min > runMin) runMin = run[j].min; 3003 if (runMin > 0 && run.length < runMin) { shortfall = runMin; break; } 3004 runStart = i; 3005 } 3006 } 3007 if (shortfall > 0) { 3008 var $err = $form.find(".cms-booking-product-min-days-error"); 3009 $err.text(($err.data("orig-text")||"").replace("***", shortfall)).show(); 3010 $form.find(".cms-booking-product-add-to-basket").hide(); 3011 } 3012 })(); 3013 3014 var days = "["; 3015 $(".cms-booking-product-selected:not(.cms-booking-product-toomany)",$prod).each(function(){ 3016 3017 var price_normal = parseFloat($(this).data("price-normal")); 3018 var price_special = parseFloat($(this).data("price-special")); 3019 var price_children = parseFloat($(this).data("price-children")); 3020 var min_price = parseFloat($(this).data("minimum-price-per-place")); 3021 3022 var normal = price_normal * qty_adults; 3023 var special = price_special * qty_special; 3024 var children = price_children * qty_children; 3025 3026 var subtotal = normal+special+children; 3027 var subsurcharge=0; 3028 if (subtotal < min_price && use_min_charge) { 3029 var subsurcharge = min_price-subtotal; 3030 surcharge = surcharge+subsurcharge; 3031 } 3032 total = total+subtotal+subsurcharge; 3033 3034 if (days!="[") { 3035 days = days+','; 3036 } 3037 days = days+'"'+$(this).data("date")+'"'; 3038 }); 3039 days = days+"]"; 3040 $(".cms-booking-product-days-input",$(this)).val(days); 3041 if (t>0&&JSON.parse(days).length>0){ 3042 $form.find(".cms-booking-product-add-to-basket").removeClass('unavailable').attr('title',$form.find(".cms-booking-product-add-to-basket").data('orig')); 3043 } 3044 3045 if ($(".persondetailsmaster",$(this)).length) { 3046 $(".persondetailsmaster",$(this)).find(".required").prop("required",fal
3046se); 3047 function addBPForms(qty,c,$this) { 3048 $(".personal-details-forms .personal-details-form.personal-details-form-"+c,$this).hide(); 3049 var a = 1; 3050 var t = qty; 3051 3052 while (a <= t) { 3053 3054 if ($(".personal-details-forms .personal-details-form.personal-details-form-"+c+":hidden",$this).length) { 3055 $(".personal-details-forms .personal-details-form.personal-details-form-"+c+":hidden:first",$this).show(); 3056 } else { 3057 if ($('.personal-details-forms .personal-details-form-'+c+":visible",$this).length) { 3058 $('.personal-details-forms .personal-details-form-'+c+":visible:last",$this).after($(".persondetailsmaster > *",$this).clone().addClass('personal-details-form-'+c)); 3059 } else { 3060 $(".personal-details-forms",$this).append($(".persondetailsmaster > *",$this).clone().addClass('personal-details-form-'+c)); 3061 } 3062 3063 } 3064 str = localStorage.getItem('bookingData'+$('body').data('page-id')); 3065 var bookingproducts = JSON.parse(str); 3066 var justcount =0; 3067 $this.addClass("currentprod"); 3068 if (bookingproducts != null){ 3069 $(".cms-booking-product").each(function(){ 3070 if ($(this).hasClass("currentprod")){ 3071 $(this).removeClass("currentprod"); 3072 var x=1; 3073 while (x<=justcount){ 3074 3075 if (justcount>0&&typeof bookingproducts[justcount-x]!= "undefined" && typeof bookingproducts[justcount-x].forms[a-1] != "undefined"&&$(".personal-details-form #"+bookingproducts[justcount-x].forms[a-1][0].id,$this).length){ 3076 $(".personal-details-form:visible:last",$this).find(".reuse-last-form").show(); 3077 } 3078 x++; 3079 } 3080 } 3081 justcount++; 3082 }); 3083 } 3084 3085 a++; 3086 } 3087 3088 } 3089 addBPForms(qty_adults,"norm",$(this)); 3090 addBPForms(qty_children,"children",$(this)); 3091 addBPForms(qty_special,"special",$(this)); 3092 setPersonalNames($(this)); 3093 } 3094 3095 3096 }); 3097 3098 if (surcharge>0) { 3099 $(".cms-booking-product-total-surcharge",$(this)).show(); 3100 $(".cms-booking-product-total-surcharge span",$(this)).text(surcharge.toFixed(2)); 3101 } else { 3102 $(".cms-booking-product-total-surcharge",$(this)).hide(); 3103 } 3104 $(".cms-booking-product-total-price span",$(this)).text(total.toFixed(2)); 3105 3106 3107 3108 if ($form.hasClass("cms-booking-combined-dates")) { 3109 3110 cmsBookingProdTestEachDay($form); 3111 3112 $(".cms-booking-product-not-available-for-days",$form).removeClass("cms-booking-product-not-available-for-days") 3113 3114 $(".cms-booking-zero-qty",$form).each(function(){ 3115 3116 var $zeroProd = $(this); 3117 setTimeout(function () { 3118 $(".cms-master-days .cms-booking-product-date.cms-booking-product-selected",$form).each(function(){ 3119 var d = $(this).data("date"); 3120 if (!$(".cms-booking-product-date[data-date='"+d+"']",$zeroProd).hasClass("cms-booking-product-available")) { 3121 $zeroProd.addClass("cms-booking-product-not-available-for-days"); 3122 } 3123 }); 3124 }, 10); 3125 3126 3127 }); 3128 } 3129 if ($form.find(".cms-booking-product-available").length==0){ 3130 3131 if (firstbookingload){ 3132 $(".cms-booking-combined-dates .cms-booking-product-next-month").trigger("click"); 3133 firstbookingload=false; 3134 } 3135 } 3136 }); 3137 3138 $("body,html").scrollTop(st); 3139 if (typeof moduleHeights == 'function') { 3140 moduleHeights(); 3141 } 3142} 3143function cmsBookingProdTestEachDay($form) { 3144 return false; 3145 $(".cms-master-days .cms-booking-product-available",$form).each(function(){ 3146 var $day = $(this); 3147 var d = $(this).data("date"); 3148 $(".cms-booking-product",$form).each(function(){ 3149 3150 var $prod = $(this); 3151 3152 var qty_adults = parseInt($(".cms-booking-product-normal-qty input",$prod).val()); 3153 var qty_special = parseInt($(".cms-booking-product-special-qty input",$prod).val()); 3154 var qty_children = parseInt($(".cms-booking-product-children-qty input",$prod).val()); 3155 3156 if (isNaN(qty_adults)) { 3157 qty_adults = 0; 3158 } 3159 if (isNaN(qty_special)) { 3160 qty_special = 0; 3161 } 3162 if (isNaN(qty_children)) { 3163 qty_children = 0; 3164 } 3165 var t = qty_adults+qty_special+qty_children; 3166 3167 $(".cms-booking-product-test",$prod).removeClass("cms-booking-product-test"); 3168 3169 $(".cms-booking-product-date[data-date='"+d+"']",$prod).each(function(){ 3170 3171 var addOrRemove = true; 3172 var c = "cms-booking-product-test"; 3173 3174 if ($(this).hasClass("block-start")) { 3175 $(this).nextUntil($(".block-end")).each(function(){ 3176 $(this).toggleClass(c,addOrRemove); 3177 }).next().toggleClass(c,addOrRemove);
3178 if ($(this).next().hasClass("block-end")) { 3179 $(this).next().toggleClass(c,addOrRemove); 3180 } 3181 } 3182 if ($(this).hasClass("block-middle")) { 3183 $(this).nextUntil($(".block-end")).each(function(){ 3184 $(this).toggleClass(c,addOrRemove); 3185 }).next().toggleClass(c,addOrRemove); 3186 if ($(this).next().hasClass("block-end")) { 3187 $(this).next().toggleClass(c,addOrRemove); 3188 } 3189 $(this).prevUntil($(".block-start")).each(function(){ 3190 $(this).toggleClass(c,addOrRemove); 3191 }).prev().toggleClass(c,addOrRemove); 3192 if ($(this).prev().hasClass("block-start")) { 3193 $(this).prev().toggleClass(c,addOrRemove); 3194 } 3195 } 3196 if ($(this).hasClass("block-end")) { 3197 $(this).prevUntil($(".block-start")).each(function(){ 3198 $(this).toggleClass(c,addOrRemove); 3199 }).prev().toggleClass(c,addOrRemove); 3200 if ($(this).prev().hasClass("block-start")) { 3201 $(this).prev().toggleClass(c,addOrRemove); 3202 } 3203 } 3204 3205 $(this).toggleClass(c,addOrRemove); 3206 3207 }); 3208 }); 3209 $(".cms-booking-product-test",$form).each(function(){ 3210 var addD = $(this).data("date"); 3211 $(".cms-master-days .cms-booking-product-date[data-date='"+addD+"']",$form).each(function(){ 3212 if (!$(this).hasClass("cms-booking-product-available")) { 3213 $(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form).removeClass("cms-booking-product-available"); 3214 } 3215 }); 3216 }); 3217 }); 3218 $(".cms-booking-product-test",$form).removeClass("cms-booking-product-test"); 3219} 3220function setSSCalendarGroupFilter() { 3221 $(".ss_calendar_group_filter").each(function(){ 3222 $(".event.ss-filter-group-id-"+$(this).data("group-id"),$(".calendar")).hide(); 3223 }); 3224 $(".ss_calendar_group_filter:checked").each(function(){ 3225 $(".event.ss-filter-group-id-"+$(this).data("group-id"),$(".calendar")).show(); 3226 }); 3227} 3228function loadBookingProdForms() { 3229 if (!$(".personal-details-forms").length) { 3230 return false; 3231 } 3232 //var str = readCookie('bookingData'+$('body').data('page-id')); 3233 str = localStorage.getItem('bookingData'+$('body').data('page-id')); 3234 var bookingproducts = JSON.parse(str); 3235 if (bookingproducts && $(".cms-booking-product").length) { 3236 3237 var count = 0; 3238 $(".cms-booking-product").each(function(){ 3239 var adults = bookingproducts[count].adults; 3240 var children = bookingproducts[count].children; 3241 var special = bookingproducts[count].special; 3242 var formdata= bookingproducts[count].forms; 3243 $(this).find('.cms-booking-product-normal-qty input').val(adults); 3244 if ($(this).find('.cms-booking-product-children-qty input').length) { 3245 $(this).find('.cms-booking-product-children-qty input').val(children); 3246 } 3247 if ($(this).find('.cms-booking-product-special-qty input').length) { 3248 $(this).find('.cms-booking-product-special-qty input').val(special); 3249 } 3250 cmsUpdateBookingPrices(); 3251 cmsBookingReapply(); 3252 var formcount=0; 3253 $(".personal-details-forms .personal-details-form",$(this)).each(function(){ 3254 var formd = formdata[formcount]; 3255 for (var i = 0; i < formd.length; i++) { 3256 if (formd[i].value=="checkedPROP") { 3257 $("#"+formd[i].id,$(this)).prop('checked',true); 3258 } else { 3259 $("#"+formd[i].id,$(this)).val(formd[i].value); 3260 } 3261 } 3262 formcount++; 3263 }); 3264 3265 count++; 3266 }); 3267 3268 setTimeout(function () { 3269 cmsUpdateBookingPrices(); 3270 }, 10); 3271 $(".booking-just-available-dates,.cms-booking-combined-dates").first().before('<p class="Icon_Info">'+$(".cms-booking-combined-dates:first,.booking-just-available-dates ").data("retrieved-msg").replace("(","<a href='' class='resetBooking'>").replace(")","</a>")+'</p>'); 3272 $('.resetBooking').click(function(){ 3273 localStorage.removeItem('bookingData'+$('body').data('page-id')); 3274 window.location.reload(); 3275 return false; 3276 }); 3277 } 3278 3279} 3280function saveBookingProdState() { 3281 var bookingproducts = []; 3282 $(".cms-booking-product").each(function(){ 3283 var forms = []; 3284 $(".personal-details-forms .personal-details-form",$(this)).each(function(){ 3285 var formdata = []; 3286 $(".input,.select",$(this)).each(function(){ 3287 3288 formdata.push({id:$(this).attr('id'),value:$(this).val()}) 3289 }); 3290 $(".radio:checked,.checkbox:checked",$(this)).each(function(){ 3291 formdata.push({id:$(this).attr('id'),value:"checkedPROP"}) 3292 }); 3293 forms.push(formdata); 3294 }); 3295 bookingproducts.push({ 3296 name:$(this).find(".cms-boooking-product-quantities h3").text() 3297 ,adults:$(this).find('.cms-booking-product-normal-qty input').val() 3298 ,children:$(this).find('.cms-booking-product-children-qty input').val() 3299 ,special:$(this).find('.cms-booking-product-special-qty input').val() 3300 ,forms:forms 3301 }); 3302 }); 3303 3304 //createCookie('bookingData'+$('body').data('page-id'),JSON.stringify(bookingproducts)); 3305 localStorage.setItem('bookingData'+$('body').data('page-id'),JSON.stringify(bookingproducts)); 3306} 3307if (window.performance && window.performance.navigation.type == window.performance.navigation.TYPE_BACK_FORWARD) { 3308 loadBookingProdForms(); 3309}
3310function makeCombinedDays() { 3311 $(".cms-booking-combined-dates").each(function(){ 3312 if ($(".cms-booking-product-form.cms-booking-combined-dates").length>1) { 3313 $(".cms-booking-product-form.cms-booking-combined-dates").each(function(){ 3314 $(".cms-booking-product-select-product",$(this)).hide(); 3315 $(".cms-booking-product-legend",$(this)).show(); 3316 3317 var $prev = $(this).prev().prev(); 3318 if (!$prev.hasClass("cms-booking-product-form")) { 3319 $(this).addClass("cms-booking-product-first") 3320 } 3321 }); 3322 var $f; 3323 } 3324 }); 3325 $(".cms-booking-combined-dates").each(function(){ 3326 if ($(this).hasClass("cms-booking-product-first")) { 3327 $f = $(this); 3328 } 3329 var $next = $(this).next().next(); 3330 if ($next.hasClass("cms-booking-product-form")) { 3331 $(".cms-booking-product",$next).insertBefore($f.find(".cms-booking-product-total")); 3332 $next.addClass("toremove"); 3333 } else { 3334 return false; 3335 } 3336 $(".booking-just-available-dates .cms-booking-product-legend",$(this)).hide().last().show(); 3337 $(".toremove").remove(); 3338 }); 3339 $(".cms-booking-combined-dates").each(function(){ 3340 $(".cms-master-days",$(this)).remove(); 3341 $(".cms-booking-product-total",$(this)).before('<div class="cms-master-days clearfix"></div>'); 3342 var $days= $("<div class=\"cms-booking-product-dates clearfix\"></div>"); 3343 var added= new Array(); 3344 $(".cms-booking-product-dates").each(function(){ 3345 if (!$("h4",$days).length) { 3346 $("h4",$(this)).clone().appendTo($days); 3347 3348 } 3349 if (!$(".cms-booking-product-dates-inner",$days).length) { 3350 $(".cms-booking-product-dates-inner",$(this)).clone().empty().appendTo($days); 3351 } 3352 if ($(".cms-booking-product-nav",$(this)).length && !$(".cms-booking-product-nav",$days).length) { 3353 $(".cms-booking-product-cur-month",$(this)).clone().prependTo($days); 3354 $(".cms-booking-product-nav",$(this)).clone().prependTo($days); 3355 } 3356 3357 3358 $(".cms-booking-product-date",$(this)).each(function(){ 3359 var d = $(this).data("date"); 3360 // When several products share a date on the merged calendar, the 3361 // booking must satisfy the STRICTEST minimum-consecutive-days among 3362 // them. The dedupe below keeps only the FIRST product's cell, so a 3363 // lower/zero min-days product would otherwise mask another product's 3364 // minimum on shared dates and let a single day slip through. When a 3365 // duplicate date arrives, re-stamp the merged cell with the larger. 3366 var incomingMin = parseInt($(this).attr("data-min-days"),10) || 0; 3367 if ($.inArray(d, added)===-1){ 3368 3369 $days.find(".cms-booking-product-dates-inner").append($(this).clone()); 3370 added.push(d); 3371 } else { 3372 var $existing = $days.find(".cms-booking-product-date[data-date='"+d+"']"); 3373 var currentMin = parseInt($existing.attr("data-min-days"),10) || 0; 3374 if (incomingMin > currentMin) { 3375 $existing.attr("data-min-days",incomingMin); 3376 $existing.data("min-days",incomingMin); // keep jQuery .data() cache in sync 3377 } 3378 } 3379 3380 }) 3381 }); 3382 $(".cms-master-days",$(this)).html($days); 3383 $(".block-start,.block-middle,.block-end",$(".cms-master-days",$(this))).removeClass("block-start block-middle block-end"); 3384 var $form = $(this); 3385 $(".cms-booking-product-date.cms-booking-product-selected:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)",$(this)).each(function(){ 3386 var d = $(this).data('date'); 3387 $(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form).addClass("cms-booking-product-selected"); 3388 }); 3389 cmsUpdateBookingPrices(); 3390 3391 }); 3392} 3393function hideSearchAdmin() { 3394 $("#searchiframe").fadeOut().removeClass("showing"); 3395} 3396function checkCalendars() { 3397 $(".responsive_calendar").each(function(){ 3398 if ($(".calendar_responsive_full_mode:visible",$(this)).length) { 3399 var w = $(".calendar_responsive_full_mode",$(this)).width(); 3400 } else { 3401 var w = $(".calendar_responsive_list_mode",$(this)).width(); 3402 } 3403 if (w<768) { 3404 $(".calendar_responsive_full_mode",$(this)).hide(); 3405 $(".calendar_responsive_list_mode",$(this)).show(); 3406 } else { 3407 $(".calendar_responsive_full_mode",$(this)).show(); 3408 $(".calendar_responsive_list_mode",$(this)).hide(); 3409 } 3410 }); 3411 setTimeout(function () { 3412 if (typeof moduleHeights == 'function') { 3413 moduleHeights(); 3414 } 3415 }, 10); 3416} 3417$(window).resize(function(){ 3418 checkCalendars(); 3419}); 3420window.dataLayer = window.dataLayer || []; 3421 3422function stopScroll() { 3423 localStorage.setItem('scrolltop', $(window).scrollTop()); 3424 3425} 3426 3427var charts = new Array(); 3428var stopping; 3429$(window).on("load",function(){ 3430 if (readCookie('editingcms')) { 3431 if ( window.location !== window.parent.location ) { 3432 $("a").attr("target","_blank"); 3433 $("body").removeClass("is_admin"); 3434 } 3435 $("body,html").scrollTop(localStorage.getItem("scrolltop")); 3436 $(document).on("scroll",function(){ 3437 3438 clearTimeout(stopping); 3439 stopping = setTimeout(stopScroll,100); 3440 3441 3442 }); 3443 if (typeof parent.switchpreview != "undefined") { 3444 setTimeout(function () { 3445 parent.switchpreview(); 3446 }, 200); 3447 3448 } 3449 setTimeout(function () { 3450 justloaded=false; 3451 }, 50); 3452 3453 } 3454}).on("load",function(){ 3455 3456 var ctx = new Array(); 3457 $(".cms-chart-c").each(function(){ 3458 var id = $(this).attr('id'); 3459 var $this = $(this)[0]; 3460 ctx[id] = $this.getContext('2d'); 3461 var datasets = new Array(); 3462 var i = 1; 3463 var type="bar"; 3464 var fill="true"; 3465 var maintype="bar"; 3466 var border=0; 3467 if ($(this).data('style')=="line") { 3468 maintype="line"; 3469 type="line"; 3470 border=2; 3471 } 3472 if ($(this).data('style')=="pie") { 3473 maintype="pie"; 3474 for (var set in $(this).data('datasets')) { 3475 var c = 0; 3476 var colours = new Array(); 3477 for (var col in $(this).data('datasets')[set].data) { 3478 colours[c]=getChartColour(c); 3479 c++; 3480 } 3481 datasets[i-1] = {label:$(this).data('datasets')[set].label,backgroundColor:colours,data: $(this).data('datasets')[set].data}; 3482 i++; 3483 } 3484 window.charts[id] = new Chart(ctx[id], { 3485 type: 'pie', 3486 data: { 3487 labels: $(this).data('labels'), 3488 datasets: datasets 3489 }, 3490 options: { 3491 responsive: true 3492 } 3493 }); 3494 } else { 3495 3496 for (var set in $(this).data('datasets')) { 3497 if ($(this).data('style')=="linebar") { 3498 if (i==1) { 3499 type="line"; 3500 fill="false"; 3501 border=2; 3502 } 3503 else { 3504 type="bar"; 3505 fill="false"; 3506 border=0; 3507 } 3508 } 3509 datasets[i-1] = {type:type,fill:fill,label:$(this).data('datasets')[set].label,borderWidth:border,borderColor:getChartColour(i),backgroundColor:getChartColour(i),data: $(this).data('datasets')[set].data}; 3510 i++; 3511 } 3512 window.charts[id] = new Chart(ctx[id], { 3513 type: maintype, 3514 data: { 3515 labels: $(this).data('labels'), 3516 datasets:datasets 3517 }, 3518 options: { 3519 scales:{ 3520 yAxes: [{ 3521 ticks: { 3522 beginAtZero:true 3523 } 3524 }] 3525 }, 3526 responsive: true, 3527 legend: { 3528 position: 'top' 3529 ,display:$(this).data('legend-display') 3530 }, 3531 title: { 3532 display: true, 3533 text: $(this).data('caption') 3534 } 3535 } 3536 }); 3537 } 3538 }); 3539 3540}); 3541function goTarget(target) { 3542 console.log("DEBUG: goTarget called with target:", target); 3543 console.log("DEBUG: iniframe =", iniframe); 3544 if (iniframe) { 3545 console.log("DEBUG: In iframe, calling parent.loadCMS"); 3546 parent.loadCMS(target); 3547 }else{ 3548 console.log("DEBUG: Not in iframe, navigating directly"); 3549 /* No touch test: touchscreen laptops have width + a trackpad, so width + 3550 the multi-window toggle are the only signals (matches useIframeShell). */ 3551 if ($(window).width()>900&&!$("#toggleSeparate").hasClass("enabled")) { 3552 console.log("DEBUG: Using window.location.href"); 3553 window.location.href="/admin/index-new.php?go="+encodeURIComponent(target); 3554 } else {
3555 console.log("DEBUG: Using window.open"); 3556 window.open(target,"CMS"); 3557 } 3558 } 3559} 3560document.addEventListener("touchstart", touchHandler, {passive:false}); 3561function touchHandler(event) 3562 { 3563 3564 var touches = event.changedTouches, 3565 first = touches[0], 3566 type = ""; 3567 3568 switch(event.type) 3569 { 3570 case "touchstart": 3571 touchbased=true; 3572 break; 3573 } 3574} 3575var touchbased=false; 3576window.showCMSButton = function() { 3577 if ($("#editInCMS").length) { 3578 $("#editInCMS").show(); 3579 return false; 3580 } 3581 3582 var fileref=document.createElement("link") 3583 fileref.setAttribute("rel", "stylesheet") 3584 fileref.setAttribute("type", "text/css") 3585 fileref.setAttribute("href", "https://fonts.googleapis.com/css?family=Open+Sans:300,400") 3586 3587 document.getElementsByTagName("head")[0].appendChild(fileref); 3588 var fileref=document.createElement("link") 3589 fileref.setAttribute("rel", "stylesheet") 3590 fileref.setAttribute("type", "text/css") 3591 fileref.setAttribute("href", "/admin/css/badge.css?v=97") 3592 3593 document.getElementsByTagName("head")[0].appendChild(fileref); 3594 var app = '<div id="editInCMS" class="clearfix">' 3595 +'</div>'; 3596 $('body').append(app); 3597 $("#editInCMS").load('/admin/index-new.php?justmenu=true',function(){ 3598 if ($("#editInCMS #ordersCount").length){ 3599 $("#showCMSMenu").append("<span class='badge'></span>"); 3600 } 3601 if ($("#expandCMSMenu").hasClass("saveStyles")&&$("body").hasClass("breakpoints")){ 3602 if (typeof window.findBreakpoints != 'undefined'){ 3603 if (window.self!=window.parent){ 3604 window.parent.showBreakpointLoader(); 3605 } else { 3606 $("body").append('<div class="breakpointload"><div><svg>'+ 3607 '<circle class="bg" cx="57" cy="57" r="52" />'+ 3608 '<circle class="meter-1" cx="57" cy="57" r="52" />'+ 3609 '</svg><div>Building CSS breakpoints. Please wait.<span>Please do not close this window</span></div></div></div>'); 3610 3611 } 3612 window.findBreakpoints=true; 3613 flexiBreak(); 3614 } 3615 } 3616 if (window.self!=window.parent){ 3617 $("body").removeClass("is_admin"); 3618 $("#editInCMS").remove(); 3619 } 3620 if (!$("#showCMSMenu").length && !$("#goToNewHomepage").length){ 3621 $("body").removeClass("is_admin"); 3622 } 3623 $('#showCMSMenu').click(function(){ 3624 if ($(this).parent().hasClass('active')) { 3625 $(this).parent().removeClass("active"); 3626 setTimeout(function(){ 3627 $("#expandCMSMenu").css("display","none"); 3628 }, 200); 3629 3630 // $('#expandCMSMenu').slideUp(); 3631 // $("#editDesign").removeClass("hidden"); 3632 3633 } else { 3634 $("#expandCMSMenu").css("display","block"); 3635 $t =$(this); 3636 setTimeout(function(){ 3637 $t.parent().addClass("active"); 3638 },2); 3639 // $('#expandCMSMenu').slideDown(); 3640 // $("#editDesign").addClass("hidden"); 3641 3642 } 3643 }); 3644 $('#goToNewHomepage').click(function(){ 3645 window.location.href = '/admin/home.php'; 3646 }); 3647 if (readCookie('editingdesign')) { 3648 $("#editThisPageCMS").after("<div id='editDesign'>Edit template</div>") 3649 } 3650 if (readCookie("separateEnabled")){ 3651 $("#youSection").after("<div id='toggleSeparate' title='Disable two-window mode' class='enabled'>Multi-Window Mode<span></span></div>") 3652 }else{ 3653 $("#youSection").after("<div id='toggleSeparate' title='Enable two-window mode'>Multi-Window Mode<span></span></div>") 3654 3655 } 3656 $("#toggleLearningMode").click(function(){ 3657 if ($(this).hasClass("enabled")) { 3658 $(this).removeClass("enabled"); 3659 var update = "0"; 3660 } else { 3661 $(this).addClass("enabled"); 3662 var update = "1"; 3663 } 3664 $.ajax({ 3665 type: "POST", 3666 url: "/admin/adminUsersActions.php", 3667 data: "adminUsersAction=toggleLearningMode&learningmode="+update, 3668 success: function(msg){ 3669 } 3670 }); 3671 }); 3672 $("#toggleNewHomepage").click(function(){ 3673 var update = $(this).hasClass("enabled") ? "0" : "1"; 3674 $(this).toggleClass("enabled"); 3675 $.ajax({ 3676 type: "POST", 3677 url: "/admin/adminUsersActions.php", 3678 data: "adminUsersAction=toggleNewHomepage&use_new_homepage="+update, 3679 success: function(msg){ 3680 if (update === "1") { 3681 window.location.href = "/admin/home.php"; 3682 } 3683 } 3684 }); 3685 }); 3686 $("#toggleSeparate").click(function(){ 3687 if ($(this).hasClass("enabled")){ 3688 eraseCookie("separateEnabled"); 3689 $(this).removeClass("enabled").attr("title","Enable two-window mode"); 3690 } else{ 3691 createCookie("separateEnabled",true,30); 3692 $(this).addClass("enabled").attr("title","Disable"); 3693 } 3694 }); 3695 $("#editThisPageCMS").click(function(){ 3696 var page = window.location.pathname; 3697 createCookie('lastEditedPage',page); 3698 if ($('input[name="editmeid"]').length) { 3699 var target = "/admin/editme.php?pageid="+encodeURIComponent($('input[name="editmeid"]').val()); 3700 goTarget(target); 3701 3702 }else{ 3703 var target = "/admin/editme.php?page="+encodeURIComponent(page); 3704 goTarget(target); 3705 3706 } 3707 3708 }); 3709 $('#clearCacheCMS').click(function(){ 3710 var $btn = $(this); 3711 $btn.css('opacity', '0.5'); 3712 $.ajax({ 3713 url: '/admin/pageActions.php', 3714 type: 'POST', 3715 data: { pageAction: 'cleartemplatecache' }, 3716 success: function() { 3717 window.location.reload(); 3718 }, 3719 error: function() { 3720 $btn.css('opacity', '1'); 3721 alert('Failed to clear cache'); 3722 } 3723 }); 3724 }); 3725 $('#editDesign').click(function(){ 3726 var page = window.location.pathname; 3727 createCookie('lastEditedPage',page); 3728 if ($('input[name="editmeid"]').length) { 3729 var target = "/admin/editme.php?edittemplate=1&pageid="+encodeURIComponent($('input[name="editmeid"]').val()); 3730 goTarget(target); 3731 3732 }else{ 3733 var target = "/admin/editme.php?edittemplate=1&page="+encodeURIComponent(page); 3734 3735 goTarget(target); 3736 3737 } 3738 3739 }); 3740 $("#expandCMSMenu #actingAs").clone().prependTo("#editInCMS"); 3741 $("#expandCMSMenu #brandingbar").clone().prependTo("#editInCMS"); 3742 // Move home button to the left of brandingbar 3743 if ($("#editInCMS #goToNewHomepage").length) { 3744 $("#editInCMS #goToNewHomepage").prependTo("#editInCMS"); 3745 } 3746 }); 3747 if ($("body").hasClass("is_admin")){ 3748 var tbh=0; 3749 } else { 3750 var tbh=38; 3751 } 3752 $("body > *:not(#editInCMS)").each(function(){ 3753 3754 if (($(this).css("position")=="fixed"||$(this).css("position")=="absolute")&&$(this).position().top<tbh){ 3755 var n = $(this).position().top+tbh; 3756 $(this).css("top",n+"px"); 3757 3758 } 3759 }); 3760 var pt = parseInt($("body").css('padding-top')); 3761 pt = pt+tbh; 3762 $("body").css("padding-top",pt+"px"); 3763 $("#editInCMS").on("click",'#logoutCMS',function(){ 3764 var target = "/admin/logout.php"; 3765 3766 window.location.href=target; 3767 3768 }) 3769 .on("click",".menuItemPA",function(){ 3770 var data = {"label":$(this).text(),"type":$(this).data('uaid')}; 3771 var target = "/admin/#activityPA-"+encodeURIComponent(JSON.stringify(data)); 3772 goTarget(target); 3773 }) 3774 .on("click",".menuItemUA",function(){ 3775 var data = {"label":$(this).text(),"type":$(this).data('uaid')}; 3776 var target = "/admin/#activityUA-"+encodeURIComponent(JSON.stringify(data)); 3777 goTarget(target); 3778 }) 3779 .on("click",".menuItemTemplate",function(){ 3780 var target = "/admin/?edit_template="+$(this).data('id'); 3781 goTarget(target); 3782 }) 3783 .on("click",".menuItemForm",function(){ 3784 var target = "/admin/#activityForm-"+$(this).data('formid'); 3785 goTarget(target); 3786 }) 3787 .on("click",".menuItemWorkflow",function(){ 3788 var workflowId = $(this).data('workflow-id'); 3789 var target = "/admin/workflows.php?workflow=" + encodeURIComponent(workflowId); 3790 goTarget(target); 3791 }) 3792 .on("click",".dashboardLinkCMS",function(e){ 3793 e.preventDefault(); 3794 var dashboardId = $(this).data('dashboard-id'); 3795 if (dashboardId) { 3796 window.location.href = "/admin_dashboards/" + dashboardId; 3797 } 3798 }) 3799 .on("click","#websitesCMS",function(){ 3800 var target = "/admin/browseContent.php?show=websites&string="; 3801 goTarget(target); 3802 }) 3803 .on("click","#checkoutCMS",function(){ 3804 var target = "/admin/#activityOrders"; 3805 goTarget(target); 3806 }) 3807 .on("click",".menuGroupTitle",function(){ 3808 $(this).parent().toggleClass("collapsedMenuGroup"); 3809 return false;
3810 }) 3811 .on("click",'#staffAccounts',function(){ 3812 var target = "/admin/#staff"; 3813 goTarget(target); 3814 3815 }) 3816 .on("click",'#creatorStats',function(){ 3817 window.open("/admin/creator-stats.php","Creator Stats"); 3818 return false; 3819 }) 3820 .on("click",'#brandCMS',function(){ 3821 var target = "/admin/#brand"; 3822 goTarget(target); 3823 3824 }) 3825 .on("click",'#you',function(){ 3826 var target = "/admin/?you=1#you"; 3827 goTarget(target); 3828 3829 }) 3830 .on("click",'#activityCMS',function(){ 3831 var target = "/admin/#activity"; 3832 goTarget(target); 3833 3834 }) 3835 .on("click",'#usersCMS',function(){ 3836 var target = "/admin/#users"; 3837 goTarget(target); 3838 }) 3839 .on("click",'#collectionsCMS',function(){ 3840 var target = "/admin/showCollections.php"; 3841 window.open(target, "Collections"); 3842 return false; 3843 }) 3844 .on('click','#bookingsCMS',function(){ 3845 var target = "/admin/#bookings"; 3846 window.open(target,"Bookings"); 3847 }) 3848 .on('click','#settingsCMS',function(){ 3849 var target = "/admin/?settings=1#settings"; 3850 goTarget(target); 3851 }) 3852 .on("click",'#helpCMS',function(){ 3853 3854 window.open("/admin/help.php","Help"); 3855 3856 3857 }) 3858 3859 .on('click',"#showAllCMS",function(){ 3860 var target = "/admin/#pages"; 3861 goTarget(target); 3862 }) 3863 .on("click","#composeCMS",function(){ 3864 var target = "/admin/#compose"; 3865 goTarget(target); 3866 }) 3867 .on("click","#dashboardCMS",function(){ 3868 console.log("DEBUG: #dashboardCMS clicked in core.js"); 3869 var target = "/admin/#dashboards"; 3870 console.log("DEBUG: target =", target); 3871 goTarget(target); 3872 }) 3873 .on("click","#workflowsCMS",function(){ 3874 var target = "/admin/workflows.php"; 3875 goTarget(target); 3876 }); 3877 var url = window.location.href; 3878 var split = url.split("/"); 3879 var prot = split[0]; 3880 var siteURL = prot+"//" + top.location.host.toString(); 3881 var $internalLinks = $("a[href^='"+siteURL+"'], a[href^='/'], a[href^='./'], a[href^='../'], a[href^='#']"); 3882 $internalLinks.click(function(){ 3883 if (iniframe) { 3884 parent.location.href = $(this).attr("href"); 3885 return false; 3886 } 3887 }); 3888} 3889function hideCMSButton() { 3890 $('#editInCMS').hide(); 3891} 3892var iniframe = false; 3893var firstbookingload=true; 3894window.autosaved=false; 3895 3896/** 3897 * Mask encrypted fields before submission to prevent plain text exposure. 3898 * When FormEncryptionLite is available (non-logged-in users), performs actual 3899 * encryption and appends _admin_encrypted / _is_encrypted hidden fields. 3900 * Otherwise falls back to masking only (logged-in case where autosave encrypts). 3901 * @param {jQuery} $form - The form element 3902 * @returns {Promise<Array>} Array of masked field objects for restoration 3903 */ 3904async function maskEncryptedFieldsForSubmission($form) { 3905 var maskedFields = []; 3906 3907 // Find fields that are marked as encrypted 3908 var $encryptedFields = $form.find('[data-encrypted="true"], .encrypted-field'); 3909 3910 if ($encryptedFields.length === 0) { 3911 return maskedFields; 3912 } 3913 3914 // Check if FormEncryptionLite is available for actual encryption 3915 var canEncrypt = window.FormEncryptionLite && typeof window.FormEncryptionLite.encryptForAdmin === 'function'; 3916 3917 for (var i = 0; i < $encryptedFields.length; i++) { 3918 var $field = $($encryptedFields[i]); 3919 var fieldName = $field.attr('name'); 3920 3921 if ($field.attr('type') === 'file') { 3922 // For file inputs, replace with hidden input containing metadata 3923 if ($field[0].files && $field[0].files.length > 0) { 3924 var originalValue = $field.val(); 3925 var file = $field[0].files[0]; 3926 3927 if (canEncrypt) { 3928 try { 3929 // Read file as base64 and encrypt (matches form-encryption-lite.js format) 3930 var fileData = await file.arrayBuffer(); 3931 var uint8Array = new Uint8Array(fileData); 3932 var binary = ''; 3933 for (var j = 0; j < uint8Array.length; j++) { 3934 binary += String.fromCharCode(uint8Array[j]); 3935 } 3936 var base64Data = btoa(binary); 3937 var encryptedFileData = await window.FormEncryptionLite.encryptForAdmin(base64Data); 3938 3939 // Append encrypted hidden fields 3940 $form.append($('<input type="hidden" class="lite-encryption-appended">').attr('name', fieldName + '_admin_encrypted').val(encryptedFileData)); 3941 $form.append($('<input type="hidden" class="lite-encryption-appended">').attr('name', fieldName + '_is_encrypted').val('lite')); 3942 $form.append($('<input type="hidden" class="lite-encryption-appended">').attr('name', fieldName + '_file_metadata').val(JSON.stringify({ 3943 originalFilename: file.name, 3944 fileType: file.type, 3945 fileSize: file.size, 3946 isEncrypted: true, 3947 encryptionMode: 'lite' 3948 }))); 3949 } catch (e) { 3950 // Encryption failed, fall through to masking only 3951 } 3952 } 3953 3954 // Create replacement hidden input 3955 var $hiddenInput = $('<input type="hidden">').attr('name', fieldName).val('[encrypted file]'); 3956 3957 // Store original for restoration 3958 maskedFields.push({ 3959 $originalElement: $field, 3960 $replacementElement: $hiddenInput, 3961 originalValue: originalValue, 3962 isFileInput: true 3963 }); 3964 3965 // Replace in DOM and completely remove the file input to prevent file upload 3966 $field.before($hiddenInput); 3967 $field.remove(); 3968 } 3969 } else if ($field.val() && $field.val().trim() !== '') { 3970 // For text/textarea inputs with content 3971 var originalTextValue = $field.val(); 3972 3973 if (canEncrypt) { 3974 try { 3975 var encryptedTextData = await window.FormEncryptionLite.encryptForAdmin(originalTextValue); 3976 3977 // Append encrypted hidden fields 3978 $form.append($('<input type="hidden" class="lite-encryption-appended">').attr('name', fieldName + '_admin_encrypted').val(encryptedTextData)); 3979 $form.append($('<input type="hidden" class="lite-encryption-appended">').attr('name', fieldName + '_is_encrypted').val('lite')); 3980 } catch (e) { 3981 // Encryption failed, fall through to masking only 3982 } 3983 } 3984 3985 maskedFields.push({ 3986 $originalElement: $field, 3987 originalValue: originalTextValue, 3988 isFileInput: false 3989 }); 3990 3991 // Temporarily mask the value 3992 $field.val('[encrypted data]'); 3993 } 3994 } 3995 3996 return maskedFields; 3997} 3998 3999/** 4000 * Restore original field values after submission 4001 * @param {Array} maskedFields - Array of masked field objects 4002 */ 4003function restoreFieldValuesAfterSubmission(maskedFields) { 4004 var $form = null; 4005 4006 maskedFields.forEach(function(fieldInfo) { 4007 try { 4008 if (fieldInfo.isFileInput) { 4009 // Restore file input - need to re-add it to the DOM since it was removed 4010 if (fieldInfo.$replacementElement && fieldInfo.$replacementElement.parent().length) { 4011 var $parentNode = fieldInfo.$replacementElement.parent(); 4012 fieldInfo.$replacementElement.remove(); 4013 // Re-add the original file input to the DOM 4014 $parentNode.append(fieldInfo.$originalElement); 4015 } 4016 } else { 4017 // Restore text field value 4018 if (fieldInfo.$originalElement) { 4019 fieldInfo.$originalElement.val(fieldInfo.originalValue); 4020 } 4021 } 4022 // Track the form for cleanup 4023 if (!$form && fieldInfo.$originalElement && fieldInfo.$originalElement.closest('form').length) { 4024 $form = fieldInfo.$originalElement.closest('form'); 4025 } 4026 } catch (error) { 4027 console.error('Error restoring field:', error); 4028 } 4029 }); 4030 4031 // Remove dynamically appended lite encryption hidden fields 4032 if ($form) { 4033 $form.find('.lite-encryption-appended').remove(); 4034 } 4035} 4036 4037function bindForms(){ 4038 $(".submit_form a").unbind().click(function(){ 4039 $(this).parents("form").submit(); 4040 return false;
4041 }); 4042 $("#reverify").click(function(){ 4043 $(this).parents("form").append('<input type="hidden" name="reverify" value="true"/>'); 4044 $(this).parents("form").submit(); 4045 return false; 4046 }); 4047 if ($(".cms_connect_fields").length){ 4048 $(".cms_connect_fields").each(function(){ 4049 4050 var data = $(this).parents("form").serialize(); 4051 var url = $(this).parents("form").attr("action"); 4052 $.ajax({ 4053 url: url, 4054 data: data, 4055 success: function(data) { 4056 4057 } 4058 }); 4059 }); 4060 } 4061 if ($(".saveorder").length){ 4062 $(".form").each(function(){ 4063 if ($(".saveorder",$(this)).length){ 4064 var data = $(this).serialize(); 4065 var url = $(this).attr("action"); 4066 $.ajax({ 4067 url: url, 4068 data: data, 4069 success: function(data) { 4070 4071 } 4072 }); 4073 }; 4074 }); 4075 } 4076 $(".form:not(.accessible-mode .form),.formUsedInCheckout").submit(function(){ 4077 $(".saveorder").remove(); 4078 $('.recaptchaSend').removeClass('recaptchaSend'); 4079 var toSend = $(this); 4080 // A field not yet linked to its form carries a connect_fields marker so 4081 // the page load can link it. Sent with a real submission, the marker makes 4082 // the server treat the whole send as a linking request and save nothing, 4083 // so drop it here as saveorder is dropped above. 4084 toSend.find('.cms_connect_fields').remove(); 4085 if (!window.autosaved){ 4086 4087 if (toSend.find(".autosavingFlag").length) { 4088 alert('Your form is autosaving a draft. Please submit again in a moment.'); 4089 return false; 4090 } 4091 } 4092 clearTimeout(window.autosavingForm); 4093 if (!$("#addToBasketId",$(this)).length&&!$(this).hasClass('addToBasketForm')&&!$(this).hasClass('noAjax')) { 4094 var ajaxSend = true; 4095 } else { 4096 var ajaxSend = false; 4097 if ($(this).hasClass("oktosend")) { 4098 return true; 4099 } 4100 } 4101 if ($(this).attr("id")=="paymentGatewayForm") { 4102 var ajaxSend = false; 4103 if ($(this).hasClass("oktosend")) { 4104 if (typeof ga === 'function') { 4105 ga('send', 'event', 'Checkout', 'Gone to Payment Gateway', $(this).attr("action")); 4106 } 4107 if (typeof $(this).data("datalayer-total")!="undefined") { 4108 if (readCookie("transid")==$(this).data('transid')) { 4109 var transid = readCookie("transidvalue"); 4110 } else { 4111 createCookie("transid",$(this).data('transid')); 4112 var transid = Math.floor(Math.random()*1000000); 4113 createCookie("transidvalue",transid); 4114 } 4115 dataLayer.push({ 4116 "transactionId":transid 4117 ,"transactionTotal":parseFloat($(this).data('datalayer-total')) 4118 ,"transactionTax":parseFloat($(this).data('datalayer-tax')) 4119 ,"transactionShipping":parseFloat($(this).data('datalayer-shipping')) 4120 // ,"coupon":$(this).data('datalayer-coupon') 4121 // ,"discount":parseFloat($(this).data('datalayer-discount')) 4122 // ,"gateway":$(this).data('datalayer-gateway') 4123 }); 4124 } 4125 4126 if (!$(this).hasClass('formInCheckoutOK')&&$('.formUsedInCheckout').length) { 4127 // extra form valid 4128 $(".form.formUsedInCheckout").trigger('submit'); 4129 return false; 4130 } 4131 return true; 4132 } 4133 } 4134 $('.ajaxSending').removeClass('ajaxSending'); 4135 toSend.addClass('ajaxSending'); 4136 4137 $(this).addClass("validating"); 4138 $("#success,.signupFormNeedsEmailOrSMS",$(this)).hide(); 4139 $("#alreadyregistered, .cf_contains_errors,.cf_contains_errors_captcha",toSend).hide(); 4140 $(".cf_error").removeClass("cf_error"); 4141 if (toSend.hasClass("formUsedInCheckout")){ 4142 var showErrorIn = $("#paymentGatewayForm"); 4143 } else { 4144 var showErrorIn = toSend; 4145 } 4146 var loader = $("#loader",showErrorIn); 4147 loader.fadeIn(300); 4148 4149 if (toSend.find(".autosavingFlag").length) { 4150 // Handle encryption for autosave if needed - but don't await here 4151 window.handleFormEncryption(toSend).then(() => { 4152 toSend.ajaxSubmit(optionsForm); 4153 }).catch((error) => { 4154 console.error('Core: Encryption failed:', error); 4155 toSend.ajaxSubmit(optionsForm); // Submit anyway if encryption fails 4156 }); 4157 return false; 4158 } 4159 4160 // Password strength validation - must run before AJAX submission 4161 var pass1Input = document.getElementById('pass1'); 4162 if (pass1Input && pass1Input.value) { 4163 var password = pass1Input.value; 4164 var pass2Input = document.getElementById('pass2'); 4165 var result = testPassword(password); 4166 var passwordFailed = false;
4167 4168 if (result.score < 20) { 4169 alert('Please choose a stronger password. Your current password strength is: ' + result.verdict + ' (' + result.score + ' points). You need at least 20 points. Try adding more characters, numbers, and symbols.'); 4170 passwordFailed = true; 4171 } else if (password.length < 8 || !/[A-Z]/.test(password) || !/[0-9]/.test(password) || !/[!@#$%^&*?_~]/.test(password)) { 4172 alert('Please meet all password requirements: at least 8 characters, an uppercase letter, a number, and a special character.'); 4173 passwordFailed = true; 4174 } else if (pass2Input && password !== pass2Input.value) { 4175 alert('Passwords do not match. Please try again.'); 4176 passwordFailed = true; 4177 } 4178 4179 if (passwordFailed) { 4180 pass1Input.focus(); 4181 loader.fadeOut(200); 4182 $(".submit_form",showErrorIn).show(); 4183 return false; 4184 } 4185 4186 // Encryption re-keying: if user has encrypted data and is changing password 4187 var currentPasswordInput = document.getElementById('current_password'); 4188 var reencryptedField = document.getElementById('reencrypted_private_key'); 4189 if (currentPasswordInput && reencryptedField) { 4190 if (!currentPasswordInput.value) { 4191 alert('Please enter your current password to preserve access to your encrypted data.'); 4192 currentPasswordInput.focus(); 4193 loader.fadeOut(200); 4194 $(".submit_form",showErrorIn).show(); 4195 return false; 4196 } 4197 // Only do re-encryption if not already done (prevents loop on re-submit) 4198 if (!reencryptedField.value) { 4199 // Async re-encryption - prevent normal flow, re-trigger after completion 4200 handlePasswordReEncryption(currentPasswordInput.value, pass1Input.value, toSend).then(function() { 4201 toSend.submit(); 4202 }).catch(function(error) { 4203 alert('Failed to re-encrypt your data: ' + error.message + '\nPlease check your current password and try again.'); 4204 loader.fadeOut(200); 4205 $(".submit_form",showErrorIn).show(); 4206 }); 4207 return false; 4208 } 4209 } 4210 } 4211 4212 var $requiredFields = $("textarea.required,select.required,input.required[type!='checkbox'], .required[type='checkbox']:not(:checked)",$(this)); 4213 4214 if ($requiredFields.filter(function() { 4215 // Special handling for file inputs with existing uploads 4216 if ($(this).attr('type') === 'file') { 4217 // Check if there's an existing file display (download link showing) 4218 var $wrapper = $(this).closest('.input-wrapper, .form-field, .field-wrapper'); 4219 var hasExistingFile = $wrapper.find('.existing-file-display, .file-display, .encrypted-file-download').length > 0; 4220 4221 // Check if this is during autosave and there's a preservation marker 4222 var hasPreservationMarker = $(this).siblings('input[value="__PRESERVE_EXISTING_FILE__"]').length > 0; 4223 4224 // Check if file was explicitly cleared 4225 var wasCleared = $(this).attr('data-file-cleared') === 'true'; 4226 4227 // Skip validation if file exists and wasn't cleared 4228 if ((hasExistingFile || hasPreservationMarker) && !wasCleared) { 4229 return false; // Don't treat as missing required field 4230 } 4231 4232 // If no file selected and no existing file, treat as missing 4233 return !$(this).val() || $(this).val() === ''; 4234 } 4235 4236 if (typeof $(this).attr('placeholder') !='undefined') { 4237 if ($(this).val()!=$(this).attr('placeholder') && $(this).val()!='') { 4238 if ($(this).data("required-format")) { 4239 4240 for (var i = 0; i < $(this).data("required-format").length; i++) { 4241 if ($(this).data("required-format")[i]=="#"){ 4242 if (isNaN($(this).val()[i])) { 4243 return true; 4244 } 4245 } 4246 if ($(this).data("required-format")[i]==" "){ 4247 if ($(this).val()[i]!=" ") { 4248 return true; 4249 } 4250 } 4251 if ($(this).data("required-format")[i]=="-"){ 4252 if ($(this).val()[i]!="-") { 4253 return true; 4254 } 4255 } 4256 if ($(this).data("required-format")[i]=="/"){ 4257 if ($(this).val()[i]!="/") { 4258 return true; 4259 } 4260 } 4261 } 4262 } else { 4263 return false; 4264 } 4265 } else { 4266 return true; 4267 } 4268 } else { 4269 if ($(this).is(':checkbox')) { 4270 return true; 4271 } else { 4272 return $(this).val() == ""; 4273 } 4274 4275 } 4276 }).length > 0) { 4277 $("textarea.required,select.required,input.required[type!='checkbox'], .required[type='checkbox']:not(:checked)",$(this)).filter(function() { 4278 // Special handling for file inputs with existing uploads 4279 if ($(this).attr('type') === 'file') { 4280 // Check if there's an existing file display (download link showing) 4281 var $wrapper = $(this).closest('.input-wrapper, .form-field, .field-wrapper'); 4282 var hasExistingFile = $wrapper.find('.existing-file-display, .file-display, .encrypted-file-download').length > 0; 4283 4284 // Check if this is during autosave and there's a preservation marker 4285 var hasPreservationMarker = $(this).siblings('input[value="__PRESERVE_EXISTING_FILE__"]').length > 0; 4286 4287 // Check if file was explicitly cleared 4288 var wasCleared = $(this).attr('data-file-cleared') === 'true'; 4289 4290 // Skip validation if file exists and wasn't cleared 4291 if ((hasExistingFile || hasPreservationMarker) && !wasCleared) { 4292 return false; // Don't treat as missing required field 4293 } 4294 4295 // If no file selected and no existing file, treat as missing 4296 return !$(this).val() || $(this).val() === ''; 4297 } 4298 4299 if (typeof $(this).attr('placeholder') !='undefined') { 4300 if ($(this).val()!=$(this).attr('placeholder') && $(this).val()!='') { 4301 if ($(this).data("required-format")) { 4302 4303 for (var i = 0; i < $(this).data("required-format").length; i++) { 4304 if ($(this).data("required-format")[i]=="#"){
4305 if (isNaN($(this).val()[i])) { 4306 return true; 4307 } 4308 } 4309 if ($(this).data("required-format")[i]==" "){ 4310 if ($(this).val()[i]!=" ") { 4311 return true; 4312 } 4313 } 4314 if ($(this).data("required-format")[i]=="-"){ 4315 if ($(this).val()[i]!="-") { 4316 return true; 4317 } 4318 } 4319 if ($(this).data("required-format")[i]=="/"){ 4320 if ($(this).val()[i]!="/") { 4321 return true; 4322 } 4323 } 4324 } 4325 } else { 4326 return false; 4327 } 4328 } else { 4329 return true; 4330 } 4331 } else { 4332 if ($(this).is(':checkbox')) { 4333 return true; 4334 } else { 4335 return $(this).val() == ""; 4336 } 4337 } 4338 }).addClass('cf_error').first().each(function(){ 4339 $(this).focus(); 4340 loader.fadeOut(200); 4341 return false; 4342 }); 4343 4344 $(".submit_form",showErrorIn).show(); 4345 $(".cf_contains_errors",showErrorIn).slideDown(300,function(){ 4346 if (typeof moduleHeights == 'function') { 4347 magicHeights(); 4348 moduleHeights(); 4349 } 4350 }); 4351 return false; 4352 4353 } else { 4354 if ( $("input[type=email]",$(this)).length > 0 ) { 4355 if ($("input[type=email]",$(this)).hasClass("required")) { 4356 4357 $.ajax({ 4358 type: "GET", 4359 url: "/actions/CheckEmail/", 4360 data: "email="+$("input[type=email]",toSend).val(), 4361 success: function(msg){ 4362 if (msg == "ok") { 4363 var validEmail = true; 4364 } else { 4365 var validEmail = false; 4366 } 4367 if (validEmail == false) { 4368 $("#emailIncorrect",toSend).css("display","block"); 4369 $("input[type=email]",toSend).addClass('cf_error'); 4370 $("input[type=email]",toSend).focus(); 4371 $(".submit_form",showErrorIn).show(); 4372 $(".cf_contains_errors",showErrorIn).slideDown(300,function(){ 4373 if (typeof moduleHeights == 'function') { 4374 magicHeights(); 4375 moduleHeights(); 4376 } 4377 }); 4378 loader.fadeOut(200); 4379 return false; 4380 4381 } else { 4382 $("#emailIncorrect",toSend).css("display","none"); 4383 if (ajaxSend==true) { 4384 4385 // Mask encrypted fields before submission to prevent plain text exposure 4386 maskEncryptedFieldsForSubmission(toSend).then(function(maskedFields) { 4387 4388 // Store maskedFields on the form for reCAPTCHA callback access 4389 toSend.data('maskedFields', maskedFields); 4390 4391 // Create custom options that include field restoration 4392 var customOptions = $.extend({}, optionsForm, { 4393 success: function(responseText, statusText, xhr, $form) { 4394 // Restore masked fields first 4395 restoreFieldValuesAfterSubmission(maskedFields); 4396 // Then call the original success handler 4397 if (optionsForm.success) { 4398 optionsForm.success(responseText, statusText, xhr, $form); 4399 } 4400 }, 4401 error: function(xhr, status, error) { 4402 // Restore masked fields on error too 4403 restoreFieldValuesAfterSubmission(maskedFields); 4404 // Call original error handler if it exists 4405 if (optionsForm.error) { 4406 optionsForm.error(xhr, status, error); 4407 } 4408 } 4409 }); 4410 4411 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInvisRecaptcha')) { 4412 grecaptcha.execute(toSend.attr('recapid')); 4413 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 4414 }else { 4415 toSend.ajaxSubmit(customOptions); 4416 } 4417 }); 4418 return false; 4419 } 4420 toSend.removeClass("validating").addClass("oktosend"); 4421 toSend.submit(); 4422 } 4423 } 4424 }); 4425 return false; 4426 //if (ajaxSend==true) { 4427 //return false; 4428 //} 4429 } else { 4430 if ($("input[type=email]",toSend).val()!="") { 4431 4432 $.ajax({ 4433 type: "GET", 4434 url: "/actions/CheckEmail/", 4435 data: "email="+$("input[type=email]",toSend).val(), 4436 success: function(msg){ 4437 if (msg == "ok") { 4438 var validEmail = true; 4439 } else { 4440 var validEmail = false;
4441 } 4442 if (validEmail == false) { 4443 $("#emailIncorrect",toSend).css("display","block"); 4444 $("input[type=email]",toSend).addClass('cf_error'); 4445 $("input[type=email]",toSend).focus(); 4446 $(".submit_form",showErrorIn).show(); 4447 $(".cf_contains_errors",showErrorIn).slideDown(300,function(){ 4448 if (typeof moduleHeights == 'function') { 4449 magicHeights(); 4450 moduleHeights(); 4451 } 4452 }); 4453 loader.fadeOut(200); 4454 return false; 4455 4456 } else { 4457 if (ajaxSend==true) { 4458 $("#emailIncorrect",toSend).css("display","none"); 4459 4460 // Mask encrypted fields before submission to prevent plain text exposure 4461 maskEncryptedFieldsForSubmission(toSend).then(function(maskedFields) { 4462 4463 // Store maskedFields on the form for reCAPTCHA callback access 4464 toSend.data('maskedFields', maskedFields); 4465 4466 // Create custom options that include field restoration 4467 var customOptions = $.extend({}, optionsForm, { 4468 success: function(responseText, statusText, xhr, $form) { 4469 // Restore masked fields first 4470 restoreFieldValuesAfterSubmission(maskedFields); 4471 // Then call the original success handler 4472 if (optionsForm.success) { 4473 optionsForm.success(responseText, statusText, xhr, $form); 4474 } 4475 }, 4476 error: function(xhr, status, error) { 4477 // Restore masked fields on error too 4478 restoreFieldValuesAfterSubmission(maskedFields); 4479 // Call original error handler if it exists 4480 if (optionsForm.error) { 4481 optionsForm.error(xhr, status, error); 4482 } 4483 } 4484 }); 4485 4486 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInvisRecaptcha')) { 4487 grecaptcha.execute(toSend.attr('recapid')); 4488 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 4489 }else{ 4490 $(toSend).ajaxSubmit(customOptions); 4491 } 4492 }); 4493 return false; 4494 } 4495 toSend.removeClass("validating").addClass("oktosend"); 4496 toSend.submit(); 4497 } 4498 } 4499 }); 4500 } else { 4501 if ($('.signupFormNeedsEmailOrSMS',toSend).length) { 4502 4503 if ($('input[type="email"]',toSend).val()==""&&$('.input_sms',toSend).val()=="") { 4504 $('.signupFormNeedsEmailOrSMS').show(); 4505 $("#sending_wait").hide(); 4506 $(".submit_form",showErrorIn).show(); 4507 if (typeof moduleHeights == 'function') { 4508 moduleHeights(); 4509 } 4510 loader.fadeOut(200); 4511 return false; 4512 } 4513 } 4514 if (ajaxSend==true) { 4515 $("#emailIncorrect",toSend).css("display","none"); 4516 4517 // Mask encrypted fields before submission to prevent plain text exposure 4518 maskEncryptedFieldsForSubmission(toSend).then(function(maskedFields) { 4519 4520 // Store maskedFields on the form for reCAPTCHA callback access 4521 toSend.data('maskedFields', maskedFields); 4522 4523 // Create custom options that include field restoration 4524 var customOptions = $.extend({}, optionsForm, { 4525 success: function(responseText, statusText, xhr, $form) { 4526 // Restore masked fields first 4527 restoreFieldValuesAfterSubmission(maskedFields); 4528 // Then call the original success handler 4529 if (optionsForm.success) { 4530 optionsForm.success(responseText, statusText, xhr, $form); 4531 } 4532 }, 4533 error: function(xhr, status, error) { 4534 // Restore masked fields on error too 4535 restoreFieldValuesAfterSubmission(maskedFields); 4536 // Call original error handler if it exists 4537 if (optionsForm.error) { 4538 optionsForm.error(xhr, status, error); 4539 } 4540 } 4541 }); 4542 4543 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInvisRecaptcha')) { 4544 grecaptcha.execute(toSend.attr('recapid')); 4545 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 4546 }else{ 4547 $(toSend).ajaxSubmit(customOptions); 4548 } 4549 }); 4550 return false;
4551 4552 } 4553 toSend.removeClass("validating").addClass("oktosend"); 4554 toSend.submit(); 4555 return false; 4556 } 4557 } 4558 4559 } else { 4560 if (ajaxSend==true) { 4561 $("#emailIncorrect",toSend).css("display","none"); 4562 4563 // Mask encrypted fields before submission to prevent plain text exposure 4564 maskEncryptedFieldsForSubmission(toSend).then(function(maskedFields) { 4565 4566 // Store maskedFields on the form for reCAPTCHA callback access 4567 toSend.data('maskedFields', maskedFields); 4568 4569 // Create custom options that include field restoration 4570 var customOptions = $.extend({}, optionsForm, { 4571 success: function(responseText, statusText, xhr, $form) { 4572 // Restore masked fields first 4573 restoreFieldValuesAfterSubmission(maskedFields); 4574 // Then call the original success handler 4575 if (optionsForm.success) { 4576 optionsForm.success(responseText, statusText, xhr, $form); 4577 } 4578 }, 4579 error: function(xhr, status, error) { 4580 // Restore masked fields on error too 4581 restoreFieldValuesAfterSubmission(maskedFields); 4582 // Call original error handler if it exists 4583 if (optionsForm.error) { 4584 optionsForm.error(xhr, status, error); 4585 } 4586 } 4587 }); 4588 4589 if (typeof grecaptcha != "undefined"&&$(toSend).hasClass('withInvisRecaptcha')) { 4590 grecaptcha.execute(toSend.attr('recapid')); 4591 toSend.removeClass("validating").addClass("oktosend").addClass('recaptchaSend'); 4592 }else{ 4593 $(toSend).ajaxSubmit(customOptions); 4594 } 4595 }); 4596 return false; 4597 } 4598 toSend.removeClass("validating").addClass("oktosend"); 4599 + toSend.submit(); 4600 } 4601 } 4602 4603 //if (ajaxSend==true) { 4604 return false; 4605 //} 4606 4607 }); 4608 4609} 4610function setDoubleDatepicker ($this) { 4611 $(".datepicker_td_range_start",$this).removeClass("datepicker_td_range_start"); 4612 $(".datepicker_td_range_end",$this).removeClass("datepicker_td_range_end"); 4613 $(".rangeFill",$this).removeClass("rangeFill"); 4614 $(".startRangeMonth",$this).removeClass("startRangeMonth"); 4615 $(".endRangeMonth",$this).removeClass("endRangeMonth"); 4616 $buttons = $(".default_datepicker_double").parents(".formDaterange"); 4617 var start = $buttons.find(".formDaterangeStartValue").text().trim(); 4618 var end = $buttons.find(".formDaterangeEndValue").text().trim(); 4619 $buttons.find("input.combinedrange").val(start+" - "+end); 4620 $buttons.find("input.startrange").val(start); 4621 $buttons.find("input.endrange").val(end).trigger("change"); 4622 if (start!=""){ 4623 $("td[data-date='"+start+"']:not(.othermonth)",$this).addClass("datepicker_td_range_start"); 4624 } 4625 if (end!=""){ 4626 $("td[data-date='"+end+"']:not(.othermonth)",$this).addClass("datepicker_td_range_end"); 4627 } 4628 if (start==end){ 4629 $(".datepicker_td_range_start",$this).parents(".datepicker_multimonth").addClass("startRangeMonth"); 4630 $(".datepicker_td_range_end",$this).parents(".datepicker_multimonth").addClass("endRangeMonth"); 4631 } 4632 if (start!=""&&end!=""&&start!=end){ 4633 $(".datepicker_td_range_start",$this).parents(".datepicker_multimonth").addClass("startRangeMonth"); 4634 $(".datepicker_td_range_end",$this).parents(".datepicker_multimonth").addClass("endRangeMonth"); 4635 if ($(".startRangeMonth",$this).hasClass("endRangeMonth")){ 4636 var doneend=false; 4637 $(".startRangeMonth .datepicker_td_range_start",$this).nextAll("td").each(function(){ 4638 if ($(this).hasClass("datepicker_td_range_end")){ 4639 doneend=true; 4640 } 4641 if (!doneend){ 4642 $(this).addClass("rangeFill"); 4643 } 4644 }); 4645 $(".startRangeMonth .datepicker_td_range_start",$this).parent().nextAll("tr").each(function(){ 4646 $("td",$(this)).each(function(){ 4647 if ($(this).hasClass("datepicker_td_range_end")){ 4648 doneend=true; 4649 } 4650 if (!doneend){ 4651 $(this).addClass("rangeFill"); 4652 } 4653 }); 4654 }); 4655 4656 } else { 4657 $(".startRangeMonth",$this).nextUntil(".endRangeMonth").each(function(){ 4658 $("td",$(this)).addClass("rangeFill"); 4659 }); 4660 $(".startRangeMonth .datepicker_td_range_start",$this).nextAll("td").each(function(){ 4661 $(this).addClass("rangeFill"); 4662 }); 4663 $(".startRangeMonth .datepicker_td_range_start",$this).parent().nextAll("tr").each(function(){ 4664 $("td",$(this)).addClass("rangeFill"); 4665 }); 4666 var doneend=false; 4667 $(".endRangeMonth tr",$this).each(function(){ 4668 $("td",$(this)).each(function(){ 4669 if ($(this).hasClass("datepicker_td_range_end")){ 4670 doneend=true; 4671 } 4672 if (!doneend){ 4673 $(this).addClass("rangeFill"); 4674 } 4675 }); 4676 }); 4677 } 4678 } 4679}; 4680 4681// Password Strength Meter for Registration and Password Reset 4682// These functions are in global scope so bindForms() submit handler can access them 4683// Single source of truth for password-reset validation. BOTH the strength gate 4684// and the encryption re-key submit handler call this, so a flagged password can 4685// never slip through: the gate's preventDefault() does NOT stop the inline 4686// re-key handler's programmatic loginForm.submit(), so the re-key handler must 4687// re-check this itself before submitting. Returns {ok:bool, message:string}. 4688window.validatePasswordReset = function(password, password2) { 4689 var result = testPassword(password); 4690 if (result.score < 20) { 4691 return { ok: false, message: 'Please choose a stronger password. Your current password strength is: ' + result.verdict
4691+ ' (' + result.score + ' points). You need at least 20 points. Try adding more characters, numbers, and symbols.' }; 4692 } 4693 if (password.length < 8 || !/[A-Z]/.test(password) || !/[0-9]/.test(password) || !/[!@#$%^&*?_~]/.test(password)) { 4694 return { ok: false, message: 'Please meet all password requirements: at least 8 characters, an uppercase letter, a number, and a special character.' }; 4695 } 4696 if (typeof password2 !== 'undefined' && password !== password2) { 4697 return { ok: false, message: 'Passwords do not match. Please try again.' }; 4698 } 4699 return { ok: true, message: '' }; 4700}; 4701 4702function testPassword(passwd) { 4703 var intScore = 0; 4704 var strVerdict = "weak"; 4705 4706 // PASSWORD LENGTH 4707 if (passwd.length < 5) { 4708 intScore = (intScore + 3); 4709 } else if (passwd.length > 4 && passwd.length < 8) { 4710 intScore = (intScore + 6); 4711 } else if (passwd.length > 7 && passwd.length < 16) { 4712 intScore = (intScore + 12); 4713 } else if (passwd.length > 15) { 4714 intScore = (intScore + 18); 4715 } 4716 4717 // LETTERS 4718 if (passwd.match(/[a-z]/)) { 4719 intScore = (intScore + 1); 4720 } 4721 4722 if (passwd.match(/[A-Z]/)) { 4723 intScore = (intScore + 5); 4724 } 4725 4726 // NUMBERS 4727 if (passwd.match(/\d+/)) { 4728 intScore = (intScore + 5); 4729 } 4730 4731 if (passwd.match(/(.*[0-9].*[0-9].*[0-9])/)) { 4732 intScore = (intScore + 5); 4733 } 4734 4735 // SPECIAL CHAR 4736 if (passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)) { 4737 intScore = (intScore + 5); 4738 } 4739 4740 if (passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) { 4741 intScore = (intScore + 5); 4742 } 4743 4744 // COMBOS 4745 if (passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) { 4746 intScore = (intScore + 2); 4747 } 4748 4749 if (passwd.match(/([a-zA-Z])/) && passwd.match(/([0-9])/)) { 4750 intScore = (intScore + 2); 4751 } 4752 4753 if (passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)) { 4754 intScore = (intScore + 2); 4755 } 4756 4757 if (intScore < 16) { 4758 strVerdict = "needs improvement"; 4759 } else if (intScore >= 16 && intScore < 25) { 4760 strVerdict = "getting better"; 4761 } else if (intScore >= 25 && intScore < 35) { 4762 strVerdict = "good"; 4763 } else if (intScore >= 35 && intScore < 45) { 4764 strVerdict = "great"; 4765 } else { 4766 strVerdict = "excellent"; 4767 } 4768 4769 return { 4770 score: intScore, 4771 verdict: strVerdict 4772 }; 4773} 4774 4775// Re-encrypt user's private key when changing password (logged-in user) 4776async function handlePasswordReEncryption(oldPassword, newPassword, $form) { 4777 if (typeof window.EncryptionManager === 'undefined') { 4778 throw new Error('Encryption manager not available'); 4779 } 4780 4781 var userIdField = $form.find('input[name="encryption_user_id"]'); 4782 if (!userIdField.length) { 4783 throw new Error('User ID not found for re-encryption'); 4784 } 4785 var userId = userIdField.val(); 4786 4787 // Fetch the user's encrypted private key from the server 4788 var response = await fetch('/actions/GetUserKeys/', { 4789 method: 'POST', 4790 headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, 4791 body: 'user_id=' + userId 4792 }); 4793 4794 var keyData = await response.json(); 4795 if (keyData.error) { 4796 throw new Error(keyData.error); 4797 } 4798 4799 // Derive key from old password to decrypt the private key 4800 var oldDerivedKey = await window.EncryptionManager.precomputeKeyDerivation(oldPassword, keyData.symmetric_key_salt); 4801 4802 // Decrypt private key with old password-derived key 4803 var privateKeyPem = await window.EncryptionManager.decryptWithSymmetricKey( 4804 keyData.encrypted_private_key, 4805 oldDerivedKey 4806 ); 4807 4808 // Re-encrypt private key with new password 4809 var newSalt = window.EncryptionManager.generateSalt(); 4810 var reencryptedKey = await window.EncryptionManager.encryptMasterPrivateKey(privateKeyPem, newPassword, newSalt); 4811 4812 if (!reencryptedKey) { 4813 throw new Error('Failed to re-encrypt private key'); 4814 } 4815 4816 // Set the hidden fields with the re-encrypted data 4817 $form.find('#reencrypted_private_key').val(reencryptedKey); 4818 $form.find('#new_key_salt').val(newSalt); 4819} 4820 4821function updatePasswordRequirements(password, requirementsList) { 4822 if (!requirementsList) return; 4823 var items = requirementsList.querySelectorAll('li[data-requirement]'); 4824 for (var i = 0; i < items.length; i++) { 4825 var item = items[i]; 4826 var req = item.getAttribute('data-requirement'); 4827 var met = false; 4828 if (req === 'length') met = password.length >= 8; 4829 else if (req === 'uppercase') met = /[A-Z]/.test(password); 4830 else if (req === 'number') met = /[0-9]/.test(password); 4831 else if (req === 'special') met = /[!@#$%^&*?_~]/.test(password); 4832 4833 if (met) { 4834 item.classList.add('met'); 4835 item.querySelector('.req-icon').innerHTML = '✓'; 4836 } else { 4837 item.classList.remove('met'); 4838 item.querySelector('.req-icon').innerHTML = '✗'; 4839 } 4840 } 4841} 4842 4843function updatePasswordStrength(password, barElement, textElement, requirementsList) { 4844 if (!password) { 4845 barElement.style.width = '0%'; 4846 barElement.className = 'strength-bar'; 4847 textElement.textContent = 'enter password'; 4848 updatePasswordRequirements('', requirementsList); 4849 return; 4850 } 4851 4852 var result = testPassword(password); 4853 var percentage = Math.min((result.score / 50) * 100, 100); 4854 4855 barElement.style.width = percentage + '%'; 4856 textElement.textContent = result.verdict; 4857 4858 // Update color classes 4859 barElement.className = 'strength-bar'; 4860 if (result.score < 16) { 4861 barElement.classList.add('very-weak'); 4862 } else if (result.score < 25) { 4863 barElement.classList.add('weak'); 4864 } else if (result.score < 35) { 4865 barElement.classList.add('mediocre'); 4866 } else if (result.score < 45) { 4867 barElement.classList.add('strong'); 4868 } else { 4869 barElement.classList.add('stronger'); 4870 } 4871 4872 updatePasswordRequirements(password, requirementsList); 4873} 4874 4875function initPasswordStrength() { 4876 // Check for registration form password field (pass1) 4877 var pass1Input = document.getElementById('pass1'); 4878 var pass1StrengthBar = document.getElementById('pass1-strength-bar'); 4879 var pass1StrengthText = document.getElementById('pass1-strength-verdict'); 4880 var pass1Requirements = document.getElementById('pass1-requirements'); 4881 4882 if (pass1Input && pass1StrengthBar && pass1StrengthText) { 4883 pass1Input.addEventListener('input', function() { 4884 updatePasswordStrength(this.value, pass1StrengthBar, pass1StrengthText, pass1Requirements); 4885 }); 4886 // Form submit validation is handled in the jQuery submit handler in bindForms() 4887 } 4888 4889 // Check for password reset fields (password/password2 names) 4890 var passwordInput = document.querySelector('input[name="password"]'); 4891 var password2Input = document.querySelector('input[name="password2"]'); 4892 var strengthBar = document.getElementById('password-strength-bar'); 4893 var strengthText = document.getElementById('password-strength-verdict'); 4894 var passwordRequirements = document.getElementById('password-requirements'); 4895 4896 if (passwordInput && strengthBar && strengthText && password2Input) { 4897 passwordInput.addEventListener('input', function() { 4898 updatePasswordStrength(this.value, strengthBar, strengthText, passwordRequirements); 4899 }); 4900 4901 password2Input.addEventListener('input', function() { 4902 updatePasswordStrength(this.value, strengthBar, strengthText, passwordRequirements); 4903 }); 4904 4905 // Validate on form submit 4906 var loginForm = document.getElementById('loginForm'); 4907 if (loginForm) { 4908 loginForm.addEventListener('submit', function(e) { 4909 var password = passwordInput.value; 4910 4911 // On the encryption reset path the inline re-key handler is the 4912 // authoritative validator (it must re-check before its programmatic 4913 // submit). If those radios exist, stay silent here to avoid a
4914 // duplicate alert. On a plain (non-encrypted) reset there is no 4915 // re-key handler, so this gate is the sole validator. 4916 if (document.getElementById('smart_reset') || document.getElementById('fallback_reset')) { 4917 return; 4918 } 4919 4920 // Only validate if password2 field is visible (resetting mode) 4921 if (password2Input && password2Input.offsetParent !== null) { 4922 var check = window.validatePasswordReset(password); 4923 if (!check.ok) { 4924 e.preventDefault(); 4925 alert(check.message); 4926 return false; 4927 } 4928 } 4929 }); 4930 } 4931 } 4932} 4933 4934$(document).ready(function(){ 4935 $('#sms_login_expired').hide(); 4936 $('#loginFormSMS').unbind().submit(function(){ 4937 $('body').append('<div id="login_sms_mask"><div id="sms_login"><form id="sms_login_form" action="/actions/loginSMSDo/"><label>Enter your one-time login code:<br/><input id="sms_code" type="text" name="code" /><p class="Button_Medium" id="submit_sms_form"><a href="#">Login</a></p><p style="display:none" class="Icon_Alert" id="sms_not_ok">Your code is incorrect. Please try again or <a href="#">cancel and start again.</a></p></form></div></div>'); 4938 $.ajax({ url: $(this).attr("action"), data: {'sms':$('#sms_number').val(),'sms_country':$('#sms_country').val()}, success: function(){ 4939 }}); 4940 $('#sms_not_ok a ').click(function(){ 4941 $('#login_sms_mask').remove(); 4942 $('#sms_login_expired').hide(); 4943 return false; 4944 }); 4945 $('#submit_sms_form a').click(function(){ 4946 $(this).parents('form').submit(); 4947 return false; 4948 }); 4949 $('#sms_login_form').submit(function(){ 4950 $('#sms_not_ok').hide(); 4951 $.ajax({ url: $(this).attr("action"), data: {'code':$('#sms_code').val()}, success: function(resp){ 4952 if (resp=="notok"){ 4953 $('#sms_not_ok').show(); 4954 } 4955 if (resp=="ok"){ 4956 window.location.reload(); 4957 } 4958 if (resp=="expired"){ 4959 $('#login_sms_mask').remove(); 4960 $('#sms_login_expired').show(); 4961 } 4962 }}); 4963 return false; 4964 }); 4965 return false; 4966 }); 4967 $(".login-form-reset-pass-label input").on("change",function(){ 4968 var $submit =$(this).parents("#loginForm").find("input[type=submit]"); 4969 if ($(this).is(":checked")) { 4970 $(this).parents("#loginForm").addClass("resetting"); 4971 $submit.val($submit.data('val-if-resetting')); 4972 } else { 4973 $(this).parents("#loginForm").removeClass("resetting"); 4974 $submit.val($submit.data('default-val')); 4975 } 4976 }); 4977 $("body").addClass("js"); 4978 checkCalendars(); 4979 if (window.self !== window.top) { 4980 iniframe=true; 4981 } 4982 4983 $(".cms-booking-product").on("change",".personal-details-form input,.personal-details-form select",function(){ 4984 saveBookingProdState(); 4985 }).on("click",".reuse-last-form a",function(){ 4986 str = localStorage.getItem('bookingData'+$('body').data('page-id')); 4987 var bookingproducts = JSON.parse(str); 4988 var justcount =0; 4989 $(this).parents(".cms-booking-product").addClass("currentprod"); 4990 $(this).parents(".personal-details-form").addClass("currentperson"); 4991 $(".cms-booking-product").each(function(){ 4992 if ($(this).hasClass("currentprod")){ 4993 $(this).removeClass("currentprod"); 4994 var x=1; 4995 var formcount=0; 4996 $(".personal-details-forms .personal-details-form",$(this)).each(function(){ 4997 if ($(this).hasClass("currentperson")){ 4998 $(this).removeClass("currentperson"); 4999 $(".reuse-last-form",$(this)).hide(); 5000 return false; 5001 } 5002 formcount++; 5003 }); 5004 while (x<=justcount){ 5005 var count = justcount-x; 5006 if (justcount>0&&typeof bookingproducts[justcount-x]!= "undefined" && typeof bookingproducts[justcount-x].forms[formcount] != "undefined"&&$(".personal-details-form #"+bookingproducts[justcount-x].forms[formcount][0].id,$(this)).length){ 5007 var formdata= bookingproducts[count].forms; 5008 var formd = formdata[formcount]; 5009 if (typeof formd != "undefined"){ 5010 for (var i = 0; i < formd.length; i++) { 5011 $(".personal-details-forms .personal-details-form:eq("+formcount+")",$(this)).each(function(){ 5012 if (formd[i].value=="checkedPROP") { 5013 $("#"+formd[i].id,$(this)).prop('checked',true); 5014 } else { 5015 $("#"+formd[i].id,$(this)).val(formd[i].value); 5016 } 5017 }); 5018 } 5019 saveBookingProdState(); 5020 } 5021 5022 } 5023 x++; 5024 } 5025 } 5026 justcount++; 5027 }); 5028 return false;
5029 }); 5030 if (typeof cmshookBeforeBookingProducts != 'undefined') { 5031 cmshookBeforeBookingProducts(); 5032 } 5033 5034 5035 $(".ss_calendar_group_filter").change(function(){ 5036 setSSCalendarGroupFilter(); 5037 }); 5038 $('.cms-booking-product-min-days-error').hide(); 5039 $(".cms-booking-product-add-to-basket").show(); 5040 makeCombinedDays(); 5041 5042 $(".cms-booking-product-form").submit(function(){ 5043 var $form=$(this); 5044 var fail=false; 5045 $(".personal-details-form:visible .required:visible",$(this)).each(function(){ 5046 if ($(this).val()=="") { 5047 fail = true; 5048 } 5049 }); 5050 if (fail) { 5051 alert($form.data('fail-msg')); 5052 return false; 5053 } 5054 $(".personal-details-form:hidden").remove(); 5055 var days = 0; 5056 $(".cms-booking-product-days-input",$(this)).each(function(){ 5057 days = days+JSON.parse($(this).val()).length; 5058 }); 5059 if (days==0) { 5060 $(".cms-booking-product-select-day",$(this)).slideDown(); 5061 return false; 5062 } 5063 }) 5064 $(".cms-booking-combined-dates").on("click",".cms-master-days .cms-booking-product-date",function(e,reapply){ 5065 5066 var $form = $(this).parents(".cms-booking-product-form"); 5067 var $clicked = $(this); 5068 var d = $(this).data("date"); 5069 $(".cms-booking-product-select-day").hide(); 5070 $(".cms-booking-product",$form).each(function(){ 5071 var $prod = $(this); 5072 5073 var qty_adults = parseInt($(".cms-booking-product-normal-qty input",$prod).val()); 5074 var qty_special = parseInt($(".cms-booking-product-special-qty input",$prod).val()); 5075 var qty_children = parseInt($(".cms-booking-product-children-qty input",$prod).val()); 5076 5077 if (isNaN(qty_adults)) { 5078 qty_adults = 0; 5079 } 5080 if (isNaN(qty_special)) { 5081 qty_special = 0; 5082 } 5083 if (isNaN(qty_children)) { 5084 qty_children = 0; 5085 } 5086 var t = qty_adults+qty_special+qty_children; 5087 if (t>0) { 5088 5089 if ($clicked.hasClass("cms-booking-product-selected") && typeof reapply === 'undefined') { 5090 $(".cms-booking-product-date[data-date='"+d+"']",$prod).trigger("click",false); 5091 } else { 5092 $(".cms-booking-product-date[data-date='"+d+"']",$prod).trigger("click",true); 5093 } 5094 5095 } 5096 }); 5097 $("input",$(".cms-master-days .cms-booking-product-selected",$form)).prop("checked", false); 5098 5099 $(".cms-master-days .cms-booking-product-selected",$form).removeClass("cms-booking-product-selected"); 5100 $(".cms-booking-product-date.cms-booking-product-selected:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)",$form).each(function(){ 5101 var d = $(this).data('date'); 5102 $("input",$(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form)).prop("checked", true); 5103 $(".cms-master-days .cms-booking-product-date[data-date='"+d+"']",$form).addClass("cms-booking-product-selected"); 5104 }); 5105 // Re-validate AFTER the master calendar has been re-synced above. 5106 // The product-cell click triggered further up already ran 5107 // cmsUpdateBookingPrices(), but that happened BEFORE these lines rebuilt 5108 // the master-days selection — and in combined mode the 5109 // minimum-consecutive-days check reads its selection from .cms-master-days. 5110 // So that earlier run validated the PREVIOUS selection: picking a single 5111 // night on a 2-night-minimum rate left the button enabled, and completing 5112 // the pair left the stale error showing. Running it once more here checks 5113 // the selection the visitor can actually see. 5114 cmsUpdateBookingPrices(); 5115 }); 5116 $(".cms-booking-combined-dates .cms-booking-product-dates:not(.cms-master-days .cms-booking-product-dates)").hide(); 5117 5118 5119 $(".cms-booking-product-qty input").change(function(){ 5120 5121 cmsUpdateBookingPrices(); 5122 cmsBookingReapply(); 5123 setTimeout(function () { 5124 cmsUpdateBookingPrices(); 5125 }, 10); 5126 5127 }); 5128 $(".cms-booking-product-qty input").keyup(function(){ 5129 cmsUpdateBookingPrices(); 5130 cmsBookingReapply(); 5131 setTimeout(function () { 5132 cmsUpdateBookingPrices(); 5133 }, 10); 5134 saveBookingProdState(); 5135 }); 5136 $(".cms-booking-qty-plus").click(function(){ 5137 /* 5138 if ($(".persondetailsmaster",$(this).parents('.cms-booking-product')).length) { 5139 if ($(".personal-details-forms .personal-details-form:hidden",$(this).parents('.cms-booking-product')).length) { 5140 5141 $(".personal-details-forms .personal-details-form:hidden:first",$(this).parents('.cms-booking-product ')).show(); 5142 } else { 5143 $(".personal-details-forms",$(this).parents('.cms-booking-product')).append($(".persondetailsmaster > *",$(this).parents('.cms-booking-product')).clone()); 5144 } 5145 } 5146 */ 5147 var val = parseInt($("input",$(this).parent()).val()); 5148 val = val+1; 5149 $("input",$(this).parent()).val(val); 5150 5151 cmsUpdateBookingPrices(); 5152// cmsBookingReapply(); 5153 5154 setTimeout(function () { 5155// cmsUpdateBookingPrices(); 5156 }, 10); 5157// saveBookingProdState(); 5158 }); 5159 $(".cms-booking-qty-minus").click(function(){ 5160 5161 var val = parseInt($("input",$(this).parent()).val()); 5162 if (val>0) { 5163 //if ($(".persondetailsmaster",$(this).parents('.cms-booking-product')).length) { 5164 // $(".personal-details-forms .personal-details-form:visible:last",$(this).parents('.cms-booking-product')).hide(); 5165 //} 5166 5167 } 5168 val = val-1; 5169 if (val<0) { 5170 val=0; 5171 } 5172 5173 $("input",$(this).parent()).val(val); 5174 cmsUpdateBookingPrices(); 5175 cmsBookingReapply(); 5176 //setPersonalNames($(this).parents('.cms-booking-product')); 5177 5178 setTimeout(function () { 5179 cmsUpdateBookingPrices(); 5180 }, 10); 5181 saveBookingProdState(); 5182 }); 5183 loadBookingProdForms(); 5184 $(".cms-booking-products-qtys.selectone .cms-booking-qty-plus").trigger("click"); 5185 $(".cms-booking-products-qtys.selectone").hide(); 5186 $(".cms-booking-product-dates-inner").on("scroll",function(){ 5187 if (!$(this).parents("form").hasClass("cms-booking-combined-dates")) { 5188 var sl = $(this).scrollLeft(); 5189 $(".cms-booking-product-dates-inner").scrollLeft(sl); 5190 } 5191 5192 }).on("click",".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date)",function(e,addOverride){ 5193 var $form = $(this).parents(".cms-booking-product-form"); 5194 var combined = ($(this).parents(".cms-booking-combined-dates").length?true:false); 5195 if ($(this).hasClass("cms-booking-product-available") && !$(this).hasClass("cms-booking-product-history")) { 5196 if ($(this).hasClass("cms-booking-product-selected")) { 5197 var addOrRemove = false;
5198 } else { 5199 var addOrRemove = true; 5200 } 5201 if (typeof addOverride !== 'undefined') { 5202 if (addOverride) { 5203 addOrRemove=true; 5204 } else { 5205 addOrRemove=false; 5206 } 5207 } 5208 if ($(this).hasClass("block-start")) { 5209 $(this).nextUntil($(".block-end")).filter(':not(.cms-booking-filler)').each(function(){ 5210 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 5211 if (combined) { 5212 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5213 } 5214 5215 }) 5216 $(this).nextUntil($(".block-end")).last().next().toggleClass("cms-booking-product-selected",addOrRemove); 5217 5218 if (combined) { 5219 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).nextUntil($(".block-end")).last().next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5220 } 5221 5222 if ($(this).next().hasClass("block-end")) { 5223 $(this).next().toggleClass("cms-booking-product-selected",addOrRemove); 5224 if (combined) { 5225 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5226 } 5227 } 5228 } 5229 if ($(this).hasClass("block-middle")) { 5230 5231 $(this).nextUntil($(".block-end")).filter(':not(.cms-booking-filler)').each(function(){ 5232 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 5233 if (combined) { 5234 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5235 } 5236 5237 }); 5238 $(this).nextUntil($(".block-end")).last().next().toggleClass("cms-booking-product-selected",addOrRemove); 5239 5240 if (combined) { 5241 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).nextUntil($(".block-end")).last().next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5242 } 5243 5244 if ($(this).next().hasClass("block-end")) { 5245 $(this).next().toggleClass("cms-booking-product-selected",addOrRemove); 5246 if (combined) { 5247 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).next().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5248 } 5249 } 5250 $(this).prevUntil($(".block-start")).filter(':not(.cms-booking-filler)').each(function(){ 5251 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 5252 if (combined) { 5253 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5254 } 5255 }); 5256 $(this).prevUntil($(".block-start")).last().prev().toggleClass("cms-booking-product-selected",addOrRemove); 5257 5258 5259 if (combined) { 5260 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).prevUntil($(".block-start")).last().prev().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5261 } 5262 5263 if ($(this).prev().hasClass("block-start")) { 5264 $(this).prev().toggleClass("cms-booking-product-selected",addOrRemove); 5265 if (combined) { 5266 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).prev().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5267 } 5268 } 5269 } 5270 5271 if ($(this).hasClass("block-end")) { 5272 $(this).prevUntil($(".block-start")).filter(':not(.cms-booking-filler)').each(function(){ 5273 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 5274 if (combined) { 5275 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5276 } 5277 5278 });
5279 $(this).prevUntil($(".block-start")).last().prev().toggleClass("cms-booking-product-selected",addOrRemove); 5280 5281 if (combined) { 5282 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).prevUntil($(".block-start")).last().prev().data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5283 } 5284 5285 5286 if ($(this).prev().hasClass("block-start")) { 5287 $(this).prev().toggleClass("cms-booking-product-selected",addOrRemove); 5288 if (combined) { 5289 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).prev().toggleClass("cms-booking-product-selected",addOrRemove); 5290 } 5291 } 5292 } 5293 5294 $(this).toggleClass("cms-booking-product-selected",addOrRemove); 5295 if (combined) { 5296 $(".cms-booking-product-date:not(.cms-master-days .cms-booking-product-date,.cms-booking-zero-qty .cms-booking-product-date)[data-date='"+$(this).data("date")+"']",$form).toggleClass("cms-booking-product-selected",addOrRemove); 5297 } 5298 } 5299 cmsUpdateBookingPrices(); 5300 }); 5301 var add1 = true; 5302 var selectDay = true; 5303 $('.booking-just-available-dates').each(function(){ 5304 var add1temp=false; 5305 var selectDayTemp = false; 5306 if ($(this).find(".cms-booking-product-special-qty").length==0&&$(this).find(".cms-booking-product-children-qty").length==0){ 5307 if ($(this).find('.cms-booking-product-date').length==1&&$(this).find('.cms-booking-product-qty input').val()=="0"){ 5308 add1temp=true; 5309 } 5310 } 5311 if (!add1temp){ 5312 add1=false; 5313 } 5314 if ($(this).find('.cms-booking-product-date').length==1){ 5315 selectDayTemp=true; 5316 } 5317 if (!selectDayTemp){ 5318 selectDay=false; 5319 } 5320 }); 5321 $('.booking-just-available-dates').each(function(){ 5322 if (add1){ 5323 if ($(this).find(".cms-booking-product-special-qty").length==0&&$(this).find(".cms-booking-product-children-qty").length==0){ 5324 if ($(this).find('.cms-booking-product-date').length==1&&$(this).find('.cms-booking-product-qty input').val()=="0"){ 5325 $(this).find('.cms-booking-qty-plus').trigger('click'); 5326 } 5327 } 5328 } 5329 if (selectDay){ 5330 if ($(this).find('.cms-booking-product-date').length==1){ 5331 $(this).find('.cms-booking-product-date').trigger('click'); 5332 } 5333 } 5334 }); 5335 function loadCMSBookingProdMonth(month,year,id,$target,silent) { 5336 5337 if (typeof silent =='undefined') 5338 { 5339 var silent = false; 5340 } 5341 $.getJSON( "/actions/ShowBookingProdMonth/", "month="+month+"&year="+year+"&id="+id, function( data ) { 5342 5343 if (!silent) { 5344 $target.parents(".cms-booking-product-dates").data("month",month); 5345 if (month==$target.parents(".cms-booking-product-dates").data("load-month")) { 5346 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-prev-month").css("visibility","hidden"); 5347 5348 } else { 5349 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-prev-month").css("visibility","visible"); 5350 } 5351 $target.parents(".cms-booking-product-dates").data("next-month",data['next_month']); 5352 $target.parents(".cms-booking-product-dates").data("next-month-year",data['next_month_year']); 5353 $target.parents(".cms-booking-product-dates").data("prev-month",data['prev_month']); 5354 $target.parents(".cms-booking-product-dates").data("prev-month-year",data['prev_month_year']); 5355 $target.parents(".cms-booking-product-dates").find("h3").html(month+" "+year); 5356 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-next-month").html(data['next_month']+" →"); 5357 $target.parents(".cms-booking-product-dates").find(".cms-booking-product-prev-month").html("← "+data['prev_month']); 5358 } 5359 var type = $target.parents(".cms-booking-product-dates").data("product-type"); 5360 var spaces = $target.parents(".cms-booking-product-dates").data("product-spaces"); 5361 var modules = $target.parents(".cms-booking-product-dates").data("product-modules"); 5362 5363 var items = []; 5364 var $p = $target.parents(".cms-booking-product-dates"); 5365 if (!silent) { 5366 $(".cms-booking-product-date",$p).hide(); 5367 } 5368 if ($(".date-month-"+month+"-"+year,$p).length) { 5369 if (!silent) { 5370 if($('body').hasClass('booking-month-at-time')||$target.parents('.cms-booking-combined-dates').hasClass('booking-month-at-time')) { 5371 $(".date-month-"+month+"-"+year,$p).show(); 5372 } else { 5373 $(".date-month-"+month+"-"+year+":not(.cms-booking-filler)",$p).show(); 5374 } 5375 } 5376 } else { 5377 5378 $.each( data['days'], function( key, val ) { 5379 var notavailable=false; 5380 if (!$("body").hasClass('accessible-mode')) { 5381 if (val[3]=="prevMonth"||val[3]=="nextMonth") { 5382 if (silent) { 5383 var s = " style=\"display:none\""; 5384 }else { 5385 var s = ''; 5386 } 5387 5388 items.push( "<div class=\"cms-booking-product-date cms-booking-filler cms-booking-product-history date-month-"+month+"-"+year+"\" data-date=\""+val[7]+"-"+val[6]+"+"+val[5]+"\" "+s+">" 5389 +"<span class=\"cms-booking-product-date-weekday\">"+val[8]+"</span>" 5390 +"<span class=\"cms-booking-product-date-day\">"+val[5]+"</span>" 5391 +"</div>" ); 5392 } 5393 5394 } 5395 5396 if ( 5397 val[3]!="prevMonth" 5398 && val[3]!="nextMonth" 5399 && ( 5400 ( 5401 val[6]==$target.parents(".cms-booking-product-dates").data("load-month") 5402 && val[7]==$target.parents(".cms-booking-product-dates").data("load-year") 5403 && val[5]>=$target.parents(".cms-booking-product-dates").data("load-day") 5404 ) 5405 || 5406 ( 5407 val[6]!=$target.parents(".cms-booking-product-dates").data("load-month") 5408 || val[7]!=$target.parents(".cms-booking-product-dates").data("load-year") 5409 ) 5410 ) 5411 ) 5412 { 5413 var d = ""; 5414 if (type==2) { 5415 var available_modules = modules - val[4]['booked_modules']; 5416 5417 if (available_modules>0) { 5418 d = d+" data-available=\""+spaces+"\""; 5419 } else { 5420 d = d+" data-available=\"0\""; 5421 notavailable =true; 5422 } 5423 } else { 5424 var available = spaces - val[4]['booked_individuals']; 5425 d = d+" data-available=\""+available+"\""; 5426 if (available<=0) { 5427 notavailable = true; 5428 } 5429 } 5430 var c = ""; 5431 if (val[8]=="Mon") { 5432 c = c+" cms-booking-date-mon"; 5433 } 5434 if ("-"+val[4]['price_normal']+"-"!="-0-" && notavailable===false) { 5435 c = c+" cms-booking-product-available"; 5436 } 5437 if (val[4].block_start!=0) { 5438 c = c+" block-start"; 5439 } 5440 if (val[4].block_middle!=0) { 5441 c = c+" block-middle"; 5442 } 5443 if (val[4].block_end!=0) {
5444 c = c+" block-end"; 5445 } 5446 5447 d = d+" data-minimum-price-per-place=\""+val[4]['minimum_price_per_place']+"\""; 5448 d = d+" data-price-normal=\""+val[4]['price_normal']+"\""; 5449 d = d+" data-min-days=\""+val[4]['min_days']+"\""; 5450 d = d+" data-price-special=\""+val[4]['price_special']+"\""; 5451 d = d+" data-price-children=\""+val[4]['price_children']+"\""; 5452 d = d+" data-date=\""+val[1]+"\""; 5453 if (silent) { 5454 d = d+" style=\"display:none\""; 5455 } 5456 if ($('body').hasClass("accessible-mode")) { 5457 var i = "<div class=\"cms-booking-product-date date-month-"+val[6]+"-"+val[7]+" "+c+"\" "+d+">"; 5458 i+="<label for=\"day_"+val[8]+"_"+val[5]+"_"+val[6]+"_"+val[7]+"\"><input type=\"checkbox\" "; 5459 5460 if (val[4]['price_normal']!=0 && notavailable===false) {}else{ 5461 i+="disabled"; 5462 } 5463 i+=" name=\"day_"+val[8]+"_"+val[5]+"_"+val[6]+"_"+val[7]+"\" id=\"day_"+val[8]+"_"+val[5]+"_"+val[6]+"_"+val[7]+"\" /> <span class=\"available-label\">Available:</span> <span class=\"unavailable-label\">Unavailable:</span> "+val[8]+" "+val[5]+" "+val[6]+" "+val[7]+"</label></div>"; 5464 5465 items.push(i); 5466 } else { 5467 items.push( "<div class=\"cms-booking-product-date date-month-"+val[6]+"-"+val[7]+" "+c+"\" "+d+"><span class=\"cms-booking-product-date-weekday\">"+val[8]+"</span>" 5468 +"<span class=\"cms-booking-product-date-day\">"+val[5]+" </span></div>" ); 5469 5470 } 5471 } 5472 }); 5473 $target.append(items.join( "" )); 5474 } 5475 if (!silent){ 5476 $target.scrollLeft(0); 5477 if (month==$target.parents(".cms-booking-product-dates").data("load-month")) { 5478 var ol = $(".cms-booking-product-date:not(.cms-booking-product-history):first",$target).position().left; 5479 $target.animate({scrollLeft:ol},500); 5480 } 5481 loadCMSBookingProdMonth(data['next_month'],data['next_month_year'],id,$target,true); 5482 loadCMSBookingProdMonth(data['prev_month'],data['prev_month_year'],id,$target,true); 5483 } 5484 5485 makeCombinedDays(); 5486 5487 //cmsUpdateBookingPrices(); 5488 5489 }); 5490 } 5491 $(".cms-booking-combined-dates").on("click",".cms-booking-product-prev-month",function(){ 5492 $(".cms-booking-product-prev-month:not(.cms-master-days .cms-booking-product-prev-month)").each(function(){ 5493 var $p = $(this).parents(".cms-booking-product-dates"); 5494 var month = $p.data("prev-month"); 5495 var year = $p.data("prev-month-year"); 5496 var id = $p.data("product-id"); 5497 loadCMSBookingProdMonth(month,year,id,$(".cms-booking-product-dates-inner",$p)); 5498 }); 5499 return false; 5500 }); 5501 $(".cms-booking-combined-dates").on("click",".cms-booking-product-next-month",function(){ 5502 $(".cms-booking-product-next-month:not(.cms-master-days .cms-booking-product-next-month)").each(function(){ 5503 var $p = $(this).parents(".cms-booking-product-dates"); 5504 var month = $p.data("next-month"); 5505 var year = $p.data("next-month-year"); 5506 var id = $p.data("product-id"); 5507 loadCMSBookingProdMonth(month,year,id,$(".cms-booking-product-dates-inner",$p)); 5508 }); 5509 return false; 5510 }); 5511 $(".cms-booking-product-prev-month:not(.cms-master-days .cms-booking-product-prev-month)").click(function(){ 5512 var $p = $(this).parents(".cms-booking-product-dates"); 5513 var month = $p.data("prev-month"); 5514 var year = $p.data("prev-month-year"); 5515 var id = $p.data("product-id"); 5516 loadCMSBookingProdMonth(month,year,id,$(".cms-booking-product-dates-inner",$p)); 5517 }); 5518 $(".cms-booking-product-next-month:not(.cms-master-days .cms-booking-product-next-month)").click(function(){ 5519 var $p = $(this).parents(".cms-booking-product-dates"); 5520 var month = $p.data("next-month"); 5521 var year = $p.data("next-month-year"); 5522 var id = $p.data("product-id"); 5523 loadCMSBookingProdMonth(month,year,id,$(".cms-booking-product-dates-inner",$p)); 5524 return false; 5525 }); 5526 5527 /* 5528 if ($(".formUsedInCheckout").length && $("#paymentGatewayForm").length) { 5529 $("#paymentGatewayForm").submit(function(){ 5530 5531 if ($(this).hasClass('formInCheckoutOK')) { 5532 if (typeof ga === 'function') { 5533 ga('send', 'event', 'Checkout', 'Gone to Payment Gateway', $(this).attr("action")); 5534 } 5535 if (typeof $(this).data("datalayer-total")!="undefined") { 5536 if (readCookie("transid")==$(this).data('transid')) { 5537 var transid = readCookie("transidvalue"); 5538 } else { 5539 createCookie("transid",$(this).data('transid')); 5540 var transid = Math.floor(Math.random()*1000000); 5541 createCookie("transidvalue",transid); 5542 } 5543 dataLayer.push({ 5544 "transactionId":transid 5545 ,"transactionTotal":parseFloat($(this).data('datalayer-total')) 5546 ,"transactionTax":parseFloat($(this).data('datalayer-tax')) 5547 ,"transactionShipping":parseFloat($(this).data('datalayer-shipping')) 5548 // ,"coupon":$(this).data('datalayer-coupon') 5549 // ,"discount":parseFloat($(this).data('datalayer-discount')) 5550 // ,"gateway":$(this).data('datalayer-gateway') 5551 }); 5552 } 5553 return true; 5554 } else { 5555 $(".form.formUsedInCheckout").submit(); 5556 5557 5558 return false; 5559 } 5560 }); 5561 }*/ 5562 if (!$(".formUsedInCheckout").length && $("#paymentGatewayForm").length) { 5563 $("#paymentGatewayForm").submit(function(){ 5564 if (typeof ga === 'function') { 5565 ga('send', 'event', 'Checkout', 'Gone to Payment Gateway', $(this).attr("action")); 5566 } 5567 if (typeof $(this).data("datalayer-total")!="undefined") { 5568 dataLayer.push({ 5569 "event":"checkoutGoingToGateway" 5570 ,"total":parseFloat($(this).data('datalayer-total')) 5571 ,"tax":parseFloat($(this).data('datalayer-tax')) 5572 ,"shipping":parseFloat($(this).data('datalayer-shipping')) 5573 ,"coupon":$(this).data('datalayer-coupon') 5574 ,"discount":parseFloat($(this).data('datalayer-discount')) 5575 ,"gateway":$(this).data('datalayer-gateway') 5576 }); 5577 } 5578 }); 5579 } 5580 $("body").click(function(e){ 5581 if (!$(e.target).parents("#defaultDatepicker").length 5582 && !$(e.target).hasClass("default_datepicker") 5583 && !$(e.target).parents("#defaultDatepickerDouble").length 5584 && $(e.target).attr("id")!="defaultDatepickerDouble" 5585 ) { 5586 $("#defaultDatepicker").remove(); 5587 $("#defaultDatepickerDouble").hide(); 5588 $("body").removeClass("showingDefaultDatepicker"); 5589 $(".default_datepicker_target").removeClass("default_datepicker_target"); 5590 } 5591 }); 5592 if ($(".default_datepicker_double").length){ 5593 5594 var $dp = $("<div id='defaultDatepickerDouble'><p id='closeDatepicker'>x</p><a href='' id='datepicker_prev_month_double'>‹</a> <a href='' id='datepicker_next_month_double'>›</a><div id='datepickerInner'></div></div>"); 5595 $dp.appendTo($("body")); 5596 $("#closeDatepicker").click(function(){ 5597 $("#defaultDatepickerDouble").hide(); 5598 $(".default_datepicker_target").removeClass("default_datepicker_target"); 5599 return false;
5600 }); 5601 $("#defaultDatepickerDouble,#proxyDatepickerDouble").on("click","#datepicker_prev_month_double",function(){ 5602 if (!$(".default_datepicker_target").length){ 5603 $(".default_datepicker_double:first").addClass("default_datepicker_target"); 5604 } 5605 if (!$(".default_datepicker_target").data("showing")){ 5606 $(".default_datepicker_target").data("showing",0); 5607 } 5608 var showing = $(".default_datepicker_target").data("showing"); 5609 showing-=1; 5610 if (showing<0){ 5611 showing=0; 5612 } 5613 $(".default_datepicker_target").data("showing",showing); 5614 var dist = showing * 310; 5615 $("#datepickerInner",$(this).parents("#defaultDatepickerDouble,#proxyDatepickerDouble")).css({"left":"-"+dist+"px"}); 5616 updateOtherDatepickerDouble($(this)); 5617 return false; 5618 }); 5619 $("#defaultDatepickerDouble,#proxyDatepickerDouble").on("click","#datepicker_next_month_double",function(){ 5620 if (!$(".default_datepicker_target").length){ 5621 $(".default_datepicker_double:first").addClass("default_datepicker_target"); 5622 } 5623 if (!$(".default_datepicker_target").data("showing")){ 5624 $(".default_datepicker_target").data("showing",0); 5625 } 5626 var showing = $(".default_datepicker_target").data("showing"); 5627 showing+=1; 5628 if (showing<0){ 5629 showing=0; 5630 } 5631 $(".default_datepicker_target").data("showing",showing); 5632 var dist = showing * 310; 5633 $("#datepickerInner",$(this).parents("#defaultDatepickerDouble,#proxyDatepickerDouble")).css({"left":"-"+dist+"px"}); 5634 updateOtherDatepickerDouble($(this)); 5635 return false; 5636 }); 5637 if ($(".default_datepicker_double").hasClass("prevent_past")) { 5638 var more = "?cutoff="+$(".default_datepicker_double").data('cutoff')+"&timezone="+$(".default_datepicker_double").data("timezone"); 5639 } else { 5640 var more = ""; 5641 } 5642 $("#defaultDatepickerDouble #datepickerInner").load("/actions/DefaultDatepickerDouble/"+more,function(){ 5643 if (typeof stickyLoad == "function"){ 5644 stickyLoad(); 5645 } 5646 $(".doubleDatepickerUnavail").each(function(){ 5647 $("#defaultDatepickerDouble td[data-date='"+$(this).val()+"']").wrapInner("<strike>").addClass("unavailable"); 5648 }); 5649 $(".doubleDatepickerUnavailFirstNight").each(function(){ 5650 $("#defaultDatepickerDouble td[data-date='"+$(this).val()+"']").addClass("unavailableFirstNight"); 5651 }); 5652 $(".doubleDatepickerUnavailLastNight").each(function(){ 5653 $("#defaultDatepickerDouble td[data-date='"+$(this).val()+"']").addClass("unavailableLastNight"); 5654 }); 5655 $("#proxyDatepickerDouble").html($("#defaultDatepickerDouble").html()); 5656 setDoubleDatepicker($("#proxyDatepickerDouble")); 5657 if (typeof moduleHeights == 'function') { 5658 moduleHeights(); 5659 } 5660 $("#proxyDatepickerDouble #closeDatepicker").remove(); 5661 $("#proxyDatepickerDouble").append("<a href='#' id='cleardates'>Clear dates</a>"); 5662 $("#cleardates").click(function(){ 5663 $(".default_datepicker_target").removeClass("default_datepicker_target"); 5664 $(".datepicker_td_range_end,.datepicker_td_range_start,.rangeFill").removeClass("datepicker_td_range_end datepicker_td_range_start rangeFill"); 5665 return false; 5666 }); 5667 $("#defaultDatepickerDouble,#proxyDatepickerDouble").on("click","td.othermonth,td.unavailable",function(){ 5668 return false; 5669 }); 5670 $("#defaultDatepickerDouble,#proxyDatepickerDouble").on("click","td:not(.unavailable,.othermonth)",function(){ 5671 if ($(this).parents(".formDaterange").length) { 5672 var $parent = $(this).parents(".formDaterange"); 5673 } else { 5674 if (!$(".default_datepicker_target").length){ 5675 $(".default_datepicker_double:first").addClass("default_datepicker_target"); 5676 } 5677 var $parent = $(".formDaterange:visible").first(); 5678 } 5679 $(".default_datepicker_target").data("date",$(this).data("date")); 5680 if ($(".default_datepicker_target").parents(".formDaterangeStart").length){ 5681 $(".default_datepicker_target .formDaterangeStartValue").text($(this).data("date")); 5682 if ($(this).data("date")>$(".formDaterangeEndValue",$parent).text()){ 5683 $(".formDaterangeEndValue",$parent).html("<br/>"); 5684 } 5685 if ($(".formDaterangeEndValue",$parent).text().trim()==""){ 5686 $buttons = $(".default_datepicker_target").parents(".formDaterange"); 5687 $(".default_datepicker_target").removeClass("default_datepicker_target"); 5688 $buttons.find(".formDaterangeEnd .default_datepicker_double",$parent).addClass("default_datepicker_target"); 5689 } 5690 } else { 5691 $(".default_datepicker_target .formDaterangeEndValue").text($(this).data("date")); 5692 if ($(this).data("date")<$(".formDaterangeStartValue",$parent).text()){ 5693 $(".formDaterangeStartValue",$parent).html("<br/>"); 5694 $buttons = $(".default_datepicker_target").parents(".formDaterange"); 5695 $(".default_datepicker_target").removeClass("default_datepicker_target"); 5696 $buttons.find(".formDaterangeStart .default_datepicker_double",$parent).addClass("default_datepicker_target"); 5697 } 5698 5699 } 5700 if (!$(".default_datepicker_target").data("showing")){ 5701 $(".default_datepicker_target").data("showing",0); 5702 } 5703 setDoubleDatepicker($(this).parents("#defaultDatepickerDouble,#proxyDatepickerDouble")); 5704 updateOtherDatepickerDouble($(this)); 5705 return false;
5706 }); 5707 }); 5708 } 5709 $(".default_datepicker_double").click(function(){ 5710 $(".default_datepicker_target").removeClass("default_datepicker_target"); 5711 $(this).addClass("default_datepicker_target"); 5712 if (!$(this).data("showing")){ 5713 $(this).data("showing",0); 5714 } 5715 $("body").addClass("showingDefaultDatepicker"); 5716 $dp=$("#defaultDatepickerDouble"); 5717 var ot = $(this).offset().top + $(this).outerHeight() + 3; 5718 if ($("#mobile-menu-page-wrap").length){ 5719 ot = ot-$("#mobile-menu-page-wrap").offset().top; 5720 } 5721 var ol = $(this).parents(".formDaterange").offset().left; 5722 if (ol + 640>$(window).width() && $(window).width() > 680) { 5723 var diff =(ol+640)-$(window).width()+40; 5724 ol = ol - diff; 5725 } 5726 $dp.css({ 5727 top:ot+"px" 5728 ,left:ol+"px" 5729 ,background:"white" 5730 ,padding:"5px" 5731 ,position:"absolute" 5732 ,zIndex:3000 5733 ,border:"1px solid #ddd" 5734 ,borderRadius:"5px" 5735 ,maxWidth:"640px" 5736 ,display:"block" 5737 }); 5738 setDoubleDatepicker($dp); 5739 return false; 5740 }); 5741 $(".default_datepicker").click(function(){ 5742 $(this).addClass("default_datepicker_target"); 5743 $("body").addClass("showingDefaultDatepicker"); 5744 $("#defaultDatepicker").remove(); 5745 var $dp = $("<div id='defaultDatepicker'></div>"); 5746 var ot = $(this).offset().top + $(this).outerHeight() + 3; 5747 var ol = $(this).offset().left; 5748 $dp.css({ 5749 top:ot+"px" 5750 ,left:ol+"px" 5751 ,background:"white" 5752 ,padding:"5px" 5753 ,position:"absolute" 5754 ,zIndex:3000 5755 ,border:"1px solid #ddd" 5756 ,borderRadius:"5px" 5757 ,maxWidth:"250px" 5758 }); 5759 $dp.appendTo($("body")); 5760 if ($(this).hasClass("prevent_past")) { 5761 var more = "?cutoff="+$(this).data('cutoff')+"&timezone="+$(this).data("timezone"); 5762 } else { 5763 var more = ""; 5764 } 5765 $("#defaultDatepicker").load("/actions/DefaultDatepicker/"+more,function(){ 5766 assignDatepickerCal(); 5767 }); 5768 return false; 5769 }); 5770 $(".separateOptionStock").change(function(){ 5771 var code = $(this).attr("data-product-code"); 5772 var stock = $("option",$(this)).filter(":selected").attr("data-stock"); 5773 $("#updateWithOptionStock"+code).text(stock); 5774 }); 5775if ($("html").attr("lang")!="") { 5776 lang = "?language="+$("html").attr("lang"); 5777 langAppend = "&language="+$("html").attr("lang"); 5778} 5779$(".lightbox").click(function(){ 5780 var clicked = $(this); 5781 var parentsId = $(this).parents(".galleryWrapper").attr("id"); 5782 $(".lightboxCurrent").removeClass("lightboxCurrent"); 5783 clicked.addClass("lightboxCurrent"); 5784 $('embed, object, select',"#wrapper").css({ 'visibility' : 'hidden' }); 5785 var formName = $(this).parents(".galleryWrapper").attr("id").replace(/gallery/, ""); 5786 $('body').append("<div id='lightboxOverlay'></div><div id='lightboxOuter'><div id='lightboxContainer'><div id='lightboxExtra1'><div id='lightboxExtra2'><div id='lightboxExtra3'><div id='lightboxClose'></div><div id='lightboxPrev'></div><div id='lightboxNext'></div><div id='lightboxInner'></div></div></div></div></div><div id='lightboxStuff'><div id='lightboxShop'></div><div id='lightboxCaption'></div></div></div>"); 5787 $(".shopGalleryVariant[name="+formName+"]").appendTo("#lightboxShop").fadeIn(); 5788 $("#lightboxShop form").append("<input type='hidden' name='pic_url' value='' />"); 5789 $("#lightboxOverlay").css("height",$(document).height()+"px"); 5790 $("#lightboxOuter").css("top",$(document).scrollTop()+100+"px"); 5791 5792 $("#lightboxContainer").css({ 5793 opacity: 0, 5794 display: "block" 5795 }); 5796 $("#lightboxContainer").animate({ 5797 opacity: 1 5798 }); 5799 function showImage (href,title) { 5800 function cont4 () { 5801 function cont3 () { 5802 showNav(); 5803 $("."+formName+"input").val(title); 5804 $("input[name=pic_url]",$("#lightboxShop form")).val(href); 5805 $("#lightboxCaption").html("<p>"+title+"</p>"); 5806 $("#lightboxInner").html('<img src="'+href+'" alt="'+title+'" style="display:none"/>'); 5807 $("#lightboxInner img").css({ 5808 opacity: 0, 5809 display: "block" 5810 }); 5811 $("#lightboxInner img").animate({ 5812 opacity: 1 5813 },300); 5814 } 5815 $('<img src="'+href+'" style="display:none;"/>').appendTo("body").on("load",function(){ 5816 $("#lightboxContainer").animate({ 5817 width: $(this).width(), 5818 height: $(this).height() 5819 },300,cont3); 5820 $("#lightboxStuff").animate({ 5821 width: $(this).width() 5822 },300); 5823 }); 5824 } 5825 $("#lightboxNext,#lightboxPrev,#lightboxClose").fadeOut(300); 5826 $("#lightboxInner img").fadeOut(300,cont4); 5827 } 5828 function showNav () { 5829 $("#lightboxClose").fadeIn(); 5830 $("#lightboxClose").unbind().click(function(){ 5831 function cont2 () { 5832 $("#lightboxOverlay,#lightboxOuter").remove(); 5833 $('embed, object, select',"#wrapper").css({ 'visibility' : 'visible' }); 5834 5835 } 5836 $("#lightboxOverlay,#lightboxOuter").fadeOut(300,cont2); 5837 $(".shopGalleryVariant[name="+formName+"]").appendTo("body").hide(); 5838 }); 5839 var totalEls = $("#"+parentsId+" .lightbox").length-1; 5840 var clickedEl = 0; 5841 var currentEl = 0; 5842 $("#"+parentsId+" .lightbox").each(function(){ 5843 if ($(this).hasClass("lightboxCurrent")) { 5844 clickedEl = currentEl; 5845 } 5846 currentEl++; 5847 }); 5848 if (clickedEl!=totalEls) { 5849 $("#lightboxNext").fadeIn(); 5850 $("#lightboxNext").unbind().click(function(){ 5851 var stop = 0; 5852 var stop2 = 0; 5853 $("#"+parentsId+" .lightbox").each(function(){ 5854 stop++; 5855 if ($(this).hasClass("lightboxCurrent")) { 5856 stop2 = stop; 5857 } 5858 }); 5859 var stop3 = 0; 5860 $("#"+parentsId+" .lightbox").each(function(){ 5861 if (stop3 == stop2) { 5862 $(".lightboxCurrent").removeClass("lightboxCurrent"); 5863 $(this).addClass("lightboxCurrent"); 5864 var href = $(this).attr("href"); 5865 var title = $(this).attr("title"); 5866 showImage(href,title); 5867 } 5868 stop3++; 5869 }); 5870 }); 5871 } 5872 if (clickedEl!=0) { 5873 $("#lightboxPrev").fadeIn(); 5874 $("#lightboxPrev").unbind().click(function(){ 5875 var prev = 0; 5876 var clicked = 0; 5877 $("#"+parentsId+" .lightbox").each(function(){ 5878 if ($(this).hasClass("lightboxCurrent")) { 5879 current = prev; 5880 } 5881 prev++; 5882 }); 5883 var prev = 0; 5884 $("#"+parentsId+" .lightbox").each(function(){ 5885 if (prev==current-1) { 5886 $(".lightboxCurrent").removeClass("lightboxCurrent"); 5887 $(this).addClass("lightboxCurrent"); 5888 var href = $(this).attr("href"); 5889 var title = $(this).attr("title"); 5890 showImage(href,title); 5891 } 5892 prev++; 5893 }); 5894 }); 5895 } 5896 } 5897 function cont () { 5898 $("."+formName+"input").val(clicked.attr("title")); 5899 $("input[name=pic_url]",$("#lightboxShop form")).val(clicked.attr("href")); 5900 $("#lightboxStuff").css("width",preloader.width+"px"); 5901 $("#lightboxCaption").html("<p>"+clicked.attr("title")+"</p>"); 5902 $("#lightboxStuff").fadeIn(); 5903 $("#lightboxInner").html('<img src="'+clicked.attr("href")+'" alt="'+clicked.attr("title")+'" style="display:none"/>'); 5904 $("#lightboxInner img").css({ 5905 opacity: 0, 5906 display: "block" 5907 }); 5908 $("#lightboxInner img").animate({ 5909 opacity: 1 5910 },300); 5911 5912 showNav(); 5913 5914 } 5915 5916 var preloader = new Image(); 5917 5918 preloader.onload = function() { 5919 $("#lightboxContainer").animate({ 5920 width: preloader.width, 5921 height: preloader.height 5922 },300,cont); 5923 }; 5924 preloader.src = clicked.attr("href"); 5925 return false;
5926}); 5927function updateOtherDatepickerDouble($this){ 5928 if ($this.parents("#defaultDatepickerDouble").length){ 5929 var inner ="default"; 5930 var dest ="proxy"; 5931 } else { 5932 var inner ="proxy"; 5933 var dest ="default"; 5934 } 5935 var $inner = $("#"+inner+"DatepickerDouble #datepickerInner").clone(); 5936 $("#"+dest+"DatepickerDouble #datepickerInner").replaceWith($inner); 5937 5938} 5939function assignDatepickerCal () { 5940 $("#defaultDatepicker td:not(.unavailable)").click(function(){ 5941 $(".default_datepicker_target").val($(this).attr("data-date")).change(); 5942 $("#defaultDatepicker").remove(); 5943 $("body").removeClass("showingDefaultDatepicker"); 5944 $(".default_datepicker_target").removeClass("default_datepicker_target"); 5945 return false; 5946 }); 5947 $("#datepicker_next_month").click(function(){ 5948 month = $("#datepicker_next_month_val").val(); 5949 year = $("#datepicker_next_month_year").val(); 5950 5951 if ($(".default_datepicker_target").hasClass("prevent_past")) { 5952 var more = "&cutoff="+$(".default_datepicker_target").data('cutoff')+"&timezone="+$(".default_datepicker_target").data("timezone"); 5953 } else { 5954 var more = ""; 5955 } 5956 5957 $("#defaultDatepicker").load("/actions/DefaultDatepicker/?month="+month+"&year="+year+langAppend+more,function(){ 5958 assignDatepickerCal(); 5959 }); 5960 return false; 5961 }); 5962 $("#datepicker_prev_month").click(function(){ 5963 month = $("#datepicker_prev_month_val").val(); 5964 year = $("#datepicker_prev_month_year").val(); 5965 5966 if ($(".default_datepicker_target").hasClass("prevent_past")) { 5967 var more = "&cutoff="+$(".default_datepicker_target").data('cutoff')+"&timezone="+$(".default_datepicker_target").data("timezone"); 5968 } else { 5969 var more = ""; 5970 } 5971 5972 5973 $("#defaultDatepicker").load("/actions/DefaultDatepicker/?month="+month+"&year="+year+langAppend+more,function(){ 5974 assignDatepickerCal(); 5975 }); 5976 return false; 5977 }); 5978} 5979function assignBlogCal() { 5980 $("#blog_next_month").click(function(){ 5981 month = $("#blog_next_month_val").val(); 5982 year = $("#blog_next_month_year").val(); 5983 5984 $("#blogCal").load("/actions/BlogCal/?month="+month+"&year="+year+langAppend+"&"+catAppend,function(){ 5985 assignBlogCal(); 5986 }); 5987 return false; 5988 }); 5989 $("#blog_prev_month").click(function(){ 5990 month = $("#blog_prev_month_val").val(); 5991 year = $("#blog_prev_month_year").val(); 5992 5993 $("#blogCal").load("/actions/BlogCal/?month="+month+"&year="+year+langAppend+"&"+catAppend,function(){ 5994 assignBlogCal(); 5995 }); 5996 return false; 5997 }); 5998} 5999var url = window.location.href; 6000url = url.split("/"); 6001if (lang=="") { 6002 var catPrepend="?"; 6003} else { 6004 var catPrepend="&"; 6005} 6006var catAppend=""; 6007if (url[4]=="category"&&url[5]!="") { 6008 var catAppend="cat="+url[5]; 6009} 6010if (url[7]=="category"&&url[8]!="") { 6011 var catAppend="cat="+url[8]; 6012} 6013if (url[8]=="category"&&url[9]!="") { 6014 var catAppend="cat="+url[9]; 6015} 6016$("#blogCal").load("/actions/BlogCal/"+lang+catPrepend+catAppend,function(){ 6017 assignBlogCal(); 6018}); 6019 6020$("#commentForm").load("/actions/ShowCommentForm/"+lang, function(){ 6021 if (typeof moduleHeights == 'function') { 6022 moduleHeights(); 6023 } 6024 $("#commentFormForm a.submitForm").click(function(){ 6025 $(this).parent().submit(); 6026 return false; 6027 }); 6028 $("#commentFormForm").submit(function(){ 6029 $("#loader").fadeIn(300); 6030 6031 6032 if ($("#name").val() == "") { 6033 $("#name").addClass("error"); 6034 $("#name").animate({ 6035 left: +10 6036 }, 20, function(){ 6037 $("#name").animate({ 6038 left: -20 6039 }, 40, function(){ 6040 $("#name").animate({ 6041 left: +20 6042 }, 40, function(){ 6043 $("#name").animate({ 6044 left: 0 6045 }, 20, function(){ 6046 $("#name").removeClass("error"); 6047 $("#name").focus(); 6048 $("#loader").fadeOut(200); 6049 }); 6050 }); 6051 }); 6052 }); 6053 6054 return false; 6055 6056 6057 } else if ($("#email").val() == "") { 6058 $("#email").addClass('error'); 6059 $("#email").animate({ 6060 left: +10 6061 }, 20, function(){ 6062 $("#email").animate({ 6063 left: -20 6064 }, 40 ,function(){ 6065 $("#email").animate({ 6066 left: +20 6067 }, 40 ,function(){ 6068 $("#email").animate({ 6069 left: -0 6070 }, 20 ,function(){ 6071 $("#email").removeClass('error'); 6072 $("#email").focus(); 6073 6074 }); 6075 }); 6076 }); 6077 }); 6078 $("#loader").fadeOut(200); 6079 6080 return false;
6081 6082 } else if ($("#comment").val() == "") { 6083 $("#comment").addClass('error'); 6084 $("#comment").animate({ 6085 left: +10 6086 }, 20 ,function(){ 6087 $("#comment").animate({ 6088 left: -20 6089 }, 40 ,function(){ 6090 $("#comment").animate({ 6091 left: +20 6092 }, 40 ,function(){ 6093 $("#comment").animate({ 6094 left: -0 6095 }, 20 ,function(){ 6096 $("#comment").removeClass('error'); 6097 $("#comment").focus(); 6098 6099 }); 6100 }); 6101 }); 6102 }); 6103 $("#loader").fadeOut(200); 6104 6105 return false; 6106 } else { 6107 function urlencode( str ) { 6108 // http://kevin.vanzonneveld.net 6109 // + original by: Philip Peterson 6110 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 6111 // * example 1: urlencode('Kevin van Zonneveld!'); 6112 // * returns 1: 'Kevin+van+Zonneveld%21' 6113 6114 var ret = str; 6115 6116 ret = ret.toString(); 6117 ret = encodeURIComponent(ret); 6118 ret = ret.replace(/%20/g, '+'); 6119 6120 return ret; 6121 } 6122 function htmlentities( s ){ 6123 // http://kevin.vanzonneveld.net 6124 // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 6125 // * example 1: htmlentities('Kevin & van Zonneveld'); 6126 // * returns 1: 'Kevin & van Zonneveld' 6127 6128 var div = document.createElement('div'); 6129 var text = document.createTextNode(s); 6130 div.appendChild(text); 6131 return div.innerHTML; 6132 } 6133 $.ajax({ 6134 type: "GET", 6135 url: "/actions/CheckEmail/", 6136 data: "email="+$("#email").val(), 6137 success: function(msg){ 6138 if (msg == "ok") { 6139 var validEmail = true; 6140 } else { 6141 var validEmail = false; 6142 } 6143 if (validEmail == false) { 6144 $("#emailIncorrect").css("display","block"); 6145 $("#email").addClass('error'); 6146 $("#email").animate({ 6147 left: +10 6148 }, 20 ,function(){ 6149 $("#email").animate({ 6150 left: -20 6151 }, 40 ,function(){ 6152 $("#email").animate({ 6153 left: +20 6154 }, 40 ,function(){ 6155 $("#email").animate({ 6156 left: -0 6157 }, 20 ,function(){ 6158 $("#email").removeClass('error'); 6159 $("#email").focus(); 6160 }); 6161 }); 6162 }); 6163 }); 6164 $("#loader").fadeOut(200); 6165 6166 return false; 6167 6168 } else { 6169 $("#emailIncorrect").css("display","none"); 6170 $.ajax({ 6171 type: "GET", 6172 url: "/actions/AddComment/"+lang, 6173 data: "name="+$("#name").val()+"&email="+$("#email").val()+"&website="+urlencode($("#website").val())+"&c
6173omment="+urlencode($("#comment").val())+"&blogId="+$("#blogId").val(), 6174 success: function(msg){ 6175 $('#commentsList').html(msg); 6176 if (typeof moduleHeights == 'function') { 6177 moduleHeights(); 6178 } 6179 $('#name').val(""); 6180 $('#email').val(""); 6181 $('#website').val(""); 6182 $('#comment').val(""); 6183 $("#loader").fadeOut(200); 6184 6185 } 6186 }); 6187 6188 return false; 6189 6190 } 6191 } 6192 }); 6193 return false; 6194 6195 } 6196 return false; 6197 }); 6198}); 6199 6200// $("#loginForm").submit(function(){ 6201// pwhash = hex_hmac_sha1(hex_hmac_sha1($("input[name=password]",$(this)).val(),$("#saltInput").val()),$("#timestampInput").val()); 6202// $("#hashInput").val(pwhash); 6203// $("input[name=password]",$(this)).val("") 6204// 6205// }); 6206 6207if ($(".form").length>0) { 6208 $(".email1,.fakeemail").css({ 6209 "position":"absolute" 6210 ,"top":"-40000px" 6211 ,"left":"-50000px" 6212 }); 6213// $(".fakeemail").hide(); 6214 $(".form:not(.accessible-mode .form)").each(function(){ 6215 $(this).append("<input type='hidden' name='ajax' value='yes'/>"); 6216 }); 6217} 6218$(".form:not(.accessible-mode .form),.formUsedInCheckout").find("input,textarea,select").change(function(){ 6219 $(this).parents(".oktosend").removeClass("oktosend"); 6220}); 6221function autoSaveLoggedInForm($this) { 6222 window.autosaved=true; 6223 $this.append("<input type='hidden' name='autosaving' value='true' class='autosavingFlag' />").submit(); 6224 6225 setTimeout(function(){ 6226 window.autosaved=false; 6227 },10); 6228} 6229 window.autosavingForm = false; 6230$(".form.reload_on_send:not(.accessible-mode .form)").each(function(){ 6231 $(this).on("change keyup","input:not('[type=tel],[type=email],[type=password]'),textarea,select",function(){ 6232 clearTimeout(autosavingForm); 6233 window.autosavingForm = setTimeout(autoSaveLoggedInForm,1000,$(this).parents(".form")); 6234 }); 6235}); 6236function invisRecaptcha(token) { 6237 var $form = $('.recaptchaSend'); 6238 var maskedFields = $form.data('maskedFields'); 6239 6240 if (maskedFields && maskedFields.length > 0) { 6241 // Create custom options that include field restoration for reCAPTCHA submissions 6242 var customOptions = $.extend({}, optionsForm, { 6243 success: function(responseText, statusText, xhr, $formElement) { 6244 // Restore masked fields first 6245 restoreFieldValuesAfterSubmission(maskedFields); 6246 // Clear the stored data 6247 $form.removeData('maskedFields'); 6248 // Then call the original success handler 6249 if (optionsForm.success) { 6250 optionsForm.success(responseText, statusText, xhr, $formElement); 6251 } 6252 }, 6253 error: function(xhr, status, error) { 6254 // Restore masked fields on error too 6255 restoreFieldValuesAfterSubmission(maskedFields); 6256 // Clear the stored data 6257 $form.removeData('maskedFields'); 6258 // Call original error handler if it exists 6259 if (optionsForm.error) { 6260 optionsForm.error(xhr, status, error); 6261 } 6262 } 6263 }); 6264 $form.ajaxSubmit(customOptions); 6265 } else { 6266 // No masking was applied, use original options 6267 $form.ajaxSubmit(optionsForm); 6268 } 6269} 6270var grecapLoad = function() { 6271 $(".g-recaptchaload").each(function() { 6272 if (!$(this).parents('#popupMessageContents').length&&!$(this).parents('.popupMessageOnClickContent').length) { 6273 var object = $(this); 6274 var rid = grecaptcha.render(object.attr("id"), { 6275 "sitekey" :$(this).data("sitekey"), 6276 "callback" : function(token) { 6277 object.parents('form').find(".g-recaptcha-response").val(token); 6278 invisRecaptcha(token); 6279 } 6280 }); 6281 $(this).parents('form').attr('recapid',rid); 6282 } 6283 }); 6284} 6285window.grecapLoad = grecapLoad; 6286$(window).load(function() { 6287 setTimeout(function(){ 6288 if (readCookie('editingcms') && document.location.hash=="" && window.self === window.top) { 6289 // not iframe 6290 showCMSButton(); 6291 } 6292 if (readCookie('editingcms') && document.location.hash=="" && window.self !== window.top) { 6293 // iframe,just check for breakpoin init 6294 var app = '<div style="display:none" id="editInCMStemp">' 6295 +'</div>'; 6296 $('body').append(app); 6297 $("#editInCMStemp").load('/admin/index-new.php?justmenu=true',function(){ 6298 if ($("#expandCMSMenu").hasClass("saveStyles")&&$("body").hasClass("breakpoints")){ 6299 if (typeof window.findBreakpoints != 'undefined'){ 6300 window.parent.showBreakpointLoader(); 6301 window.findBreakpoints=true; 6302 flexiBreak(); 6303 } 6304 } 6305 }); 6306 6307 } 6308 }
6308,1000); 6309}); 6310window.invisRecaptcha = invisRecaptcha; 6311function showResponseForm (responseText, statusText) { 6312 var toSend = $('.ajaxSending'); 6313 if (toSend.hasClass("formUsedInCheckout")){ 6314 var showErrorIn = $("#paymentGatewayForm"); 6315 } else { 6316 var showErrorIn = toSend; 6317 } 6318 var loader = $("#loader",showErrorIn); 6319 if (toSend.find(".autosavingFlag").length) { 6320 $(".autoSaved").remove(); 6321 toSend.find(".autosavingFlag").remove(); 6322 $('body').append("<p class='autoSaved off iconAlert'>Draft autosaved.</p>"); 6323 6324 // Restore file fields that were hidden during autosave 6325 if (window.FormEncryptionManager && window.FormEncryptionManager.restoreFileFieldsAfterAutosave) { 6326 window.FormEncryptionManager.restoreFileFieldsAfterAutosave(); 6327 } 6328 6329 setTimeout(function () { 6330 $(".autoSaved").removeClass("off"); 6331 }, 10); 6332 6333 setTimeout(function () { 6334 $(".autoSaved").addClass("off"); 6335 setTimeout(function () { 6336 $(".autoSaved").remove(); 6337 }, 1000); 6338 }, 2000); 6339 loader.fadeOut(200); 6340 return false; 6341 } 6342 // A server-side rejection (missing required fields, a PHP error) comes back 6343 // as a full HTML page rather than one of the short codes handled below. 6344 // Without this it fell through to the success path and told the visitor the 6345 // form had been sent. 6346 if (/<title>\s*Error\s*<\/title>|Fatal error|Parse error/i.test(responseText)) { 6347 loader.fadeOut(200); 6348 $("#sending_wait").hide(); 6349 $(".submit_form",toSend).show(); 6350 alert(/Required fields missing/i.test(responseText) 6351 ? "Some required fields are missing. Please check the form and try again." 6352 : "Sorry, your form could not be sent. Please check it and try again."); 6353 return false; 6354 } 6355 var formid = toSend.find('input[name="formId"]').val(); 6356 var showSuccess=true; 6357 if (responseText=="promptsmscode"){ 6358 if (toSend.find('input[type="email"]').length && toSend.find('input[type="email"]').val()!=""){ 6359 var text=$('#success').text()+" You have also entered a mobile number. You will recive a verification code which you can enter here to verify your number. Your code expires within two minutes."; 6360 }else{ 6361 var text="To complete your registration you need to enter your SMS verification code here. Your code will expire in two minutes:"; 6362 } 6363 var showSuccess=false; 6364 $('body').append('<div id="login_sms_mask"><div id="sms_login"><form id="sms_login_form" action="/actions/verifySMS/"><label>'+text+'<br/><input id="sms_code" type="text" name="code" /><p class="Button_Medium" id="submit_sms_form"><a href="#">Verify</a></p><p style="display:none" class="Icon_Alert" id="sms_not_ok">Your code is incorrect. Please try again or <a href="#">cancel and start again.</a></p><p style="display:none" class="Icon_Alert" id="sms_ok">Your number has been successfully verified. You can now use it to login.</p></form></div></div>'); 6365 $('#sms_not_ok a ').click(function(){ 6366 $('#login_sms_mask').remove(); 6367 $('#sms_login_expired').hide(); 6368 return false; 6369 }); 6370 $('#submit_sms_form a').click(function(){ 6371 $(this).parents('form').submit(); 6372 return false; 6373 }); 6374 $('#sms_login_form').submit(function(){ 6375 $('#sms_not_ok').hide(); 6376 $.ajax({ url: $(this).attr("action"), data: {'formid':formid,'code':$('#sms_code').val()}, success: function(resp){ 6377 if (resp=="notok"){ 6378 $('#sms_not_ok').show(); 6379 } 6380 else if (resp=="ok"){ 6381 $('#sms_ok').show(); 6382 } 6383 else if (resp=="expired"){ 6384 $('#login_sms_mask').remove(); 6385 $('#sms_login_expired').show(); 6386 }else { 6387 window.location.href=resp; 6388 } 6389 6390 }}); 6391 return false; 6392 }); 6393 } 6394 if (responseText=="error: newemailreqpass"){ 6395 loader.fadeOut(200); 6396 alert('Please enter a password to add an email adderess to your account.'); 6397 if (typeof grecaptcha != "undefined") { 6398 if (typeof toSend.attr('recapid') !='undefined') { 6399 grecaptcha.reset(toSend.attr('recapid')); 6400 } else { 6401 grecaptcha.reset(); 6402 } 6403 } 6404 if (typeof turnstile != "undefined") { 6405 if (typeof toSend.attr('recapid') !='undefined') { 6406 turnstile.reset(toSend.attr('recapid')); 6407 } else { 6408 turnstile.reset(); 6409 } 6410 } 6411 6412 $("#sending_wait").hide(); 6413 $(".submit_form",toSend).show(); 6414 return false;
6415 } 6416 if (responseText=="error: alreadyregistered"){ 6417 loader.fadeOut(200); 6418 $("#alreadyregistered",toSend).fadeIn(); 6419 if (typeof grecaptcha != "undefined") { 6420 if (typeof toSend.attr('recapid') !='undefined') { 6421 grecaptcha.reset(toSend.attr('recapid')); 6422 } else { 6423 grecaptcha.reset(); 6424 } 6425 } 6426 if (typeof turnstile != "undefined") { 6427 if (typeof toSend.attr('recapid') !='undefined') { 6428 turnstile.reset(toSend.attr('recapid')); 6429 } else { 6430 turnstile.reset(); 6431 } 6432 } 6433 6434 $("#sending_wait").hide(); 6435 $(".submit_form",toSend).show(); 6436 return false; 6437 } 6438 if (responseText=="error: recaptcha") { 6439 loader.fadeOut(200); 6440 $("#recaptcha_error",toSend).fadeIn(); 6441 if (typeof grecaptcha != "undefined") { 6442 if (typeof toSend.attr('recapid') !='undefined') { 6443 grecaptcha.reset(toSend.attr('recapid')); 6444 } else { 6445 grecaptcha.reset(); 6446 } 6447 } 6448 if (typeof turnstile != "undefined") { 6449 if (typeof toSend.attr('recapid') !='undefined') { 6450 turnstile.reset(toSend.attr('recapid')); 6451 } else { 6452 turnstile.reset(); 6453 } 6454 } 6455 6456 $("#sending_wait").hide(); 6457 $(".submit_form",toSend).show(); 6458 return false; 6459 } 6460 if (responseText=="error: duplicate") { 6461 loader.fadeOut(200); 6462 $("#sending_wait").hide(); 6463 $(".submit_form",toSend).show(); 6464 alert("Error: You've already sent this form"); 6465 return false; 6466 } 6467 if (responseText=="error: ban") { 6468 loader.fadeOut(200); 6469 $("#sending_wait").hide(); 6470 $(".submit_form",toSend).show(); 6471 alert("Error: You are not allowed to send this form."); 6472 return false; 6473 } 6474 if (responseText=="error: flood") { 6475 loader.fadeOut(200); 6476 $("#sending_wait").hide(); 6477 $(".submit_form",toSend).show(); 6478 alert("Error: Please wait 15 seconds between sending forms."); 6479 return false; 6480 } 6481 if (responseText=="error: passwordsnotsame") { 6482 loader.fadeOut(200); 6483 $("#sending_wait").hide(); 6484 $(".submit_form",toSend).show(); 6485 alert("Error: Your passwords don't match"); 6486 return false; 6487 } 6488 if (responseText=="formInCheckout") { 6489 $("#paymentGatewayForm").addClass("formInCheckoutOK").trigger('submit'); 6490 $("#paymentGatewayFormStripe").addClass("formInCheckoutOK").trigger('click'); 6491 } else { 6492 if (responseText.substring(0,9)=="redirect:") { 6493 var url = responseText.substring(9,responseText.length); 6494 var counter = 1; 6495 $(".input-wrapper input,.input-wrapper textarea,.input-wrapper select",toSend).each(function(){ 6496 url = url.replace("***FIELD"+counter+"***",encodeURIComponent($(this).val())); 6497 counter++; 6498 }); 6499 6500 window.location.href=url; 6501 } 6502 if (typeof grecaptcha != "undefined"&& $('.g-recaptcha',$(toSend)).length) { 6503 grecaptcha.reset(); 6504 } 6505 if (typeof turnstile != "undefined"&& $('.cf-turnstile',$(toSend)).length) { 6506 turnstile.reset(); 6507 } 6508 6509 $("#sending_wait").hide(); 6510 setTimeout(function () { 6511 $(".submit_form",showErrorIn).fadeIn(); 6512 if (typeof moduleHeights == 'function') { 6513 moduleHeights(); 6514 } 6515 6516 }, 2500); 6517 loader.fadeOut(200); 6518 6519 $(".submit_form",toSend).hide(); 6520 if (showSuccess){ 6521 if ($('.signupFormNeedsEmailOrSMS',toSend).length) { 6522 var text=$('#success',toSend).text(); 6523 $('body').append('<div id="login_sms_mask"><div id="sms_login"><p class="Icon_Alert">'+text+'</p><p class="Button_Large"><a href="">OK</a></p></div></div>'); 6524 6525 }else{ 6526 $("#success",toSend).fadeIn(200,function(){ 6527 if (typeof moduleHeights == 'function') { 6528 moduleHeights(); 6529 } 6530 }); 6531 } 6532 6533 } 6534 if (typeof ga === 'function') { 6535 ga('send', 'event', 'Contact Forms', 'Send', 'ID: '+$("input[name=formId]",toSend).val()); 6536 } 6537 // Let themes and widgets react to a completed send without patching this 6538 // handler. Fired on the form and bubbles, so a listener can sit on the 6539 // document; the form's field values are still in place at this point. 6540 if (toSend.length && typeof window.CustomEvent === 'function') { 6541 toSend[0].dispatchEvent(new CustomEvent('setseed:formsent', { 6542 bubbles: true, 6543 detail: { formId: formid, response: responseText } 6544 })); 6545 } 6546 if (!toSend.hasClass("reload_on_send")) { 6547 $(".input:not(.input[name='group'])",toSend).val(""); 6548 $(".textarea",toSend).val(""); 6549 } 6550 6551 6552 }
6553 if (typeof moduleHeights == 'function') { 6554 moduleHeights(); 6555 } 6556 6557} 6558window.optionsForm = { 6559 success: showResponseForm // post-submit callback 6560}; 6561bindForms(); 6562 6563$("#miniBasket").load("/actions/ShowMiniBasket/"+lang); 6564 6565$("#startConvo").click(function () { 6566 href = this.href; 6567 var popup = window.open(href,'','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=311,height=349'); 6568 return false; 6569}) 6570$(".shopOptions").change(function(){ 6571 href = $("#"+$(this).attr("id")+"button").attr("href"); 6572 href = href.split("&variant="); 6573 newHref = href[0]+"&variant="+urlencode($(this).val()); 6574 $("#"+$(this).attr("id")+"button").attr("href",newHref); 6575}); 6576if ($(".shopGalleryVariant").length>0) { 6577 $(".shopGalleryVariant").each(function(){ 6578 if ($("#"+$(this).attr("name")+"gallery").length>0) { 6579 6580 $(this).prev().prev().data("prodid",$(this).data("datalayer-productid")); 6581 6582 $("."+$(this).attr("name")+"title").show(); 6583 $(this).appendTo('body'); 6584 $(this).hide(); 6585 } 6586 6587 }); 6588} 6589// Handle form encryption for encrypted fields before submission 6590window.handleFormEncryption = async function($form) { 6591 // Only process if form has encrypted fields and encryption manager is available 6592 const $encryptedFields = $form.find('input[data-encrypted="true"], textarea[data-encrypted="true"], select[data-encrypted="true"]'); 6593 if ($encryptedFields.length === 0 || typeof window.FormEncryptionManager === 'undefined') { 6594 return; 6595 } 6596 6597 console.log('Core: Processing', $encryptedFields.length, 'encrypted fields'); 6598 6599 // Ensure user is authenticated for encryption 6600 if (typeof window.FormEncryptionManager.isUserKeyLoaded === 'function' && 6601 !window.FormEncryptionManager.isUserKeyLoaded()) { 6602 6603 if (typeof window.FormEncryptionManager.promptForUserPassword === 'function') { 6604 await window.FormEncryptionManager.promptForUserPassword(); 6605 } 6606 } 6607 6608 // Use the new processEncryptedFieldsForForm function if available (supports file uploads) 6609 if (typeof window.FormEncryptionManager.processEncryptedFieldsForForm === 'function') { 6610 console.log('Core: Using processEncryptedFieldsForForm for file upload support'); 6611 await window.FormEncryptionManager.processEncryptedFieldsForForm($encryptedFields, $form); 6612 return; 6613 } 6614 6615 // Fallback to original logic for text fields only 6616 console.log('Core: Using legacy encryption logic (text fields only)'); 6617 6618 // Process each encrypted field 6619 for (let i = 0; i < $encryptedFields.length; i++) { 6620 const $field = $encryptedFields.eq(i); 6621 const fieldName = $field.attr('name'); 6622 const plaintext = $field.val(); 6623 6624 if (!plaintext) continue; 6625 6626 console.log('Core: Encrypting field:', fieldName); 6627 6628 try { 6629 // Encrypt the data 6630 const userEncrypted = await window.EncryptionManager.encryptForUser( 6631 plaintext, 6632 await window.FormEncryptionManager.exportUserPublicKey() 6633 ); 6634 const adminEncrypted = await window.EncryptionManager.encryptForAdmin(plaintext); 6635 6636 // Add encrypted hidden fields 6637 $form.append($('<input type="hidden">').attr('name', fieldName + '_user_encrypted').val(userEncrypted)); 6638 $form.append($('<input type="hidden">').attr('name', fieldName + '_admin_encrypted').val(adminEncrypted)); 6639 $form.append($('<input type="hidden">').attr('name', fieldName + '_is_encrypted').val('1')); 6640 6641 // Clear original field for autosave, store for restoration 6642 if ($form.find('.autosavingFlag').length > 0) { 6643 $field.data('originalValue', plaintext); 6644 $field.val(''); 6645 6646 // Restore after submission 6647 setTimeout(function() { 6648 const originalValue = $field.data('originalValue'); 6649 if (originalValue !== undefined) { 6650 $field.val(originalValue); 6651 $field.removeData('originalValue'); 6652 } 6653 }, 200); 6654 } else { 6655 $field.val(''); 6656 $field.prop('disabled', true); 6657 } 6658 6659 console.log('Core: Successfully encrypted field:', fieldName); 6660 6661 } catch (error) { 6662 console.error('Core: Failed to encrypt field:', fieldName, error); 6663 } 6664 } 6665}; 6666 6667// Initialize password strength on page load 6668$(document).ready(function() { 6669 initPasswordStrength(); 6670}); 6671 6672 6673var refpath = document.referrer.split("?"); 6674var hpath = document.location.href.split("?"); 6675$.ajax({ 6676 type: "GET", 6677 url: "/actions/LogStats/?title="+document.title+"&referrer="+encodeURIComponent(refpath[0])+"&url="+encodeURIComponent(hpath[0]) 6678 } 6679); 6680 6681}); 6682 6683 6684 function backstretches_core() { 6685 $("*[data-backgrounds]").each(function(){ 6686 var duration = 4000; 6687 var fade = 1000; 6688 var opacity = 1; 6689 var colour = "transparent";
6690 var align = "center"; 6691 if ($(this).data("backgrounds") != null){ 6692 if (typeof $(this).data("background-align") != 'undefined') { 6693 align = $(this).data("background-align"); 6694 } 6695 if (typeof $(this).data("background-color") != 'undefined') { 6696 colour = $(this).data("background-color"); 6697 } 6698 if (typeof $(this).data("background-opacity") != 'undefined') { 6699 opacity = $(this).data("background-opacity"); 6700 } 6701 if (typeof $(this).data("background-duration") != 'undefined') { 6702 duration = $(this).data("background-duration"); 6703 } 6704 if (typeof $(this).data("background-fade") != 'undefined') { 6705 fade = $(this).data("background-fade"); 6706 } 6707 if ($(this).data('parallax-combined')) { 6708 $(".combined-parallax-bg-wrap",$(this)).remove(); 6709 var c = 9; 6710 6711 for (var i = 0; i < $(this).data("backgrounds").length; i++) { 6712 6713 $(this).append("<div class='combined-parallax-bg-wrap' data-scroll-decay='0."+c+"'></div>") 6714 $(this).find(".combined-parallax-bg-wrap:last").backstretch($(this).data("backgrounds")[i], {duration: duration, fade: fade, parallax: true,align:align}); 6715 6716 c--; 6717 6718 } 6719 6720 } else { 6721 6722 6723 if (typeof $(this).data("scroll-decay") != "undefined") { 6724 if ($(this).data("background-panzoom")==1) { 6725 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade, parallax: true, panzoom: true,align:align}); 6726 } else { 6727 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade, parallax: true,align:align}); 6728 } 6729 6730 } else { 6731 if ($(this).data("background-panzoom")==1) { 6732 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade, panzoom: true,align:align}); 6733 } else { 6734 $(this).backstretch($(this).data("backgrounds"), {duration: duration, fade: fade,align:align}); 6735 } 6736 6737 } 6738 if ($(this).data("background-panzoom")==1) { 6739 $(this).addClass('panzoom'); 6740 } 6741 $(".backstretch",$(this)).css("opacity",opacity); 6742 } 6743 6744 $(this).css("background-color",colour); 6745 } 6746 }); 6747 } 6748 6749 6750/* 6751 * Backstretch 6752 * http://srobbin.com/jquery-plugins/backstretch/ 6753 * 6754 * Copyright (c) 2013 Scott Robbin 6755 * Licensed under the MIT license. 6756 */ 6757 6758(function ($, window, undefined) { 6759 'use strict'; 6760 6761 /* PLUGIN DEFINITION 6762 * ========================= */ 6763 6764 $.fn.backstretch = function (images, options) { 6765 // We need at least one image or method name 6766 if (images === undefined || images.length === 0) { 6767 $.error("No images were supplied for Backstretch"); 6768 } 6769 6770 /* 6771 * Scroll the page one pixel to get the right window height on iOS 6772 * Pretty harmless for everyone else 6773 */ 6774 if ($(window).scrollTop() === 0 ) { 6775 window.scrollTo(0, 0); 6776 } 6777 6778 return this.each(function () { 6779 var $this = $(this) 6780 , obj = $this.data('backstretch'); 6781 6782 // Do we already have an instance attached to this element? 6783 if (obj) { 6784 6785 // Is this a method they're trying to execute? 6786 if (typeof images == 'string' && typeof obj[images] == 'function') { 6787 // Call the method 6788 obj[images](options); 6789 6790 // No need to do anything further 6791 return; 6792 } 6793 6794 // Merge the old options with the new 6795 options = $.extend(obj.options, options); 6796 6797 // Remove the old instance 6798 obj.destroy(true); 6799 } 6800 6801 obj = new Backstretch(this, images, options); 6802 $this.data('backstretch', obj); 6803 }); 6804 }; 6805 6806 // If no element is supplied, we'll attach to body 6807 $.backstretch = function (images, options) { 6808 // Return the instance 6809 return $('body') 6810 .backstretch(images, options) 6811 .data('backstretch'); 6812 }; 6813 6814 // Custom selector 6815 $.expr[':'].backstretch = function(elem) { 6816 return $(elem).data('backstretch') !== undefined; 6817 }; 6818 6819 /* DEFAULTS 6820 * ========================= */ 6821 6822 $.fn.backstretch.defaults = { 6823 centeredX: true // Should we center the image on the X axis? 6824 , centeredY: true // Should we center the image on the Y axis? 6825 , align:"center" 6826 , duration: 5000 // Amount of time in between slides (if slideshow) 6827 , fade: 0 // Speed of fade transition between slides 6828 , parallax: false 6829 ,panzoom: false 6830 }; 6831
6832 /* STYLES 6833 * 6834 * Baked-in styles that we'll apply to our elements. 6835 * In an effort to keep the plugin simple, these are not exposed as options. 6836 * That said, anyone can override these in their own stylesheet. 6837 * ========================= */ 6838 var styles = { 6839 wrap: { 6840 left: 0 6841 , top: 0 6842 , overflow: 'hidden' 6843 , margin: 0 6844 , padding: 0 6845 , height: '100%' 6846 , width: '100%' 6847 , zIndex: -999999 6848 } 6849 , img: { 6850 position: 'absolute' 6851 , display: 'none' 6852 , margin: 0 6853 , padding: 0 6854 , border: 'none' 6855 , width: 'auto' 6856 , height: 'auto' 6857 , maxHeight: 'none' 6858 , maxWidth: 'none' 6859 , zIndex: -999999 6860 } 6861 }; 6862 6863 /* CLASS DEFINITION 6864 * ========================= */ 6865 var Backstretch = function (container, images, options) { 6866 this.options = $.extend({}, $.fn.backstretch.defaults, options || {}); 6867 6868 /* In its simplest form, we allow Backstretch to be called on an image path. 6869 * e.g. $.backstretch('/path/to/image.jpg') 6870 * So, we need to turn this back into an array. 6871 */ 6872 this.images = $.isArray(images) ? images : [images]; 6873 6874 // Preload images 6875 $.each(this.images, function () { 6876 $('<img />')[0].src = this; 6877 }); 6878 6879 // Convenience reference to know if the container is body. 6880 this.isBody = container === document.body; 6881 6882 /* We're keeping track of a few different elements 6883 * 6884 * Container: the element that Backstretch was called on. 6885 * Wrap: a DIV that we place the image into, so we can hide the overflow. 6886 * Root: Convenience reference to help calculate the correct height. 6887 */ 6888 this.$container = $(container); 6889 this.$root = this.isBody ? supportsFixedPosition ? $(window) : $(document) : this.$container; 6890 6891 // Don't create a new wrap if one already exists (from a previous instance of Backstretch) 6892 var $existing = this.$container.children(".backstretch").first(); 6893 this.$wrap = $existing.length ? $existing : $('<div class="backstretch"></div>').css(styles.wrap).appendTo(this.$container); 6894 6895 // Non-body elements need some style adjustments 6896 if (!this.isBody) { 6897 // If the container is statically positioned, we need to make it relative, 6898 // and if no zIndex is defined, we should set it to zero. 6899 var position = this.$container.css('position') 6900 , zIndex = this.$container.css('zIndex'); 6901 6902 this.$container.css({ 6903 position: position === 'static' ? 'relative' : position 6904 , zIndex: zIndex === 'auto' ? 0 : zIndex 6905 , background: 'none' 6906 }); 6907 6908 // Needs a higher z-index 6909 this.$wrap.css({zIndex: -999998}); 6910 } 6911 6912 // Fixed or absolute positioning? 6913 this.$wrap.css({ 6914 position: this.isBody && supportsFixedPosition ? 'fixed' : 'absolute' 6915 }); 6916 6917 // Set the first image 6918 this.index = 0; 6919 this.ssbsinitwh=$(window).height(); 6920 this.ssbsinitww=$(window).width(); 6921 this.ssbsinitset= new Array(); 6922 this.show(this.index); 6923 6924 // Listen for resize 6925 $(window).on('resize.backstretch', $.proxy(this.resize, this)) 6926 .on('orientationchange.backstretch', $.proxy(function () { 6927 // Need to do this in order to get the right window height 6928 if (this.isBody && window.pageYOffset === 0) { 6929 window.scrollTo(0, 1); 6930 this.resize(); 6931 } 6932 }, this)); 6933 }; 6934 6935 /* PUBLIC METHODS 6936 * ========================= */ 6937 Backstretch.prototype = { 6938 resize: function (e,force) { 6939 var hd = $(window).height() - this.ssbsinitwh; 6940 6941 if ($(window).width()==this.ssbsinitww && Math.abs(hd) < 200 && jQuery.inArray(this.$img.attr('src'),this.ssbsinitset)!=-1 && typeof force == 'undefined') { 6942 this.ssbsinitww=$(window).width(); 6943 return false; 6944 } 6945 if (jQuery.inArray(this.$img.attr('src'),this.ssbsinitset) == -1) { 6946 this.ssbsinitset.push(this.$img.attr('src')); 6947 } 6948 6949 this.ssbsinitwh=$(window).height(); 6950 this.ssbsinitww=$(window).width(); 6951 try { 6952 6953 var bgCSS = {left: 0, top: 0} 6954 , rootWidth = this.isBody ? this.$root.width() : this.$root.innerWidth() 6955 , bgWidth = rootWidth 6956 , rootHeight = this.options.parallax ? window.innerHeight : (this.isBody ? ( window.innerHeight ? window.innerHeight : this.$root.height() ) : this.$root.innerHe
6956ight()) 6957 , bgHeight = bgWidth / this.$img.data('ratio') 6958 , bgOffset 6959 ; 6960 6961 if (this.options.parallax) { 6962 6963 var decay=this.$root.data('scroll-decay'); 6964 if (this.$root.hasClass('combined-parallax-bg-wrap')) { 6965 decay = 0.7; 6966 } 6967 6968 /* 6969 var dh = $(document).height(); 6970 6971 var b = $(window).height(); 6972 6973 var cs = dh - b; 6974 var csbe = cs + b; 6975 var tt = this.$root.offset().top; 6976 var be = tt + this.$root.outerHeight(); 6977 6978 6979 6980 if (be > b) { 6981 var sb =0; 6982 } else { 6983 var sb = b - be; 6984 } 6985 6986 if (tt < cs) { 6987 var sa = 0 6988 } else { 6989 var sa = tt - cs; 6990 } 6991 //b = b - (this.$root.height()*(1-decay)) 6992 6993 bgHeight = b - sb - sa; 6994 6995 6996 var space = $(window).height()/10; 6997 var halfspace = space/2; 6998 6999 7000 // if (bgHeight<this.$root.height()+space) { 7001 // bgHeight=bgHeight+space; 7002 // } 7003 7004 if ($("body").hasClass("match-parallax-zoom")) { 7005 var highest = $("body").data("parallax-tallest"); 7006 if (bgHeight>highest) { 7007 $("body").data("parallax-tallest",bgHeight); 7008 } else { 7009 bgHeight=highest; 7010 } 7011 } 7012 7013 bgWidth = bgHeight * this.$img.data('ratio'); 7014 7015 7016 if (bgWidth<rootWidth) { 7017 bgWidth=rootWidth; 7018 bgHeight = bgWidth / this.$img.data('ratio') 7019 } 7020 if (sa>0) { 7021 var md = sa - halfspace/decay ; 7022 if (md>0) { 7023 bgCSS.top = md + 'px'; 7024 } 7025 7026 } 7027 */ 7028 // window = paralax div 7029 var screenHeight = $(window).height(); 7030 var documentHeight = $(document).height(); 7031 var docAbove = this.$root.offset().top; 7032 var windowHeight = this.$root.outerHeight(); 7033 if (documentHeight > screenHeight){ 7034 var windowAbove = documentHeight-screenHeight; 7035 if (windowAbove > docAbove){ 7036 windowAbove = docAbove; 7037 } 7038 } else { 7039 var windowAbove = 0; 7040 } 7041 var imageTop = docAbove - windowAbove; 7042 var imageEnd = docAbove + windowHeight; 7043 if (imageEnd > screenHeight){ 7044 imageEnd=screenHeight; 7045 } 7046 var imageHeight = imageEnd-imageTop; 7047 if ($("body").hasClass("match-parallax-zoom")) { 7048 var highest = $("body").data("parallax-tallest"); 7049 if (imageHeight>highest) { 7050 $("body").data("parallax-tallest",imageHeight); 7051 } else { 7052 imageHeight=highest; 7053 } 7054 } 7055 7056 bgWidth = imageHeight * this.$img.data('ratio'); 7057 bgHeight = imageHeight; 7058 7059 7060 if (bgWidth<rootWidth) { 7061 bgWidth=rootWidth; 7062 bgHeight = bgWidth / this.$img.data('ratio') 7063 } 7064 var bottomEdge = docAbove+windowHeight; 7065 var nudgeCSS ={top:"0px"}; 7066 if (bgHeight>bottomEdge&&bottomEdge<screenHeight){ 7067 var halfImageHeight = bgHeight/2; 7068 var halfWindowHeight = (windowAbove + windowHeight) / 2 7069 var toMove = halfImageHeight-halfWindowHeight; 7070 nudgeCSS.top="-"+toMove+"px"; 7071 } 7072 var visibleBit = windowAbove+windowHeight; 7073 if (bgHeight>visibleBit&&bottomEdge>screenHeight){ 7074 var halfImageHeight = bgHeight/2; 7075 var halfScreenHeight = screenHeight / 2 7076 var toMove = halfImageHeight-halfScreenHeight; 7077 nudgeCSS.top="-"+toMove+"px"; 7078 } 7079 7080 bgOffset = (bgWidth - rootWidth) / 2; 7081 7082 if ($("body").hasClass("supports-pos-fixed")) { 7083 var center = window.innerWidth/2; 7084 bgOffset = this.$root.offset().left - bgOffset; 7085 if(this.options.centeredX||this.options.align=="center") { 7086 7087 bgCSS.left = bgOffset + 'px'; 7088 } 7089 7090 } else { 7091 if(this.options.centeredX || this.options.align=="center") { 7092 bgCSS.left = '-' + bgOffset + 'px'; 7093 } 7094 7095 } 7096 7097 } 7098 7099 7100 7101 // Make adjustments based on image ratio 7102 if (!this.options.parallax) { 7103 7104 if (bgHeight >= rootHeight) { 7105 bgOffset = (bgHeight - (rootHeight)) / 2; 7106 if(this.options.centeredY || this.options.align=="center") { 7107 bgCSS.top = '-' + bgOffset + 'px'; 7108 } 7109 7110 7111 } else { 7112 7113 bgWidth = rootHeight * this.$img.data('ratio'); 7114 bgHeight = rootHeight; 7115 7116 bgOffset = (bgWidth - rootWidth) / 2; 7117 if (this.options.parallax && $("body").hasClass("supports-pos-fixed")) { 7118 var center = window.innerWidth/2; 7119 bgOffset = this.$root.offset().left - bgOffset; 7120 if(this.options.centeredX) { 7121 bgCSS.left = bgOffset + 'px'; 7122 } 7123 7124 } else { 7125 if(this.options.centeredX||this.options.align=="center") { 7126 bgCSS.left = '-' + bgOffset + 'px'; 7127 } 7128 7129 } 7130 } 7131 } 7132 if (this.options.align=="right") { 7133 bgCSS.left="auto"; 7134 bgCSS.right=0; 7135 } 7136 if (this.options.align=="left") { 7137 bgCSS.left=0; 7138 } 7139 this.$wrap.css({width: rootWidth, height: rootHeight}) 7140 .find('img:not(.deleteable)').css({width: bgWidth, height: bgHeight}).css(bgCSS); 7141 if (this.options.parallax){ 7142 7143 this.$wrap 7144 .find('img').css(nudgeCSS); 7145 } 7146 } catch(err) { 7147 7148 // IE7 seems to trigger resize before the image is loaded.
7149 // This try/catch block is a hack to let it fail gracefully. 7150 } 7151 7152 return this; 7153 } 7154 7155 // Show the slide at a certain position 7156 , show: function (newIndex) { 7157 7158 // Validate index 7159 if (Math.abs(newIndex) > this.images.length - 1) { 7160 return; 7161 } 7162 7163 // Vars 7164 var self = this 7165 , oldImage = self.$wrap.find('img').addClass('deleteable') 7166 , evtOptions = { relatedTarget: self.$container[0] }; 7167 7168 // Trigger the "before" event 7169 self.$container.trigger($.Event('backstretch.before', evtOptions), [self, newIndex]); 7170 7171 // Set the new index 7172 this.index = newIndex; 7173 7174 // Pause the slideshow 7175 clearInterval(self.interval); 7176 7177 // New image 7178 if (this.options.panzoom) { 7179 self.$img = $('<img />') 7180 .addClass('img'+newIndex) 7181 .addClass('hidden') 7182 .css(styles.img) 7183 .css('display','block') 7184 .attr('alt','Background image') 7185 .bind('load', function (e) { 7186 var imgWidth = this.width || $(e.target).width() 7187 , imgHeight = this.height || $(e.target).height(); 7188 7189 // Save the ratio 7190 $(this).data('ratio', imgWidth / imgHeight); 7191 7192 // Show the image, then delete the old one 7193 // "speed" option has been deprecated, but we want backwards compatibilty 7194 $(document).trigger("scroll"); 7195 $(this).removeClass("hidden"); 7196 setTimeout(function () { 7197 oldImage.remove(); 7198 // Resume the slideshow 7199 if (!self.paused) { 7200 self.cycle(); 7201 } 7202 7203 // Trigger the "after" and "show" events 7204 // "show" is being deprecated 7205 $(['after', 'show']).each(function () { 7206 self.$container.trigger($.Event('backstretch.' + this, evtOptions), [self, newIndex]); 7207 }); 7208 }, self.options.fade); 7209 7210 7211 7212 7213 // Resize 7214 self.resize(e,true); 7215 }) 7216 .appendTo(self.$wrap); 7217 7218 } else { 7219 self.$img = $('<img />') 7220 .css(styles.img) 7221 .attr('alt','Background image') 7222 .bind('load', function (e) { 7223 var imgWidth = this.width || $(e.target).width() 7224 , imgHeight = this.height || $(e.target).height(); 7225 7226 // Save the ratio 7227 $(this).data('ratio', imgWidth / imgHeight); 7228 7229 // Show the image, then delete the old one 7230 // "speed" option has been deprecated, but we want backwards compatibilty 7231 $(this).fadeIn(self.options.speed || self.options.fade, function () { 7232 oldImage.remove(); 7233 7234 // Resume the slideshow 7235 if (!self.paused) { 7236 self.cycle(); 7237 } 7238 7239 // Trigger the "after" and "show" events 7240 // "show" is being deprecated 7241 $(['after', 'show']).each(function () { 7242 self.$container.trigger($.Event('backstretch.' + this, evtOptions), [self, newIndex]); 7243 }); 7244 }); 7245 7246 // Resize 7247 self.resize(e,true); 7248 }) 7249 .appendTo(self.$wrap); 7250 7251 } 7252 7253 // Hack for IE img onload event 7254 var src = self.images[newIndex].split("?"); 7255 7256 self.$img.attr('src', self.images[newIndex]); 7257 return self; 7258 } 7259 7260 , next: function () { 7261 // Next slide 7262 return this.show(this.index < this.images.length - 1 ? this.index + 1 : 0); 7263 } 7264 7265 , prev: function () { 7266 // Previous slide 7267 return this.show(this.index === 0 ? this.images.length - 1 : this.index - 1); 7268 } 7269 7270 , pause: function () { 7271 // Pause the slideshow 7272 this.paused = true; 7273 return this; 7274 } 7275 7276 , resume: function () { 7277 // Resume the slideshow 7278 this.paused = false;
7279 this.next(); 7280 return this; 7281 } 7282 7283 , cycle: function () { 7284 // Start/resume the slideshow 7285 if(this.images.length > 1) { 7286 // Clear the interval, just in case 7287 clearInterval(this.interval); 7288 7289 this.interval = setInterval($.proxy(function () { 7290 // Check for paused slideshow 7291 if (!this.paused) { 7292 this.next(); 7293 } 7294 }, this), this.options.duration); 7295 } 7296 return this; 7297 } 7298 7299 , destroy: function (preserveBackground) { 7300 // Stop the resize events 7301 $(window).off('resize.backstretch orientationchange.backstretch'); 7302 7303 // Clear the interval 7304 clearInterval(this.interval); 7305 7306 // Remove Backstretch 7307 if(!preserveBackground) { 7308 this.$wrap.remove(); 7309 } 7310 this.$container.removeData('backstretch'); 7311 } 7312 }; 7313 7314 /* SUPPORTS FIXED POSITION? 7315 * 7316 * Based on code from jQuery Mobile 1.1.0 7317 * http://jquerymobile.com/ 7318 * 7319 * In a nutshell, we need to figure out if fixed positioning is supported. 7320 * Unfortunately, this is very difficult to do on iOS, and usually involves 7321 * injecting content, scrolling the page, etc.. It's ugly. 7322 * jQuery Mobile uses this workaround. It's not ideal, but works. 7323 * 7324 * Modified to detect IE6 7325 * ========================= */ 7326 7327 var supportsFixedPosition = (function () { 7328 var ua = navigator.userAgent 7329 , platform = navigator.platform 7330 // Rendering engine is Webkit, and capture major version 7331 , wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ) 7332 , wkversion = !!wkmatch && wkmatch[ 1 ] 7333 , ffmatch = ua.match( /Fennec\/([0-9]+)/ ) 7334 , ffversion = !!ffmatch && ffmatch[ 1 ] 7335 , operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ) 7336 , omversion = !!operammobilematch && operammobilematch[ 1 ] 7337 , iematch = ua.match( /MSIE ([0-9]+)/ ) 7338 , ieversion = !!iematch && iematch[ 1 ]; 7339 7340 return !( 7341 // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5) 7342 ((platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534) || 7343 7344 // Opera Mini 7345 (window.operamini && ({}).toString.call( window.operamini ) === "[object OperaMini]") || 7346 (operammobilematch && omversion < 7458) || 7347 7348 //Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2) 7349 (ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533) || 7350 7351 // Firefox Mobile before 6.0 - 7352 (ffversion && ffversion < 6) || 7353 7354 // WebOS less than 3 7355 ("palmGetResource" in window && wkversion && wkversion < 534) || 7356 7357 // MeeGo 7358 (ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1) || 7359 7360 // IE6 7361 (ieversion && ieversion <= 6) 7362 ); 7363 }()); 7364 7365 7366}(jQuery, window)); 7367 7368 7369/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) 7370 * Licensed under the MIT License (LICENSE.txt). 7371 * 7372 * Version 1.2.3 7373 */ 7374 7375(function (factory) { 7376 if (typeof define === 'function' && define.amd) { 7377 // AMD. Register as an anonymous module. 7378 define(['jquery'], factory); 7379 } else { 7380 // Browser globals 7381 factory(jQuery); 7382 } 7383}(function ($) { 7384 7385 $.fn.overlaps = function(selector) { 7386 return this.pushStack(filterOverlaps(this, selector && $(selector))); 7387 }; 7388 7389 function filterOverlaps(collection1, collection2) { 7390 var dims1 = getDims(collection1), 7391 dims2 = !collection2 ? dims1 : getDims(collection2), 7392 stack = [], 7393 index1 = 0, 7394 index2 = 0, 7395 length1 = dims1.length, 7396 length2 = !collection2 ? dims1.length : dims2.length; 7397 7398 if (!collection2) { collection2 = collection1; } 7399 7400 for (; index1 < length1; index1++) { 7401 for (index2 = 0; index2 < length2; index2++) { 7402 if (collection1[index1] === collection2[index2]) { 7403 continue; 7404 } else if (checkOverlap(dims1[index1], dims2[index2])) { 7405 stack.push( (length1 > length2) ? 7406 collection1[index1] : 7407 collection2[index2]); 7408 } 7409 } 7410 } 7411 7412 return $.unique(stack); 7413 } 7414 7415 function getDims(elems) { 7416 var dims = [], i = 0, offset, elem; 7417 7418 while ((elem = elems[i++])) { 7419 offset = $(elem).offset(); 7420 dims.push([ 7421 offset.top, 7422 offset.left, 7423 $(elem).outerWidth(), 7424 $(elem).outerHeight() 7425 ]); 7426 } 7427 7428 return dims; 7429 } 7430 7431 function checkOverlap(dims1, dims2) { 7432 var x1 = dims1[1], y1 = dims1[0], 7433 w1 = dims1[2], h1 = dims1[3], 7434 x2 = dims2[1], y2 = dims2[0], 7435 w2 = dims2[2], h2 = dims2[3]; 7436 return !(y2 + h2 <= y1 || y1 + h1 <= y2 || x2 + w2 <= x1 || x1 + w1 <= x2); 7437 } 7438 7439})); 7440/* 7441waitForImages plugin 7442 7443Copyright (c) 2014 Alex Dickson 7444 7445Permission is hereby granted, free of charge, to any person 7446obtaining a copy of this software and associated documentation 7447files (the "Software"), to deal in the Software without
7448restriction, including without limitation the rights to use, 7449copy, modify, merge, publish, distribute, sublicense, and/or sell 7450copies of the Software, and to permit persons to whom the 7451Software is furnished to do so, subject to the following 7452conditions: 7453 7454The above copyright notice and this permission notice shall be 7455included in all copies or substantial portions of the Software. 7456 7457THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 7458EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 7459OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 7460NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 7461HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 7462WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 7463FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 7464OTHER DEALINGS IN THE SOFTWARE. 7465 7466*/ 7467/*! waitForImages jQuery Plugin 2018-02-13 */ 7468!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){var b="waitForImages",c=function(a){return a.srcset&&a.sizes}(new Image);a.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage","cursor"],hasImageAttributes:["srcset"]},a.expr.pseudos["has-src"]=function(b){return a(b).is('img[src][src!=""]')},a.expr.pseudos.uncached=function(b){return!!a(b).is(":has-src")&&!b.complete},a.fn.waitForImages=function(){var d,e,f,g=0,h=0,i=a.Deferred(),j=this,k=[],l=a.waitForImages.hasImageProperties||[],m=a.waitForImages.hasImageAttributes||[],n=/url\(\s*(['"]?)(.*?)\1\s*\)/g;if(a.isPlainObject(arguments[0])?(f=arguments[0].waitForAll,e=arguments[0].each,d=arguments[0].finished):1===arguments.length&&"boolean"===a.type(arguments[0])?f=arguments[0]:(d=arguments[0],e=arguments[1],f=arguments[2]),d=d||a.noop,e=e||a.noop,f=!!f,!a.isFunction(d)||!a.isFunction(e))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var b=a(this);f?b.find("*").addBack().each(function(){var b=a(this);b.is("img:has-src")&&!b.is("[srcset]")&&k.push({src:b.attr("src"),element:b[0]}),a.each(l,function(a,c){var d,e=b.css(c);if(!e)return!0;for(;d=n.exec(e);)k.push({src:d[2],element:b[0]})}),a.each(m,function(a,c){var d=b.attr(c);return!d||void k.push({src:b.attr("src"),srcset:b.attr("srcset"),element:b[0]})})}):b.find("img:has-src").each(function(){k.push({src:this.src,element:this})})}),g=k.length,h=0,0===g&&(d.call(j),i.resolveWith(j)),a.each(k,function(f,k){var l=new Image,m="load."+b+" error."+b;a(l).one(m,function b(c){var f=[h,g,"load"==c.type];if(h++,e.apply(k.element,f),i.notifyWith(k.element,f),a(this).off(m,b),h==g)return d.call(j[0]),i.resolveWith(j[0]),!1}),c&&k.srcset&&(l.srcset=k.srcset,l.sizes=k.sizes),l.src=k.src}),i.promise()}}); 7469 7470/* 7471End waitForImages plugin 7472*/ 7473 7474/*! 7475 * jQuery UI Touch Punch 0.2.3 7476 * 7477 * Copyright 2011–2014, Dave Furfero 7478 * Dual licensed under the MIT or GPL Version 2 licenses. 7479 * 7480 * Depends: 7481 * jquery.ui.widget.js 7482 * jquery.ui.mouse.js 7483 */ 7484!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); 7485 7486 7487 7488/* 7489 7490 Starting Blocks Theme Custom jQuery File 7491 7492 ====== 7493 Contents: 7494 ------ 7495 #Popup Video 7496 #Expand Collapse Widgets 7497 #Popdown widgets 7498 #Basic init setup 7499 #'Default' Gallery Style (Lightbox with thumbs) - including support for prodcuts based on this gallery style 7500 #'Montage' Gallery Style - including support for prodcuts based on this gallery style 7501 #'Slideshow' Gallery Styles (single and multi) - including support for prodcuts based on these gallery styles 7502 #'Gallery with thumbs' Gallery Style - including support for prodcuts based on these gallery styles 7503 #'Carousel Slide' Widget 7504 #'Live Shopping Basket' Widget 7505 #'Shopping Basket' Widget 7506 # Livechat Status Widget 7507 # Searchable Subpage Index 7508 # Searchable Preview Based Subpage Index 7509 #Responsive video helper for jPlayer 7510 #Responsive video helper for JWPlayer 7511 #Responsive Calendar 7512 #Full width banner 7513 #Blog Loop 7514 #Countdown 7515 #Consent widgets 7516 7517 7518*/ 7519/* Share links */ 7520 function shareReady() { 7521 $('.share-links a').click(function() { 7522 var w = 700; 7523 var h = 600; 7524 var wleft = (screen.width/2)-(w/2); 7525 var wtop = (screen.height/2)-(h/2); 7526 window.open($(this).attr('href'), $(this).attr('title'), 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+wtop+', left
7526='+wleft); 7527 return false; 7528 }); 7529 }; 7530/* YouTube Channel */ 7531 function youTubeReady() { 7532 if (window.consent.functional){ 7533 $('.youtube-channel').each(function(){ 7534 var feed = $(this).data('feed'); 7535 var total = $(this).data('show'); 7536 var x = 0; 7537 if (isNaN(total)) { 7538 total = 10; 7539 } 7540 while (x<total) { 7541 if (typeof feed[x] != 'undefined') { 7542 var link = feed[x].link; 7543 var id = link.substr(link.indexOf("=") + 1); 7544 $(this).append('<div class="youtube-iframe-col"><div class="youtube-iframe"><iframe src="https://youtube.com/embed/'+id+'?"/></div></div>'); 7545 } 7546 x++; 7547 } 7548 }); 7549 } else { 7550 7551 } 7552 moduleHeights(); 7553 } 7554 7555$(window).on('scroll',function(e){ 7556 floatingScroll(); 7557 backtotopScroll(); 7558 frillsScroll(); 7559 asyncImagesLoad(); 7560}); 7561window.fontsloaded=false; 7562window.findBreakpoints=false; 7563$(window).on('load',function(e){ 7564 $(window).on('scroll',function(e){ 7565 fixedHeaderScroll(); 7566 }); 7567 floatingLoad(); 7568 foldericons(); 7569 stickyLoad(); 7570 miscLoad(); 7571 searchImageLoad(); 7572 montageLoad(); 7573 magicHeights(); 7574 asyncImagesLoad(); 7575 tabsResize(); 7576 instaLoad(); 7577 setTimeout(function(){ 7578 frillsReady(); 7579 if (!window.fontsloaded){ 7580 window.fontsloaded=true; 7581 afterFonts(); 7582 } 7583 },150); 7584 7585 $("#mobile-menu-page-wrap").css("height",$("#mobileheader").height()-"px"); 7586}); 7587document.fonts.ready.then(function () { 7588 setTimeout(function(){ 7589 window.fontsloaded=true; 7590 afterFonts(); 7591 },100); 7592}); 7593$(window).on('resize',function(e){ 7594 galleryResize(); 7595 if ($(window).width()==windowwidth) { 7596 return false; 7597 } 7598 /* width only below */ 7599 windowwidth=$(window).width(); 7600 foldericons();
7601 magicHeights(); 7602 asyncImagesLoad(); 7603 floatingResize(); 7604 mp_lightboxResize(); 7605 miscResize(); 7606 montageResize(); 7607 galThumbResize(); 7608 responsiveVideoResize(); 7609 responsiveVideoJWResize(); 7610 backstretches(); 7611 tabsResize(); 7612}); 7613$(document).on('ready',function() { 7614 windowwidth=$(window).width(); 7615 smileyReady(); 7616 mapsMarkersReady(); 7617 bookmarksReady(); 7618 tabsReady(); 7619 forumReady(); 7620 bannerHeightWithFloating(); 7621 folderGalleryStylesLoad(); 7622 userChatReady(); 7623 youTubeReady(); 7624 shareReady(); 7625 avatarReady(); 7626 galThumbReady(); 7627 walthroughReady(); 7628 consentReady(); 7629 updateConsentBasedContent(); 7630 countdownReady(); 7631 calendarReady(); 7632 bannerReady(); 7633 livechatReady(); 7634 pbReady(); 7635 kbReady(); 7636 basketReady(); 7637 productQuanReady(); 7638 carouselReady(); 7639 slideshowReady(); 7640 montageReady(); 7641 galleryReady(); 7642 popupReady(); 7643 popdownReady(); 7644 expandReady(); 7645 filterReady(); 7646 floatingReady(); 7647 stickyReady(); 7648 magicHeights(); 7649 asyncImagesLoad(); 7650 conditionalForm(); 7651 accessibleReady(); 7652 imagesReady(); 7653 mpPopupReady(); 7654 iconsReady(); 7655 hoverImageReady(); 7656 anchorCheckLoad(); 7657 miscReady(); 7658 swReady(); 7659 subscriptionReady(); 7660 unleashedReady(); 7661}); 7662function setFormPages($form){ 7663 var $prev = $(".prev_form_page",$form); 7664 var $next = $(".next_form_page",$form); 7665 var $submit = $(".submit_form",$form); 7666 if ($(".current_form_page").prevAll(".form_page").length===0){ 7667 $prev.hide(); 7668 }else{ 7669 $prev.show(); 7670 $submit.hide(); 7671 } 7672 if ($(".current_form_page").nextAll(".form_page").length===0){ 7673 $next.hide(); 7674 $submit.show(); 7675 }else{ 7676 $next.show(); 7677 $submit.hide(); 7678 } 7679 moduleHeights(); 7680}; 7681function conditionalForm() { 7682 $(".form").each(function(){ 7683 $(".form_page",$(this)).first().addClass("current_form_page"); 7684 setFormPages($(this)); 7685 }); 7686 $(".prev_form_page,.next_form_page").click(function(){ 7687 if ($(this).hasClass("next_form_page")){ 7688 var $each=$(".current_form_page").removeClass("current_form_page").nextAll(".form_page"); 7689 } else { 7690 var $each=$(".current_form_page").removeClass("current_form_page").prevAll(".form_page"); 7691 } 7692 var $form = $(this).parents(".form"); 7693 var $submit = $(".submit_form",$form); 7694 $each.each(function(){ 7695 //if (($(".showing_conditional_section",$(this)).length&&$(".form_conditional_section",$(this)).length)||!$(".form_conditional_section",$(this)).length){ 7696 $(this).addClass("current_form_page"); 7697 setTimeout(function(){ 7698 setFormPages($form); 7699 },10); 7700 return false; 7701 //} 7702 }); 7703 return false; 7704 }); 7705 $(".form_page").parents(".form").addClass("form_with_sections"); 7706 if ($(".form_conditional_section").length){ 7707 $("input,select,textarea",$(".form")).change(function(e){ 7708 $(".form_conditional_section",$(e.target).parents(".form")).each(function(){ 7709 var rules = $(this).data("rules"); 7710 var visible = $(this).data("visible"); 7711 if (visible=="all"){ 7712 var pass = true; 7713 }else{ 7714 var pass = false; 7715 } 7716 7717 for (var i=0; i < rules.length; i++) { 7718 var ok = false; 7719 if (rules[i]["operator"]=="=="){ 7720 if ($(".input-numeric-id-"+rules[i]["ID"]).find(".input,.textarea,.select,.radio:checked").val()==rules[i]["Value"]){ 7721 ok=true; 7722 } 7723 if ($(".input-numeric-id-"+rules[i]["ID"]).find(".checkbox:checked").length && (rules[i]["Value"]=="1"||rules[i]["Value"]=="true"||rules[i]["Value"]=="checked")){ 7724 ok=true; 7725 } 7726 } 7727 if (rules[i]["operator"]=="!="){ 7728 if ($(".input-numeric-id-"+rules[i]["ID"]).find(".input,.textarea,.select,.radio:checked").val()!=rules[i]["Value"]){ 7729 ok=true; 7730 } 7731 if (!$(".input-numeric-id-"+rules[i]["ID"]).find(".checkbox:checked").length && (rules[i]["Value"]=="1"||rules[i]["Value"]=="true"||rules[i]["Value"]=="checked")){ 7732 ok=true; 7733 } 7734 } 7735 if (rules[i]["operator"]==">"){ 7736 if ($(".input-numeric-id-"+rules[i]["ID"]).find(".input,.textarea,.select,.radio:checked").val()>rules[i]["Value"]){ 7737 ok=true; 7738 } 7739 } 7740 if (rules[i]["operator"]=="<"){ 7741 if ($(".input-numeric-id-"+rules[i]["ID"]).find(".input,.textarea,.select,.radio:checked").val()<rules[i]["Value"]){ 7742 ok=true; 7743 } 7744 } 7745 if (visible=="all"){ 7746 if (!ok){ 7747 pass=false; 7748 } 7749 }else{ 7750 if (ok) { 7751 pass=true; 7752 } 7753 } 7754 }; 7755 if (pass){ 7756 $(this).addClass("showing_conditional_section"); 7757 $(this).find(".required_hidden").removeClass("required_hidden").addClass("required"); 7758 }else{ 7759 $(this).find(".required").removeClass("required").addClass("required_hidden"); 7760 $(this).removeClass("showing_conditional_section"); 7761 } 7762 moduleHeights(); 7763 7764 }); 7765 formStyleHelper(); 7766 }); 7767 } 7768 7769 $(".form_conditional_section").parents(".form").find("input:first").trigger("change"); 7770} 7771function unleashedReady(){ 7772 if (!$("#unleashed-automatic").length&&!readCookie('output_cursym_idv3')){ 7773 $('#unleashed-region-chooser').addClass('visible').appendTo($('body')); 7774 } 7775 if(readCookie('output_cursymv3')) { 7776 createCookie('preselect_cur',readCookie("output_cursymv3"),0); 7777 } 7778 if ($("#unleashed-automatic").length){ 7779 var id = $("#unleashed-automatic").data("instance-id"); 7780 $.ajax({ 7781 url: '', 7782 data: 'choose_region=true&nocache=true', 7783 success: function(data) { 7784 var s = data.split("AJAX_"+"REGION");// + stops it matching this part of the script if loaded inline 7785 s = s[1]; 7786 if (s=="aud"||s=="nzd"||s=="gbp"||s=="usd"||s=="eur"||s=="default"){ 7787 if (s!="default"){ 7788 createCookie('output_cursymv3',s,0); 7789 createCookie('preselect_cur',s,0); 7790 } 7791 createCookie('output_cursym_idv3',id,0); 7792 } 7793 else { 7794 $('#unleashed-region-chooser').addClass('visible').appendTo($('body')); 7795 } 7796 } 7797 }); 7798 } 7799 $('#unleashed-region-chooser select').change(function(){ 7800 var val = $(this).val(); 7801 var id = $(this).data("instance-id"); 7802 if (val!=""){ 7803 if (val!="default"){ 7804 createCookie('output_cursymv3',val,0); 7805 createCookie('preselect_cur',val,0); 7806 } 7807 createCookie('output_cursym_idv3',id,0); 7808 window.location.reload(); 7809 } 7810 7811 }); 7812} 7813function instaLoad() { 7814 $(".instagram-mini-feed-post").each(function(){ 7815 var $img = $('img',$(this)); 7816 $img.attr('src',$img.data('src')); 7817 }); 7818} 7819function tabsResize() { 7820 $('.tabs-widgets').each(function(){ 7821 $(this).removeClass('not-enough-space-tabs'); 7822 var ot=0; 7823 $('.tabs-tab',$(this)).each(function() { 7824 var tot=$(this).offset().top; 7825 if (ot==0) { 7826 ot=tot; 7827 } 7828 if (tot!=ot) { 7829 $(this).parents('.tabs-widgets').addClass('not-enough-space-tabs'); 7830 } 7831 }); 7832 }); 7833} 7834function tabsReady() { 7835 if (typeof tabsReady_core != "undefined"){ 7836 tabsReady_core(); 7837 } 7838} 7839function mapsMarkersReady() { 7840 if (typeof mapsMarkersReady_core != "undefined"){ 7841 mapsMarkersReady_core(); 7842 } 7843} 7844function smileyReady(){ 7845 $(".smiley_feedback").each(function(){ 7846 7847 var id = $(this).data("id"); 7848 var done = readCookie("smileyDone"+id); 7849 if (done){ 7850 $(".save_score_done",$(this)).show(); 7851 $(".smiley_score[data-score='"+done+"']").addClass("score_clicked"); 7852 } 7853 }); 7854 $(".smiley_score").click(function(){ 7855 $(this).addClass("score_clicked"); 7856 var score = $(this).data("score"); 7857 var id = $(this).parent().data("id"); 7858 var $done=$(".save_score_done",$(this).parent()); 7859 createCookie("smileyDone"+id,score); 7860 $.post(window.location.href, {'id':id,'data[score]':score,'no_cac
7860he':'true'}, function(){ 7861 $done.fadeIn(); 7862 } 7863 ); 7864 }); 7865} 7866function bookmarksReady() { 7867 $('.user-bookmark-show-add').click(function() { 7868 var $t =$(this).parents('.user-bookmarks-list').find('.user-bookmarks-add'); 7869 if ($t.is(":visible")) { 7870 $t.slideUp(100,function(){ 7871 magicHeights(); 7872 moduleHeights(); 7873 }); 7874 }else { 7875 $t.slideDown(100,function(){ 7876 magicHeights(); 7877 moduleHeights(); 7878 }); 7879 } 7880 return false; 7881 }); 7882} 7883function forumReady() { 7884 7885 $("#notification_subscribe,#notification_post_subscribe").on("change",function(){ 7886 $(this).parents("form").submit(); 7887 7888 }); 7889 $('.remove_attachment').click(function(){ 7890 $(this).parent().remove(); 7891 return false; 7892 }); 7893 if ($(".blog-add-form,.post-add-form,.post-edit-form,.blog-comment-form").length>0) { 7894 $(".email1").css({ 7895 "position":"absolute" 7896 ,"top":"-4000px" 7897 ,"left":"-1000px" 7898 }); 7899 $(".fakeemail").hide(); 7900 } 7901 $('.edit_forum_comment_button').click(function(){ 7902 var $comment= $(this).parents('.forum-comment'); 7903 if (!$comment.find('form:visible').length) { 7904 $(this).text('Cancel'); 7905 $comment.find("form").show(); 7906 $comment.find('textarea').focus(); 7907 $comment.find('.forum-comment-body').hide(); 7908 $comment.find('.forum-comment-date').hide(); 7909 $comment.find('> .forum-attachment').hide(); 7910 }else{ 7911 $(this).text('Edit'); 7912 $comment.find("form").hide(); 7913 $comment.find('.forum-comment-body').show(); 7914 $comment.find('.forum-comment-date').show(); 7915 $comment.find('> .forum-attachment').show(); 7916 } 7917 return false; 7918 }); 7919 $("#addpost:not('.dont-hide')").hide(); 7920 moduleHeights(); 7921 $('#show_add_post').attr('href',''); 7922 $("#show_add_post").click(function(){ 7923 $("#addpost").show(); 7924 $("#forum_title").focus(); 7925 moduleHeights(); 7926 return false; 7927 }); 7928 $('#forum-add-attachment a').click(function(){ 7929 if ($('.forum-file-upload:hidden').length) { 7930 $('.forum-file-upload:hidden:first').removeClass("input-concealed"); 7931 } 7932 if (!$('.forum-file-upload:hidden').length) { 7933 $(this).parent().hide(); 7934 } 7935 return false; 7936 }); 7937 $('#forum-comment-add-attachment a').click(function(){ 7938 if ($('.forum-comment-file-upload:hidden').length) { 7939 $('.forum-comment-file-upload:hidden:first').removeClass("input-concealed"); 7940 } 7941 if (!$('.forum-comment-file-upload:hidden').length) { 7942 $(this).parent().hide(); 7943 } 7944 return false; 7945 }); 7946} 7947function subscriptionReady() { 7948 $('.subscription-cancel-button a').click(function() { 7949 $('body').append('<div id="subscribe-confirm-mask"></div><div id="subscribe-confirm"><h2>End your subscription to '+$(this).parents('.subscription-product').find('.subscription-product-title').text()+'</h2><p>You will not be charged again.</p><div id="subscription-confirm-buttons"><a href="" id="subscription-end">Stop subscription</a><a href="" id="subscription-cancel">Cancel (keep subscription)</a></div></div>'); 7950 var link = $(this).attr('href'); 7951 setTimeout(function() { 7952 7953 $('body #subscription-end').unbind().click(function() { 7954 if ($(this).parents('#subscribe-confirm').hasClass('loading')) { 7955 return false; 7956 } 7957 $(this).parents('#subscribe-confirm').addClass('loading'); 7958 setTimeout( function() { 7959 window.location.href=link; 7960 },50); 7961 return false; 7962 }); 7963 $('body #subscription-cancel').unbind().click(function() { 7964 if ($(this).parents('#subscribe-confirm').hasClass('loading')) { 7965 return false; 7966 } 7967 $('#subscribe-confirm-mask,#subscribe-confirm').remove(); 7968 return false; 7969 }); 7970 },10); 7971 return false; 7972 }); 7973 $('.subscription-subscribe').click(function() { 7974 7975 // Prevent multiple clicks 7976 if ($(this).hasClass('processing')) { 7977 return false; 7978 } 7979 $(this).addClass('processing').css({'opacity': '0.5', 'pointer-events': 'none'}); 7980 7981 $('body').append('<div id="subscribe-confirm-mask"></div><div id="subscribe-confirm"><h2>Confirm subscription to '+$(this).parents('.subscription-product').find('.subscription-product-title').text()+'</h2><p>'+$(this).parents('.subscription-product').find('.subscription-product-price').html()+' You will receive an email reminder 7 days prior.<div id="subscription-confirm-buttons"><a href="" id="subscription-confirm">Confirm and start payments</a><a href="" id="subscription-cancel">Cancel</a></div></div>'); 7982 var link = $(this).attr('href'); 7983 setTimeout(function() { 7984 7985 $('body #subscription-confirm').unbind().click(function() { 7986 if ($(this).parents('#subscribe-confirm').hasClass('loading')) { 7987 return false;
7988 } 7989 $(this).parents('#subscribe-confirm').addClass('loading'); 7990 setTimeout( function() { 7991 window.location.href=link; 7992 },50); 7993 return false; 7994 }); 7995 $('body #subscription-cancel').unbind().click(function() { 7996 if ($(this).parents('#subscribe-confirm').hasClass('loading')) { 7997 return false; 7998 } 7999 $('#subscribe-confirm-mask,#subscribe-confirm').remove(); 8000 // Re-enable the subscribe button 8001 $('.subscription-subscribe').removeClass('processing').css({'opacity': '', 'pointer-events': ''}); 8002 return false; 8003 }); 8004 },10); 8005 return false; 8006 }); 8007 $('.auth-payment').click(function() { 8008 8009 stripe.confirmCardPayment($(this).data('intent')).then(function(result) { 8010 setTimeout(function(){ 8011 window.location.reload(); 8012 },50); 8013 if (result.error) { 8014 8015 } else { 8016 8017 } 8018 }); 8019 }); 8020} 8021function swReady() { 8022 // SWA2HS 8023 if (!$("#SWA2HS").length){ return false; } 8024 const addBtn = document.getElementById('SWA2HS'); 8025 const installPromptDiv = document.getElementById('installPrompt'); 8026 //const installPromptDiv = document.getElementById('SWA2HS'); 8027 //const addBtn = document.getElementById('installPrompt'); 8028 if (window.localStorage.getItem('dismissInstallPrompt')){ 8029 $("#installPrompt").remove(); 8030 } else { 8031 $(".dismissInstallPrompt").click(function(){ 8032 window.localStorage.setItem('dismissInstallPrompt',true); 8033 $("#installPrompt").remove(); 8034 return false; 8035 }); 8036 let deferredPrompt; 8037 $("#installPrompt").appendTo("body"); 8038 8039 8040 addBtn.style.display = 'none'; 8041 // Prevent Chrome from showing the mini-infobar 8042 window.addEventListener('beforeinstallprompt', (e) => { 8043 // Prevent the mini-infobar from appearing on mobile 8044 e.preventDefault(); 8045 // Stash the event so it can be triggered later. 8046 deferredPrompt = e; 8047 // Update UI notify the user they can add to home screen 8048 addBtn.style.display = 'block'; 8049 }); 8050 8051 // Show the prompt when the button is clicked 8052 addBtn.addEventListener('click', (e) => { 8053 // Hide the app provided install promotion 8054 addBtn.style.display = 'none'; 8055 // Show the install prompt 8056 deferredPrompt.prompt(); 8057 // Wait for the user to respond to the prompt 8058 deferredPrompt.userChoice.then((choiceResult) => { 8059 if (choiceResult.outcome === 'accepted') { 8060 console.log('User accepted the A2HS prompt'); 8061 installPromptDiv.style.display = 'none'; 8062 } else { 8063 console.log('User dismissed the A2HS prompt'); 8064 } 8065 deferredPrompt = null; 8066 }); 8067 }); 8068 8069 // Optionally, show a custom prompt for iOS since it doesn't support the standard install event 8070 } 8071 if (window.navigator.standalone === true || window.matchMedia('(display-mode: standalone)').matches) { 8072 // Already installed or running standalone 8073 installPromptDiv.style.display = 'none'; 8074 addBtn.style.display='none'; 8075 } else if ((/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || (navigator.platform="MacIntel" && navigator.maxTouchPoints > 1) ) { 8076 // Show iOS specific instructions 8077 installPromptDiv.style.display = 'block'; 8078 addBtn.style.display='none'; 8079 } 8080 8081 8082 // 8083 const applicationServerPublicKey = $("body").data("push-notif-public"); 8084 let isSubscribed = false; 8085 let swRegistration = null; 8086 8087 function urlB64ToUint8Array(base64String) { 8088 const padding = '='.repeat((4 - base64String.length % 4) % 4); 8089 const base64 = (base64String + padding) 8090 .replace(/\-/g, '+') 8091 .replace(/_/g, '/'); 8092 8093 const rawData = window.atob(base64); 8094 const outputArray = new Uint8Array(rawData.length); 8095 8096 for (let i = 0; i < rawData.length; ++i) { 8097 outputArray[i] = rawData.charCodeAt(i); 8098 } 8099 return outputArray; 8100 } 8101 function updateSubscriptionOnServer(subscription,default_list) { 8102 const key = subscription.getKey('p256dh'); 8103 const token = subscription.getKey('auth'); 8104 const contentEncoding = (PushManager.supportedContentEncodings || ['aesgcm'])[0]; 8105 if (typeof default_list == "undefined") { 8106 default_list=""; 8107 } 8108 return fetch('/actions/PushSubscribe/', { 8109 method: 'POST', 8110 body: JSON.stringify({ 8111 endpoint: subscription.endpoint, 8112 default_list: default_list, 8113 publicKey: key ? btoa(String.fromCharCode.apply(null, new Uint8Array(key))) : null, 8114 authToken: token ? btoa(String.fromCharCode.apply(null, new Uint8Array(token))) : null, 8115 contentEncoding, 8116 }), 8117 }).then(function(response){ 8118 //console.log(response.text()); 8119 }); 8120 } 8121 8122 function unsubscribeUser() { 8123 swRegistration.pushManager.getSubscription() 8124 .then(function(subscription) { 8125 if (subscription) { 8126 return subscription.unsubscribe(); 8127 } 8128 }) 8129 .catch(function(error) { 8130 //console.log('Error unsubscribing', error); 8131 }) 8132 .then(function() { 8133 updateSubscriptionOnServer(null); 8134 8135 //console.log('User is unsubscribed.'); 8136 isSubscribed = false;
8137 8138 $("#PushNotifSubscribeButton").text("Subscribe"); 8139 }); 8140 } 8141 function subscribeUser(default_list) { 8142 const applicationServerKey = urlB64ToUint8Array(applicationServerPublicKey); 8143 swRegistration.pushManager.subscribe({ 8144 userVisibleOnly: true, 8145 applicationServerKey: applicationServerKey 8146 }) 8147 .then(function(subscription) { 8148 // console.log('User is subscribed.'); 8149 // console.log(subscription); 8150 updateSubscriptionOnServer(subscription,default_list); 8151 isSubscribed = true; 8152 $("#PushNotifSubscribeButton").text("Unsubcribe"); 8153 8154 }) 8155 .catch(function(error) { 8156 console.error('Failed to subscribe the user: ', error); 8157 }); 8158 } 8159 function initializeUI() { 8160 // Set the initial subscription value 8161 if (Notification.permission === 'denied') { 8162 $("#PushNotifSubscribeButton").hide(); 8163 $("#PushNotifBlocked").show(); 8164 return; 8165 } 8166 $("#PushNotifSubscribeButton").click(function(){ 8167 if (isSubscribed) { 8168 unsubscribeUser(); 8169 } else { 8170 subscribeUser($(this).data("default-list")); 8171 } 8172 }); 8173 swRegistration.pushManager.getSubscription() 8174 .then(function(subscription) { 8175 isSubscribed = !(subscription === null); 8176 8177 if (isSubscribed) { 8178 // user is subscribed 8179 $("#PushNotifSubscribeButton").text("Unsubscribe"); 8180 } else { 8181 // user in not subscribed 8182 $("#PushNotifSubscribeButton").text("Subscribe"); 8183 } 8184 8185 }); 8186 } 8187 8188 if ('serviceWorker' in navigator && 'PushManager' in window) { 8189 navigator.serviceWorker.register('/javascripts/sw.js') 8190 .then(function(swReg) { 8191 // success register service worker 8192 swRegistration = swReg; 8193 initializeUI(); 8194 }) 8195 .catch(function(error) { 8196 // error 8197 $("#PushNotAvailable").show(); 8198 $("#PushNotifSubscribeButton").parent().hide(); 8199 // alert("didn't work "); 8200 }); 8201 } else { 8202 8203 if ($("#PushNotAvailable").length && !window.matchMedia('(display-mode: standalone)').matches) { 8204 var ver = navigator.appVersion; 8205 var agt = navigator.userAgent; 8206 var browser = navigator.appName; 8207 var version = parseInt(navigator.appVersion,10); 8208 var no,vo,x; 8209 8210 if ((vo=agt.indexOf("Chrome"))!=-1) { 8211 browser= "Chrome"; 8212 version = agt.substring(vo+7); 8213 } 8214 else if ((vo=agt.indexOf("Safari"))!=-1) { 8215 browser= "Safari"; 8216 version = agt.substring(vo+7); 8217 if ((vo=agt.indexOf("Version"))!=-1) 8218 version = agt.substring(vo+8); 8219 } 8220 if ((x=version.indexOf(";"))!=-1) 8221 version=version.substring(0,x); 8222 if ((x=version.indexOf(" "))!=-1) 8223 version=version.substring(0,x); 8224 8225 version = parseInt(''+version,10); 8226 if (isNaN(version)) { 8227 version = parseInt(navigator.appVersion,10); 8228 } 8229 } 8230 $("#PushNotifSubscribeButton").parent().hide(); 8231 8232 if (browser=="Safari"&&version>=17||browser=="Chrome") { 8233 $("#addToHomeScreen").show(); 8234 } else { 8235 $("#PushNotAvailable").show(); 8236 8237 } 8238 // alert("not available"); 8239 // not supported 8240 } 8241} 8242function miscReady() { 8243 $('.Greyed_Out_Button a').click(function() { 8244 return false; 8245 }); 8246} 8247function userChatUpdateRecipients() { 8248 var ids = ""; 8249 var names = ""; 8250 $('#user_list_chat_convo .user_chat_recipient').each(function() { 8251 if (ids!="") { 8252 ids+=","; 8253 names+=", "; 8254 } 8255 ids += $(this).data('id'); 8256 names += $(this).data('name').replace(/,/g,' '); 8257 }); 8258 $('#user_chat_recipient_ids').val(ids); 8259 $('#user_chat_recipient_names').val(names); 8260} 8261var livemessages=false; 8262function liveMessages(id,last_id) { 8263 if (livemessages!==false) { 8264 livemessages.close(); 8265 } 8266 if (!!window.EventSource) { 8267 8268 livemessages = new EventSource("?sse=true&app=true&sse_tpl=User_List_Chat&message_id="+id+"&last_id="+last_id); 8269 //console.log("event source init"); 8270 } else { 8271 alert("Your browser doesn't support the livechat system. We recommend upgrading to Google Chrome."); 8272 } 8273 8274 livemessages.addEventListener("open", function(e) { 8275 //console.log("Connection was opened."); 8276 }, false); 8277 8278 livemessages.addEventListener("error", function(e) { 8279 //console.log("Error - connection was lost."); 8280 }, false); 8281 livemessages.addEventListener("message", function(e) { 8282 // console.log("Message: " + e.data); 8283 if (e.data.indexOf('unread|')===0) { 8284 var unread = e.data.split('|'); 8285 $('.user_chat_sidebar_convo[data-id="'+unread[1]+'"]').addClass('unread'); 8286 } 8287 else { 8288 $('#user_chat_messages').append(e.data); 8289 $('#user_chat_messages').scrollTop(10000000); 8290 } 8291 8292 }, false); 8293} 8294function userChatReady() { 8295 if (!$('#user_list_chat').length) { 8296 return false;
8297 } 8298 liveMessages(-1,0); 8299 $('.user_chat_sidebar_convo').each(function() { 8300 var $convo = $(this); 8301 $('.user_chat_recipient',$(this)).each(function() { 8302 if ($('.user_chat_name',$convo).text().trim()!="") { 8303 $('.user_chat_name',$convo).text($('.user_chat_name',$convo).text()+','); 8304 } 8305 $('.user_chat_name',$convo).text($('.user_chat_name',$convo).text()+' '+$(this).text()); 8306 }); 8307 }); 8308 $('.user_chat_sidebar_convo').click(function() { 8309 $('.user_chat_sidebar_convo.current_user_chat').removeClass('current_user_chat'); 8310 $(this).addClass('current_user_chat'); 8311 $(this).removeClass('unread'); 8312 $('#editing_chat').val($(this).data('id')); 8313 $('#user_chat_messages').html($('.user_chat_messages',$(this)).html()); 8314 $('#user_chat_messages').scrollTop(10000000); 8315 if ($(this).attr('id')=="user_list_chat_add_chat") { 8316 liveMessages(-1,0); 8317 $('#user_chat_type_message textarea').prop('disabled',true); 8318 $('#user_chat_add_new p').show(); 8319 $('#user_chat_recipient_search').show().focus(); 8320 8321 } else { 8322 liveMessages($(this).data('id'),$('#user_chat_messages .user_chat_message:last').data('id')); 8323 $('#user_chat_recipient_search').hide(); 8324 $('#user_chat_type_message textarea').prop('disabled',false); 8325 $('#user_chat_add_new p').hide(); 8326 } 8327 $('#user_chat_recipient_list').html($('.user_chat_users',$(this)).html()); 8328 return false; 8329 }); 8330 $('#user_chat_type_message form').submit(function() { 8331 if ($('#user_list_chat_add_chat').hasClass('current_user_chat')) { 8332 8333 } else { 8334 if ($(this).hasClass('sending')) { 8335 return false; 8336 } 8337 $(this).addClass('sending'); 8338 $(this).ajaxSubmit({success:function() { 8339 $('#user_chat_type_message textarea').val(''); 8340 $('#user_chat_type_message form').removeClass('sending'); 8341 }}); 8342 return false; 8343 } 8344 }); 8345 $('#user_chat_add_new').click(function() { 8346 $('#user_chat_recipient_search:visible').focus(); 8347 }); 8348 $('#user_chat_user_list a').click(function() { 8349 $(this).parent().addClass('disabled'); 8350 $('#user_chat_recipient_search').val('').trigger('change'); 8351 8352 $('#user_chat_recipient_list').append('<span data-name="'+$(this).data('name')+'" data-id="'+$(this).data('user-id')+'" class="user_chat_recipient">'+$(this).data('name')+'<span>x</span></span>'); 8353 userChatUpdateRecipients(); 8354 $('#user_chat_type_message textarea').prop('disabled',false); 8355 return false; 8356 }); 8357 $('#user_chat_recipient_list').on('click','.user_chat_recipient > span',function() { 8358 var toreshow = $(this).parent().data('id'); 8359 $('#user_chat_user_list .user_'+toreshow).removeClass('disabled'); 8360 $(this).parent().remove(); 8361 userChatUpdateRecipients(); 8362 if (!$('#user_chat_recipient_list span').length) { 8363 $('#user_chat_type_message textarea').prop('disabled',true); 8364 } 8365 return false; 8366 }); 8367 $('#user_chat_recipient_search').on('keydown',function(e) { 8368 if (e.keyCode=="8" && $(this).val()=="") { 8369 var toreshow = $('.user_chat_recipient:last').data('id'); 8370 $('#user_chat_user_list .user_'+toreshow).removeClass('disabled'); 8371 $('.user_chat_recipient:last').remove(); 8372 userChatUpdateRecipients(); 8373 } 8374 }); 8375 $('#user_chat_recipient_search').on('keydown',function(e) { 8376 if (e.keyCode=="40") { // down 8377 if ($('.recipient_highlight').next('li:visible').length) { 8378 $('.recipient_highlight').next('li:visible').addClass('recipient_highlight').prev().removeClass('recipient_highlight'); 8379 e.preventDefault(); 8380 return false; 8381 } 8382 } 8383 if (e.keyCode=="38") { // up 8384 if ($('.recipient_highlight').prev('li:visible').length) { 8385 $('.recipient_highlight').prev('li:visible').addClass('recipient_highlight').next().removeClass('recipient_highlight'); 8386 e.preventDefault(); 8387 return false; 8388 } 8389 } 8390 if (e.keyCode=="13") { // up 8391 $('.recipient_highlight:visible a').trigger('click'); 8392 } 8393 }); 8394 $('body').on('click',function(e) { 8395 if (!$(e.target).parents('#user_chat_add_new').length) { 8396 $('#user_chat_user_list').hide(); 8397 $('#user_chat_recipient_search').val(''); 8398 } 8399 }); 8400 $('#user_chat_type_message button').click(function() { 8401 $(this).parents('form').submit(); 8402 return false; 8403 }); 8404 $('#user_chat_recipient_search').on('keyup change',function(e) { 8405 var s = $(this).val().toLowerCase(); 8406 var show = false;
8407 $('#user_chat_user_list li').hide().each(function() { 8408 if ($(this).data('search').indexOf(s)!=-1&&s.trim()!=""&&!$(this).hasClass('disabled')) { 8409 $(this).show(); 8410 show = true; 8411 } 8412 }); 8413 if (show) { 8414 $('#user_chat_user_list').show(); 8415 if (!$('#user_chat_user_list .recipient_highlight:visible').length) { 8416 $('.recipient_highlight').removeClass('recipient_highlight'); 8417 $('#user_chat_user_list li:visible').first().addClass('recipient_highlight'); 8418 } 8419 }else { 8420 $('#user_chat_user_list').hide(); 8421 } 8422 8423 }); 8424} 8425function anchorCheckLoad() { 8426 setTimeout(function() { 8427 if (window.location.hash){ 8428 var hs = window.location.hash.split('#'); 8429 if (hs[1].indexOf('tab')===0||hs[1].indexOf('map-')===0){ 8430 return false; 8431 } 8432 if ($('*[name="'+hs[1]+'"]').length) { 8433 var target = $('*[name="'+hs[1]+'"]'); 8434 } 8435 try { 8436 var $element = $(window.location.hash); 8437 } catch(error) { 8438 return false; 8439 } 8440 if ($(window.location.hash).length) { 8441 var target = $(window.location.hash); 8442 } 8443 if (typeof target != 'undefined') { 8444 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 8445 if (typeof $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist') !='undefined'){ 8446 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight() - $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist'); 8447 } else { 8448 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight(); 8449 } 8450 8451 } else if ($('body').hasClass("with-fixed-header")) { 8452 var extra = $("#header").outerHeight(); 8453 } else { 8454 var extra = 0; 8455 } 8456 8457 $('html, body').animate({ 8458 scrollTop: target.offset().top - extra 8459 }, 1500,function(){ 8460 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 8461 checkFloatingSub(); 8462 } 8463 8464 }); 8465 }; 8466 } 8467 },50); 8468} 8469var asyncRunning=false; 8470function asyncImagesLoad() { 8471 if (asyncRunning){ 8472 return false; 8473 } 8474 asyncRunning=true; 8475 $(".index-async-load:not(.async-loaded,.async-loading)").each(function(){ 8476 var rect = $(this)[0].getBoundingClientRect(); 8477 if (((rect['top'] > 0 && rect['top'] < window.innerHeight) || 8478 (rect['bottom'] > 0 && rect['bottom'] < window.innerHeight)) && 8479 ((rect['left'] > 0 && rect['left'] < window.innerWidth) || (rect['right'] > 0 && rect['right'] < window.innerWidth))){ 8480 $(this).addClass("async-loading"); 8481 8482 } 8483 }); 8484 $(".index-async-load:not(.async-loaded,.async-loading)").eq($(".async-loading:last").index()+1).addClass("async-preload"); 8485 $(".index-async-load:not(.async-loaded,.async-loading)").eq($(".async-loading:last").index()+2).addClass("async-preload"); 8486 $(".index-async-load:not(.async-loaded,.async-loading)").eq($(".async-loading:last").index()+3).addClass("async-preload"); 8487 $(".index-async-load:not(.async-loaded,.async-loading)").eq($(".async-loading:last").index()+4).addClass("async-preload"); 8488 8489 $(".async-loading,.async-preload").each(function(){ 8490 if ($(this).hasClass("src-requested")){ 8491 return true; 8492 } 8493 $(this).addClass("src-requested"); 8494 var path = $(this).data("async-src").split("?"); 8495 var w = $(this).parent().innerWidth()*2; 8496 var $t = $(this); 8497 $(this).attr("src",path[0]+"?width="+w+"&height=auto").load(function(){ 8498 magicHeights(); 8499 moduleHeights(); 8500 $t.addClass("async-loaded"); 8501 $t.removeClass("async-loading"); 8502 $t.removeClass("async-preload"); 8503 }); 8504 }); 8505 8506 asyncRunning=false; 8507} 8508/* Magic Heights */ 8509function magicHeights() { 8510 /* 8511 $('.magic-heights:visible').each(function(){ 8512 if ($(this).children().find(".magic-heights-inner:not('.magic-heights-wrap .magic-heights-inner')").length) { 8513 var $i = $(this).childen().find(".magic-heights-inner:not('.magic-heights-wrap .magic-heights-inner')"); 8514 }else { 8515 var $i = $(this); 8516 } 8517 $i.css('height','auto'); 8518 if ($(this).children().find(".magic-heights-inner2:not('.magic-heights-wrap .magic-heights-inner2')").length) { 8519 var $i = $(this).childen().find(".magic-heights-inner2:not('.magic-heights-wrap .magic-heights-inner2')"); 8520 $i.css('height','auto'); 8521 } 8522 }); 8523 */ 8524 8525 setTimeout(function(){ 8526 8527 var todo = ['.magic-heights-wrap .magic-heights-wrap .magic-heights-wrap:not(".mhdone")','.magic-heights-wrap .magic-heights-wrap:not(".mhdone")','.magic-heights-wrap:not(".mhdone")']; 8528 var colors = ['#f00','#0f0','#00f']; 8529 $(".magic-heights-inner,.magic-heights-inner-2,.magic-heights-inner-3,.magic-heights").css("height","auto"); 8530 $(".mhdone").removeClass("mhdone"); 8531 var cc=0;
8532 todo.forEach(function(str) { 8533 $(str).each(function(){ 8534 // $(this).attr('style','border:1px solid '+colors[cc]); 8535 $('.firstinrow:not(".mhdone .firstinrow")',$(this)).removeClass('firstinrow'); 8536 if ($('.magic-heights:not(".mhdone .magic-heights"):visible',$(this)).length) { 8537 var ot = $('.magic-heights:not(".mhdone .magic-heights"):visible:first',$(this)).offset().top; 8538 var count = 0; 8539 $('.magic-heights:visible:not(".mhdone .magic-heights")',$(this)).each(function(){ 8540 if ($(this).offset().top != ot) { 8541 return false; 8542 } 8543 count++; 8544 }); 8545 var iteration = 1; 8546 var h = 0; 8547 var h2 = 0; 8548 var h3 = 0; 8549 $('.magic-heights:not(".mhdone .magic-heights"):visible',$(this)).addClass('notdone').each(function(){ 8550 if ($('.magic-heights-inner:not(".mhdone .magic-heights-inner")',$(this)).length) { 8551 var $i = $('.magic-heights-inner:not(".mhdone .magic-heights-inner")',$(this)); 8552 }else { 8553 var $i = $(this); 8554 } 8555 if ($i.innerHeight()>h) { 8556 h = $i.innerHeight(); 8557 } 8558 if ($('.magic-heights-inner-2:not(".mhdone .magic-heights-inner-2")',$(this)).length) { 8559 var $i2 = $('.magic-heights-inner-2:not(".mhdone .magic-heights-inner-2")',$(this)); 8560 if ($i2.innerHeight()>h2) { 8561 h2 = $i2.innerHeight(); 8562 } 8563 } 8564 if ($('.magic-heights-inner-3:not(".mhdone .magic-heights-inner-3")',$(this)).length) { 8565 var $i3 = $('.magic-heights-inner-3:not(".mhdone .magic-heights-inner-3")',$(this)); 8566 if ($i3.innerHeight()>h3) { 8567 h3 = $i3.innerHeight(); 8568 } 8569 } 8570 if (iteration==1) { 8571 $(this).addClass('firstinrow'); 8572 } 8573 if (iteration % count == 0) { 8574 $(this).nextAll('.magic-heights:not(".mhdone .magic-heights"):visible').first().addClass('firstinrow'); 8575 $(this).prevAll('.magic-heights:not(".mhdone .magic-heights"):visible').slice(0,count-1).removeClass('notdone').each(function(){ 8576 if ($(".magic-heights-inner:not('.mhdone .magic-heights-inner')",$(this)).length) { 8577 var $i = $(".magic-heights-inner:not('.mhdone .magic-heights-inner')",$(this)); 8578 }else { 8579 var $i = $(this); 8580 } 8581 $i.css('height',h+'px'); 8582 if ($(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)).length) { 8583 $(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)).css('height',h2+'px'); 8584 } 8585 if ($(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)).length) { 8586 $(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)).css('height',h3+'px'); 8587 } 8588 }); 8589 $(this).removeClass('notdone'); 8590 $i.css('height',h+'px'); 8591 if ($(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)).length) { 8592 $(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)).css('height',h2+'px'); 8593 } 8594 if ($(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)).length) { 8595 $(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)).css('height',h3+'px'); 8596 } 8597 h = 0; 8598 h2 = 0; 8599 h3 = 0; 8600 } 8601 iteration++; 8602 }); 8603 iteration = 1; 8604 h = 0; 8605 h2 = 0; 8606 h3 = 0; 8607 $('.notdone:visible',$(this)).each(function(){ 8608 if ($(".magic-heights-inner:not('.mhdone .magic-heights-inner')",$(this)).length) { 8609 var $i = $(".magic-heights-inner:not('.mhdone .magic-heights-inner')",$(this)); 8610 }else { 8611 var $i = $(this); 8612 } 8613 if ($i.innerHeight()>h) { 8614 h = $i.innerHeight(); 8615 } 8616 if ($(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)).length) { 8617 var $i2 = $(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)); 8618 if ($i2.innerHeight()>h2) { 8619 h2 = $i2.innerHeight(); 8620 } 8621 } 8622 if ($(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)).length) { 8623 var $i3 = $(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)); 8624 if ($i3.innerHeight()>h3) { 8625 h3 = $i3.innerHeight(); 8626 } 8627 } 8628 iteration++; 8629 }); 8630 $('.notdone:visible',$(this)).each(function(){ 8631 if ($(".magic-heights-inner:not('.mhdone .magic-heights-inner')",$(this)).length) { 8632 var $i = $(".magic-heights-inner:not('.mhdone .magic-heights-inner')",$(this)); 8633 }else { 8634 var $i = $(this); 8635 } 8636 $i.css('height',h+'px'); 8637 if ($(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)).length) { 8638 $(".magic-heights-inner-2:not('.mhdone .magic-heights-inner-2')",$(this)).css('height',h2+'px'); 8639 } 8640 if ($(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)).length) { 8641 $(".magic-heights-inner-3:not('.mhdone .magic-heights-inner-3')",$(this)).css('height',h3+'px'); 8642 } 8643 $(this).removeClass('notdone'); 8644 }); 8645 } 8646 $(this).addClass("mhdone"); 8647 }); 8648 cc++; 8649 }); 8650 },50); 8651} 8652/* Folder icons */ 8653 8654function foldericons() { 8655 $(".folder-item").css("height","auto"); 8656 var h = 0; 8657 $(".folder-style-grid .folder-item").each(function(){ 8658 if ($(this).innerHeight()>h) { 8659 h=$(this).innerHeight(); 8660 } 8661 }); 8662 $(".folder-style-grid .folder-item").css("height",h+"px"); 8663} 8664 8665function walthroughReady() { 8666 $("h1,h2,h3,h4,p,li,h1 a,h2 a,h3 a,h4 a,p a,li a,.disclosure-reveal",$(".prevent-orphans .content")).each(function(){ 8667 if ($(this).width()>200) { 8668 if ($(this).children().length==0) { 8669 $(this).html($(this).text().replace(/ (?=[^ ]*$)/i, " ")); 8670 } 8671 } 8672 }); 8673 $(".walkthrough_checkbox").each(function(){ 8674 var nth = $(this).prevAll(".walkthrough_checkbox").length; 8675 var uid = hex_hmac_sha1($(this).text()+nth,window.location.pathname); 8676 $(this).data('uid',uid); 8677 if (readCookie('checkbox'+uid)) { 8678 $(this).addClass("checked"); 8679 } 8680 }); 8681 8682 $(".walkthrough_reset a").click(function(){ 8683 $(".walkthrough_checkbox.checked").trigger("click") 8684 return false;
8685 }); 8686 $(".walkthrough_checkbox").click(function(){ 8687 if ($(this).hasClass("checked")) { 8688 $(this).removeClass("checked"); 8689 eraseCookie("checkbox"+$(this).data('uid')); 8690 } else { 8691 $(this).addClass("checked"); 8692 createCookie('checkbox'+$(this).data('uid'),true,0); 8693 } 8694 return false; 8695 }); 8696} 8697function avatarReady() { 8698 $('#user_avatar').click(function(){ 8699 if ($("#change_avatar:visible").length) { 8700 $("#change_avatar").slideUp(50,function(){moduleHeights();}); 8701 } else { 8702 $("#change_avatar").slideDown(50,function(){moduleHeights();}); 8703 } 8704 }); 8705 $('#change_bio_button').click(function(){ 8706 if ($("#change_bio:visible").length) { 8707 $("#change_bio").slideUp(50,function(){moduleHeights();}); 8708 } else { 8709 $("#change_bio").slideDown(50,function(){moduleHeights();}); 8710 } 8711 return false; 8712 }); 8713 $(".inputFile").on("change",function(){ 8714 if ($(this).val()!="") { 8715 8716 var theSplit = $(this).val().split('\\'); 8717 $("#filelabel_"+$(this).attr("id")).text( theSplit[theSplit.length-1]); 8718 } 8719 8720 8721 8722 }) 8723}; 8724function accessibleReady() { 8725 $(".accessible-mode .form:not(#paymentGatewayForm.form) .hide_if_no_js").hide(); 8726 $(".accessible-mode .form:not(#paymentGatewayForm.form) .contact-form-hide-with-js").show(); 8727 $("select[name=chb_sh]").change(function(){ 8728 $(this).parents("form").submit(); 8729 }); 8730 /* 8731 $("input[name=gateway]").change(function(){ 8732 $(this).parents("form").submit(); 8733 }); 8734 $("input[name=agree_terms]").change(function(){ 8735 $(this).parents("form").submit(); 8736 }); 8737 $("input[name=add_to_list]").change(function(){ 8738 $(this).parents("form").submit(); 8739 }); 8740 */ 8741 8742 $("#header .row").each(function(){ 8743 $(this).waitForImages(function(){ 8744 if (window.fontsloaded&&!$(this).hasClass('jsLoaded')){ 8745 // if (!$(this).hasClass('jsLoaded')){ 8746 flexiBreak(); 8747 $("#header .row:not('.flexibreak-big')").addClass("jsLoaded"); 8748 } 8749 }); 8750 }); 8751 $("#footer .row").each(function(){ 8752 $(this).waitForImages(function(){ 8753 if (window.fontsloaded&&!$(this).hasClass('jsLoaded')){ 8754 //if (!$(this).hasClass('jsLoaded')){ 8755 flexiBreak(); 8756 $("#footer .row:not('.flexibreak-big')").addClass("jsLoaded"); 8757 } 8758 }); 8759 }); 8760 $(".nav li").mouseleave(function(){ 8761 clearTimeout(hidingPagePreview); 8762 8763 hidingPagePreview = setTimeout(function () { 8764 $(".hover-preview").removeClass('hover-preview'); 8765 $(".page-preview").fadeOut(100); 8766 }, 50); 8767 8768 }); 8769 $(".nav li").mouseover(function(){ 8770 clearTimeout(hidingPagePreview); 8771 if ($(this).hasClass('show-preview')) { 8772 var mw = $(this).width(); 8773 var left = $(this).offset().left-$(this).parents(".row").offset().left; 8774 var w = $("#page-preview-id-"+$(this).data('page-id')+"").show().css({"visibility":"hidden","width":"auto","position":"relative"}).find('.page-preview-inner').css("float","left").outerWidth(); 8775 var space= $(this).parents(".row").width(); 8776 8777 if (left+w > space) { 8778 if (w > space) { 8779 // need to move to left and shrink 8780 left = 0; 8781 w = space; 8782 } else { 8783 8784 // just need to move left 8785 var diff = (left+w) - space; 8786 left = left - diff; 8787 } 8788 } 8789 $(this).addClass('hover-preview'); 8790 if ($(".page-preview:visible").length) { 8791 $(".page-preview").hide(); 8792 8793 $("#page-preview-id-"+$(this).data('page-id')).css("visibility","visible").css("min-width",mw+"px").css("width",w+"px").css("position","absolute").css("left",left+"px").show().find('.page-preview-inner').css("float","none"); 8794 } else { 8795 $("#page-preview-id-"+$(this).data('page-id')).css("visibility","visible").css("min-width",mw+"px").css("width",w+"px").css("position","absolute").css("left",left+"px").fadeIn(100).find('.page-preview-inner').css("float","none"); 8796 } 8797 8798 } else { 8799 $(".hover-preview").removeClass('hover-preview'); 8800 $(".nav li.hover-preview").removeClass("hover-preview"); 8801 $(".page-preview").fadeOut(100); 8802 } 8803 }); 8804 8805 $(".page-preview").mouseleave(function(){ 8806 $(".hover-preview").removeClass('hover-preview'); 8807 $(this).fadeOut(100); 8808 }); 8809 8810 $(".page-preview").mouseover(function(){ 8811 clearTimeout(hidingPagePreview); 8812 }); 8813 8814 $(".Smaller").wrapInner("<span class=\"smallerWrap\"></span>") 8815 $(".Much_Smaller").wrapInner("<span class=\"muchSmallerWrap\"></span>") 8816 $(".Bigger").wrapInner("<span class=\"biggerWrap\"></span>") 8817 $(".Much_Bigger").wrapInner("<span class=\"muchBiggerWrap\"></span>") 8818 if (!$('body').hasClass("accessible-mode")){ 8819 $('a[href*="#"]:not([href="#cookies"],[href="#"],[href="#navSearch"]),#backToTop').unbind().click(function() { 8820 8821 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 8822 8823 var target = $(this.hash); 8824 target = target.length ? target : $('*[name="' + this.hash.slice(1) +'"]'); 8825 if ($(this).attr("id")=="backToTop") { 8826 var target = $("body"); 8827 } 8828 if (target.length) { 8829 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 8830 if (typeof $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist') !='undefined'){ 8831 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight() - $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist'); 8832 } else { 8833 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight(); 8834 } 8835 8836 } else if ($('body').hasClass("with-fixed-header")) { 8837 var extra = $("#header").outerHeight(); 8838 } else { 8839 var extra = 0; 8840 } 8841 8842 $('html, body').animate({ 8843 scrollTop: target.offset().top - extra 8844 }, 1500,function(){ 8845 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 8846 checkFloatingSub(); 8847 } 8848 8849 }); 8850 return false;
8851 } 8852 } 8853 }); 8854 } 8855 8856 parallaxScroll(); 8857 8858 if ($(window).width()<768) { 8859 $("body").addClass("mobile-header-enabled"); 8860 $("#mobile-menu-page-wrap").css("height",$("#mobileheader").height()-"px"); 8861 if ($(".mobile-header-icon").length>4){ 8862 $("body").addClass("mobile-header-many"); 8863 } 8864 $("#header .row,#footer .row").addClass("jsLoaded"); 8865 }else{ 8866 $("body").addClass("js"); 8867 $("body").addClass("prepping"); 8868 } 8869 8870 8871 $("body").removeClass("prepping"); 8872 8873 $(".column").each(function(){ 8874 if ($(this).text().trim()==""&&!$(this).children().length) { 8875 $(this).addClass("empty-column"); 8876 } 8877 }); 8878 8879 $(".mobile-menu a").click(function(){ 8880 var $this = $(this); 8881 8882 if (!$(this).parents(".flexibreak-small").length&&!$(this).parents('#mobileheader').length) { 8883 $this = $("#"+$(".module.nav").parent().data("flexibreak-small")).find(".mobile-menu a"); 8884 var i = $this.parents(".flexibreak-small").attr("id"); 8885 var $orig = $("*[data-flexibreak-small=\""+i+"\"]"); 8886 } 8887 else { 8888 var $orig = $('#header .nav').parent(); 8889 } 8890 if (!$this.parents(".mobile-menu").hasClass("style") || $this.parents(".mobile-menu").hasClass("style-append")) { 8891 if (!$("#mobile-menu-auto").length) { 8892 $this.parents(".row").after('<section class="row jsLoaded mobile-menu-row"><ul id="mobile-menu-auto" class="hidden"></ul></section>'); 8893 var $target = $("#mobile-menu-auto"); 8894 $(".nav > ul",$orig).children(":not(#nav-logo,#nav-search)").each(function(){ 8895 if (!$(".mobile-header-icon a[href='"+$("a",$(this)).attr("href")+"']").length){ 8896 $target.append($(this).clone()); 8897 } 8898 }); 8899 if ($(".nav > ul #nav-search.nav-search-first",$orig).length&&$("body").hasClass("with-mobile-header")) { 8900 $target.prepend($("#search-form-popdown form").clone()); 8901 } 8902 if ($(".nav > ul #nav-search.nav-search-last",$orig).length&&$("body").hasClass("with-mobile-header")) { 8903 $target.append($("#search-form-popdown form").clone()); 8904 } 8905 $target.find("> li > a").removeAttr("style"); 8906 } else { 8907 var $target = $("#mobile-menu-auto"); 8908 } 8909 setTimeout(function () { 8910 if ($target.hasClass("hidden")) { 8911 $target.removeClass("hidden"); 8912 } else { 8913 $target.addClass("hidden"); 8914 } 8915 }, 0); 8916 } 8917 if ($this.parents(".mobile-menu").hasClass("style-reveal-left")||$this.parents(".mobile-menu").hasClass("style-reveal-right")) { 8918 var revealDirection = ($this.parents(".mobile-menu").hasClass("style-reveal-left")?"left":"right"); 8919 if (!$("#mobile-menu-behind").length) { 8920 $("body").addClass("mobile-menu-position-"+revealDirection); 8921 $("body").wrapInner('<div id="mobile-menu-page-wrap"></div>'); 8922 8923 $("#editInCMS").appendTo("body"); 8924 $("#mobile-menu-page-wrap").prepend($("#mobileheader")); 8925 $("#mobile-menu-page-wrap,#mobilemenu").click(function(){ 8926 $("body").removeClass("mobile-menu-revealing-left mobile-menu-revealing-right"); 8927 setTimeout(function () { 8928 $("body").removeClass("mobile-menu-animating-"+revealDirection); 8929 }, 700); 8930 }); 8931 if (typeof turnstile != "undefined" && $(".cf-turnstile").length) { 8932 turnstile.reset(); 8933 } 8934 checkMobileMenuHeights(); 8935 var below_nav_append=""; 8936 if ($("#below_nav_append").length){ 8937 below_nav_append='<div id="below_mobile_nav">'+$("#below_nav_append").html()+"</div>"; 8938 } 8939 $("body").prepend('<div id="mobile-menu-behind"><ul></ul>'+below_nav_append+'</div>'); 8940 var $target = $("#mobile-menu-behind ul"); 8941 $(".nav > ul",$orig).children(":not(#nav-logo,#nav-search)").each(function(){ 8942 if (!$(".mobile-header-icon a[href='"+$("a",$(this)).attr("href")+"']").length){ 8943 $target.append($(this).clone()); 8944 } 8945 }); 8946 if ($(".nav > ul #nav-search.nav-search-first",$orig).length&&$("body").hasClass("with-mobile-header")) { 8947 $target.prepend($("#search-form-popdown form").clone()); 8948 } 8949 if ($(".nav > ul #nav-search.nav-search-last",$orig).length&&$("body").hasClass("with-mobile-header")) { 8950 $target.append($("#search-form-popdown form").clone()); 8951 } 8952 8953 $target.find("> li > a").removeAttr("style"); 8954 } 8955 setTimeout(function () { 8956 8957 $("body").addClass("mobile-menu-animating-"+revealDirection+" mobile-menu-revealing-"+revealDirection); 8958 8959 }, 10); 8960 $(".showSubMenu").remove(); 8961 $("#mobile-menu-behind ul ul").each(function(){ 8962 $(this).parent().addClass("withHiddenNav").append("<div class='showSubMenu'></div>"); 8963 }); 8964 $(".showSubMenu").click(function(){ 8965 $(this).parent().toggleClass("showingSubMenu"); 8966 return false;
8967 }); 8968 } 8969 return false; 8970 }); 8971 8972 $("*[data-scroll-decay]").each(function(){ 8973 $(this).addClass("parallax"); 8974 }); 8975 // Fix for image margins when floated before headings 8976 $("div.Right_Image,div.Left_Image").each(function(){ 8977 if ($(this).prev().length && $(this).next().length) { 8978 if ($(this).prev()[0].tagName.toLowerCase()=="p"&&$(this).next()[0].tagName.toLowerCase()=="h1") { 8979 $(this).css("margin-top","30px"); 8980 } 8981 if ( 8982 $(this).prev()[0].tagName.toLowerCase()=="p"&& 8983 ( 8984 $(this).next()[0].tagName.toLowerCase()=="h2" 8985 ||$(this).next()[0].tagName.toLowerCase()=="h3" 8986 ||$(this).next()[0].tagName.toLowerCase()=="h4" 8987 ) 8988 ) { 8989 $(this).css("margin-top","18px"); 8990 } 8991 } 8992 8993 }); 8994 // Small bit of code to enable 'warning' class to be added to stock level based on 'Warning stock level' theme variable. 8995 $(".separateOptionStock").change(function(){ 8996 8997 if (parseInt($("option:selected",$(this)).attr("data-stock"))<parseInt($(".stockAndPrice",$(this).parent()).attr("data-warning-threshold"))) { 8998 $(".stockAndPrice .stock",$(this).parent()).addClass("warning"); 8999 } else { 9000 $(".stockAndPrice .stock",$(this).parent()).removeClass("warning"); 9001 } 9002 9003 if ($(this).val()=="") { 9004 $('.out-of-stock',$(this).parents(".addToBasketForm")).hide(); 9005 $('.submit_form',$(this).parents(".addToBasketForm")).hide(); 9006 } else { 9007 $('.out-of-stock',$(this).parents(".addToBasketForm")).show(); 9008 $('.submit_form',$(this).parents(".addToBasketForm")).show(); 9009 } 9010 }); 9011 imageMarginHelper(); 9012 9013 $(".submit_form a").click(function(){ 9014 $(this).parents("form").find(".autosavingFlag").remove(); 9015 return false; 9016 }); 9017 9018 formStyleHelper(); 9019 $(".Circular.bpe_image").each(function() { 9020 if (!$(this).find('.circularwrap').length) { $(this).wrapInner('<span class="circularwrap"></span>'); } 9021 }); 9022 9023 $(".bpe_image").each(function(){ 9024 if (typeof $("img",$(this)).attr("alt") != 'undefined' && typeof $('img',$(this)).attr("title") == 'undefined') { 9025 if (typeof $("img",$(this)).attr("title") == 'undefined') { 9026 $("img",$(this)).attr("title",$("img",$(this)).attr("alt")); 9027 } 9028 } 9029 }); 9030 $(".Caption,.Heavy_Border_Caption,.Light_Border_Caption,.Caption_Below_Image,.intranet_pic_big,.intranet_pic_small").each(function(){ 9031 if (typeof $("img",$(this)).attr("title") != 'undefined') { 9032 var text = $("img",$(this)).attr("title"); 9033 if (text.indexOf('[caption:')!=-1) { 9034 var texts = text.split("[caption:"); 9035 var captions = texts[1].split("]"); 9036 caption = captions[0].trim(); 9037 text = caption.split("||"); 9038 var alt = captions[1].trim(); 9039 $("img",$(this)).attr("alt",alt); 9040 } else { 9041 var alt = text; 9042 text = text.split("||"); 9043 var caption = alt; 9044 } 9045 var newString = ""; 9046 for (var i=0; i < text.length; i++) { 9047 if (i==0) { 9048 newString = "<strong>"+text[i]+"</strong>"; 9049 } else { 9050 newString = newString+"<br/>"+text[i]; 9051 } 9052 }; 9053 $(this).addClass("clearfix"); 9054 if ($("a",$(this)).length) { 9055 $("a",$(this)).wrapInner("<div class='captionWrap'></div>"); 9056 } else { 9057 $(this).wrapInner("<div class='captionWrap'></div>"); 9058 } 9059 $(".captionWrap",$(this)).append('<span class="caption">'+newString+'</span>'); 9060 9061 if ($("a",$(this)).length) { 9062 $("a",$(this)).attr("title",caption); 9063 } 9064 } 9065 }); 9066 9067 9068 9069 $("body").addClass("js"); 9070 9071 $(".focusSwapWrap input[type=text]").focus(function(){ 9072 $(this).parent('.focusSwapWrap').addClass("focus"); 9073 }); 9074 $(".focusSwapWrap input[type=text]").blur(function(){ 9075 if ($(this).val().replace(/ /g,'')=="") { 9076 $(this).val(""); 9077 $(this).parent('.focusSwapWrap').removeClass("focus"); 9078 } 9079 }); 9080 $( '#nav li:has(ul)' ).doubleTapToGo(); 9081 $("#updateQuantitiesP").click(function(){ 9082 $("#quantityForm").submit(); 9083 return false; 9084 }); 9085 9086 9087}; 9088 9089 9090/* Frills mode */ 9091var frillinterval= 0; 9092var clearfrillsinterval; 9093function frillsReady(){ 9094 9095 if ($("body").hasClass("frills_load")){ 9096 setTimeout(function(){ 9097 $("body").addClass("frills"); 9098 9099 setTimeout(function(){ 9100 $("body").removeClass("frills_load"); 9101 frillsScroll(); 9102 },10); 9103 },500); 9104 } 9105} 9106function frillsScroll() { 9107 var $frills = $("h1:not(.column h1),h2:not(.column h2),.bpe_image:not(.column .bpe_image),.column"); 9108 var bottomedge = $(window).scrollTop() + $(window).height() - 20; 9109 $frills.each(function(){ 9110 if (!$(this).hasClass("frills_showing") && $(this).offset().top < bottomedge) { 9111 $(this).addClass("frills_showing"); 9112 var $t = $(this); 9113 setTimeout(function(){ 9114 $t.addClass("frills_shown"); 9115 },frillinterval); 9116 frillinterval = frillinterval+200; 9117 9118 } 9119 }); 9120 clearfrillsinterval = setTimeout(function(){ 9121 frillinterval= 0; 9122 },1000); 9123 9124}; 9125/* Sticky Sidebar */ 9126 9127function stickyReady() { 9128 $(".sticky-column-sidebar").parents('.container').addClass("with-sticky"); 9129 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 9130}; 9131function stickyLoad() { 9132 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 9133}; 9134/* Popup Message */ 9135 9136function popupReady() { 9137 var popuphash = hex_sha1($('#popupMessageBox').html()+""); 9138 if($('#popupMessageBox.autoshow').length && !$("body").hasClass("accessible-mode")) { 9139 $('#popupMessageBox.autoshow').each(function(){ 9140 if ($(this).data('html')===undefined){ 9141 $(this).data('html',$(this).html()); 9142 $(this).html(''); 9143 } 9144 }); 9145
9146 var delay = $("body").data("popup-delay"); 9147 9148 if (!readCookie('seenPopupMessage'+popuphash)) { 9149 9150 setTimeout(function () { 9151 var message= $($("#popupMessageBox.autoshow").data('html')); 9152 $('body').append('<div id="popupMessageBoxPopup" title="Important Information"><div id="popupMessageBoxPopupCenter"><div id="popupMessageBoxPopupBox"><div id="closePopupBox"></div><div></div></div></div></div>'); 9153 message.appendTo($("#popupMessageBoxPopup > div > div")); 9154 setTimeout(function(){ 9155 $("#popupMessageBoxPopup .submit_form a").click(function(){ 9156 $(this).parents("form").find(".autosavingFlag").remove(); 9157 $(this).parents("form").submit(); 9158 return false; 9159 }); 9160 $("#popupMessageBoxPopup .g-recaptchaload").each(function() { 9161 var object = $(this); 9162 var rid = grecaptcha.render(object.attr("id"), { 9163 "sitekey" :$(this).data("sitekey"), 9164 "callback" : function(token) { 9165 object.parents('form').find(".g-recaptcha-response").val(token); 9166 invisRecaptcha(token); 9167 } 9168 }); 9169 $(this).parents('form').attr('recapid',rid); 9170 }); 9171 $("#popupMessageBoxPopup .cf-turnstile").each(function() { 9172 var object = $(this); 9173 var rid = turnstile.render(object[0], { 9174 "sitekey" :$(this).data("sitekey"), 9175 "callback" : function(token) { 9176 object.parents('form').append("<input type='hidden' name='cf-turntstile-response' value='"+ token+"'/>"); 9177 } 9178 }); 9179 $(this).parents('form').attr('recapid',rid); 9180 }); 9181 bindForms(); 9182 },100); 9183 }, delay); 9184 9185 9186 } 9187 } 9188 $("body").on("click","#closePopupBox",function(){ 9189 9190 if (!$("#popupMessageBoxPopup").hasClass("fromlink")) { 9191 createCookie('seenPopupMessage'+popuphash,true,0); 9192 } 9193 9194 9195 $("#popupMessageBoxPopup").fadeOut(); 9196 setTimeout(function () { 9197 $("#popupMessageBoxPopup").remove(); 9198 }, 300); 9199 }); 9200 $('.popupMessageOnClickContent').each(function(){ 9201 if ($(this).data('html')===undefined){ 9202 $(this).data('html',$(this).html()); 9203 $(this).html(''); 9204 } 9205 }); 9206 $(".popupMessageOnClick a").unbind("click").click(function(){ 9207 var message= $($(this).parents(".popupMessageOnClick").next('.popupMessageOnClickContent').data('html')); 9208 $('body').append('<div id="popupMessageBoxPopup" class="fromlink" title="Important Information"><div id="popupMessageBoxPopupCenter"><div id="popupMessageBoxPopupBox"><div id="closePopupBox"></div><div id="popupMessageContents"></div></div></div></div>'); 9209 message.appendTo($("#popupMessageContents")); 9210 setTimeout(function(){ 9211 $("#popupMessageContents .submit_form a").click(function(){ 9212 $(this).parents("form").find(".autosavingFlag").remove(); 9213 $(this).parents("form").submit(); 9214 return false; 9215 }); 9216 $("#popupMessageContents .g-recaptchaload").each(function() { 9217 var object = $(this); 9218 var rid = grecaptcha.render(object.attr("id"), { 9219 "sitekey" :$(this).data("sitekey"), 9220 "callback" : function(token) { 9221 object.parents('form').find(".g-recaptcha-response").val(token); 9222 invisRecaptcha(token); 9223 } 9224 }); 9225 $(this).parents('form').attr('recapid',rid); 9226 }); 9227 $("#popupMessageContents .cf-turnstile").each(function() { 9228 var object = $(this); 9229 var rid = turnstile.render(object[0], { 9230 "sitekey" :$(this).data("sitekey"), 9231 "callback" : function(token) { 9232 object.parents('form').append("<input type='hidden' name='cf-turntstile-response' value='"+ token+"'/>"); 9233 } 9234 }); 9235 $(this).parents('form').attr('recapid',rid); 9236 }); 9237 bindForms(); 9238 },100); 9239 return false; 9240 }); 9241 9242}; 9243/* Filter subpage index 9244*/ 9245function filterReady() { 9246 $("#subPageIndexProducts").each(function(){ 9247 var attributes = {}; 9248 $(".productMeta",$(this)).each(function(){ 9249 var $product = $(this).parent(); 9250 if ($(this).text().trim()!="") { 9251 9252 var metaString = $(this).text().split(","); 9253 9254 for (var i = metaString.length - 1; i >= 0; i--){ 9255 var metaName = metaString[i].split(":")[0].trim(); 9256 var metaVal = metaString[i].split(":")[1].trim().split("||"); 9257 9258 9259 if (metaName in attributes) { 9260 9261 for (var y = 0; y < metaVal.length; y++) { 9262 $product.addClass("attr_"+metaName.replace(/[^a-zA-Z0-9]+/g,'')+"_"+metaVal[y].replace(/[^a-zA-Z0-9]+/g,'')); 9263 if ($.inArray(metaVal[y], attributes[metaName])===-1) { 9264 attributes[metaName].push(metaVal[y]); 9265 } 9266 } 9267 9268 9269 } else { 9270 9271 attributes[metaName] = new Array(); 9272 for (var y = 0; y < metaVal.length; y++) { 9273 $product.addClass("attr_"+metaName.replace(/[^a-zA-Z0-9]+/g,'')+"_"+metaVal[y].replace(/[^a-zA-Z0-9]+/g,'')); 9274 attributes[metaName].push(metaVal[y]); 9275 } 9276 9277 } 9278 } 9279 9280 } 9281 9282 }); 9283 9284 for (var property in attributes) { 9285 9286 var filter = "<div><strong>"+property+"</strong><br/><select name='"+property.replace(/[^a-zA-Z0-9]+/g,'')+"' class='filterMenu'><option value=''>All</option>"; 9287 9288 for (var i=0; i < attributes[property].length; i++) { 9289 filter += "<option value='"+attributes[property][i].replace(/[^a-zA-Z0-9]+/g,'')+"'>"+attributes[property][i]+"</option>"; 9290 }; 9291 9292 filter += "</select></div>"; 9293
9294 $("#subPageIndexProducts #filterBox").prepend(filter); 9295 9296 } 9297 $(".filterMenu").change(function(){ 9298 var needsClasses = ""; 9299 $(".subPageProducts").hide(); 9300 $(".filterMenu").each(function(){ 9301 if ($(this).val()!="") { 9302 needsClasses += ".attr_"+$(this).attr("name")+"_"+$(this).val(); 9303 } 9304 }); 9305 9306 if (needsClasses=="") { 9307 $(".subPageProducts").show(); 9308 } else { 9309 $(needsClasses).show(); 9310 } 9311 magicHeights(); 9312 9313 }); 9314 }); 9315 setTimeout(function () { 9316 if (window.location.href){ 9317 if (window.location.hash.indexOf("#filter")===0) { 9318 var preselect = window.location.hash.split("#filter-"); 9319 var string = preselect[1].split(":"); 9320 var option = string[0]; 9321 var value = string[1] 9322 if (option && value) { 9323 $(".filterMenu[name=\""+option+"\"]").val(value).trigger("change"); 9324 $("#filterBox .filterRadio[name=\""+option+"\"][value=\""+value+"\"]").prop("checked",true); 9325 9326 } 9327 } 9328 } 9329 }, 590); 9330 9331}; 9332/* 9333 Floating Sub Menu 9334*/ 9335 function checkFloatingSub() { 9336 if ($("#dmt-floating-sub-menu").length==0) { 9337 return false; 9338 } 9339 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 9340 $el.removeClass('mobile'); 9341 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 2 && $(window).width()<480) { 9342 $el.addClass('mobile'); 9343 } 9344 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 3 && $(window).width()<540) { 9345 $el.addClass('mobile'); 9346 } 9347 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 4 && $(window).width()<600) { 9348 $el.addClass('mobile'); 9349 } 9350 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 5 && $(window).width()<700) { 9351 $el.addClass('mobile'); 9352 } 9353 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 6 && $(window).width()<750) { 9354 $el.addClass('mobile'); 9355 } 9356 if ($("#dmt-floating-sub-menu:not(.fixed) a").length > 7 && $(window).width()<800) { 9357 $el.addClass('mobile'); 9358 } 9359 if ($el.offset().top + $el.outerHeight() < window.pageYOffset) { 9360 if (!$("#dmt-floating-sub-menu.fixed").length) { 9361 var l = $el.offset().left; 9362 $("body").append($el.clone(true).addClass("fixed").css("left",l+"px")); 9363 if ($el.hasClass('mobile')) { 9364 $("#submenu").remove(); 9365 $el.prepend("<div id='submenu'></div>") 9366 $("#dmt-floating-sub-menu.fixed a").remove(); 9367 $("#dmt-floating-sub-menu.fixed").append("<div class='mobile-menu'><p><a href=\"#submenu\">Menu</a></p></div>"); 9368 } else { 9369 $("#dmt-floating-sub-menu.fixed .dmt-floating-sub-menu-link").each(function(){ 9370 if (typeof $(this).data("move-dist")!="undefined") { 9371 $(this).css("top","-"+$(this).data("move-dist")+'px').css("margin-bottom","-"+$(this).data("move-dist")+'px'); 9372 } 9373 }); 9374 $("#dmt-floating-sub-menu.fixed .dmt-floating-sub-menu-link").hover(function(){ 9375 $(this).css("top","0px"); 9376 },function(){ 9377 $(this).css("top","-"+$(this).data("move-dist")+'px'); 9378 }); 9379 9380 } 9381 9382 $('a[href*="#"]:not([href="#"],[href="#navSearch"])',$('#dmt-floating-sub-menu.fixed')).unbind('click').click(function() { 9383 9384 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 9385 var target = $(this.hash); 9386 target = target.length ? target : $('*[name="' + this.hash.slice(1) +'"]'); 9387 if (target.length) { 9388 9389 9390 if (typeof $(this).data("move-dist") != "undefined") { 9391 $('html, body').animate({ 9392 scrollTop: target.offset().top - $(this).outerHeight() + $(this).data("move-dist") 9393 }, 1500); 9394 } else { 9395 $('html, body').animate({ 9396 scrollTop: target.offset().top - $(this).outerHeight() 9397 }, 1500); 9398 } 9399 9400 9401 return false; 9402 } 9403 } 9404 }); 9405 9406 setTimeout(function () { 9407 $("#dmt-floating-sub-menu.fixed").addClass("visible"); 9408 }, 10); 9409 } 9410 9411 } 9412 if ($el.offset().top > window.pageYOffset -$el.outerHeight()) { 9413 $("#dmt-floating-sub-menu.fixed").removeClass("visible"); 9414 setTimeout(function () { 9415 $("#dmt-floating-sub-menu.fixed").remove(); 9416 }, 500); 9417 9418 } 9419 9420 9421 } 9422 function floatingScroll() { 9423 if ($("#dmt-floating-sub-menu:not(.fixed)").length) { 9424 checkFloatingSub(); 9425 } 9426 }; 9427 function floatingReady() { 9428 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 9429 $el.css("width",$el.width()); 9430 }; 9431 function floatingResize() { 9432 $("#dmt-floating-sub-menu.fixed").remove(); 9433 9434 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 9435 $el.removeAttr('style'); 9436 $el.css("width",$el.outerWidth()); 9437 checkFloatingSub(); 9438 addFloatingSubHeights(); 9439 }; 9440 function addFloatingSubHeights() { 9441 var $el = $("#dmt-floating-sub-menu:not(.fixed)"); 9442 $(".dmt-floating-sub-menu-link",$el).each(function(){ 9443 if ($(".bpe_image",$(this)).length) { 9444 9445 var h = $(".bpe_image",$(this)).outerHeight(); 9446 9447 $(this).data('move-dist',h); 9448 } 9449 }); 9450 } 9451 function floatingLoad() { 9452 addFloatingSubHeights(); 9453 9454 }; 9455 9456/* 9457 Product images 9458*/ 9459 function imagesReady() { 9460 if ($("#main .bpe_image").length) { 9461 var pagepicenc = encodeURIComponent($("#main .bpe_image:first").find("img").attr('src')); 9462 var pagepic = $("#main .bpe_image:first").find("img").attr('src'); 9463 } else { 9464 var pagepic=false; 9465 } 9466 9467 9468 $(".addToBasketForm").each(function(){ 9469 if (pagepic) { 9470 if (!$("input[name=pic_url]",$(this)).length) { 9471 $(this).append('<input type="hidden" name="pic_url" value="'+pagepic+'"/>'); 9472 } 9473 } 9474 if (!$("input[name=url_str]",$(this)).length) { 9475 $(this).append('<input type="hidden" name="url_str" value="'+window.location.pathname+'"/>'); 9476 } 9477 }); 9478 $(".addToBasketLink").each(function(){ 9479 if (pagepic) { 9480 if ($(this).attr('href').indexOf("pic_url")==-1) { 9481 $(this).attr('href',$(this).attr('href')+'&pic_url='+pagepicenc); 9482 } 9483 9484 } 9485 if ($(this).attr('href').indexOf("url_str")==-1) { 9486 $(this).attr('href',$(this).attr('href')+'&url_str='+encodeURIComponent(window.location.pathname)); 9487 } 9488 }); 9489 $(".column_row").each(function(){ 9490 if ($("input[name=pic_url]",$(this)).length==1 && $("img",$(this)).length) { 9491 $("input[name=pic_url]",$(this)).val($("img",$(this)).first().attr('src')); 9492 } 9493 if ($(".addToBasketLink",$(this)).length==1 && $("img",$(this)).length) { 9494 var urlparts = $(".addToBasketLink",$(this)).attr('href').split("?"); 9495 9496 var query_parts = urlparts[1].split('&'); 9497 var newquery=""; 9498 for (var i = 0; i < query_parts.length; i++) { 9499 if (newquery!="") { 9500 newquery+="&"; 9501 } 9502 if (query_parts[i].indexOf("pic_url=")===0) { 9503 var imgurl = $("img",$(this)).first().attr('src').split("?"); 9504 newquery+="pic_url="+encodeURIComponent(imgurl[0]); 9505 } else { 9506 newquery+=query_parts[i]; 9507 } 9508 9509 } 9510 9511 $(".addToBasketLink",$(this)).attr('href',urlparts[0]+"?"+newquery); 9512 } 9513 9514 }); 9515 $(".column").each(function(){ 9516 if ($("input[name=pic_url]",$(this)).length==1 && $("img",$(this)).length) { 9517 $("input[name=pic_url]",$(this)).val($("img",$(this)).first().attr('src')); 9518 } 9519 if ($(".addToBasketLink",$(this)).length==1 && $("img",$(this)).length) { 9520 var urlparts = $(".addToBasketLink",$(this)).attr('href').split("?"); 9521 9522 var query_parts = urlparts[1].split('&'); 9523 var newquery=""; 9524 for (var i = 0; i < query_parts.length; i++) { 9525 if (newquery!="") { 9526 newquery+="&"; 9527 } 9528 if (query_parts[i].indexOf("pic_url=")===0) { 9529 var imgurl = $("img",$(this)).first().attr('src').split("?"); 9530 newquery+="pic_url="+encodeURIComponent(imgurl[0]); 9531 } else { 9532 newquery+=query_parts[i]; 9533 } 9534 9535 } 9536 9537 $(".addToBasketLink",$(this)).attr('href',urlparts[0]+"?"+newquery); 9538 } 9539 9540 }); 9541 }; 9542/* 9543 Icon text 9544*/ 9545 function fixIconLinks(c) { 9546 $("."+c).each(function(){ 9547 if ($(">a",$(this)).length) { 9548 if ($(">a",$(this)).text()==$(this).text()) { 9549 $(">a",$(this)).addClass(c); 9550 $(this).removeClass(c); 9551 } 9552 } 9553 }); 9554 } 9555 function iconsReady() { 9556 var icons = new Array(); 9557 icons.push("Icon_Phone"); 9558 icons.push("Icon_Tick"); 9559 icons.push("Icon_Info"); 9560 icons.push("Icon_Question"); 9561 icons.push("Icon_Alert"); 9562 icons.push("Icon_Email"); 9563 icons.push("Icon_Home"); 9564 icons.push("Icon_Livechat"); 9565 9566 for (var i = 0; i < icons.length; i++) { 9567 fixIconLinks(icons[i]); 9568 } 9569 }; 9570/* 9571 Hover Image 9572*/ 9573 function hoverImageReady() { 9574 if (!$('body').hasClass("accessible-mode")){ 9575 $(".Hover_Image_Button").each(function(){ 9576 $("a",$(this)).append("<div class='cms_hover_image_hover'><img srcset='"+$(this).data('hover-srcset')+"' src='"+$(this).data('hover-src')+"'/></div>"); 9577 }); 9578 } 9579 }; 9580/* 9581 9582 #Popup Video 9583 9584*/ 9585var mpytplayer; 9586function insertYT() { 9587 if (window.consent.functional){ 9588 var mpplayer_tag = document.createElement('script'); 9589 mpplayer_tag.src = "https://www.youtube.com/iframe_api"; 9590 var firstScriptTag = document.getElementsByTagName('script')[0]; 9591 firstScriptTag.parentNode.insertBefore(mpplayer_tag, firstScriptTag); 9592 } 9593} 9594 function showMPPopup(src,desc) { 9595 $("#mp_lightbox_outer").removeClass("ytvidmp"); 9596 9597 $("#mp_lightbox_inner,#mp_lightbox_outer_outer").removeAttr("style"); 9598 if (src.substr(src.length - 4).toLowerCase()==".png" 9599 || src.substr(src.length - 4).toLowerCase()==".jpg" 9600 || src.substr(src.length - 5).toLowerCase()==".jpeg" 9601 || src.substr(src.length - 4).toLowerCase()==".gif" 9602 || src.substr(src.length - 5).toLowerCase()==".apng" 9603 ) { 9604 9605 var img = new Image(); 9606 img.onload = function() { 9607 $("#mp_lightbox_outer").fadeIn(); 9608 9609 var r = this.height/this.width*100; 9610 $("#mp_lightbox_inner").css("padding-bottom",r+"%"); 9611 $("#mp_lighbox_content").data("ratio",r); 9612 $("#mp_lightbox_outer_outer").data("maxw",this.width).css("width",this.width+"px"); 9613 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 9614 var nw = ($(window).height()-100) / (r/100); 9615 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 9616 } 9617 9618 $("#mp_lighbox_content").html("<img src='"+src+"' style=\"width:100%\"/>"); 9619 if (desc!="") { 9620 $("#mp_lighbox_content").append('<div class="mpPopupDescOuter"><div class="mpPopupDesc">'+desc+'</div></div>'); 9621 } 9622 9623 } 9624 img.src = src; 9625 } 9626 if (src.substr(src.length - 4).toLowerCase()==".mov"||src.substr(src.length - 4).toLowerCase()==".mp4") { 9627 9628 $("#mp_lightbox_outer").fadeIn(); 9629 9630 $("#mp_lightbox_inner").css("padding-bottom","56.25%"); 9631 $("#mp_lightbox_outer_outer").css("width","1800px"); 9632 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 9633 var nw = ($(window).height()-100) / (56.25/100); 9634 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 9635 } 9636 9637 9638 var width = $("#mp_lighbox_content").width(); 9639 var height = $("#mp_lighbox_content").height(); 9640 var video = src; 9641 $("#mp_lighbox_content").html("<div id=\"videoMPPopup\" class='jplayerInit' data-poster='/graphics/play.jpg' data-vid='"+video+"'>"+playerHTML+"</div>"); 9642 makeVideo("videoMPPopup",width,height,"/graphics/play.jpg",video,true,false); 9643 } 9644 9645 if (src.substr(0,23)=="https://www.youtube.com" || src.substr(0,22)=="http://www.youtube.com") { 9646 src = src.replace("/shorts/","/embed/"); 9647 src = src.replace("/watch?v=","/embed/"); 9648 src = src.split("/embed/"); 9649 src = src[1]; 9650 $("#mp_lightbox_outer").fadeIn().addClass("ytvidmp"); 9651 9652 $("#mp_lightbox_inner").css("padding-bottom","56.25%"); 9653 $("#mp_lightbox_outer_outer").css("width","1800px"); 9654 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 9655 var nw = ($(window).height()-100) / (56.25/100); 9656 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 9657 } 9658 9659 9660 var width = $("#mp_lighbox_content").width(); 9661 var height = $("#mp_lighbox_content").height(); 9662 $("#mp_lighbox_content").html("<div id='mppopupytplayer'></div>"); 9663 9664 mpytplayer = new YT.Player('mppopupytplayer', { 9665 height: "100%", 9666 width: "100%", 9667 videoId: src, 9668 playerVars: {autoplay:1,rel:0} 9669 }); 9670 9671 } 9672 9673 } 9674 function mp_lightboxResize() { 9675 if ($("#mp_lightbox_outer:visible").length && $("#mp_lighbox_content img").length) { 9676 9677 var r = $("#mp_lighbox_content").data("ratio"); 9678 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 9679 var nw = ($(window).height()-100) / (r/100); 9680 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 9681 } else { 9682 $("#mp_lightbox_outer_outer").css("width",$("#mp_lightbox_outer_outer").data("maxw")+'px'); 9683 } 9684 } 9685 if ($("#mp_lightbox_outer:visible").length && $("#mp_lightbox_outer").hasClass("ytvidmp")) { 9686 9687 $("#mp_lightbox_inner").css("padding-bottom","56.25%"); 9688 $("#mp_lightbox_outer_outer").data("maxw",this.width).css("width",this.width+"px"); 9689 if ($("#mp_lighbox_content").height()+100>$(window).height()) { 9690 var nw = ($(window).height()-100) / (56.25/100); 9691 $("#mp_lightbox_outer_outer").css("width",nw+"px"); 9692 } else { 9693 $("#mp_lightbox_outer_outer").css("width","1800px"); 9694 } 9695 } 9696 }; 9697 function mpPopupReady() { 9698 $("#showCouponCode").click(function(){ 9699 $("#couponForm").slideDown(); 9700 return false;
9701 }); 9702 $('.Popup_Link').each(function() { 9703 if (typeof $("img",$(this)).attr("alt") != 'undefined') { 9704 var text = $("img",$(this)).attr("alt"); 9705 if (text.indexOf('[caption:')!=-1) { 9706 var texts = text.split("[caption:"); 9707 var captions = texts[1].split("]"); 9708 caption = captions[0].trim(); 9709 text = caption.split("||"); 9710 var alt = captions[1].trim(); 9711 $("img",$(this)).attr("alt",alt); 9712 } else { 9713 var alt = text; 9714 text = text.split("||"); 9715 var caption = alt; 9716 } 9717 $("img",$(this)).attr('caption',caption); 9718 } 9719 }); 9720 9721 if (!$('body').hasClass("accessible-mode")){ 9722 $(".Popup_Link").click(function(){ 9723 var desc = ""; 9724 if (typeof $(this).find("img").attr("alt") != "undefined" && $(this).find("img").attr("alt")!="") { 9725 desc = $(this).find("img").attr("alt"); 9726 } 9727 if (typeof $(this).find("img").attr('caption')!="undefined") { 9728 desc = $(this).find('img').attr('caption'); 9729 } 9730 if ($(this).find('a').length) { 9731 var href=$(this).find('a').attr('href'); 9732 } 9733 if ($(this).find('img')) { 9734 var href = $(this).find('img').attr('src').split('?'); 9735 href = href[0]; 9736 } 9737 if (typeof href !='undefined') { 9738 showMPPopup(href,desc); 9739 } 9740 return false; 9741 }); 9742 $("#closeMP").click(function(){ 9743 $("#mp_lightbox_outer").fadeOut(); 9744 if ($("#videoMPPopup .jplayer").hasClass("playing")) { 9745 $("#videoMPPopup .jplayer").jPlayer("stop"); 9746 } 9747 if (mpytplayer) { 9748 mpytplayer.stopVideo(); 9749 } 9750 return false; 9751 9752 }); 9753 } 9754 }; 9755/* 9756 9757 #Expand Collapse Widgets 9758 9759*/ 9760 function expandReady() { 9761 if (!$('body').hasClass("accessible-mode")){ 9762 $(".expand-box-content:not(.openonload .expand-box-content)").slideUp(300,function(){ 9763 moduleHeights(); 9764 }); 9765 $(".expand-box-title").click(function(e){ 9766 if ($(e.target)[0].tagName.toLowerCase() == "a") { 9767 if ($(e.target).attr('href')!="#") { 9768 return true; 9769 } 9770 9771 } 9772 if ($(this).parent().hasClass("showing")) { 9773 $(this).parent().removeClass("showing").find("> .expand-box-content").slideUp(300,function(){ 9774 moduleHeights(); 9775 magicHeights(); 9776 setTimeout(function(){ 9777 moduleHeights(); 9778 },5); 9779 }); 9780 } else { 9781 $("> .showing > .expand-box-content",$(this).parent().parent()).slideUp(295).parent().removeClass("showing"); 9782 $(this).parent().addClass("showing"); 9783 $("> .expand-box-content",$(this).parent()).slideDown(300,function(){ 9784 moduleHeights(); 9785 magicHeights(); 9786 setTimeout(function(){ 9787 moduleHeights(); 9788 },5); 9789 if($('.galleryWithThumbs',$(this)).length) { 9790 afterResizeGallery(); 9791 } 9792 }); 9793 } 9794 return false; 9795 }); 9796 9797 } 9798 if ($("input[name='verify_email']").length && $("input[name=verify_email]").parents(".expand-box:not(.showing)").length) { 9799 $("input[name='verify_email']").parents(".expand-box:not(.showing)").find(".expand-box-title").trigger("click"); 9800 $("input[name='pass1']").focus(); 9801 } 9802 setTimeout(function(){ 9803 var hs = window.location.hash.split('#expand-'); 9804 if (hs.length>1){ 9805 if ($('.expand-box[data-expand-id="'+hs[1]+'"]').length) { 9806 var target = $('.expand-box[data-expand-id="'+hs[1]+'"] .expand-box-title'); 9807 target.trigger('click'); 9808 if (typeof target != 'undefined') { 9809 9810 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 9811 if (typeof $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist') !='undefined'){ 9812 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight() - $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').data('move-dist'); 9813 } else { 9814 var extra = $('#dmt-floating-sub-menu:not(.fixed) .dmt-floating-sub-menu-link:first').outerHeight(); 9815 } 9816 9817 } else if ($('body').hasClass("with-fixed-header")) { 9818 var extra = $("#header").outerHeight(); 9819 } else { 9820 var extra = 0; 9821 } 9822 9823 $('html, body').animate({ 9824 scrollTop: target.offset().top - extra 9825 }, 1500,function(){ 9826 if ($('#dmt-floating-sub-menu:not(.fixed)').length) { 9827 checkFloatingSub(); 9828 } 9829 9830 }); 9831 } 9832 } 9833 } 9834 },550); 9835 }; 9836/* 9837 9838 #Popdown widgets 9839 9840*/ 9841 function hideSearchPopdown() { 9842 $("#search-form-popdown").removeClass("visible"); 9843 setTimeout(function () { 9844 $("#search-form-popdown").removeClass("animate").removeAttr("style"); 9845 }, 300); 9846 $(".display-popdown-widget a.active").removeClass("active"); 9847 9848 } 9849 function popdownReady() { 9850 backstretches(); 9851 $("html").click(function(e){ 9852 if (e.target.nodeName.toLowerCase()!="input") { 9853 hideSearchPopdown(); 9854 } 9855 9856 }); 9857 $("body").on("click",".display-popdown-widget a",function(e){ 9858 if ($(this).hasClass("active")) { 9859 $(this).removeClass("active"); 9860 hideSearchPopdown(e); 9861 } else { 9862 $(this).addClass("active"); 9863 var $pd = $("#"+$(this).data("target")); 9864 9865 var lh = $(this).outerWidth() / 2; 9866 var ol = $(this).offset().left + lh; 9867 var t = $(this).offset().top + $(this).outerHeight() + 3; 9868 var pl = 160; 9869 ol = ol - pl; 9870 $(".tri",$pd).css("margin-left","-6px"); 9871 if (ol + 320 > $(window).width()-20) { 9872 var diff = ol + 320 - $(window).width() + 10; 9873 ol = ol - diff; 9874 diff = diff-6; 9875 $(".tri",$pd).css("margin-left",diff+"px"); 9876 } 9877 $pd.css("left",ol+"px").css("top",t+"px"); 9878 setTimeout(function () { 9879 $pd.addClass("animate"); 9880 $pd.addClass("visible"); 9881 }, 1); 9882 $("input",$pd).focus(); 9883 } 9884 9885 return false;
9886 }); 9887 }; 9888/* 9889 9890 #Basic init setup 9891 9892*/ 9893 9894 var scrolling = false; 9895 var scrollingTimer; 9896 var scroll = window.requestAnimationFrame || 9897 window.webkitRequestAnimationFrame || 9898 window.mozRequestAnimationFrame || 9899 window.msRequestAnimationFrame || 9900 window.oRequestAnimationFrame || 9901 function(callback){ window.setTimeout(callback, 1000/60) }; 9902 9903 if(navigator.userAgent.indexOf('AppleWebKit') != -1){ 9904 var isWebKit = true; 9905 } else { 9906 var isWebKit = false; 9907 } 9908 9909 9910 9911 function parallaxScroll(timestamp) { 9912 $("*[data-scroll-decay]").each(function(){ 9913 //var st = $(document).scrollTop(); 9914 var st = window.pageYOffset; 9915 var ot = $(this).offset().top; 9916 var th = $(this).outerHeight(); 9917 var wh = $(window).height(); 9918 9919 var decay = 0.5; 9920 if (typeof $(this).data("scroll-decay") != 'undefined') { 9921 decay = $(this).data("scroll-decay"); 9922 } 9923 if (st<0) { 9924 st=0; 9925 } 9926 9927 if (isWebKit) { 9928 $("body").addClass("supports-pos-fixed"); 9929 decay = 1-decay; 9930 move = ot-st; 9931 move = move*decay; 9932 9933 } else { 9934 move = ot-st; 9935 move = -move*decay; 9936 } 9937 9938 $("> .backstretch img:last",$(this)) 9939 .css("height",wh+"px") 9940 .css("width","auto") 9941 .css("left","50%") 9942 .css("min-width","100%") 9943 .css("-moz-transform","translate3d(-50%,"+move+"px,0)") 9944 .css("-webkit-transform","translate3d(-50%,"+move+"px,0)") 9945 .css("-o-transform","translate3d(-50%,"+move+"px,0)") 9946 .css("transform","translate3d(-50%,"+move+"px,0)"); 9947 9948 9949 }); 9950 scroll(parallaxScroll); 9951 9952 } 9953 9954 function backtotopScroll() { 9955 scrolling = true; 9956 clearTimeout(scrollingTimer); 9957 scrollingTimer = setTimeout(function () { 9958 scrolling = false; 9959 }, 100); 9960 9961 $("#backToTop").show().css("opacity","0"); 9962 if ($(document).scrollTop()>200) { 9963 $("#backToTop").css("opacity","1"); 9964 } else { 9965 $("#backToTop").css("opacity","0"); 9966 } 9967 9968 }; 9969 function afterFonts(){ 9970 flexiBreak(); 9971 $("#header .row:not('.flexibreak-big'),#footer .row:not('.flexibreak-big')").addClass("jsLoaded"); 9972 9973 }; 9974 function miscLoad() { 9975 setRecentBlogWidths(); 9976 if ($("#logo img").width()<$("#logo").width()) { 9977 $("#logo").css("width",$("#logo img").width()+"px"); 9978 } 9979 imageMarginHelper(); 9980 backstretches(); 9981 9982 setTimeout(function () { 9983 $("body").addClass("loaded"); 9984 }, 50); 9985 setTimeout(function () { 9986 backstretches(); 9987 }, 200); 9988 9989 }; 9990 var ww = 0; 9991 function miscResize() { 9992 if (!scrolling){ 9993 var st = $(document).scrollTop(); 9994 $("#mobile-menu-auto").addClass("hidden"); 9995 imageMarginHelper(); 9996 if (window.fontsloaded){ 9997 flexiBreak(); 9998 $("#header .row:not('.flexibreak-big'),#footer .row:not('.flexibreak-big')").addClass("jsLoaded"); 9999 } 10000 hideSearchPopdown(); 10001 setRecentBlogWidths(); 10002 $("body,html").scrollTop(st); 10003 if ($('body').hasClass("match-parallax-zoom")) { 10004 backstretches(); 10005 } 10006 } 10007 10008 10009 }; 10010 var hidingPagePreview; 10011 10012 10013 function backstretches() { 10014 if (typeof backstretches_core != "undefined"){ 10015 backstretches_core(); 10016 } 10017 } 10018 function prepMobileHeader() { 10019 10020 $(".mobile-menu:visible a").each(function(){ 10021 var $this = $(this); 10022 10023 if (!$(this).parents(".flexibreak-small").length&&!$(this).parents('#mobileheader').length) { 10024 $this = $("#"+$(".module.nav").parent().data("flexibreak-small")).find(".mobile-menu a"); 10025 var i = $this.parents(".flexibreak-small").attr("id"); 10026 var $orig = $("*[data-flexibreak-small=\""+i+"\"]"); 10027 } 10028 else { 10029 var $orig = $('#header .nav').parent(); 10030 } 10031 if ($this.parents(".mobile-menu").hasClass("style-reveal-left")||$this.parents(".mobile-menu").hasClass("style-reveal-right")) { 10032 var revealDirection = ($this.parents(".mobile-menu").hasClass("style-reveal-left")?"left":"right"); 10033 if (!$("#mobile-menu-behind").length) { 10034 $("body").addClass("mobile-menu-position-"+revealDirection); 10035 $("body").wrapInner('<div id="mobile-menu-page-wrap"></div>'); 10036 //$("#mobileheader").insertAfter("#mobile-menu-page-wrap"); 10037 $("#mobile-menu-page-wrap").prepend($("#mobileheader")); 10038 $("#mobile-menu-page-wrap,#mobileheader").click(function(){ 10039 $("body").removeClass("mobile-menu-revealing-left mobile-menu-revealing-right"); 10040 setTimeout(function () { 10041 $("body").removeClass("mobile-menu-animating-"+revealDirection); 10042 }, 700); 10043 }); 10044 if (typeof turnstile != "undefined" && $(".cf-turnstile").length) { 10045 turnstile.reset(); 10046 } 10047 checkMobileMenuHeights(); 10048 var below_nav_append=""; 10049 if ($("#below_nav_append").length){ 10050 below_nav_append='<div id="below_mobile_nav">'+$("#below_nav_append").html()+"</div>"; 10051 } 10052 $("body").prepend('<div id="mobile-menu-behind"><ul></ul>'+below_nav_append+'</div>'); 10053 var $target = $("#mobile-menu-behind ul"); 10054 $(".nav > ul",$orig).children(":not(#nav-logo,#nav-search)").each(function(){ 10055 if (!$(".mobile-header-icon a[href='"+$("a",$(this)).attr("href")+"']").length){ 10056 $target.append($(this).clone()); 10057 } 10058 }); 10059 if ($(".nav > ul #nav-search.nav-search-first",$orig).length&&$("body").hasClass("with-mobile-header")) { 10060 $target.prepend($("#search-form-popdown form").clone()); 10061 } 10062 if ($(".nav > ul #nav-search.nav-search-last",$orig).length&&$("body").hasClass("with-mobile-header")) { 10063 $target.append($("#search-form-popdown form").clone()); 10064 } 10065 if ($this.parents(".inc-search").length){ 10066 $target.parent().append($(".search-module:first form").clone().addClass("appended-search")); 10067 $target.parent().find("form.appended-search").wrap("<div class='search-module'></div>"); 10068 } 10069 10070 if ($target.find("li").length==0){ 10071 $this.parents(".mobile-menu").hide(); 10072 } 10073 $target.find("> li > a").removeAttr("style"); 10074 popupReady(); 10075 } 10076 setTimeout(function () { 10077 10078 // $("body").addClass("mobile-menu-animating-"+revealDirection+" mobile-menu-revealing-"+revealDirection); 10079 10080 }, 10); 10081 $("#mobile-menu-behind ul ul").each(function(){ 10082 $(this).parent().addClass("withHiddenNav").append("<div class='showSubMenu'></div>"); 10083 }); 10084 $(".showSubMenu").click(function(){ 10085 // $(this).parent().toggleClass("showingSubMenu"); 10086 return false;
10087 }); 10088 } 10089 return false; 10090 }); 10091 10092 } 10093 function moduleHeights (replace) { 10094 if (typeof replace == 'undefined'){ 10095 var replace = true; 10096 } 10097 10098 $(".widget-banner-window-height").each(function(){ 10099 var wh = $(window).height(); 10100 10101 $('.banner-feature',$(this)).css('min-height',wh+"px"); 10102 }); 10103 $(".vertical-align .column").css("padding-top","0px"); 10104 $(".vertical-align").each(function(){ 10105 var tallest = 0; 10106 $(".column",$(this)).each(function(){ 10107 if ($(this).height()>tallest) { 10108 tallest = $(this).height(); 10109 } 10110 }); 10111 $(".column",$(this)).each(function(){ 10112 if ($(this).height()<tallest) { 10113 var pt = tallest - $(this).height(); 10114 pt = pt / 2; 10115 $(this).css('padding-top',pt+'px'); 10116 } 10117 }); 10118 10119 }); 10120 10121 $(".row:visible:not(.mobile-menu-row,.flexibreak-small .row),.fill-row:visible").each(function(){ 10122 // calculate row height 10123 var r= 0; 10124 var rowhl = 0; 10125 var rowhr = 0; 10126 var subrowh=0; 10127 var firstrow=true; 10128 var wrapperspace = 0; 10129 if ($("> *:not(.module)",$(this)).length) { 10130 wrapperspace = 10131 parseFloat($("> *:not(.module)",$(this)).css("padding-top")) 10132 + parseFloat($("> *:not(.module)",$(this)).css("margin-top")) 10133 + parseFloat($("> *:not(.module)",$(this)).css("border-top-width")) 10134 + parseFloat($("> *:not(.module)",$(this)).css("padding-bottom")) 10135 + parseFloat($("> *:not(.module)",$(this)).css("margin-bottom")) 10136 + parseFloat($("> *:not(.module)",$(this)).css("border-bottom-width")) 10137 ; 10138 rowhl = wrapperspace; 10139 } 10140 $(this).find(".banner-feature").removeAttr("style"); 10141 $(".module",$(this)).each(function(){ 10142 if ($(this).outerHeight(true)>rowhl) { 10143 rowhl = $(this).outerHeight(true); 10144 } 10145 }); 10146 rowhl = rowhl+subrowh; 10147 10148 $(".align-left:not(.valign),.align-:not(.valign)",$(this)).each(function(){ 10149 if ($(this).hasClass("clear-left") || firstrow) { 10150 firstrow = false; 10151 subrowh = subrowh+$(this).outerHeight(true); 10152 10153 } else { 10154 if ($(this).outerHeight(true)>subrowh) { 10155 subrowh=$(this).outerHeight(true); 10156 } 10157 } 10158 }); 10159 if (subrowh>rowhl) { 10160 rowhl = subrowh; 10161 } 10162 subrowh=0; 10163 firstrow=true; 10164 $(".align-right:not(.valign)",$(this)).each(function(){ 10165 10166 if ($(this).hasClass("clear-right") || firstrow) { 10167 firstrow=false 10168 subrowh = subrowh+$(this).outerHeight(true); 10169 } else { 10170 if ($(this).outerHeight(true)>subrowh) { 10171 subrowh=$(this).outerHeight(true); 10172 } 10173 } 10174 10175 rowhr = rowhr+subrowh; 10176 10177 }); 10178 10179 subrowh=0; 10180 firstrow=true; 10181 $(".align-center",$(this)).each(function(){ 10182 if (!$(this).next().length&&!$(this).prev().length) { 10183 subrowh = $(this).outerHeight(true); 10184 } 10185 rowhr = rowhr+subrowh; 10186 if ($(this).outerHeight(true)>rowhr) { 10187 rowhr=$(this).outerHeight(true); 10188 } 10189 10190 }); 10191 10192 10193 $(".align-justify",$(this)).each(function(){ 10194 10195 if (!$(this).hasClass("clear-right")) { 10196 if ($(this).prev().hasClass("align-right")) { 10197 if ($(this).prev().hasClass("clear-right")) { 10198 var oldrow = $(this).prev().outerHeight(true); 10199 } else { 10200 var oldrow = 0; 10201 $(this).prevUntil(".clear-right",".align-right").each(function(){ 10202 if ($(this).outerHeight(true)>oldrow) { 10203 oldrow = $(this).outerHeight(true); 10204 } 10205 }); 10206 } 10207 if ($(this).outerHeight(true) > oldrow) { 10208 rowhr = rowhr-oldrow; 10209 rowhr = rowhr+$(this).outerHeight(true); 10210 } 10211 } 10212 if (!$(this).next().length&&!$(this).prev().length) { 10213 rowhr = rowhr+$(this).outerHeight(true); 10214 } 10215 } 10216 10217 10218 if (!$(this).hasClass("clear-left")) { 10219 if ($(this).prev().hasClass("align-left")) { 10220 if ($(this).prev().hasClass("clear-left")) { 10221 var oldrow = $(this).prev().outerHeight(true); 10222 } else { 10223 var oldrow = 0; 10224 $(this).prevUntil(".clear-left",".align-left").each(function(){ 10225 if ($(this).outerHeight(true)>oldrow) { 10226 oldrow = $(this).outerHeight(true); 10227 } 10228 }); 10229 } 10230 if ($(this).outerHeight(true) > oldrow) { 10231 rowhl = rowhl-oldrow; 10232 rowhl = rowhl+$(this).outerHeight(true); 10233 } 10234 } 10235 } 10236 10237 10238 }); 10239 10240 10241 var wh = 0; 10242 $(".width",$(this)).each(function(){ 10243 if ($(this).hasClass("width-valign-middle")||$(this).hasClass("width-valign-bottom")) { 10244 if ($(this).find("> div").outerHeight(true)>wh) { 10245 wh=$(this).find("> div").outerHeight(true); 10246 } 10247 10248 } else { 10249 if ($(this).outerHeight(true)>wh) { 10250 wh=$(this).outerHeight(true); 10251 } 10252 10253 } 10254 }); 10255 $(".width",$(this)).css("height",wh+"px"); 10256 10257 10258 10259 if (rowhl>rowhr) { 10260 var r = rowhl; 10261 } else { 10262 var r = rowhr; 10263 } 10264 10265 if (wh > r) { 10266 r = wh; 10267 } 10268 10269 $(this).css("height",r+"px"); 10270 10271 appendCustomStyle($(this).attr("id"),"row","height",r,replace); 10272 /* 10273 if (typeof $(this).attr("id") != "undefined"){ 10274 if (customstyle["fb1"][$(this).attr("id")]===undefined && 10275 customstyle["rs1"][$(this).attr("id")]===undefined) { 10276 customstyle["default_row_height"][$(this).attr("id")]=r; 10277 } 10278 if (customstyle["fb2"][$(this).attr("id")]===undefined) { 10279 customstyle["row_height_fb1"][$(this).attr("id")]=r; 10280 } 10281 if (customstyle["fb3"][$(this).attr("id")]===undefined) { 10282 customstyle["row_height_fb2"][$(this).attr("id")]=r; 10283 } 10284 if (customstyle["fb3"][$(this).attr("id")]!==undefined) { 10285 customstyle["row_height_fb3"][$(this).attr("id")]=r; 10286 } 10287 if (customstyle["rs2"][$(this).attr("id")]===undefined) { 10288 customstyle["row_height_rs1"][$(this).attr("id")]=r; 10289 } 10290 if (customstyle["rs3"][$(this).attr("id")]===undefined) { 10291 customstyle["row_height_rs2"][$(this).attr("id")]=r; 10292 } 10293 if (customstyle["rs3"][$(this).attr("id")]!==undefined) { 10294 customstyle["row_height_rs3"][$(this).attr("id")]=r; 10295 } 10296 } 10297 */ 10298 10299 10300 if (typeof $(this).data("min-height")!='undefined') { 10301 $(this).css('height','auto'); 10302 10303 10304 if ($(this).data("min-height")=="window") { 10305 var wh = $(window).height(); 10306 } else { 10307 var wh = parseFloat($(this).data("min-height")); 10308 if ($(this).data("scale-prop")) { 10309 var ratio = 1000 / wh; 10310 wh = $(window).width() / ratio; 10311 } 10312 } 10313 10314 var p = wh / 2; 10315 var pt = p - r/2; 10316 var pb = p - r/2; 10317 var deduct = parseFloat($(this).parent(".container").css("padding-top")) + parseFloat($(this).parent(".container").css("border-top-width")) + parseFloat($(this).css("margin-top")); 10318 10319 pt = pt - deduct; 10320 pb = pb - deduct; 10321 if (pt>0&&pb>0) { 10322 //if (pb>r) { 10323 if ($(this).find(".banner-feature").length){ 10324 $(this).find(".banner-feature").css("padding-top",pt+"px").css("padding-bottom",pb+"px"); 10325 } else { 10326 $(this).css("padding-top",pt+"px").css("padding-bottom",pb+"px"); 10327 } 10328 //} else { 10329 // $(this).css("padding-top","0px").css("padding-bottom","0px"); 10330 //} 10331 10332 } else { 10333 $(this).css("padding-top","0px").css("padding-bottom","0px"); 10334 } 10335 } 10336 $(".width-valign-middle").each(function(){ 10337 var t = $(this).find("> div,> ul").height() / 2; 10338 $(this).find("> *").css("margin-bottom","-"+t+'px'); 10339 }); 10340 10341 }); 10342 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 10343 10344 } 10345 function setFixedHeader() { 10346 if ($("body").hasClass("with-fixed-header")) { 10347 if ($("#all_headers_bg").length) { 10348 var $header = $("#all_headers_bg"); 10349 } else { 10350 var $header = $("#header"); 10351 } 10352 10353 if (!$("body").hasClass("fixed-type-1")){ 10354 $("body").css("padding-top","0px"); 10355 } 10356 $header.css({position:"relative"}); 10357 var targeth = $header.height()*1.2; 10358 if ($(window).height()>targeth) { 10359 if (!$("body").hasClass("fixed-type-1")){ 10360 if ($("body").hasClass("is_admin")){ 10361 var t = "36px"; 10362 } else { 10363 var t = "0px"; 10364 } 10365 $header.css({top:t,left:"0px",right:"0px",position:"fixed"}); 10366 } 10367 toscroll = 1; 10368 if (!$("body").hasClass("skip-padding")) { 10369 10370 $("#header .container.hide-in-fixed").each(function(){ 10371 $(this).addClass("no-animate"); 10372 $(this).css("max-height","2000px"); 10373 $(this).css("max-height",$(this).outerHeight()+"px"); 10374 $(this).removeClass("no-animate"); 10375 toscroll = toscroll + $(this).outerHeight(); 10376 }); 10377 $("#header .container:not(.hide-in-fixed)").each(function(){ 10378 $(this).data("ot",$(this).offset().top); 10379 if ($(".logo-module.with-fixed-logo-version",$(this)).length) { 10380 toscroll = toscroll + $(this).outerHeight()/2; 10381 } 10382 }); 10383 var headerHeight = $header.outerHeight(); 10384 10385 if (!$("body").hasClass("fixed-type-1")){ 10386 $("body").css("padding-top",headerHeight+"px"); 10387 } 10388 10389 $('body').addClass('header-calculated'); 10390 10391 } 10392 } 10393 } 10394 if ($("body").hasClass("header-no-height")) { 10395 if ($("#all_headers_bg").length) { 10396 var $header = $("#all_headers_bg"); 10397 } else { 10398 var $header = $("#header"); 10399 } 10400 $header.addClass("no-height"); 10401 } 10402 if ($("body").hasClass("header-fixed-behind")) { 10403 if ($("#all_headers_bg").length) { 10404 var $header = $("#all_headers_bg"); 10405 } else { 10406 var $header = $("#header"); 10407 } 10408 $("body").css("padding-top",$header.outerHeight()+"px"); 10409 } 10410 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 10411 } 10412 var toscroll = 1; 10413 function fixedHeaderScroll() { 10414 if (!$('body').hasClass('header-calculated')&&$('body').hasClass('with-fixed-header')&&!$('body').hasClass('skip-padding')){ 10415 return true; 10416 } 10417 if ($("#all_headers_bg").length) { 10418 var $header = $("#all_headers_bg"); 10419 } else { 10420 var $header = $("#header"); 10421 } 10422 10423 var targeth = $header.height()*1.2; 10424 10425 if ($("body").hasClass("with-fixed-header") && $(window).height()>targeth) { 10426 var t = $(document).scrollTop(); 10427 if ($("body").hasClass("fixed-type-1")){ 10428 var adds = parseInt($("body").css("padding-top")); 10429 var pt = adds; 10430 $("#header .container:not(.hide-in-fixed)").each(function(){ 10431 var ot = $(this).data("ot")-pt; 10432 if (t>ot-adds+pt){ 10433 $(this).css({top:adds+"px",left:"0px",right:"0px",position:"fixed"}); 10434 $(this).addClass("pinned-header-row"); 10435 if (!$(this).next(".fixed-header-placeholder").length){ 10436 $(this).after("<div class='fixed-header-placeholder' style='height:"+$(this).outerHeight()+"px'></div>"); 10437 } 10438 adds+=$(this).outerHeight(); 10439 } else { 10440 $(this).removeClass("pinned-header-row"); 10441 $(this).removeAttr("style"); 10442 $(this).next(".fixed-header-placeholder").remove(); 10443 } 10444 }); 10445 adds+=20; 10446 $(".sticky-column-sidebar").css("top",adds+"px"); 10447 10448 } else { 10449 if (t > toscroll) { 10450 if (!$('body').hasClass('showing-fixed-header')){ 10451 $("body").addClass("showing-fixed-header"); 10452 // modules(); 10453 } 10454 setTimeout(function () { 10455 $(".backstretch").each(function(){ 10456 var instance = $(this).parent().data("backstretch"); 10457 instance.resize(); 10458 }); 10459 }, 650); 10460 $(".logo-module.with-fixed-logo-version").each(function(){ 10461 $("img",$(this)).attr("width",$(this).data("logo-fixed-width")).attr("height",$(this).data("logo-fixed-height")); 10462 var $t = $(this); 10463 setTimeout(function () { 10464 $("img",$t).attr("src",$t.data("logo-fixed-img")); 10465 }, 1); 10466 10467 }); 10468 var miniHeaderSpace = $("#header").height(); 10469 if ($(window).width()>800) { 10470 $(".sticky-column-sidebar").css("top",miniHeaderSpace+"px"); 10471 } 10472 10473 } else { 10474 if ($('body').hasClass('showing-fixed-header')){ 10475 $("body").removeClass("showing-fixed-header"); 10476 $('.hide-in-fixed').removeAttr('style'); 10477 // modules(); 10478 } 10479 setTimeout(function () { 10480 $(".backstretch").each(function(){ 10481 var instance = $(this).parent().data("backstretch"); 10482 instance.resize(); 10483 }); 10484 }, 650); 10485 $(".logo-module.with-fixed-logo-version").each(function(){ 10486 $("img",$(this)).attr("width",$(this).data("norm-width")).attr("height",$(this).data("norm-height")); 10487 var $t = $(this); 10488 setTimeout(function () { 10489 $("img",$t).attr("src",$t.data("logo-normal-img")); 10490 }, 1); 10491 10492 }); 10493 if ($(window).width()>800) { 10494 10495 $(".sticky-column-sidebar").height($(".sticky-sidebar-inner").outerHeight()+"px"); 10496 } 10497 } 10498 } 10499 if ($(".logo-module.with-fixed-logo-version").length) { 10500 setTimeout(function () { 10501 moduleHeights(); 10502 }, 50); 10503 } 10504 }; 10505 } 10506 function checkMobileMenuHeights() { 10507 if ($("#mobile-menu-page-wrap").length) { 10508 var ept = parseInt($("#mobile-menu-page-wrap").css("padding-top")); 10509 //var npt = parseInt($("body").css("padding-top")) + ept; 10510 var npt = ept; 10511 if ($("#mobile-menu-page-wrap").height()<$(window).height()) { 10512 $("#mobile-menu-page-wrap").css("min-height",$(window).height()+"px").css("padding-top",npt+"px"); 10513 } 10514 if ($("#mobile-menu-behind").height()<$(window).height()) { 10515 $("#mobile-menu-behind").css("min-height",$(window).height()+"px").css("padding-top",npt+"px"); 10516 } 10517 } 10518 } 10519 function modules($scope,replace) { 10520 if (!findBreakpoints&&$("body").hasClass("breakpoints")){ 10521 return false;
10522 } 10523 if (typeof $scope == 'undefined'){ 10524 var $scope = $('body'); 10525 } 10526 if (typeof replace == 'undefined'){ 10527 var replace = replace; 10528 } 10529 $(".align-center:visible:not(.width)",$scope).each(function(){ 10530 var $t = $(this); 10531 var l = $t.css("left"); 10532 var r = $t.css("right"); 10533 $t.css({opacity:1,float:"left",width:"auto",right:"auto",left:"auto"}); 10534 setTimeout(function(){ 10535 var w = $t.outerWidth()+10; 10536 $t.css({width:w+"px",float:"none",opacity:1,left:l,right:r}); 10537 appendCustomStyle($scope.attr("id"),"w",$t.data("position"),w,replace); 10538 appendCustomStyle($scope.attr("id"),"pl",$t.data("position"),l,replace); 10539 appendCustomStyle($scope.attr("id"),"pr",$t.data("position"),r,replace); 10540 },10); 10541 10542 }); 10543 $(".valign-middle:not(.width,.align-center)",$scope).each(function(){ 10544 var t = $(this).height() / 2; 10545 $(this).css("margin-bottom","-"+t+'px'); 10546 appendCustomStyle($scope.attr("id"),"mb",$(this).data("position"),t,replace); 10547 }); 10548 $(".align-center.valign-middle.nav",$scope).each(function(){ 10549 var t = $(this).find("li:first").height() / 2; 10550 $(this).find("li:not(#nav-logo)").css("top","-"+t+'px'); 10551 appendCustomStyle($scope.attr("id"),"t",$(this).data("position"),t,replace); 10552 }); 10553 if ($scope.hasClass("row")){ 10554 var $rows=$scope; 10555 }else{ 10556 var $rows=$(".row:visible",$scope); 10557 } 10558 //$(".row:visible",$scope).each(function(){ 10559 $rows.each(function(){ 10560 if (!$(this).is(":visible")){ 10561 return true; 10562 } 10563 var $row = $(this); 10564 $row.css("height","auto"); 10565 $(".width",$(this)).css("height","auto"); 10566 10567 // Loop through all valign-bottom align-right clear-right items and adjust the bottom position so they stack. 10568 var offset =0 10569 var $els = $($(".valign-bottom.clear-right",$(this)).get().reverse()); 10570 $els.each(function(){ 10571 $(this).css("bottom",offset+"px"); 10572 offset=offset+$(this).outerHeight(true); 10573 });
10574 if ($els.last().hasClass("valign-bottom")) { 10575 $els.last().prevUntil(":not(.align-right,.align-justify),.clear-right",".valign-bottom.align-right").css("bottom",offset+"px"); 10576 } 10577 10578 // Loop through all valign-bottom align-left clear-left items and adjust the bottom position so they stack. 10579 var offset =0 10580 var $els = $($(".valign-bottom.clear-left",$(this)).get().reverse()); 10581 $els.each(function(){ 10582 $(this).css("bottom",offset+"px"); 10583 offset=offset+$(this).outerHeight(true); 10584 }); 10585 if ($els.last().prev().hasClass("valign-bottom")) { 10586 $els.last().prevUntil(":not(.align-left,.align-justify),.clear-left",".valign-bottom.align-left").css("bottom",offset+"px"); 10587 } 10588 10589 // Loop through all valign-top align-right clear-right items and adjust the top position so they stack. 10590 var offset =0 10591 var $els = $($(".valign-top.clear-right",$(this)).get()); 10592 $els.each(function(){ 10593 $(this).css("top",offset+"px"); 10594 offset=offset+$(this).outerHeight(true); 10595 }); 10596 if ($els.last().hasClass("valign-top")) { 10597 $els.last().prevUntil(":not(.align-right,.align-justify),.clear-right",".valign-top.align-right").css("top",offset+"px"); 10598 } 10599 10600 // Loop through all valign-top align-left clear-left items and adjust the top position so they stack. 10601 var offset =0 10602 var $els = $($(".valign-top.clear-left",$(this)).get()); 10603 $els.each(function(){ 10604 $(this).css("top",offset+"px"); 10605 offset=offset+$(this).outerHeight(true); 10606 });
10607 if ($els.last().prev().hasClass("valign-top")) { 10608 $els.last().prevUntil(":not(.align-left,.align-justify),.clear-left",".valign-top.align-left").css("top",offset+"px"); 10609 } 10610 10611 10612 10613 10614 // Go through valign-top align-right items and adjust right position so they sit on the same row 10615 var widths = parseFloat($(".valign-top.align-right",$(this)).css("right")); 10616 $(".valign-top.align-right",$(this)).each(function(){ 10617 widths = widths+$(this).outerWidth(true); 10618 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-top.align-right").length) { 10619 $(this).next().css("right",widths+"px"); 10620 appendCustomStyle($scope.attr("id"),"pr",$(this).next().data("position"),widths,replace); 10621 } 10622 10623 }); 10624 10625 // Go through valign-middle align-right items and adjust right position so they sit on the same row 10626 var widths = parseFloat($(".valign-middle.align-right",$(this)).css("right")); 10627 $(".valign-middle.align-right",$(this)).each(function(){ 10628 widths = widths+$(this).outerWidth(true); 10629 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-middle.align-right").length) { 10630 $(this).next().css("right",widths+"px"); 10631 appendCustomStyle($scope.attr("id"),"pr",$(this).next().data("position"),widths,replace); 10632 } 10633 10634 }); 10635 10636 // Go through valign-bottom align-right items and adjust right position so they sit on the same row 10637 var widths = parseFloat($(".valign-bottom.align-right",$(this)).css("right")); 10638 $(".valign-bottom.align-right",$(this)).each(function(){ 10639 widths = widths+$(this).outerWidth(true); 10640 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-bottom.align-right").length) { 10641 $(this).next().css("right",widths+"px"); 10642 appendCustomStyle($scope.attr("id"),"pr",$(this).next().data("position"),widths,replace); 10643 } 10644 10645 }); 10646 10647 // Go through valign-bottom align-left items and adjust right position so they sit on the same row 10648 var widths = parseFloat($(".valign-bottom.align-left",$(this)).css("left")); 10649 $(".valign-bottom.align-left",$(this)).each(function(){ 10650 widths = widths+$(this).outerWidth(true); 10651 if (!$(this).next().hasClass("clear-left") && $(this).next(".valign-bottom.align-left").length) { 10652 $(this).next().css("left",widths+"px"); 10653 appendCustomStyle($scope.attr("id"),"pl",$(this).next().data("position"),widths,replace); 10654 } 10655 10656 }); 10657 10658 // Go through valign-middle align-left items and adjust right position so they sit on the same row 10659 var widths = parseFloat($(".valign-.align-left:not(.valign-top,.valign-middle,.valign-bottom)",$(this)).css("left")); 10660 $(".valign-.align-left:not(.valign-top,.valign-middle,.valign-bottom)",$(this)).each(function(){ 10661 widths = widths+$(this).outerWidth(true); 10662 if (!$(this).next().hasClass("clear-left") && $(this).next(".valign-middle.align-left").length) { 10663 $(this).next().css("left",widths+"px"); 10664 appendCustomStyle($scope.attr("id"),"pl",$(this).next().data("position"),widths,replace); 10665 } 10666 10667 }); 10668 10669 // Go through valign-middle align-left items and adjust right position so they sit on the same row 10670 var widths = parseFloat($(".valign-middle.align-left",$(this)).css("left")); 10671 $(".valign-middle.align-left",$(this)).each(function(){ 10672 widths = widths+$(this).outerWidth(true); 10673 if (!$(this).next().hasClass("clear-left") && $(this).next(".valign-middle.align-left").length) { 10674 $(this).next().css("left",widths+"px"); 10675 appendCustomStyle($scope.attr("id"),"pl",$(this).next().data("position"),widths,replace); 10676 } 10677 10678 }); 10679 10680 // Go through valign-middle align-right items and adjust right position so they sit on the same row 10681 var widths = parseFloat($(".valign-middle.align-right",$(this)).css("right")); 10682 $(".valign-middle.align-right",$(this)).each(function(){ 10683 widths = widths+$(this).outerWidth(true); 10684 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-middle.align-right").length) { 10685 $(this).next().css("right",widths+"px"); 10686 appendCustomStyle($scope.attr("id"),"pr",$(this).next().data("position"),widths,replace); 10687 } 10688 }); 10689 10690 10691 // Go through valign-top align-left items and adjust right position so they sit on the same row 10692 var widths = parseFloat($(".valign-top.align-left",$(this)).css("left")); 10693 $(".valign-top.align-left",$(this)).each(function(){ 10694 widths = widths+$(this).outerWidth(true); 10695 if (!$(this).next().hasClass("clear-left") && $(this).next(".valign-top.align-left").length) { 10696 $(this).next().css("left",widths+"px"); 10697 appendCustomStyle($scope.attr("id"),"pl",$(this).next().data("position"),widths,replace); 10698 } 10699 10700 }); 10701 10702 10703 // Go through valign-top align-right items and adjust right position so they sit on the same row 10704 var widths = parseFloat($(".valign-top.align-right",$(this)).css("right")); 10705 $(".valign-top.align-right",$(this)).each(function(){ 10706 widths = widths+$(this).outerWidth(true); 10707 if (!$(this).next().hasClass("clear-right") && $(this).next(".valign-top.align-right").length) { 10708 $(this).next().css("right",widths+"px"); 10709 appendCustomStyle($scope.attr("id"),"pr",$(this).next().data("position"),widths,replace); 10710 } 10711 10712 }); 10713
10714 // Check any valign-middle or valign-bottom justify items to make sure they they don't overlap left aligned items. 10715 var leftedge = 20; 10716 $(".align-left,.align-",$(this)).each(function(){ 10717 var rightedge = $(this).outerWidth(true) + $(this).position().left; 10718 if (rightedge>leftedge) { 10719 leftedge =rightedge; 10720 } 10721 }); 10722 /* 10723 $(".valign-bottom.align-justify,.valign-middle.align-justify,.valign-top.align-justify",$(this)).each(function(){ 10724 $(this).css("left",leftedge+"px"); 10725 appendCustomStyle($scope.attr("id"),"pl",$(this).data("position"),leftedge,replace); 10726 }); 10727 */ 10728 10729 10730 10731 }); 10732 10733 /* 10734 $(".module.align-justify.style-equal",$scope).each(function(){ 10735 var $lis = $("> * > *",$(this)); 10736 var n = $lis.length; 10737 var space = n * 10 - 10; 10738 var width = ($(this).width() - space) / n; 10739 width = Math.floor(width); 10740 $lis.css("width",width+"px"); 10741 }); 10742 $(".module.align-justify:not(.style-equal,.style-space)",$scope).each(function(){ 10743 var w = $(this).innerWidth(); 10744 var ews = 0; 10745 var $m = $(this); 10746 $("> * >*",$(this)).each(function(){ 10747 if ($("> a",$(this)).length) { 10748 var $el = $(">a",$(this)); 10749 var incOuter = true; 10750 } else { 10751 var $el = $(this); 10752 var incOuter = false; 10753 } 10754 if (typeof $m.attr("padding-left") == 'undefined') { 10755 $m.attr("padding-left",$el.css("padding-left")); 10756 $m.attr("padding-right",$el.css("padding-right")); 10757 } 10758 10759 $el.css("padding-left","0px").css("padding-right","0px"); 10760 if (incOuter) { 10761 var ew = $el.parent().outerWidth(true); 10762 } else { 10763 var ew = $el.outerWidth(true); 10764 } 10765 10766 ews = ews+ew; 10767 }); 10768 var d = w - ews - 2; 10769 var c = $("> * > *",$(this)).length; 10770 var p = d/c; 10771 p = p/2; 10772 10773 $("> * > *",$(this)).each(function(){ 10774 if ($("> a",$(this)).length) { 10775 var $el = $(">a",$(this)); 10776 } else { 10777 var $el = $(this); 10778 } 10779 10780 if (p<parseFloat($m.attr("padding-right"))) { 10781 $el.css({"padding-left":$m.attr("padding-left"),"padding-right":$m.attr("padding-right")}); 10782 } else { 10783 $el.css({"padding-left":p+"px","padding-right":p+"px"}); 10784 } 10785 }); 10786 }); 10787 */ 10788 $(".nav.valign-bottom.logo-first,.nav.valign-middle.logo-first,.nav.valign-bottom.logo-last,.nav.valign-middle.logo-last,.nav.with-middle-logo",$scope).each(function(){ 10789 $(">ul>li:not(#nav-logo)",$(this)).css("margin-top","0px"); 10790 var th = $("> ul > li#nav-logo",$(this)).outerHeight(); 10791 var $t = $(this); 10792 $(">ul>li:not(#nav-logo)",$(this)).each(function(){ 10793 var h = $(">a,>form",$(this)).outerHeight(); 10794 var mt = th-h;
10795 if ($t.hasClass("valign-middle")||$t.hasClass("with-middle-logo")) { 10796 mt = mt/2; 10797 } 10798 $(this).css("margin-top",mt+"px"); 10799 }); 10800 10801 }); 10802 10803 10804 10805 } 10806 function testFlexiBreak($container) { 10807 10808 var offset = 0; 10809 var ok = true; 10810 if ($container.hasClass("contains-text")) { 10811 var offset = $("> li",$container).offset().top; 10812 10813 $("> li:not(#nav-logo)",$container).each(function(){ 10814 if ($(this).offset().top!=offset) { 10815 ok = false; 10816 } 10817 }); 10818 } 10819 10820 if ($container.parent().hasClass("align-justify") && $container.parent().hasClass("style-equal")) { 10821 $(".tfb").contents().unwrap(); 10822 10823 $("> li > a",$container).wrapInner("<span class='tfb'>"); 10824 10825 $('.tfb').each(function(){ 10826 var outer = $(this).parent().width() - (parseInt($(this).parent().css("padding-left"))+parseInt($(this).parent().css("padding-right"))); 10827 10828 if ($(this).width()>outer) { 10829 ok = false; 10830 } 10831 }); 10832 10833 } 10834 10835 if (!$container.hasClass("allow-line-breaks")) { 10836 var h = $("> li:not(#nav-search,#nav-basket,#nav-logo) > a",$container).first().height(); 10837 $("> li:gt(0):not(#nav-search,#nav-basket,#nav-logo) > a",$container).each(function(){ 10838 if ($(this).height()!=h) { 10839 ok=false; 10840 } 10841 }); 10842 } 10843 10844 return ok; 10845 } 10846 var testWidth=3560; 10847 var maxTestWidth=3560; 10848 var minTestWidth=320; 10849 var customstyle={}; 10850 customstyle["default_row_height"]={}; 10851 customstyle["row_height_fb1"]={}; 10852 customstyle["row_height_fb2"]={}; 10853 customstyle["row_height_fb3"]={}; 10854 customstyle["row_height_rs1"]={}; 10855 customstyle["row_height_rs2"]={}; 10856 customstyle["row_height_rs3"]={}; 10857 10858 customstyle["mb_left_default"]={}; 10859 customstyle["mb_left_fb1"]={}; 10860 customstyle["mb_left_fb2"]={}; 10861 customstyle["mb_left_fb3"]={}; 10862 customstyle["mb_left_rs1"]={}; 10863 customstyle["mb_left_rs2"]={}; 10864 customstyle["mb_left_rs3"]={}; 10865 10866 customstyle["mb_left2_default"]={}; 10867 customstyle["mb_left2_fb1"]={}; 10868 customstyle["mb_left2_fb2"]={}; 10869 customstyle["mb_left2_fb3"]={}; 10870 customstyle["mb_left2_rs1"]={}; 10871 customstyle["mb_left2_rs2"]={}; 10872 customstyle["mb_left2_rs3"]={}; 10873 10874 customstyle["mb_right_default"]={}; 10875 customstyle["mb_right_fb1"]={}; 10876 customstyle["mb_right_fb2"]={}; 10877 customstyle["mb_right_fb3"]={}; 10878 customstyle["mb_right_rs1"]={}; 10879 customstyle["mb_right_rs2"]={}; 10880 customstyle["mb_right_rs3"]={}; 10881 10882 customstyle["mb_right2_default"]={}; 10883 customstyle["mb_right2_fb1"]={}; 10884 customstyle["mb_right2_fb2"]={}; 10885 customstyle["mb_right2_fb3"]={}; 10886 customstyle["mb_right2_rs1"]={}; 10887 customstyle["mb_right2_rs2"]={}; 10888 customstyle["mb_right2_rs3"]={}; 10889 10890 customstyle["mb_centered_default"]={}; 10891 customstyle["mb_centered_fb1"]={}; 10892 customstyle["mb_centered_fb2"]={}; 10893 customstyle["mb_centered_fb3"]={}; 10894 customstyle["mb_centered_rs1"]={}; 10895 customstyle["mb_centered_rs2"]={}; 10896 customstyle["mb_centered_rs3"]={}; 10897 10898 customstyle["pl_left_default"]={}; 10899 customstyle["pl_left_fb1"]={}; 10900 customstyle["pl_left_fb2"]={}; 10901 customstyle["pl_left_fb3"]={}; 10902 customstyle["pl_left_rs1"]={}; 10903 customstyle["pl_left_rs2"]={}; 10904 customstyle["pl_left_rs3"]={}; 10905 10906 customstyle["pl_left2_default"]={}; 10907 customstyle["pl_left2_fb1"]={}; 10908 customstyle["pl_left2_fb2"]={}; 10909 customstyle["pl_left2_fb3"]={}; 10910 customstyle["pl_left2_rs1"]={}; 10911 customstyle["pl_left2_rs2"]={}; 10912 customstyle["pl_left2_rs3"]={}; 10913 10914 customstyle["pl_right_default"]={}; 10915 customstyle["pl_right_fb1"]={}; 10916 customstyle["pl_right_fb2"]={}; 10917 customstyle["pl_right_fb3"]={}; 10918 customstyle["pl_right_rs1"]={}; 10919 customstyle["pl_right_rs2"]={}; 10920 customstyle["pl_right_rs3"]={}; 10921 10922 customstyle["pl_right2_default"]={}; 10923 customstyle["pl_right2_fb1"]={}; 10924 customstyle["pl_right2_fb2"]={}; 10925 customstyle["pl_right2_fb3"]={}; 10926 customstyle["pl_right2_rs1"]={}; 10927 customstyle["pl_right2_rs2"]={}; 10928 customstyle["pl_right2_rs3"]={}; 10929 10930 customstyle["pl_centered_default"]={}; 10931 customstyle["pl_centered_fb1"]={}; 10932 customstyle["pl_centered_fb2"]={}; 10933 customstyle["pl_centered_fb3"]={}; 10934 customstyle["pl_centered_rs1"]={}; 10935 customstyle["pl_centered_rs2"]={}; 10936 customstyle["pl_centered_rs3"]={}; 10937 10938 customstyle["pr_left_default"]={}; 10939 customstyle["pr_left_fb1"]={}; 10940 customstyle["pr_left_fb2"]={}; 10941 customstyle["pr_left_fb3"]={}; 10942 customstyle["pr_left_rs1"]={}; 10943 customstyle["pr_left_rs2"]={}; 10944 customstyle["pr_left_rs3"]={}; 10945 10946 customstyle["pr_left2_default"]={}; 10947 customstyle["pr_left2_fb1"]={}; 10948 customstyle["pr_left2_fb2"]={}; 10949 customstyle["pr_left2_fb3"]={}; 10950 customstyle["pr_left2_rs1"]={}; 10951 customstyle["pr_left2_rs2"]={}; 10952 customstyle["pr_left2_rs3"]={}; 10953 10954 customstyle["pr_right_default"]={}; 10955 customstyle["pr_right_fb1"]={}; 10956 customstyle["pr_right_fb2"]={}; 10957 customstyle["pr_right_fb3"]={}; 10958 customstyle["pr_right_rs1"]={}; 10959 customstyle["pr_right_rs2"]={}; 10960 customstyle["pr_right_rs3"]={}; 10961 10962 customstyle["pr_right2_default"]={}; 10963 customstyle["pr_right2_fb1"]={}; 10964 customstyle["pr_right2_fb2"]={}; 10965 customstyle["pr_right2_fb3"]={}; 10966 customstyle["pr_right2_rs1"]={}; 10967 customstyle["pr_right2_rs2"]={}; 10968 customstyle["pr_right2_rs3"]={}; 10969 10970 customstyle["pr_centered_default"]={}; 10971 customstyle["pr_centered_fb1"]={}; 10972 customstyle["pr_centered_fb2"]={}; 10973 customstyle["pr_centered_fb3"]={}; 10974 customstyle["pr_centered_rs1"]={}; 10975 customstyle["pr_centered_rs2"]={}; 10976 customstyle["pr_centered_rs3"]={}; 10977 10978 customstyle["w_left_default"]={}; 10979 customstyle["w_left_fb1"]={}; 10980 customstyle["w_left_fb2"]={}; 10981 customstyle["w_left_fb3"]={}; 10982 customstyle["w_left_rs1"]={}; 10983 customstyle["w_left_rs2"]={}; 10984 customstyle["w_left_rs3"]={}; 10985 10986 customstyle["w_left2_default"]={}; 10987 customstyle["w_left2_fb1"]={}; 10988 customstyle["w_left2_fb2"]={}; 10989 customstyle["w_left2_fb3"]={}; 10990 customstyle["w_left2_rs1"]={}; 10991 customstyle["w_left2_rs2"]={}; 10992 customstyle["w_left2_rs3"]={}; 10993 10994 customstyle["w_right_default"]={}; 10995 customstyle["w_right_fb1"]={}; 10996 customstyle["w_right_fb2"]={}; 10997 customstyle["w_right_fb3"]={}; 10998 customstyle["w_right_rs1"]={}; 10999 customstyle["w_right_rs2"]={}; 11000 customstyle["w_right_rs3"]={}; 11001 11002 customstyle["w_right2_default"]={}; 11003 customstyle["w_right2_fb1"]={}; 11004 customstyle["w_right2_fb2"]={}; 11005 customstyle["w_right2_fb3"]={}; 11006 customstyle["w_right2_rs1"]={}; 11007 customstyle["w_right2_rs2"]={}; 11008 customstyle["w_right2_rs3"]={}; 11009 11010 customstyle["w_centered_default"]={}; 11011 customstyle["w_centered_fb1"]={}; 11012 customstyle["w_centered_fb2"]={}; 11013 customstyle["w_centered_fb3"]={}; 11014 customstyle["w_centered_rs1"]={}; 11015 customstyle["w_centered_rs2"]={}; 11016 customstyle["w_centered_rs3"]={}; 11017 11018 customstyle["t_left_default"]={}; 11019 customstyle["t_left_fb1"]={}; 11020 customstyle["t_left_fb2"]={}; 11021 customstyle["t_left_fb3"]={}; 11022 customstyle["t_left_rs1"]={}; 11023 customstyle["t_left_rs2"]={}; 11024 customstyle["t_left_rs3"]={}; 11025 11026 customstyle["t_left2_default"]={}; 11027 customstyle["t_left2_fb1"]={}; 11028 customstyle["t_left2_fb2"]={}; 11029 customstyle["t_left2_fb3"]={}; 11030 customstyle["t_left2_rs1"]={}; 11031 customstyle["t_left2_rs2"]={}; 11032 customstyle["t_left2_rs3"]={}; 11033 11034 customstyle["t_right_default"]={}; 11035 customstyle["t_right_fb1"]={}; 11036 customstyle["t_right_fb2"]={}; 11037 customstyle["t_right_fb3"]={}; 11038 customstyle["t_right_rs1"]={}; 11039 customstyle["t_right_rs2"]={}; 11040 customstyle["t_right_rs3"]={}; 11041 11042 customstyle["t_right2_default"]={}; 11043 customstyle["t_right2_fb1"]={}; 11044 customstyle["t_right2_fb2"]={}; 11045 customstyle["t_right2_fb3"]={}; 11046 customstyle["t_right2_rs1"]={}; 11047 customstyle["t_right2_rs2"]={}; 11048 customstyle["t_right2_rs3"]={}; 11049 11050 customstyle["t_centered_default"]={}; 11051 customstyle["t_centered_fb1"]={}; 11052 customstyle["t_centered_fb2"]={}; 11053 customstyle["t_centered_fb3"]={}; 11054 customstyle["t_centered_rs1"]={}; 11055 customstyle["t_centered_rs2"]={}; 11056 customstyle["t_centered_rs3"]={}; 11057 11058 customstyle["fb1"]={}; 11059 customstyle["fb2"]={}; 11060 customstyle["fb3"]={}; 11061 customstyle["rs1"]={}; 11062 customstyle["rs2"]={}; 11063 customstyle["rs3"]={}; 11064 customstyle["mm"]={}; 11065 function appendCustomStyle(id,type,pos,value,replace){ 11066 var rid = false;
11067 if (typeof id != "undefined"){ 11068 rid = id; 11069 } 11070 if (rid&&typeof pos!="undefined") { 11071 if (customstyle["fb1"][rid]===undefined && 11072 customstyle["rs1"][rid]===undefined) { 11073 if (customstyle[type+"_"+pos+"_default"]===undefined){ 11074 customstyle[type+"_"+pos+"_default"]={}; 11075 } 11076 if (customstyle[type+"_"+pos+"_default"][rid]===undefined||replace){ 11077 customstyle[type+"_"+pos+"_default"][rid]=value; 11078 } 11079 } 11080 if (customstyle["rs2"][rid]===undefined) { 11081 if (customstyle[type+"_"+pos+"_rs1"]===undefined){ 11082 customstyle[type+"_"+pos+"_rs1"]={}; 11083 } 11084 if (customstyle[type+"_"+pos+"_rs1"][rid]===undefined||replace){ 11085 customstyle[type+"_"+pos+"_rs1"][rid]=value; 11086 } 11087 } 11088 if (customstyle["rs3"][rid]===undefined) { 11089 if (customstyle[type+"_"+pos+"_rs2"]===undefined){ 11090 customstyle[type+"_"+pos+"_rs2"]={}; 11091 } 11092 if (customstyle[type+"_"+pos+"_rs2"][rid]===undefined||replace){ 11093 customstyle[type+"_"+pos+"_rs2"][rid]=value; 11094 } 11095 } 11096 if (customstyle["rs3"][rid]!==undefined) { 11097 if (customstyle[type+"_"+pos+"_rs3"]===undefined){ 11098 customstyle[type+"_"+pos+"_rs3"]={}; 11099 } 11100 if (customstyle[type+"_"+pos+"_rs3"][rid]===undefined||replace){ 11101 customstyle[type+"_"+pos+"_rs3"][rid]=value; 11102 } 11103 } 11104 if (customstyle["fb2"][rid]===undefined) { 11105 if (customstyle[type+"_"+pos+"_fb1"]===undefined){ 11106 customstyle[type+"_"+pos+"_fb1"]={}; 11107 } 11108 if (customstyle[type+"_"+pos+"_fb1"][rid]===undefined||replace){ 11109 customstyle[type+"_"+pos+"_fb1"][rid]=value; 11110 } 11111 } 11112 if (customstyle["fb3"][rid]===undefined) { 11113 if (customstyle[type+"_"+pos+"_fb2"]===undefined){ 11114 customstyle[type+"_"+pos+"_fb2"]={}; 11115 } 11116 if (customstyle[type+"_"+pos+"_fb2"][rid]===undefined||replace){ 11117 customstyle[type+"_"+pos+"_fb2"][rid]=value; 11118 } 11119 } 11120 if (customstyle["fb3"][rid]!==undefined) { 11121 if (customstyle[type+"_"+pos+"_fb3"]===undefined){ 11122 customstyle[type+"_"+pos+"_fb3"]={}; 11123 } 11124 if (customstyle[type+"_"+pos+"_fb3"][rid]===undefined||replace){ 11125 customstyle[type+"_"+pos+"_fb3"][rid]=value; 11126 } 11127 } 11128 } 11129 } 11130 function flexiBreak() { 11131 11132 if (!findBreakpoints&&$("body").hasClass("breakpoints")){ 11133 setTimeout(function () { 11134 moduleHeights(); 11135 setFixedHeader(); 11136 fixPropsHeights(); 11137 setTimeout(function () { 11138 prepMobileHeader(); 11139 11140 }, 200); 11141 }, 400); 11142 return false; 11143 } 11144 11145 $("body").removeClass("mobile-header-enabled"); 11146 if (findBreakpoints){ 11147 var total = maxTestWidth-320; 11148 var current = total-(testWidth-320); 11149 var pc = current/total*100; 11150 var of360=pc*360/100; 11151 if (of360<1){ 11152 of360=1; 11153 } 11154 if (of360>330){ 11155 of360=330; 11156 } 11157 11158 if (window.parent!=window.self){ 11159 window.parent.setBreakpointPC(of360); 11160 } 11161 if (navigator.userAgent.includes("Chrome")&&navigator.userAgent.includes("Macintosh")) { 11162 var minus=""; 11163 of360=360-of360; 11164 } else { 11165 var minus="-"; 11166 } 11167 $(".meter-1").css("stroke-dashoffset",minus+of360); 11168 var realTest = testWidth-60; 11169 $("html,body").css("width",testWidth+"px"); 11170 $("body").addClass("calculatingBreakpoints"); 11171 $("body > *:not(.breakpointload,#editInCMS)").css("width",realTest+"px"); 11172 } 11173 11174 $(".flexibreak-big").each(function(){ 11175 var ok = true; 11176 var fb = false; 11177 var forceMobile=false; 11178 if ($("body").hasClass("hamburger-on")&&$("> .nav",$(this)).length){ 11179 forceMobile=true; 11180 ok=false; 11181 } 11182 if ($(".flexibreak-container",$(this)).length) { 11183 var $container = $(".flexibreak-container",$(this)); 11184 $container.removeClass("flexibreak1 flexibreak2 flexibreak3"); 11185 fb=true; 11186 } 11187 var $row = $(this); 11188 $row.removeClass("rowscale1 rowscale2 rowscale3"); 11189 11190 $row.show(); 11191 $("#"+$row.data("flexibreak-small")).hide(); 11192 11193 modules($(this)); 11194 if (fb) { 11195 if (!testFlexiBreak($container)) { 11196 $container.addClass("flexibreak1"); 11197 if (customstyle["fb1"][$(this).attr("id")]===undefined) { 11198 customstyle["fb1"][$(this).attr("id")]=testWidth; 11199 } 11200 if (!testFlexiBreak($container)) { 11201 $container.removeClass("flexibreak1 flexibreak2 flexibreak3"); 11202 $container.addClass("flexibreak2"); 11203 if (customstyle["fb2"][$(this).attr("id")]===undefined) { 11204 customstyle["fb2"][$(this).attr("id")]=testWidth; 11205 } 11206 if (!testFlexiBreak($container)) { 11207 $container.removeClass("flexibreak1 flexibreak2 flexibreak3"); 11208 $container.addClass("flexibreak3"); 11209 if (customstyle["fb3"][$(this).attr("id")]===undefined) { 11210 customstyle["fb3"][$(this).attr("id")]=testWidth; 11211 } 11212 if (!testFlexiBreak($container)) { 11213 ok = false;
11214 } 11215 } 11216 } 11217 } 11218 } 11219 11220 var $t = $(this); 11221 if (ok){ 11222 var rep = true; 11223 } else { 11224 var rep = false; 11225 } 11226 modules($t,rep); 11227 moduleHeights(rep); 11228 var shortTime=1; 11229 if (findBreakpoints){ 11230 shortTime=25; 11231 } 11232 var longTime=250; 11233 if (findBreakpoints){ 11234 longTime=250; 11235 } 11236 11237 setTimeout(function () { 11238 if (ok){ 11239 var $modules = $(".module:not(.width)",$row); 11240 if ($modules.overlaps($(".module:not(.width)",$row)).length) { 11241 $row.addClass("rowscale1"); 11242 if (customstyle["rs1"][$t.attr("id")]===undefined) { 11243 customstyle["rs1"][$t.attr("id")]=testWidth; 11244 } 11245 setTimeout(function(){ 11246 modules($t,rep); 11247 setTimeout(function(){ 11248 if ($modules.overlaps($modules).length) { 11249 $row.addClass("rowscale2"); 11250 if (customstyle["rs2"][$t.attr("id")]===undefined) { 11251 customstyle["rs2"][$t.attr("id")]=testWidth; 11252 } 11253 setTimeout(function(){ 11254 modules($t,rep); 11255 setTimeout(function(){ 11256 if ($modules.overlaps($modules).length) { 11257 $row.addClass("rowscale3"); 11258 if (customstyle["rs3"][$t.attr("id")]===undefined) { 11259 customstyle["rs3"][$t.attr("id")]=testWidth; 11260 } 11261 setTimeout(function(){ 11262 modules($t,rep); 11263 setTimeout(function(){ 11264 if ($modules.overlaps($modules).length) { 11265 11266 ok = false; 11267 } 11268 },shortTime); 11269 },shortTime); 11270 } 11271 },shortTime); 11272 },shortTime); 11273 } 11274 },shortTime); 11275 },shortTime); 11276 } 11277 } 11278 setTimeout(function(){ 11279 if (!ok) { 11280 11281 $row.hide(); 11282 if (!$row.parent().children(":not(.flexibreak-big)").length) { 11283 $row.parent().hide().addClass("flex-wrap-hidden"); 11284 } 11285 $("#"+$row.data("flexibreak-small")).show(); 11286 modules($("#"+$row.data("flexibreak-small")),true); 11287 setTimeout(function () { 11288 $("#"+$row.data("flexibreak-small")+" .row").addClass('jsLoaded'); 11289 }, 150); 11290 $("body").addClass("mobile-header-enabled"); 11291 $("#mobile-menu-page-wrap").css("height",$("#mobileheader").height()-"px"); 11292 if (customstyle["mm"][$t.attr("id")]===undefined) { 11293 if (forceMobile){ 11294 customstyle["mm"][$t.attr("id")]=4000; 11295 } else { 11296 customstyle["mm"][$t.attr("id")]=testWidth; 11297 } 11298 } 11299 } 11300 if (!findBreakpoints){ 11301 setTimeout(function () { 11302 moduleHeights(); 11303 setFixedHeader(); 11304 fixPropsHeights(); 11305 setTimeout(function () { 11306 prepMobileHeader(); 11307 11308 }, 200); 11309 }, 400); 11310 } 11311 11312 setTimeout(function () { 11313 $t.addClass('jsLoaded'); 11314 }, 350); 11315 }, longTime); 11316 }, 100); 11317 11318 11319 }); 11320 11321 if (findBreakpoints){ 11322 if (testWidth>minTestWidth){ 11323 testWidth-=30; 11324 setTimeout(function(){flexiBreak()},300); 11325 }else{ 11326 setTimeout(function () { 11327 $.ajax({ url: "/admin/pageActions.php?pageAction=saveContentStyle" 11328 ,data: customstyle 11329 ,success: function(){ 11330 if (window.parent!=window.self){ 11331 window.parent.hideBreakpointLoad(); 11332 } 11333 location.reload(); 11334 11335 } 11336 }); 11337 },200); 11338 } 11339 } 11340 11341 } 11342 11343 11344 function setRecentBlogWidths () { 11345 $(".recent_blog_articles").each(function(){ 11346 if ($(this).width()<287) { 11347 $(this).addClass("narrow"); 11348 } else { 11349 $(this).removeClass("narrow"); 11350 } 11351 }); 11352 var h = 0; 11353 } 11354 function imageMarginHelper () { 11355 $(".Right_Image:not(.align-left .Right_Image, .align-right .Right_Image, .align-center .Right_Image),.Left_Image:not(.align-right .Left_Image,.align-left .Left_Image,.align-center .Left_Image)").each(function(){ 11356 if ($(this).next().length) { 11357 $(this).removeClass("enoughSpaceForText").removeClass("notEnoughSpaceForText"); 11358 var avail = $(this).parent().innerWidth(); 11359 var thisW = $("img",$(this)).width(); 11360 var space = avail-thisW; 11361 if (space>140) { 11362 $(this).addClass("enoughSpaceForText"); 11363 } else { 11364 $(this).addClass("notEnoughSpaceForText"); 11365 } 11366 } 11367 }); 11368 $(".Caption_Below_Image").each(function(){ 11369 $(".captionWrap",$(this)).css("width",$(this).find("img").width()+'px'); 11370 }); 11371 11372 } 11373 function formStyleHelper() { 11374 11375 $('.form-style-box.nooutlinefills').css('width',"auto"); 11376 $('.form-style-box').css('float','left'); 11377 $('.form-style-box.nooutlinefills').css('width',$('.form-style-box').width()+"px"); 11378 $('.form-style-box').css('float','none'); 11379 11380 $('.forminnerwrapcentered').css('float','left'); 11381 $('.forminnerwrapcentered').css('width',$('.forminnerwrapcentered').width()+"px"); 11382 $('.forminnerwrapcentered').css('float','none'); 11383 11384 } 11385 11386/* 11387Search select image 11388*/ 11389 11390 function searchImageLoad() { 11391 if (window.location.hash.substr(0, 11)=="#showimage-") { 11392 var id = window.location.hash.split("-"); 11393 $(".galleryitem"+id[1]).trigger("click"); 11394 } 11395 }; 11396/* 11397 Banner height fix with floating header 11398*/ 11399 function fixPropsHeights() { 11400 $(".banner-feature:not(.fill-row .banner-feature)",$(".with-scale-prop-widgets")).each(function(){ 11401 var $outer = $(this).parents(".with-scale-prop-widgets"); 11402 if (typeof $outer.data("min-height")!='undefined') { 11403 var visible = 0; 11404 if ($outer.data("min-height")=="window") { 11405 var wh = $(window).height(); 11406 } else { 11407 var wh = parseFloat($outer.data("min-height")); 11408 if ($outer.data("scale-prop")) { 11409 if ($('body').hasClass('with-fixed-header')) { 11410 var visible = $('#header').height(); 11411 } 11412 11413 var ratio = 1000 / wh; 11414 wh = $(window).width() / ratio; 11415 } 11416 } 11417 var $t = $(this); 11418 if ($t.find(".banner-feature-inner").offset().top<visible+gap/2||$t.height()<$t.find(".banner-feature-inner").height()) { 11419 $t.find(".banner-feature-inner").removeClass('banner-feature-force-bottom'); 11420 if (typeof custombannergap != 'undefined') { 11421 var gap = custombannergap; 11422 }else { 11423 var gap = 60; 11424 } 11425 $(this).css('height','auto'); 11426 $(this).css('min-height','auto');
11427 var h = $t.find(".banner-feature-inner").height() + visible+gap; 11428 if ($t.find(".banner-feature-inner").hasClass('banner-feature-content-middle')||$t.find(".banner-feature-inner").hasClass('banner-feature-content-top')) { 11429 $t.find(".banner-feature-inner").addClass('banner-feature-force-bottom'); 11430 } 11431 $t.css('height',h+'px'); 11432 } 11433 11434 11435 } 11436 }); 11437 $(".banner-feature-content-inner",$(".with-scale-prop-widgets")).each(function(){ 11438 var $outer = $(this).parents(".with-scale-prop-widgets"); 11439 if (typeof $outer.find('.row').data("min-height")!='undefined') { 11440 $(this).removeAttr('style'); 11441 var visible = 0; 11442 if ($outer.find(".row").data("min-height")=="window") { 11443 var wh = $(window).height(); 11444 } else { 11445 var wh = parseFloat($outer.find(".row").data("min-height")); 11446 if ($outer.find(".row").data("scale-prop")) { 11447 if ($('body').hasClass('with-fixed-header')) { 11448 var visible = $('#header').height(); 11449 } 11450 11451 var ratio = 1000 / wh; 11452 wh = $(window).width() / ratio; 11453 } 11454 } 11455 var $t = $(this); 11456 $t.removeClass('banner-feature-force-bottom'); 11457 if (typeof custombannergap != 'undefined') { 11458 var gap = custombannergap; 11459 }else { 11460 var gap = 60; 11461 } 11462 if ($t.offset().top<visible+gap/2) { 11463 var difference = visible-$t.offset().top+gap/2; 11464 $t.css('padding-top',difference+'px'); 11465 } 11466 11467 11468 } 11469 }); 11470 11471 } 11472 function bannerHeightWithFloating() { 11473 11474 11475 $('.with-scale-prop-widgets .row').each(function(){ 11476 if (!$('> *',$(this)).hasClass('banner-feature')) { 11477 $(this).wrapInner('<div class="banner-feature-content"></div>'); 11478 $(this).find(".banner-feature-content").wrapInner('<div class="banner-feature-content-inner"></div>'); 11479 } 11480 }); 11481 fixPropsHeights(); 11482 }; 11483/* 11484 * 11485 * Folder Gallery Style 11486 * 11487 */ 11488 function folderGalleryStylesLoad() { 11489 $('.folder-search input').on('change keyup',function(){ 11490 var galid = $(this).parents('.folder-filter').data('gallery-id'); 11491 if ($(this).val()=="") { 11492 $('.gallery-folder-'+galid+' .folder-item').show(); 11493 return false; 11494 } 11495 $('.gallery-folder-'+galid+' .folder-item').hide(); 11496 $('.gallery-folder-'+galid+' .folder-item[data-for-search*="'+$(this).val().toLowerCase()+'"]').show(); 11497 }); 11498 $('.folder-filter a').click(function(){ 11499 var $p = $(this).parents('.folder-filter'); 11500 $('.current',$(this).parent()).removeClass('current'); 11501 $(this).addClass('current'); 11502 var galid = $(this).parents('.folder-filter').data('gallery-id'); 11503 var by = $('.folder-sort-by .current').data('by'); 11504 var direction = $('.folder-sort-direction .current').data('direction'); 11505 $('.gallery-folder-'+galid+' .folder-item').sort(function (a, b) { 11506 var contentA = $(a).attr(by); 11507 var contentB = $(b).attr(by); 11508 if (direction=="asc") { 11509 return (contentA < contentB) ? -1 : (contentA > contentB) ? 1 : 0; 11510 } else { 11511 return (contentA > contentB) ? -1 : (contentA < contentB) ? 1 : 0; 11512 } 11513 }).appendTo($('.gallery-folder-'+galid)); 11514 return false; 11515 }); 11516 }; 11517 11518/* 11519 #'Default' Gallery Style (Lightbox with thumbs) - including support for prodcuts based on this gallery style 11520 11521*/ 11522 function galleryResize() { 11523 if ($("#lightboxContainer").length) { 11524 $('<img src="'+$("#lightboxInner img").attr("src")+'" style="display:none;max-width:10000px !important;width:auto;"/>').appendTo("html").on("load",function(){ 11525 var originalWidth = $(this).width(); 11526 var originalHeight = $(this).height(); 11527 var ratio = originalWidth/originalHeight; 11528 var newMaxWidth = $(window).width()-80; 11529 var newMaxHeight = $(window).height()-30-$("#lightboxStuff").height(); 11530 var newHeight = newMaxWidth/ratio; 11531 var newWidth = newMaxHeight*ratio; 11532 console.log(newHeight); 11533 console.log(newWidth); 11534 if (originalWidth>newMaxWidth) { 11535 var w = newMaxWidth; 11536 var h = newHeight; 11537 } else { 11538 var w = originalWidth; 11539 var h = originalHeight; 11540 } 11541 if (h>newMaxHeight) { 11542 var h = newMaxHeight; 11543 var w = newWidth; 11544 } 11545 if (w<200){ 11546 w=200; 11547 h=200/ratio; 11548 } 11549 11550 $("#lightboxExtra1").stop(false,true).animate({ 11551 width: w, 11552 height: h 11553 },300); 11554 $("#lightboxStuff").stop(false,true).animate({ 11555 width: w 11556 },300); 11557 }); 11558 } 11559 }; 11560 function galleryReady() { 11561 $(".responsive_lightbox").click(function(){ 11562 var clicked = $(this); 11563 var parentsId = $(this).parents(".galleryWrapper").attr("id"); 11564 $(".lightboxCurrent").removeClass("lightboxCurrent"); 11565 clicked.addClass("lightboxCurrent"); 11566 $('embed, object, select',"#wrapper").css({ 'visibility' : 'hidden' }); 11567 var formName = $(this).parents(".galleryWrapper").attr("id").replace(/gallery/, ""); 11568 var prodid = $(this).parents(".galleryWrapper").data("prodid"); 11569 11570 $('body').append("<div id='lightboxOverlay'></div><div id='lightboxOuter'><div id='lightboxContainer'><div id='lightboxPrev'><</div><div id='lightboxNext'>></div><div id='lightboxExtra1'><div id='lightboxExtra2'><div id='lightboxExtra3'><div id='lightboxInner'></div></div></div></div><div id='lightboxStuff'><div id='lightboxShop'></div><div id='lightboxCaption'></div></div></div><div id='lightboxClose'>x</div></div>"); 11571 11572 $(".shopGalleryVariant[name="+formName+"].prodid"+prodid).appendTo("#lightboxShop").fadeIn(); 11573 $("#lightboxShop form").append("<input type='hidden' name='pic_url' value='' />"); 11574 //$("#lightboxOverlay").css("height",$(document).height()+"px");
11575 //$("#lightboxOuter").css("top",$(document).scrollTop()+100+"px"); 11576 11577 $("#lightboxContainer").css({ 11578 opacity: 0, 11579 display: "block" 11580 }); 11581 $("#lightboxContainer").animate({ 11582 opacity: 1 11583 }); 11584 function showImage (href,title,retina) { 11585 function cont4 () { 11586 function cont3 () { 11587 showNav(); 11588 $("."+formName+"input").val(title); 11589 $("input[name=pic_url]",$("#lightboxShop form")).val(href); 11590 $("#lightboxCaption").html("<p>"+title+"</p>"); 11591 $("#lightboxInner").html('<img srcset="'+retina+' 2x" src="'+href+'" alt="'+title+'" style="display:none;min-width:200px"/>'); 11592 $("#lightboxInner img").css({ 11593 opacity: 0, 11594 display: "block" 11595 }); 11596 $("#lightboxInner img").animate({ 11597 opacity: 1 11598 },300); 11599 } 11600 $('<img srcset="'+retina+' 2x" src="'+href+'" style="display:none;max-width:1000px !important;"/>').appendTo("body").on("load",function(){ 11601 var originalWidth = $(this).width(); 11602 var originalHeight = $(this).height(); 11603 var ratio = originalWidth/originalHeight; 11604 var newMaxWidth = $(window).width()-80; 11605 var newMaxHeight = $(window).height()-60; 11606 var newHeight = newMaxWidth/ratio; 11607 var newWidth = newMaxHeight*ratio; 11608 if (originalWidth>newMaxWidth) { 11609 var w = newMaxWidth; 11610 var h = newHeight; 11611 } else { 11612 var w = originalWidth; 11613 var h = originalHeight; 11614 } 11615 if (h>newMaxHeight) { 11616 var h = newMaxHeight; 11617 var w = newWidth; 11618 } 11619 if (w<200){ 11620 w=200; 11621 h=200/ratio; 11622 } 11623 $("#lightboxExtra1 img").css("min-width",w+"px"); 11624 $("#lightboxExtra1").stop(false,true).animate({ 11625 width: w, 11626 height: h 11627 },300,cont3); 11628 $("#lightboxStuff").stop(false,true).animate({ 11629 width: w 11630 },300); 11631 }); 11632 } 11633 $("#lightboxNext,#lightboxPrev,#lightboxClose").fadeOut(300); 11634 $("#lightboxInner img").fadeOut(300,cont4); 11635 11636 11637 11638 } 11639 function showNav () { 11640 $("#lightboxClose").fadeIn(); 11641 $("#lightboxClose").unbind().click(function(){ 11642 function cont2 () { 11643 $("#lightboxOverlay,#lightboxOuter").remove(); 11644 $('embed, object, select',"#wrapper").css({ 'visibility' : 'visible' }); 11645 } 11646 $("#lightboxOuter,#lightboxOverlay").fadeOut(300,cont2); 11647 11648 $(".shopGalleryVariant[name="+formName+"]").appendTo("body").hide(); 11649 }); 11650 var totalEls = $("#"+parentsId+" .responsive_lightbox").length-1; 11651 var clickedEl = 0; 11652 var currentEl = 0; 11653 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11654 if ($(this).hasClass("lightboxCurrent")) { 11655 clickedEl = currentEl; 11656 } 11657 currentEl++; 11658 }); 11659 if (clickedEl!=totalEls) { 11660 $("#lightboxNext").fadeIn(); 11661 $("#lightboxNext").unbind().click(function(){ 11662 var stop = 0; 11663 var stop2 = 0; 11664 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11665 stop++; 11666 if ($(this).hasClass("lightboxCurrent")) { 11667 stop2 = stop; 11668 } 11669 }); 11670 var stop3 = 0; 11671 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11672 if (stop3 == stop2) { 11673 $(".lightboxCurrent").removeClass("lightboxCurrent"); 11674 $(this).addClass("lightboxCurrent"); 11675 var href = $(this).attr("href"); 11676 var title = $(this).attr("title"); 11677 var retina = $(this).data("retina"); 11678 showImage(href,title,retina); 11679 } 11680 stop3++; 11681 }); 11682 }); 11683 } 11684 if (clickedEl!=0) { 11685 $("#lightboxPrev").fadeIn(); 11686 $("#lightboxPrev").unbind().click(function(){ 11687 var prev = 0; 11688 var clicked = 0; 11689 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11690 if ($(this).hasClass("lightboxCurrent")) { 11691 current = prev; 11692 } 11693 prev++; 11694 }); 11695 var prev = 0; 11696 $("#"+parentsId+" .responsive_lightbox").each(function(){ 11697 if (prev==current-1) { 11698 $(".lightboxCurrent").removeClass("lightboxCurrent"); 11699 $(this).addClass("lightboxCurrent"); 11700 var href = $(this).attr("href"); 11701 var title = $(this).attr("title"); 11702 var retina = $(this).data("retina"); 11703 showImage(href,title,retina); 11704 } 11705 prev++; 11706 }); 11707 }); 11708 } 11709 } 11710 function cont () { 11711 $("."+formName+"input").val(clicked.attr("title")); 11712 $("input[name=pic_url]",$("#lightboxShop form")).val(clicked.attr("href")); 11713 $("#lightboxCaption").html("<p>"+clicked.attr("title")+"</p>"); 11714 $("#lightboxStuff").fadeIn(); 11715 $("#lightboxInner").html('<img srcset="'+clicked.data('retina')+' 2x" src="'+clicked.attr("href")+'" alt="'+clicked.attr("title")+'" style="display:none;
11715min-width:200px"/>'); 11716 $("#lightboxInner img").css({ 11717 opacity: 0, 11718 display: "block" 11719 }); 11720 $("#lightboxInner img").animate({ 11721 opacity: 1 11722 },300); 11723 11724 showNav(); 11725 11726 } 11727 var href = clicked.attr("href"); 11728 var title = clicked.attr("title"); 11729 var retina = clicked.data("retina"); 11730 $('<img srcset="'+retina+' 2x" src="'+href+'" style="display:none;max-width:1000px !important;"/>').appendTo("body").on("load",function(){ 11731 var originalWidth = $(this).width(); 11732 var originalHeight = $(this).height(); 11733 var ratio = originalWidth/originalHeight; 11734 var newMaxWidth = $(window).width()-80; 11735 var newMaxHeight = $(window).height()-60; 11736 var newHeight = newMaxWidth/ratio; 11737 var newWidth = newMaxHeight*ratio; 11738 if (originalWidth>newMaxWidth) { 11739 11740 var w = newMaxWidth; 11741 var h = newHeight; 11742 } else { 11743 var w = originalWidth; 11744 var h = originalHeight; 11745 } 11746 if (h>newMaxHeight) { 11747 var h = newMaxHeight; 11748 var w = newWidth; 11749 } 11750 11751 if (w<200){ 11752 w=200; 11753 h=200/ratio; 11754 } 11755 $("#lightboxExtra1").stop(false,true).animate({ 11756 width: w, 11757 height: h 11758 },300,cont); 11759 $("#lightboxStuff").stop(false,true).animate({ 11760 width: w 11761 },300); 11762 }); 11763/* 11764 var preloader = new Image(); 11765 11766 preloader.onload = function() { 11767 var originalWidth = preloader.width; 11768 var originalHeight = preloader.height; 11769 var ratio = originalWidth/originalHeight; 11770 var newMaxWidth = $(window).width()-60; 11771 var newHeight = newMaxWidth/ratio; 11772 if (originalWidth>newMaxWidth) { 11773 var w = newMaxWidth; 11774 var h = newHeight; 11775 } else { 11776 var w = originalWidth; 11777 var h = originalHeight; 11778 } 11779 11780 $("#lightboxStuff").css("width",w+"px"); 11781 $("#lightboxContainer").stop(false,true).animate({ 11782 width: w, 11783 height: h 11784 },300,cont); 11785 11786 11787 }; 11788 preloader.src = clicked.attr("href"); 11789 */ 11790 return false; 11791 }); 11792 }; 11793 11794 11795 11796/* 11797 #'Montage' Gallery Style - including support for prodcuts based on this gallery style 11798 11799*/ 11800 function montageLoad() { 11801 setMontageMargin(); 11802 $(".montageSlideshow").hide().css("width","0"); 11803 setTimeout(function() { 11804 $(".montageSlideshow").css("width","100%").show(); 11805 }, 1); 11806 }; 11807 function montageReady() { 11808 $(".montageSlideshow").each(function(){ 11809 var formId = $(this).attr("id").replace("gallery",""); 11810 if ($("form[name="+formId+"]").length) { 11811 $(this).after("<div class='montageProductWrapper'></div>"); 11812 var $wrapper = $(this).next(); 11813 $wrapper.append($(this)); 11814 $wrapper.append($("form[name="+formId+"]").show().addClass("montageProductForm")); 11815 var $form = $("form",$wrapper); 11816 $(".montage-pic",$wrapper).append('<span class="montageCheckbox"></span>'); 11817 $(".montage-pic:first",$wrapper).addClass("selected"); 11818 $(".montageSlideshow",$wrapper).addClass("with-product"); 11819 $form.append("<input type='hidden' name='pic_url' value='' />"); 11820 $("."+formId+"input",$form).val($("img:first",$wrapper).attr("alt")); 11821 var href = $("img:first",$wrapper).attr("src").split("?"); 11822 $("input[name=pic_url]",$form).val(href[0]); 11823 } 11824 }); 11825 $(".with-product .montage-pic").click(function(){ 11826 $montage = $(this).parents(".with-product"); 11827 $(".selected",$montage).removeClass("selected"); 11828 $(this).addClass("selected"); 11829 var $form = $(this).parents(".with-product").next(); 11830 var formId = $(this).parents(".with-product").attr("id").replace("gallery",""); 11831 $("."+formId+"input",$form).val($("img",$(this)).attr("alt")); 11832 var href = $("img",$(this)).attr("src").split("?"); 11833 $("input[name=pic_url]",$form).val(href[0]); 11834 }); 11835 }; 11836 11837 function montageResize() { 11838 setMontageMargin(); 11839 }; 11840 function setMontageMargin () { 11841 $(".imagesInMontage4").each(function(){ 11842 var w = $(this).width(); 11843 var p = $(".item1",$(this)).width()+$(".item2",$(this)).width(); 11844 var g = w-p; 11845 $(".for-margin",$(this)).css("margin-top",g+"px"); 11846 }); 11847 } 11848 11849 11850/* 11851 #'Slideshow' Gallery Styles (single and multi) - including support for prodcuts based on these gallery styles 11852*/ 11853 11854 function slideshowReady() { 11855 if (!$('body').hasClass("accessible-mode")){ 11856 $(".banner-feature:not(#content_bar_1_banner_slideshow .banner-feature,#content_bar_2_banner_slideshow .banner-feature,#content_bar_3_banner_slideshow .banner-feature,#content_bar_4_banner_slideshow .banner-feature,#content_bar_5_banner_slideshow .banner-feature,#content_bar_6_banner_slideshow .banner-feature,#content_bar_7_banner_slideshow .banner-feature,#content_bar_8_banner_slideshow .banner-feature,#content_bar_9_banner_slideshow .banner-feature,#content_bar_10_banner_slideshow .banner-feature)").each(function(){ 11857 if (!$(this).prev().hasClass("banner-feature")) { 11858 $(this).before("<div class='banner-feature-wrap'></div>"); 11859 } 11860 }); 11861 $(".banner-feature-wrap").each(function(){ 11862 $wrapper = $(this); 11863 $(this).nextAll().each(function(){ 11864 if (!$(this).hasClass("banner-feature")) { 11865 return false;
11866 } else { 11867 $(this).appendTo($wrapper); 11868 } 11869 }); 11870 }); 11871 $(".shop-related-products").each(function(){ 11872 $(this).owlCarousel({ 11873 items : 4, 11874 slideSpeed : 300, 11875 itemsScaleUp : false, 11876 paginationSpeed : 400, 11877 navigationText : ["<",">"], 11878 navigation:true, 11879 itemsDesktop : [1000,4], 11880 itemsDesktopSmall : [768,3], 11881 itemsTablet: [480,3], 11882 itemsMobile : [320,2] 11883 }); 11884 }); 11885 11886 $(".banner-feature-wrap").each(function(){ 11887 $(this).owlCarousel({ 11888 navigation : true, 11889 slideSpeed : 300, 11890 paginationSpeed : 400, 11891 singleItem:true, 11892 navigationText : ["<",">"], 11893 afterAction: function(el){ 11894 this.$owlItems.removeClass('activebanner'); 11895 this.$owlItems.eq(this.currentItem).addClass('activebanner'); 11896 setTimeout(function () { 11897 moduleHeights(); 11898 },350); 11899 11900 } 11901 }); 11902 }); 11903 11904 11905 $("#content_bar_1_banner_slideshow,#content_bar_2_banner_slideshow,#content_bar_3_banner_slideshow,#content_bar_4_banner_slideshow,#content_bar_5_banner_slideshow,#content_bar_6_banner_slideshow,#content_bar_7_banner_slideshow,#content_bar_8_banner_slideshow,#content_bar_9_banner_slideshow,#content_bar_10_banner_slideshow").each(function(){ 11906 var speed = $(this).data("slideshow-speed"); 11907 var transstyle = $(this).data("slideshow-style"); 11908 var dots = $(this).data("slideshow-dots"); 11909 var arrows = $(this).data("slideshow-arrows"); 11910 var c = "banner-owl "; 11911 if (arrows){ 11912 c += "with_side_buttons "; 11913 } 11914 var pag = false; 11915 if (dots){ 11916 c += "with_dots "; 11917 var pag = true; 11918 } 11919 $("> section > div > div",$(this)).addClass(c); 11920 $("> section > div > div",$(this)).owlCarousel({ 11921 navigation : true, 11922 pagination:pag, 11923 autoPlay : speed, 11924 singleItem : true, 11925 slideSpeed:500, 11926 afterMove: function(){ 11927 setTimeout(function () { 11928 // moduleHeights(); 11929 }, 350); 11930 11931 }, 11932 autoHeight : false, 11933 transitionStyle:transstyle, 11934 navigationText : ["<",">"], 11935 afterAction: function(el){ 11936 this.$owlItems.removeClass('activebanner'); 11937 this.$owlItems.eq(this.currentItem).addClass('activebanner'); 11938 setTimeout(function () { 11939 // moduleHeights(); 11940 },550); 11941 } 11942 }); 11943 }); 11944 11945 $(".recent-pages-scroll").each(function(){ 11946 var speed = $(this).data("speed"); 11947 $(this).owlCarousel({ 11948 navigation : true, 11949 autoPlay : speed, 11950 paginationSpeed : 400, 11951 goToFirstSpeed : 2000, 11952 singleItem : true, 11953 autoHeight : true, 11954 afterMove: function(){ 11955 setTimeout(function () { 11956 moduleHeights(); 11957 }, 350); 11958 11959 }, 11960 transitionStyle:"fade", 11961 navigationText : ["<",">"], 11962 afterAction: function() { 11963 setTimeout(function () { 11964 moduleHeights(); 11965 },550); 11966 11967 } 11968 }); 11969 }); 11970 $(".owl-slideshow-single").each(function(){ 11971 var speed = $(this).data("speed"); 11972 $(this).owlCarousel({ 11973 navigation : true, 11974 slideSpeed : 300, 11975 autoPlay : speed, 11976 stopOnHover : true, 11977 paginationSpeed : 400, 11978 goToFirstSpeed : 2000, 11979 singleItem : true, 11980 autoHeight : true, 11981 afterMove: function(){ 11982 setTimeout(function () { 11983 moduleHeights(); 11984 }, 350); 11985 11986 }, 11987 transitionStyle:"fade", 11988 navigationText : ["<",">"], 11989 afterAction: function() { 11990 setTimeout(function () { 11991 moduleHeights(); 11992 },550); 11993 11994 } 11995 }); 11996 }); 11997 $(".owl-slideshow-multi").each(function(){ 11998 var speed = $(this).data("speed"); 11999 $(this).owlCarousel({ 12000 items : 4, 12001 slideSpeed : 300, 12002 autoPlay : speed, 12003 stopOnHover : true, 12004 paginationSpeed : 400, 12005 goToFirstSpeed : 2000, 12006 navigationText : ["<",">"], 12007 afterAction: function() { 12008 setTimeout(function () { 12009 moduleHeights(); 12010 },550); 12011 12012 } 12013 }); 12014 }); 12015 12016 $(".owl-slideshow-multi,.owl-slideshow-single").each(function(){ 12017 var formId = $(this).attr("id").replace("gallery",""); 12018 if ($("form[name="+formId+"]").length) { 12019 $(this).after("<div class='slideshowProductWrapper'></div>"); 12020 var $wrapper = $(this).next(); 12021 $wrapper.append($(this)); 12022 $wrapper.append($("form[name="+formId+"]").show().addClass("slideshowProductForm")); 12023 var $form = $("form",$wrapper); 12024 $(".item",$wrapper).append('<span class="slideshowCheckbox"></span>'); 12025 $(".item:first",$wrapper).addClass("current"); 12026 12027 $(".owl-slideshow-multi,.owl-slideshow-single",$wrapper).addClass("with-product"); 12028 $form.append("<input type='hidden' name='pic_url' value='' />"); 12029 $("."+formId+"input",$form).val($(".item:first img",$wrapper).attr("alt")); 12030 var href = $("img:first",$wrapper).attr("src").split("?"); 12031 $("input[name=pic_url]",$form).val(href[0]); 12032 } 12033 }); 12034 $(".owl-slideshow-multi.with-product .item,.owl-slideshow-single.with-product .item").click(function(){ 12035 12036 var $galThumbs = $(this).parents(".with-product"); 12037 $(".current",$galThumbs).removeClass("current"); 12038 $(this).addClass("current"); 12039 12040 var $form = $(this).parents(".with-product").next(); 12041 var formId = $(this).parents(".with-product").attr("id").replace("gallery",""); 12042 $("."+formId+"input",$form).val($("img",$(this)).attr("alt")); 12043 var href = $("img",$(this)).attr("src").split("?"); 12044 $("input[name=pic_url]",$form).val(href[0]); 12045 }); 12046 } 12047 12048 }; 12049 12050/* 12051 #'Gallery with thumbs' Gallery Style - including support for prodcuts based on these gallery styles 12052 12053*/ 12054 function galThumbResize() { 12055 $(".enlarge img").fadeOut(); 12056 clearTimeout(afterResizingGallery); 12057 afterResizingGallery = setTimeout(function () { 12058 afterResizeGallery(); 12059 }, 400); 12060 }; 12061 var afterResizingGallery; 12062 function afterResizeGallery () { 12063 $(".galleryWithThumbs").each(function(){ 12064 var $e = $(".enlarge",$(this)); 12065 $e.css("height","auto"); 12066 var $t = $(this); 12067 var $a = $("a.current",$t); 12068 showPic($a,$e); 12069 }); 12070 } 12071 function galThumbReady() { 12072 if (!$('body').hasClass("accessible-mode")){ 12073 12074 $(".owl-gallery-thumbs").each(function(){ 12075 $(this).owlCarousel({ 12076 items : 6, 12077 slideSpeed : 300, 12078 itemsScaleUp : false, 12079 paginationSpeed : 400, 12080 navigationText : ["<",">"], 12081 itemsDesktop : [1000,5], 12082 itemsDesktopSmall : [768,4], 12083 itemsTablet: [480,4], 12084 itemsMobile : [320,3] 12085 }); 12086 }); 12087 $(".galleryWithThumbs").each(function(){ 12088 12089 var $e = $(".enlarge",$(this)); 12090 var $t = $(this); 12091 var $a = $("a:first",$t); 12092 showPic($a,$e); 12093 12094 $("a",$t).click(function(){ 12095 $(".current",$t).removeClass("current"); 12096 showPic($(this),$e); 12097 return false;
12098 }); 12099 }); 12100 } else { 12101 $(".enlarge").remove(); 12102 } 12103 $(".galleryWithThumbs").each(function(){ 12104 var formId = $(this).attr("id").replace("gallery",""); 12105 if ($("form[name="+formId+"]").length) { 12106 $(this).after("<div class='galleryThumbsProductWrapper'></div>"); 12107 var $wrapper = $(this).next(); 12108 $wrapper.append($(this)); 12109 $wrapper.append($("form[name="+formId+"]").show().addClass("galleryThumbsProductForm")); 12110 var $form = $("form",$wrapper); 12111 $(".galleryWithThumbs",$wrapper).addClass("with-product"); 12112 $form.append("<input type='hidden' name='pic_url' value='' />"); 12113 $("."+formId+"input",$form).val($(".owl-gallery-thumbs img:first",$wrapper).attr("alt")); 12114 var href = $("img:first",$wrapper).attr("src").split("?"); 12115 $("input[name=pic_url]",$form).val(href[0]); 12116 } 12117 }); 12118 $(".galleryWithThumbs.with-product .owl-gallery-thumbs a").click(function(){ 12119 var $galThumbs = $(this).parents(".with-product"); 12120 var $form = $(this).parents(".with-product").next(); 12121 var formId = $(this).parents(".with-product").attr("id").replace("gallery",""); 12122 $("."+formId+"input",$form).val($("img",$(this)).attr("alt")); 12123 var href = $("img",$(this)).attr("src").split("?"); 12124 $("input[name=pic_url]",$form).val(href[0]); 12125 }); 12126 }; 12127 function showPic ($a,$e) { 12128 $a.addClass("current"); 12129 $(".captionWrap,.caption,img",$e).fadeOut().remove(); 12130 12131 var $img = $("<img src='"+$a.attr("href")+"' style='display:none;'/>"); 12132 if ($("img",$a).attr("alt")!="") { 12133 var $i = $("<span class='captionWrap'><span class='caption'>"+$("img",$a).attr("alt")+"</span></span>"); 12134 $img.prependTo($i); 12135 } else { 12136 var $i = $img; 12137 } 12138 12139 $e.append($i); 12140 12141 $img.one('load', function() { 12142 $e.css("height",$(this).height()+"px"); 12143 $img.fadeIn(); 12144 setTimeout(function () { 12145 moduleHeights(); 12146 magicHeights(); 12147 setFixedHeader(); 12148 }, 500); 12149 if ($img.parents(".withZoom").length){ 12150 $e.zoom({url: $a.attr("href")}); 12151 } 12152 }).each(function() { 12153 if(this.complete) $(this).load(); 12154 }); 12155 } 12156 12157 12158/* 12159 #'Carousel Slide' Widget 12160*/ 12161 12162 function carouselReady() { 12163 if (!$('body').hasClass("accessible-mode")){ 12164 $(".carousel_slide").each(function(){ 12165 if (!$(this).prev().hasClass("carousel_slide")) { 12166 if ($(this).hasClass("carousel_slide_autoscroll")) { 12167 $(this).before("<div class='owl-carousel owl-carousel-autoscroll' data-speed="+$(this).data("speed")+"></div>"); 12168 } else { 12169 $(this).before("<div class='owl-carousel'></div>"); 12170 } 12171 } 12172 }); 12173 12174 $(".owl-carousel").each(function(){ 12175 $wrapper = $(this); 12176 $(this).nextAll().each(function(){ 12177 if (!$(this).hasClass("carousel_slide")) { 12178 return false; 12179 } else { 12180 $(this).appendTo($wrapper); 12181 } 12182 }); 12183 }); 12184 12185 $(".owl-carousel").each(function(){ 12186 if ($(this).hasClass("owl-carousel-autoscroll")) { 12187 var speed = $(this).data("speed"); 12188 $(this).owlCarousel({ 12189 navigation : true, 12190 slideSpeed : 300, 12191 autoPlay : speed, 12192 paginationSpeed : 300, 12193 singleItem:true, 12194 navigationText : ["<",">"] 12195 }); 12196 }else{ 12197 $(this).owlCarousel({ 12198 navigation : true, 12199 slideSpeed : 300, 12200 paginationSpeed : 400, 12201 singleItem:true, 12202 navigationText : ["<",">"] 12203 }); 12204 } 12205 12206 }); 12207 12208 $(".carousel_slide_multi").each(function(){ 12209 if (!$(this).prev().hasClass("carousel_slide_multi")) { 12210 var c = ""; 12211 if ($(this).hasClass("with_side_buttons")){ 12212 c += "with_side_buttons "; 12213 } 12214 if ($(this).hasClass("with_dots")){ 12215 c += "with_dots "; 12216 } 12217 if ($(this).data("speed") != "0000") { 12218 $(this).before("<div class='"+c+" owl-carousel-multi owl-carousel-autoscroll' data-speed='"+$(this).data("speed")+"' data-items='"+$(this).data("items")+"'></div>"); 12219 } else { 12220 $(this).before("<div class='"+c+" owl-carousel-multi' data-items='"+$(this).data("items")+"'></div>"); 12221 } 12222 } 12223 }); 12224 $(".owl-carousel-multi").each(function(){ 12225 $wrapper = $(this); 12226 $(this).nextAll().each(function(){ 12227 if (!$(this).hasClass("carousel_slide_multi")) { 12228 return false;
12229 } else { 12230 $(this).appendTo($wrapper); 12231 } 12232 }); 12233 }); 12234 12235 $(".owl-carousel-multi").each(function(){ 12236 if ($(this).data("items")==1) { 12237 var si = true; 12238 } else { 12239 var si = false; 12240 } 12241 if ($(this).hasClass("owl-carousel-autoscroll")) { 12242 $(this).owlCarousel({ 12243 navigation : true, 12244 slideSpeed : 300, 12245 autoPlay : $(this).data("speed"), 12246 paginationSpeed : 400, 12247 singleItem:si, 12248 items:$(this).data("items"), 12249 navigationText : ["<",">"] 12250 }); 12251 }else{ 12252 $(this).owlCarousel({ 12253 navigation : true, 12254 slideSpeed : 300, 12255 paginationSpeed : 400, 12256 singleItem:si, 12257 items:$(this).data("speed"), 12258 navigationText : ["<",">"] 12259 }); 12260 } 12261 12262 }); 12263 12264 } 12265 }; 12266 12267 12268/* 12269 #'Live Shopping Basket' Widget 12270*/ 12271function showCounts() { 12272 $(".chekoutcount").load("/actions/ShowMiniBasket/"+lang+"&count=true",function(){ 12273 modules(); 12274 }); 12275} 12276function bindMiniBasket () { 12277 var options = { 12278 success: function(){ 12279 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12280 bindMiniBasket(); 12281 $("#loading").stop(true,false).fadeOut(); 12282 moduleHeights(); 12283 setFixedHeader(); 12284 12285 }); 12286 12287 12288 } // post-submit callback 12289 }; 12290 $("#miniBasket2 #updateQuantities").click(function(){ 12291 $("#miniBasketForm").submit(); 12292 return false; 12293 }); 12294 $("#miniBasket2 .quantity").blur(function(e){ 12295 if ($(e.target).attr("id")!="updateQuantities") { 12296 $("#miniBasketForm").submit(); 12297 } 12298 }); 12299 $("#miniBasket2 #miniBasketForm").submit(function(){ 12300 $("#loading").fadeIn(); 12301 12302 $("#miniBasketForm").ajaxSubmit(options); 12303 return false; 12304 }); 12305 $("#miniBasket2 .removeCell a").click(function(){ 12306 $("#loading").fadeIn(); 12307 $.ajax({ url: $(this).attr("href"), success: function(){ 12308 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12309 bindMiniBasket(); 12310 $("#loading").stop(true,false).fadeOut(); 12311 moduleHeights(); 12312 setFixedHeader(); 12313 12314 }); 12315 showCounts(); 12316 }}); 12317 return false; 12318 }); 12319} 12320 function productQuanReady() { 12321 $('.product-quantity-input').on("click",function(){ 12322 $(this)[0].select(); 12323 }); 12324 $('.product-quantity-input').on("keyup change",function(){ 12325 12326 if ($(this).parents(".addToBasketForm.multi.only-sell-if-in-stock").length && typeof $("option:selected",$(this).parents(".addToBasketForm.multi")).attr("data-stock") != "undefined") { 12327 12328 if (parseInt($("option:selected",$(this).parents(".addToBasketForm.multi")).attr("data-stock"))<parseInt($(this).val())) { 12329 $(this).val(parseInt($("option:selected",$(this).parents(".addToBasketForm.multi")).attr("data-stock"))); 12330 } 12331 } else { 12332 if (typeof $(this).attr("data-max")!='undefined') { 12333 if (parseInt($(this).val())>$(this).data("max")) { 12334 $(this).val($(this).data("max")); 12335 } 12336 } 12337 12338 } 12339 if ($(this).val()<1) { 12340 $(this).val(1); 12341 } 12342 var newv = $(this).val(); 12343 if ($(this).parents(".simpleProduct").length) { 12344 var hrefstr = $(".button a",$(this).parents(".simpleProduct")).attr("href"); 12345 var href = hrefstr.split("&"); 12346 var newhref = ''; 12347 if (href.length>1 && hrefstr.indexOf("&quantity=")>0) { 12348 12349 for (var i = 0; i < href.length; i++) { 12350 12351 if (newhref!="") { 12352 newhref+="&"; 12353 } 12354 if (href[i].indexOf("quantity=")==0) { 12355 newhref += "quantity="+newv; 12356 } else { 12357 newhref += href[i]; 12358 } 12359 12360 12361 } 12362 } else { 12363 newhref = hrefstr+"&quantity="+newv; 12364 } 12365 $(".button a",$(this).parents(".simpleProduct")).attr("href",newhref); 12366 12367 } 12368 }); 12369 $(".product-quantity-plus").on("click",function(){ 12370 var c = parseInt($("input",$(this).parent()).val()); 12371 c = c+1; 12372 $("input",$(this).parent()).val(c).trigger("change"); 12373 }); 12374 $(".product-quantity-minus").on("click",function(){ 12375 var c = parseInt($("input",$(this).parent()).val()); 12376 c = c-1; 12377 $("input",$(this).parent()).val(c).trigger("change"); 12378 }); 12379 if (!$('body').hasClass('accessible-mode')) { 12380 $(".form .submit_form").before("<img src=\"/graphics/form-load.gif\" alt=\"\" id=\"loader\"/>"); 12381 } 12382 if ($('.formUsedInCheckout').length) { 12383 $("#paymentGatewayForm").css("float","none"); 12384 } 12385 showCounts();
12386 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12387 bindMiniBasket(); 12388 moduleHeights(); 12389 setFixedHeader(); 12390 12391 }); 12392 if ($("#miniBasket2").length) { 12393 $("#miniBasketDone #dismiss").click(function(){ 12394 $('#miniBasketDone').fadeOut(); 12395 return false; 12396 }); 12397 $(".addToBasketLink").click(function(){ 12398 $("#loading").fadeIn(); 12399 $("#bigloader").fadeIn(); 12400 dataLayer.push({"event":"addToBasket","productID":$(this).parents(".simpleProduct").data("datalayer-productid"),"productPrice":$(this).parents(".simpleProduct").data("datalayer-price"),"productName":$(this).parents(".simpleProduct").data("datalayer-name")}); 12401 $.ajax({ url: $(this).attr("href"), success: function(){ 12402 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12403 bindMiniBasket(); 12404 $("#loading").stop(true,false).fadeOut(); 12405 $("#bigloader").stop(true,false).fadeOut(); 12406 $("#miniBasketDone").stop(true,false).fadeIn(); 12407 moduleHeights(); 12408 setFixedHeader(); 12409 12410 }); 12411 showCounts(); 12412 12413 }}); 12414 return false; 12415 }); 12416 $(".cms-booking-product-form").unbind('submit').submit(function(){ 12417 12418 var $form=$(this); 12419 var fail=false; 12420 $(".personal-details-form:visible .required:visible",$(this)).each(function(){ 12421 if ($(this).val()=="") { 12422 fail = true; 12423 } 12424 }); 12425 if (fail) { 12426 alert($form.data('fail-msg')); 12427 return false; 12428 } 12429 $(".personal-details-form:hidden").remove(); 12430 var days = 0; 12431 $(".cms-booking-product-days-input",$(this)).each(function(){ 12432 days = days+JSON.parse($(this).val()).length; 12433 }); 12434 if (days==0) { 12435 $(".cms-booking-product-select-day",$(this)).slideDown(); 12436 return false; 12437 } 12438 $("#loading").fadeIn(); 12439 $("#bigloader").fadeIn(); 12440 $(this).ajaxSubmit({success:function() { 12441 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12442 bindMiniBasket(); 12443 $("#loading").stop(true,false).fadeOut(); 12444 $("#bigloader").stop(true,false).fadeOut(); 12445 $("#loader:visible").fadeOut(); 12446 $("#bigloader:visible").fadeOut(); 12447 $("#miniBasketDone").stop(true,false).fadeIn(); 12448 moduleHeights(); 12449 setFixedHeader(); 12450 12451 }); 12452 showCounts(); 12453 }}); 12454 return false; 12455 }); 12456 $(".addToBasketForm").unbind().submit(function(){ 12457 $("#loading").fadeIn(); 12458 $("#bigloader").fadeIn(); 12459 if ($(this).find("input[name=donation_amount]")) { 12460 var pp = $(this).find("input[name=donation_amount]").val(); 12461 } 12462 if ($(this).find("select[name=variant_price]")) { 12463 var pp = $(this).find("select[name=variant_price] option:checked").data("datalayer-price"); 12464 dataLayer.push({"event":"addToBasket","productID":$(this).data("datalayer-productid"),"productPrice":pp,"productName":$(this).parents(".simpleProduct").data("datalayer-name"),"variantName":$(this).find("select[name=variant_price]").val()}); 12465 } else { 12466 dataLayer.push({"event":"addToBasket","productID":$(this).data("datalayer-productid"),"productPrice":pp,"productName":$(this).parents(".simpleProduct").data("datalayer-name")}); 12467 } 12468 12469 $(this).ajaxSubmit({success:function() { 12470 $("#miniBasket2").load("/actions/ShowMiniBasket/"+lang,function(){ 12471 bindMiniBasket(); 12472 $("#loading").stop(true,false).fadeOut(); 12473 $("#bigloader").stop(true,false).fadeOut(); 12474 $("#loader:visible").fadeOut(); 12475 $("#bigloader:visible").fadeOut(); 12476 $("#miniBasketDone").stop(true,false).fadeIn(); 12477 moduleHeights(); 12478 setFixedHeader(); 12479 12480 }); 12481 showCounts(); 12482 }}); 12483 return false; 12484 }); 12485 } 12486 }; 12487 12488/* 12489 #'Shopping Basket' Widget 12490*/ 12491 function qtyUpdate(){ 12492 $("#quantityForm").submit(); 12493 } 12494 window.qtyTimeout; 12495 let ss_autocomplete; 12496 let ss_address1Field; 12497 let ss_address2Field; 12498 let ss_postalField; 12499 12500 function ss_initAutocomplete() { 12501 ss_address1Field = document.querySelector(".ss_autocomplete_street"); 12502 ss_address2Field = document.querySelector(".ss_autocomplete_town"); 12503 ss_postalField = document.querySelector(".ss_autocomplete_zip"); 12504 // Create the autocomplete object, restricting the search predictions to 12505 // addresses in the US and Canada. 12506 ss_autocomplete = new google.maps.places.Autocomplete(ss_address1Field, { 12507 componentRestrictions: { country: $.parseJSON($("#autocomplete_countries").val()) }, 12508 fields: ["address_components"], 12509 types: ["address"], 12510 }); 12511 ss_address1Field.focus(); 12512 // When the user selects an address from the drop-down, populate the 12513 // address fields in the form. 12514 ss_autocomplete.addListener("place_changed", ss_fillInAddress); 12515 } 12516 12517 function ss_fillInAddress() { 12518 // Get the place details from the autocomplete object. 12519 const place = ss_autocomplete.getPlace(); 12520 let address1 = ""; 12521 let postcode = ""; 12522 12523 // Get each component of the address from the place details, 12524 // and then fill-in the corresponding field on the form. 12525 // place.address_components are google.maps.GeocoderAddressComponent objects 12526 // which are documented at http://goo.gle/3l5i5Mr 12527 for (const component of place.address_components) { 12528 // @ts-ignore remove once typings fixed 12529 const componentType = component.types[0]; 12530 12531 console.log(componentType+" "+component.long_name); 12532 switch (componentType) { 12533 case "street_number": { 12534 address1 = `${component.long_name} ${address1}`; 12535 break; 12536 } 12537 12538 case "route": { 12539 address1 += component.short_name; 12540 break; 12541 } 12542 12543 case "postal_code": { 12544 postcode = `${component.long_name}${postcode}`; 12545 break; 12546 } 12547 12548 case "postal_code_suffix": { 12549 postcode = `${postcode}-${component.long_name}`; 12550 break; 12551 } 12552 case "administrative_area_level_2": { 12553 $(".ss_autocomplete_state").val(component.long_name); 12554 break; 12555 } 12556 case "postal_town": { 12557 $(".ss_autocomplete_city").val(component.long_name); 12558 break; 12559 } 12560 case "locality": { 12561 $(".ss_autocomplete_town").val(component.long_name); 12562 break; 12563 } 12564 case "country": 12565 $(".ss_autocomplete_country option").each(function(){ 12566 if ($(this).text().toLowerCase()==component.long_name.toLowerCase()){ 12567 $(".ss_autocomplete_country").val($(this).attr("value")); 12568 } 12569 }); 12570 break; 12571 } 12572 } 12573 12574 ss_address1Field.value = address1; 12575 ss_postalField.value = postcode; 12576 // After filling the form with address components from the Autocomplete 12577 // prediction, set cursor focus on the second address line to encourage 12578 // entry of subpremise information such as apartment, unit, or floor number. 12579 ss_address2Field.focus(); 12580 } 12581 12582 window.ss_initAutocomplete = ss_initAutocomplete; 12583 12584 // end address lookup 12585 function basketReady() { 12586 $("#goToStep2").submit(function(){ 12587 if ($("select[name=chb_sh]").length && $("select[name=chb_sh]").val()==""){ 12588 alert("Please select a shipping method to continue"); 12589 return false;
12590 } 12591 }); 12592 $(".shippingDisp span").text($(".shippingDropdownWrap option:selected").text()); 12593 $("#shipping_name").val($("select[name=chb_sh] option:selected").text()); 12594 if ($("select[name=chb_sh]").length){ 12595 $(".shippingDisp").addClass("withSelect"); 12596 } 12597 $(".gatewaychange").change(function(){ 12598 var t = $(".gatewaychange option:selected").text(); 12599 $(this).prev().text(t); 12600 }); 12601 $(".quantityDropdown").each(function(){ 12602 if (parseInt($(this).find(".dropdownDisp").text())<10){ 12603 $(this).show(); 12604 $(this).next().hide(); 12605 } 12606 }); 12607 $(".quantityWrapper input").keyup(function(e){ 12608 if (isFinite(e.key)){ 12609 clearTimeout(window.qtyTimeout); 12610 window.qtyTimeout = setTimeout(function(){ 12611 qtyUpdate(); 12612 },1000); 12613 } 12614 }); 12615 $(".quantityWrapper input").change(function(){ 12616 $(this).parents("form").submit(); 12617 }); 12618 $(".quantityDropdown select").change(function(){ 12619 var upd = $(this).data("update"); 12620 if ($(this).val()=="10+"){ 12621 $(this).parents(".quantityDropdown").hide(); 12622 $("#"+upd).parents(".quantityWrapper").show().find("input").focus(); 12623 $("#"+upd).val("10"); 12624 } else { 12625 $(".dropdownDisp",$(this).parents(".quantityDropdown")).text($(this).val()); 12626 $("#"+upd).val($(this).val()); 12627 $(this).parents("form").submit(); 12628 } 12629 12630 }); 12631 $('select#country').change(function(){ 12632 var c = $(this).val().toLowerCase(); 12633 $('.unhide-country-switch').each(function(){ 12634 $(this).fadeTo("fast",1); 12635 $(this).prop("disabled",0); 12636 if ($(this).hasClass('was-required')){ 12637 $(this).addClass('required'); 12638 } 12639 }); 12640 $('.country-switch').each(function(){ 12641 if (typeof $(this).attr('data-'+c) != 'undefined'){ 12642 $(this).text($(this).data(c)); 12643 }else{ 12644 12645 $(this).text($(this).data('orig')); 12646 } 12647 }); 12648 $('.hide-if-'+c).each(function(){ 12649 $(this).fadeTo("fast",0.5); 12650 if ($(this)[0].nodeName.toLowerCase()=="input") { 12651 $(this).prop("disabled",true); 12652 if ($(this).hasClass('required')){ 12653 $(this).removeClass('required'); 12654 $(this).addClass('was-required'); 12655 } 12656 } 12657 }); 12658 }).trigger("change"); 12659 } 12660 /* 12661 12662 # Searchable Subpage Index 12663 12664 */ 12665 12666 function kbReady() { 12667 $("#kbSearchInput").keyup(function(){ 12668 $("#contactform textarea").val($(this).val()); 12669 if ($(this).val()!="") { 12670 $("#kbIndex").addClass("searching"); 12671 } else { 12672 $("#kbIndex").removeClass("searching"); 12673 } 12674 12675 $(".searchShow,.searchShowTemp").removeClass("searchShow"); 12676 $(".revealH3").removeClass("revealH3"); 12677 $(".revealUL").removeClass("revealUL"); 12678 $(".revealMore").removeClass("revealMore"); 12679 12680 var words = $(this).val().split(" "); 12681 var $i; 12682 $(".kbItem1,.kbItem2").attr("data-count","0"); 12683 var highestCount=0; 12684 for (var i = words.length - 1; i >= 0; i--) { 12685 $i=$(".kbItem1[data-keywords*='"+words[i].toLowerCase().replace('$','\\$').replace('.','\\.')+"'],.kbItem2[data-keywords*='"+words[i].toLowerCase().replace('$','\\$').replace('.','\\.')+"']"); 12686 if ($i.length) { 12687 $i.addClass("searchShowTemp"); 12688 $i.each(function(){ 12689 var count = parseInt($(this).attr("data-count"))+1; 12690 if (count>highestCount) { 12691 highestCount=count; 12692 } 12693 $(this).attr("data-count",count); 12694 }); 12695 } 12696 }; 12697 $(".searchShowTemp").filter(function(){ 12698 return (parseInt($(this).attr("data-count"))<highestCount); 12699 }).removeClass("searchShowTemp"); 12700 $(".searchShowTemp").removeClass("searchShowTemp").addClass("searchShow"); 12701 $(".searchShow").parents(".kbItem").addClass("revealH3"); 12702 $(".searchShow").parents(".kbItem1").addClass("revealUL"); 12703 $(".searchShow.hidden").parent().addClass("revealMore"); 12704 12705 }); 12706 $(".kbItem1.hasSubs > a").click(function(){ 12707 if ($(this).parent().hasClass("showingSubUL")) { 12708 $(this).parent().removeClass("showingSubUL"); 12709 } else { 12710 $(this).parent().addClass("showingSubUL"); 12711 } 12712 12713 return false; 12714 }); 12715 $(".kbAll a").click(function(){ 12716 if ($(this).parents("ul").hasClass("revealHidden")) { 12717 $(this).parents("ul").removeClass("revealHidden"); 12718 $(this).html($(this).attr("data-lang-open")); 12719 } else { 12720 $(this).parents("ul").addClass("revealHidden"); 12721 $(this).html($(this).attr("data-lang-close")); 12722 } 12723 return false;
12724 }); 12725 12726 if (window.self == window.top) { 12727 $("#kbSearchInput").focus(); 12728 } 12729 12730 $("#clearKBSearch").click(function(){ 12731 $("#kbSearchInput").val("").trigger("keyup"); 12732 }); 12733 $("#contactSupport a").click(function(){ 12734 $("#hideWhenContact").hide(); 12735 $(this).parent().hide(); 12736 $(this).parent().next().addClass("revealed"); 12737 return false; 12738 }); 12739 }; 12740 /* 12741 12742 # Searchable Preview Based Subpage Index 12743 12744 */ 12745 12746 function pbReady() { 12747 $("#pbSearchInput").keyup(function(){ 12748 12749 if ($(this).val()!="") { 12750 $("#pbIndex").addClass("searching"); 12751 } else { 12752 $("#pbIndex").removeClass("searching"); 12753 } 12754 12755 $(".searchShow,.searchShowTemp").removeClass("searchShow"); 12756 12757 12758 var words = $(this).val().split(" "); 12759 var $i; 12760 $(".pbItem").attr("data-count","0"); 12761 var highestCount=0; 12762 for (var i = words.length - 1; i >= 0; i--) { 12763 $i=$(".pbItem[data-keywords*="+words[i].toLowerCase().replace('$','\\$').replace('.','\\.')+"]"); 12764 if ($i.length) { 12765 $i.addClass("searchShowTemp"); 12766 $i.each(function(){ 12767 var count = parseInt($(this).attr("data-count"))+1; 12768 if (count>highestCount) { 12769 highestCount=count; 12770 } 12771 $(this).attr("data-count",count); 12772 }); 12773 } 12774 }; 12775 $(".searchShowTemp").filter(function(){ 12776 return (parseInt($(this).attr("data-count"))<highestCount); 12777 }).removeClass("searchShowTemp"); 12778 $(".searchShowTemp").removeClass("searchShowTemp").addClass("searchShow"); 12779 }); 12780 $(".kbItem1.hasSubs > a").click(function(){ 12781 if ($(this).parent().hasClass("showingSubUL")) { 12782 $(this).parent().removeClass("showingSubUL"); 12783 } else { 12784 $(this).parent().addClass("showingSubUL"); 12785 } 12786 12787 return false; 12788 }); 12789 12790 if (window.self == window.top) { 12791 $("#pbSearchInput").focus(); 12792 } 12793 12794 $("#clearPBSearch").click(function(){ 12795 $("#pbSearchInput").val("").trigger("keyup"); 12796 }); 12797 12798 12799 }; 12800 12801 12802/* 12803 12804 #Livechat Status Widget 12805*/ 12806 12807 12808 function livechatReady() { 12809 return false; 12810 if(typeof sDMT=='undefined') { 12811 function checkLivechat () { 12812 12813 $.ajax({ 12814 type: "GET", 12815 url: "/actions/LivechatStatus/", 12816 success: function(msg){ 12817 if (msg=="online") { 12818 $(".livechatWidgetOffline").hide(); 12819 $(".livechatWidgetOnline").show(); 12820 } else { 12821 $(".livechatWidgetOffline").show(); 12822 $(".livechatWidgetOnline").hide(); 12823 } 12824 } 12825 }); 12826 setTimeout(checkLivechat, 10000); 12827 12828 } 12829 if ($("meta[name=disablelivechat]").length==0) { checkLivechat(); } 12830 } 12831 12832 $(".startConvo").click(function () { 12833 href = this.href; 12834 var popup = window.open(href,'','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=311,height=349'); 12835 return false; 12836 }); 12837 12838 }; 12839 12840/* 12841 #Responsive video helper for jPlayer 12842 12843*/ 12844 12845 var afterResizing; 12846 var windowwidth; 12847 function responsiveVideoResize() { 12848 12849 if (!$(".jplayerInit .jplayer").hasClass("playing")) { 12850 if ($("#videoMPPopup .jplayer").length) { 12851 $("#mp_lightbox_outer").fadeOut(); 12852 if ($("#videoMPPopup .jplayer").hasClass("playing")) { 12853 $("#videoMPPopup .jplayer").jPlayer("stop"); 12854 } 12855 12856 } 12857 clearTimeout(afterResizing); 12858 if (!$(".jp-video-full").length) { 12859 12860 afterResizing = setTimeout(function () { 12861 if ($(".jplayerInit").length && !$(".jp-video-full").length) { 12862 12863 $(".jplayerInit .jplayer").jPlayer("destroy"); 12864 $(".jplayerInit").each(function(){ 12865 var img = $(this).attr("data-poster"); 12866 var vid = $(this).attr("data-vid"); 12867 var $t = $(this).parent(); 12868 $(this).remove(); 12869 $t.html("<a href='"+vid+"'><img src='"+img+"' /></a>"); 12870 $t.waitForImages(function(){ 12871 afterResize(); 12872 }); 12873 }); 12874 12875 } 12876 }, 100); 12877 } 12878 } 12879 }; 12880function afterResize() { 12881 var jplayerVideoCounter=0; 12882 $(".bpe_video:not(.Popup_Video) img").each(function(){ 12883 if (!$(".jplayerInit",$(this).parents(".bpe_video")).length) { 12884 12885 var width = $(this).width(); 12886 var height = $(this).height(); 12887 var image = $(this).attr("src"); 12888 var video = $(this).parent().attr("href"); 12889 $(this).parent().after("<div id=\"video"+jplayerVideoCounter+"\" class='jplayerInit' data-poster='"+image+"' data-vid='"+video+"'>"+playerHTML+"</div>"); 12890 $(this).parent().remove(); 12891 12892 makeVideo("video"+jplayerVideoCounter,width,height,image,video,false,false); 12893 12894 jplayerVideoCounter++; 12895 } 12896 }); 12897 } 12898/* 12899 #Responsive video helper for JWPlayer 12900 12901*/ 12902 12903 var afterResizingJW; 12904 function responsiveVideoJWResize () { 12905 if ($(window).width()==windowwidth) { 12906 return false;
12907 } 12908 if (window.jwplayer) { 12909 var i = 0; 12910 while (true) { 12911 var player = jwplayer("video"+i); 12912 if (!player) 12913 break; 12914 player.remove(); 12915 i++; 12916 } 12917 $(".bpe_video:not(.Popup_Video)").show(); 12918 12919 clearTimeout(afterResizingJW); 12920 afterResizingJW = setTimeout(function () { 12921 afterResizeJW(); 12922 }, 1000); 12923 } 12924 12925 }; 12926 function afterResizeJW() { 12927 var JWPlayerVideoCounter=0; 12928 $(".bpe_video:not(.Popup_Video) img").each(function(){ 12929 12930 var img = this; 12931 var width = $(this).width(); 12932 var height = $(this).height(); 12933 var image = $(this).attr("src"); 12934 var video = $(this).parent().attr("href"); 12935 $(this).parent().parent().hide(); 12936 $(this).parent().parent().after("<div id=\"video"+JWPlayerVideoCounter+"\"></div>"); 12937 makeVideo("video"+JWPlayerVideoCounter,width,height,image,video,false); 12938 12939 12940 JWPlayerVideoCounter++; 12941 }); 12942 } 12943 12944/* 12945 12946 #Responsive Calendar 12947 12948*/ 12949 function calendarReady() { 12950 $(".calendar_responsive_list_mode").on("click",".list_event",function(e){ 12951 var $t = $(this); 12952 if ($(".eventdetails",$t).length) { 12953 $("body").append("<div id='eventPopupWrapper'><div id='eventPopup'><div id='closeEventPopup'>x</div><div id='eventInfo'></div></div></div>"); 12954 12955 $(".eventdetails",$t).clone().appendTo($("#eventInfo")); 12956 12957 var h = $("#eventPopup").outerHeight() / 2; 12958 $("#eventPopup").css("margin-top","-"+h+"px"); 12959 12960 $("#closeEventPopup").click(function(){ 12961 $("#eventPopupWrapper").remove(); 12962 }); 12963 return false; 12964 } 12965 }); 12966 $(".calendar").on("click",".event",function(e){ 12967 var $t = $(this); 12968 if ($(window).width()>768 && $(".eventdetails",$t).length) { 12969 $("body").append("<div id='eventPopupWrapper'><div id='eventPopup'><div id='closeEventPopup'>x</div><div id='eventInfo'></div></div></div>"); 12970 12971 $(".eventdetails",$t).clone().appendTo($("#eventInfo")); 12972 12973 var h = $("#eventPopup").outerHeight() / 2; 12974 $("#eventPopup").css("margin-top","-"+h+"px"); 12975 12976 $("#closeEventPopup").click(function(){ 12977 $("#eventPopupWrapper").remove(); 12978 }); 12979 return false; 12980 } 12981 }); 12982 $(".calendar").on("click",".hasEvents",function(e){ 12983 12984 if ($(window).width()<=768) { 12985 $("body").append("<div id='eventPopupWrapper'><div id='eventPopup'><div id='closeEventPopup'>x</div><div id='eventInfo'></div></div></div>"); 12986 12987 $(".eventdetails",$t).clone().appendTo($("#eventInfo")); 12988 12989 var h = $("#eventPopup").outerHeight() / 2; 12990 $("#eventPopup").css("margin-top","-"+h+"px"); 12991 12992 $("#closeEventPopup").click(function(){ 12993 $("#eventPopupWrapper").remove(); 12994 }); 12995 return false; 12996 } 12997 12998 }); 12999 13000 }; 13001 13002/* 13003 #Full width banner + Disclosures 13004 13005*/ 13006 function bannerReady() { 13007 if ($("#fullWidthBanner").length) { 13008 if ($("#fullWidthBannerBG img").length) { 13009 var src = $("#fullWidthBannerBG img").attr("src"); 13010 src = src.split("?"); 13011 src = src[0]+"?width=1920&height=auto"; 13012 } else { 13013 var src="/graphics/full-width-bg.jpg" 13014 } 13015 $("#fullWidthBanner").backstretch(src); 13016 $("h1,h2,h3,h4,p,li","#fullWidthBanner").filter(":not(.Button_Small,.Button_Medium,.Button_Large)").wrapInner("<span></span>"); 13017 } 13018 $("h1,h2,h3,h4,p,li",".disclose").filter(":not(.Button_Small,.Button_Medium,.Button_Large)").wrapInner("<span class=\"disclosure-reveal\"></span>"); 13019 }; 13020 13021/* 13022 13023 #Blog Loop 13024 13025*/ 13026 /* 13027 $(document).ready(function(){ 13028 $(".blogItemLoop").each(function(){ 13029 if (typeof $(this).attr("data-pic") != 'undefined') { 13030 $(this).backstretch($(this).attr("data-pic")); 13031 } 13032 $("h1,h2,h3,h4,p,li",$(this)).filter(":not(.Button_Small,.Button_Medium,.Button_Large,.blogDate)").wrapInner("<span></span>"); 13033 }); 13034 }); 13035 */ 13036 13037/* 13038 #Countdown 13039 13040*/ 13041 function countdownReady() { 13042 if (typeof countdownReady_core != "undefined"){ 13043 countdownReady_core(); 13044 } 13045 13046 13047 }; 13048 13049 13050 13051 13052// If you add JWPlayer to your installation you can set some basic config for the player here. 13053var videoControlBar = "over"; 13054var videoScreenColor = "#FFFFFF"; 13055 13056/* 13057#Consent banner 13058*/ 13059function updateConsentBasedContent() { 13060 insertYT(); 13061 13062 if (typeof mapsMarkersReady_core!= "undefined"){ 13063 mapsMarkersReady_core(); 13064 } 13065 if (window.consent.functional){ 13066 $(".functional-iframe-check-consent").each(function(){ 13067 $(this).html('<iframe src="'+$(this).data("iframe-src")+'" frameborder="0" allowfullscreen></iframe>').removeClass("styleBox"); 13068 }); 13069 } 13070 $(".consent-container").each(function(){
13071 var purp = $(this).data("consent-purpose"); 13072 if (($(this).hasClass("consent-container-require-consent")&&consent[purp])||!$(this).hasClass("consent-container-require-consent")) { 13073 $(this).html($(this).data("content")); 13074 moduleHeights(); 13075 13076 } 13077 }); 13078} 13079function setConsent(consent) { 13080 const consentMode = { 13081 'ad_storage': consent.advertising ? 'granted' : 'denied', 13082 'ad_user_data': consent.advertising ? 'granted' : 'denied', 13083 'ad_personalisation': consent.advertising ? 'granted' : 'denied', 13084 'analytics_storage': consent.performance ? 'granted' : 'denied', 13085 'personalization_storage': consent.functional ? 'granted' : 'denied', 13086 }; 13087 gtag('consent', 'update', consentMode); 13088 window.consent=consent; 13089 localStorage.setItem('consent', JSON.stringify(consent)); 13090 updateConsentBasedContent(); 13091} 13092function consentReady() { 13093 $('a[href="#cookies"]').click(function(){ 13094 $("#consent_banner").show(); 13095 return false; 13096 }); 13097 13098 if (localStorage.getItem('consent') === null) { 13099 $("#consent_banner").show(); 13100 } 13101 13102 $(".show-cookie-banner").click(function(){ 13103 $("#consent_banner").show(); 13104 return false; 13105 }); 13106 if (window.consent.functional){ 13107 $(".consent-functional").addClass("on"); 13108 } 13109 if (window.consent.performance){ 13110 $(".consent-performance").addClass("on"); 13111 } 13112 if (window.consent.advertising){ 13113 $(".consent-advertising").addClass("on"); 13114 } 13115 $(".consent-item:not(.consent-disabled)").click(function(){ 13116 if ($(this).hasClass("on")) { 13117 $(this).removeClass("on"); 13118 $(this).text("Opted-out"); 13119 } else { 13120 13121 $(this).text("Allowed"); 13122 $(this).addClass("on"); 13123 } 13124 $("#consent_current").text("Save selection"); 13125 13126 }); 13127 $("#consent_current").click(function(){ 13128 setConsent({ 13129 functional: $(".consent-functional").hasClass("on"), 13130 performance: $(".consent-performance").hasClass("on"), 13131 advertising: $(".consent-advertising").hasClass("on") 13132 }); 13133 setTimeout(function(){ 13134 $("#consent_banner").fadeOut(300); 13135 },300) 13136 return false; 13137 }); 13138 $("#consent_allow").click(function(){ 13139 $("#consent_banner .consent-item:not(.on)").trigger("click"); 13140 setTimeout(function(){ 13141 setConsent({ 13142 functional: true, 13143 performance: true, 13144 advertising: true 13145 }); 13146 $("#consent_banner").fadeOut(300); 13147 },300) 13148 return false; 13149 }); 13150}; 13151 13152 13153 13154 13155 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.