https://www.maunakearesort.com/js/js_client_bundle.js?v=y3Lq5KT4O1a5EwcAdGnHCYZ4hfaVuXNmAGJhOhrZTGk1
vendor: 2,219 bytes, lines 1-32
1/* Minification failed. Returning unminified contents. 2(616,9-10): run-time error JS1010: Expected identifier: . 3(616,9-10): run-time error JS1195: Expected expression: . 4(617,2-6): run-time error JS1034: Unmatched 'else'; no 'if' defined: else 5(646,18-19): run-time error JS1010: Expected identifier: . 6(646,18-19): run-time error JS1195: Expected expression: . 7(1169,8-9): run-time error JS1010: Expected identifier: . 8(1169,8-9): run-time error JS1195: Expected expression: . 9(1297,8-9): run-time error JS1010: Expected identifier: . 10(1297,8-9): run-time error JS1195: Expected expression: . 11(1548,8-9): run-time error JS1010: Expected identifier: . 12(1548,8-9): run-time error JS1195: Expected expression: . 13(1732,8-9): run-time error JS1010: Expected identifier: . 14(1732,8-9): run-time error JS1195: Expected expression: . 15(1798,8-9): run-time error JS1010: Expected identifier: . 16(1798,8-9): run-time error JS1195: Expected expression: . 17(1901,8-9): run-time error JS1010: Expected identifier: . 18(1901,8-9): run-time error JS1195: Expected expression: . 19(2175,8-9): run-time error JS1010: Expected identifier: . 20(2175,8-9): run-time error JS1195: Expected expression: . 21(2275,8-9): run-time error JS1010: Expected identifier: . 22(2275,8-9): run-time error JS1195: Expected expression: . 23(3010,9-10): run-time error JS1010: Expected identifier: . 24(3010,9-10): run-time error JS1195: Expected expression: . 25(5737,15-16): run-time error JS1010: Expected identifier: . 26(5737,15-16): run-time error JS1195: Expected expression: . 27 */ 28// Underscore.js 1.8.3 29// http://underscorejs.org 30// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 31// Underscore may be freely distributed under the MIT license. 32(function(){function n(n){function t(t,r,e,u,i,o){for(;i>=0&&o>i;i+=n){var a=u?u[i]:i;e=r(e,t[a],a,t)}return e}return function(r,e,u,i){e=b(e,i,4);var o=!k(r)&&m.keys(r),a=(o||r).length,c=n>0?0:a-1;return arguments.length<3&&(u=r[o?o[c]:c],c+=n),t(r,e,u,o,c,a)}}function t(n){return function(t,r,e){r=x(r,e);for(var u=O(t),i=n>0?0:u-1;i>=0&&u>i;i+=n)if(r(t[i],i,t))return i;return-1}}function r(n,t,r){return function(e,u,i){var o=0,a=O(e);
32if("number"==typeof i)n>0?o=i>=0?i:Math.max(i+a,o):a=i>=0?Math.min(i+1,a):i+a+1;else if(r&&i&&a)return i=r(e,u),e[i]===u?i:-1;if(u!==u)return i=t(l.call(e,o,a),m.isNaN),i>=0?i+o:-1;for(i=n>0?o:a-1;i>=0&&a>i;i+=n)if(e[i]===u)return i;return-1}}function e(n,t){var r=I.length,e=n.constructor,u=m.isFunction(e)&&e.prototype||a,i="constructor";for(m.has(n,i)&&!m.contains(t,i)&&t.push(i);r--;)i=I[r],i in n&&n[i]!==u[i]&&!m.contains(t,i)&&t.push(i)}var u=this,i=u._,o=Array.prototype,a=Object.prototype,c=Function.prototype,f=o.push,l=o.slice,s=a.toString,p=a.hasOwnProperty,h=Array.isArray,v=Object.keys,g=c.bind,y=Object.create,d=function(){},m=function(n){return n instanceof m?n:this instanceof m?void(this._wrapped=n):new m(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=m),exports._=m):u._=m,m.VERSION="1.8.3";var b=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}},x=function(n,t,r){return null==n?m.identity:m.isFunction(n)?b(n,t,r):m.isObject(n)?m.matcher(n):m.property(n)};m.iteratee=function(n,t){return x(n,t,1/0)};var _=function(n,t){return function(r){var e=arguments.length;if(2>e||null==r)return r;for(var u=1;e>u;u++)for(var i=arguments[u],o=n(i),a=o.length,c=0;a>c;c++){var f=o[c];t&&r[f]!==void 0||(r[f]=i[f])}return r}},j=function(n){if(!m.isObject(n))return{};if(y)return y(n);d.prototype=n;var t=new d;return d.prototype=null,t},w=function(n){return function(t){return null==t?void 0:t[n]}},A=Math.pow(2,53)-1,O=w("length"),k=function(n){var t=O(n);return"number"==typeof t&&t>=0&&A>=t};m.each=m.forEach=function(n,t,r){t=b(t,r);var e,u;if(k(n))for(e=0,u=n.length;u>e;e++)t(n[e],e,n);else{var i=m.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},m.map=m.collect=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=Array(u),o=0;u>o;o++){var a=e?e[o]:o;i[o]=t(n[a],a,n)}return i},m.reduce=m.foldl=m.inject=n(1),m.reduceRight=m.foldr=n(-1),m.find=m.detect=function(n,t,r){var e;return e=k(n)?m.findIndex(n,t,r):m.findKey(n,t,r),e!==void 0&&e!==-1?n[e]:void 0},m.filter=m.select=function(n,t,r){var e=[];return t=x(t,r),m.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e},m.reject=function(n,t,r){return m.filter(n,m.negate(x(t)),r)},m.every=m.all=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(!t(n[o],o,n))return!1}return!0},m.some=m.any=function(n,t,r){t=x(t,r);for(var e=!k(n)&&m.keys(n),u=(e||n).length,i=0;u>i;i++){var o=e?e[i]:i;if(t(n[o],o,n))return!0}return!1},m.contains=m.includes=m.include=function(n,t,r,e){return k(n)||(n=m.values(n)),("number"!=typeof r||e)&&(r=0),m.indexOf(n,t,r)>=0},m.invoke=function(n,t){var r=l.call(arguments,2),e=m.isFunction(t);return m.map(n,function(n){var u=e?t:n[t];return null==u?u:u.apply(n,r)})},m.pluck=function(n,t){return m.map(n,m.property(t))},m.where=function(n,t){return m.filter(n,m.matcher(t))},m.findWhere=function(n,t){return m.find(n,m.matcher(t))},m.max=function(n,t,r){var e,u,i=-1/0,o=-1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],e>i&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(u>o||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},m.min=function(n,t,r){var e,u,i=1/0,o=1/0;if(null==t&&null!=n){n=k(n)?n:m.values(n);for(var a=0,c=n.length;c>a;a++)e=n[a],i>e&&(i=e)}else t=x(t,r),m.each(n,function(n,r,e){u=t(n,r,e),(o>u||1/0===u&&1/0===i)&&(i=n,o=u)});return i},m.shuffle=function(n){for(var t,r=k(n)?n:m.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=m.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},m.sample=function(n,t,r){return null==t||r?(k(n)||(n=m.values(n)),n[m.random(n.length-1)]):m.shuffle(n).slice(0,Math.max(0,t))},m.sortBy=function(n,t,r){return t=x(t,r),m.pluck(m.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=x(r,e),m.each(t,function(e,i){var o=r(e,i,t);n(u,e,o)}),u}};m.groupBy=F(function(n,t,r){m.has(n,r)?n[r].push(t):n[r]=[t]}),m.indexBy=F(function(n,t,r){n[r]=t}),m.countBy=F(function(n,t,r){m.has(n,r)?n[r]++:n[r]=1}),m.toArray=function(n){return n?m.isArray(n)?l.call(n):k(n)?m.map(n,m.identity):m.values(n):[]},m.size=function(n){return null==n?0:k(n)?n.length:m.keys(n).length},m.partition=function(n,t,r){t=x(t,r);var e=[],u=[];return m.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},m.first=m.head=m.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:m.initial(n,n.length-t)},m.initial=function(n,t,r){return l.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},m.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:m.rest(n,Math.max(0,n.length-t))},m.rest=m.tail=m.drop=function(n,t,r){return l.call(n,null==t||r?1:t)},m.compact=function(n){return m.filter(n,m.identity)};var S=function(n,t,r,e){for(var u=[],i=0,o=e||0,a=O(n);a>o;o++){var c=n[o];if(k(c)&&(m.isArray(c)||m.isArguments(c))){t||(c=S(c,t,r));var f=0,l=c.length;for(u.length+=l;l>f;
32)u[i++]=c[f++]}else r||(u[i++]=c)}return u};m.flatten=function(n,t){return S(n,t,!1)},m.without=function(n){return m.difference(n,l.call(arguments,1))},m.uniq=m.unique=function(n,t,r,e){m.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=x(r,e));for(var u=[],i=[],o=0,a=O(n);a>o;o++){var c=n[o],f=r?r(c,o,n):c;t?(o&&i===f||u.push(c),i=f):r?m.contains(i,f)||(i.push(f),u.push(c)):m.contains(u,c)||u.push(c)}return u},m.union=function(){return m.uniq(S(arguments,!0,!0))},m.intersection=function(n){for(var t=[],r=arguments.length,e=0,u=O(n);u>e;e++){var i=n[e];if(!m.contains(t,i)){for(var o=1;r>o&&m.contains(arguments[o],i);o++);o===r&&t.push(i)}}return t},m.difference=function(n){var t=S(arguments,!0,!0,1);return m.filter(n,function(n){return!m.contains(t,n)})},m.zip=function(){return m.unzip(arguments)},m.unzip=function(n){for(var t=n&&m.max(n,O).length||0,r=Array(t),e=0;t>e;e++)r[e]=m.pluck(n,e);return r},m.object=function(n,t){for(var r={},e=0,u=O(n);u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},m.findIndex=t(1),m.findLastIndex=t(-1),m.sortedIndex=function(n,t,r,e){r=x(r,e,1);for(var u=r(t),i=0,o=O(n);o>i;){var a=Math.floor((i+o)/2);r(n[a])<u?i=a+1:o=a}return i},m.indexOf=r(1,m.findIndex,m.sortedIndex),m.lastIndexOf=r(-1,m.findLastIndex),m.range=function(n,t,r){null==t&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var E=function(n,t,r,e,u){if(!(e instanceof t))return n.apply(r,u);var i=j(n.prototype),o=n.apply(i,u);return m.isObject(o)?o:i};m.bind=function(n,t){if(g&&n.bind===g)return g.apply(n,l.call(arguments,1));if(!m.isFunction(n))throw new TypeError("Bind must be called on a function");var r=l.call(arguments,2),e=function(){return E(n,e,t,this,r.concat(l.call(arguments)))};return e},m.partial=function(n){var t=l.call(arguments,1),r=function(){for(var e=0,u=t.length,i=Array(u),o=0;u>o;o++)i[o]=t[o]===m?arguments[e++]:t[o];for(;e<arguments.length;)i.push(arguments[e++]);return E(n,r,this,this,i)};return r},m.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=m.bind(n[r],n);return n},m.memoize=function(n,t){var r=function(e){var u=r.cache,i=""+(t?t.apply(this,arguments):e);return m.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},m.delay=function(n,t){var r=l.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},m.defer=m.partial(m.delay,m,1),m.throttle=function(n,t,r){var e,u,i,o=null,a=0;r||(r={});var c=function(){a=r.leading===!1?0:m.now(),o=null,i=n.apply(e,u),o||(e=u=null)};return function(){var f=m.now();a||r.leading!==!1||(a=f);var l=t-(f-a);return e=this,u=arguments,0>=l||l>t?(o&&(clearTimeout(o),o=null),a=f,i=n.apply(e,u),o||(e=u=null)):o||r.trailing===!1||(o=setTimeout(c,l)),i}},m.debounce=function(n,t,r){var e,u,i,o,a,c=function(){var f=m.now()-o;t>f&&f>=0?e=setTimeout(c,t-f):(e=null,r||(a=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,o=m.now();var f=r&&!e;return e||(e=setTimeout(c,t)),f&&(a=n.apply(i,u),i=u=null),a}},m.wrap=function(n,t){return m.partial(t,n)},m.negate=function(n){return function(){return!n.apply(this,arguments)}},m.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},m.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},m.before=function(n,t){var r;return function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=null),r}},m.once=m.partial(m.before,2);var M=!{toString:null}.propertyIsEnumerable("toString"),I=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];m.keys=function(n){if(!m.isObject(n))return[];if(v)return v(n);var t=[];for(var r in n)m.has(n,r)&&t.push(r);return M&&e(n,t),t},m.allKeys=function(n){if(!m.isObject(n))return[];var t=[];for(var r in n)t.push(r);return M&&e(n,t),t},m.values=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},m.mapObject=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=u.length,o={},a=0;i>a;a++)e=u[a],o[e]=t(n[e],e,n);return o},m.pairs=function(n){for(var t=m.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},m.invert=function(n){for(var t={},r=m.keys(n),e=0,u=r.length;u>e;
vendor: 6,170 bytes, lines 32-34
32e++)t[n[r[e]]]=r[e];return t},m.functions=m.methods=function(n){var t=[];for(var r in n)m.isFunction(n[r])&&t.push(r);return t.sort()},m.extend=_(m.allKeys),m.extendOwn=m.assign=_(m.keys),m.findKey=function(n,t,r){t=x(t,r);for(var e,u=m.keys(n),i=0,o=u.length;o>i;i++)if(e=u[i],t(n[e],e,n))return e},m.pick=function(n,t,r){var e,u,i={},o=n;if(null==o)return i;m.isFunction(t)?(u=m.allKeys(o),e=b(t,r)):(u=S(arguments,!1,!1,1),e=function(n,t,r){return t in r},o=Object(o));for(var a=0,c=u.length;c>a;a++){var f=u[a],l=o[f];e(l,f,o)&&(i[f]=l)}return i},m.omit=function(n,t,r){if(m.isFunction(t))t=m.negate(t);else{var e=m.map(S(arguments,!1,!1,1),String);t=function(n,t){return!m.contains(e,t)}}return m.pick(n,t,r)},m.defaults=_(m.allKeys,!0),m.create=function(n,t){var r=j(n);return t&&m.extendOwn(r,t),r},m.clone=function(n){return m.isObject(n)?m.isArray(n)?n.slice():m.extend({},n):n},m.tap=function(n,t){return t(n),n},m.isMatch=function(n,t){var r=m.keys(t),e=r.length;if(null==n)return!e;for(var u=Object(n),i=0;e>i;i++){var o=r[i];if(t[o]!==u[o]||!(o in u))return!1}return!0};var N=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof m&&(n=n._wrapped),t instanceof m&&(t=t._wrapped);var u=s.call(n);if(u!==s.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}var i="[object Array]"===u;if(!i){if("object"!=typeof n||"object"!=typeof t)return!1;var o=n.constructor,a=t.constructor;if(o!==a&&!(m.isFunction(o)&&o instanceof o&&m.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in t)return!1}r=r||[],e=e||[];for(var c=r.length;c--;)if(r[c]===n)return e[c]===t;if(r.push(n),e.push(t),i){if(c=n.length,c!==t.length)return!1;for(;c--;)if(!N(n[c],t[c],r,e))return!1}else{var f,l=m.keys(n);if(c=l.length,m.keys(t).length!==c)return!1;for(;c--;)if(f=l[c],!m.has(t,f)||!N(n[f],t[f],r,e))return!1}return r.pop(),e.pop(),!0};m.isEqual=function(n,t){return N(n,t)},m.isEmpty=function(n){return null==n?!0:k(n)&&(m.isArray(n)||m.isString(n)||m.isArguments(n))?0===n.length:0===m.keys(n).length},m.isElement=function(n){return!(!n||1!==n.nodeType)},m.isArray=h||function(n){return"[object Array]"===s.call(n)},m.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},m.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(n){m["is"+n]=function(t){return s.call(t)==="[object "+n+"]"}}),m.isArguments(arguments)||(m.isArguments=function(n){return m.has(n,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(m.isFunction=function(n){return"function"==typeof n||!1}),m.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},m.isNaN=function(n){return m.isNumber(n)&&n!==+n},m.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===s.call(n)},m.isNull=function(n){return null===n},m.isUndefined=function(n){return n===void 0},m.has=function(n,t){return null!=n&&p.call(n,t)},m.noConflict=function(){return u._=i,this},m.identity=function(n){return n},m.constant=function(n){return function(){return n}},m.noop=function(){},m.property=w,m.propertyOf=function(n){return null==n?function(){}:function(t){return n[t]}},m.matcher=m.matches=function(n){return n=m.extendOwn({},n),function(t){return m.isMatch(t,n)}},m.times=function(n,t,r){var e=Array(Math.max(0,n));t=b(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},m.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},m.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},T=m.invert(B),R=function(n){var t=function(t){return n[t]},r="(?:"+m.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};m.escape=R(B),m.unescape=R(T),m.result=function(n,t,r){var e=null==n?void 0:n[t];return e===void 0&&(e=r),m.isFunction(e)?e.call(n):e};var q=0;m.uniqueId=function(n){var t=++q+"";return n?n+t:t},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,z={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\u2028|\u2029/g,L=function(n){return"\\"+z[n]};m.template=function(n,t,r){!t&&r&&(t=r),t=m.defaults({},t,m.templateSettings);var e=RegExp([(t.escape||K).source,(t.interpolate||K).source,(t.evaluate||K).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,o,a){return i+=n.slice(u,a).replace(D,L),u=a+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":o&&(i+="';\n"+o+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var o=new Function(t.variable||"obj","_",i)}catch(a){throw a.source=i,a}var c=function(n){return o.call(this,n,m)},f=t.variable||"obj";return c.source="function("+f+"){\n"+i+"}",c},m.chain=function(n){var t=m(n);return t._chain=!0,t};var P=function(n,t){return n._chain?m(t).chain():t};m.mixin=function(n){m.each(m.functions(n),function(t){var r=m[t]=n[t];m.prototype[t]=function(){var n=[this._wrapped];return f.apply(n,arguments),P(this,r.apply(m,n))}})},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=o[n];m.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],P(this,r)}}),m.each(["concat","join","slice"],function(n){var t=o[n];m.prototype[n]=function(){return P(this,t.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}).call(this); 33//# sourceMappingURL=underscore-min.map; 34/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */�
vendor: 86,842 bytes, lines 34-35
34 35!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
35 36; 37/** 38 * jQuery Cookie plugin 39 * 40 * Copyright (c) 2010 Klaus Hartl (stilbuero.de) 41 * Dual licensed under the MIT and GPL licenses: 42 * http://www.opensource.org/licenses/mit-license.php 43 * http://www.gnu.org/licenses/gpl.html 44 * 45 */ 46jQuery.cookie = function (key, value, options) { 47 48 // key and at least value given, set cookie... 49 if (arguments.length > 1 && String(value) !== "[object Object]") { 50 options = jQuery.extend({}, options); 51 52 if (value === null || value === undefined) { 53 options.expires = -1; 54 } 55 56 if (typeof options.expires === 'number') { 57 var days = options.expires, t = options.expires = new Date(); 58 t.setDate(t.getDate() + days); 59 } 60 61 value = String(value); 62 63 return (document.cookie = [ 64 encodeURIComponent(key), '=', 65 options.raw ? value : encodeURIComponent(value), 66 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 67 options.path ? '; path=' + options.path : '', 68 options.domain ? '; domain=' + options.domain : '', 69 options.secure ? '; secure' : '' 70 ].join('')); 71 } 72 73 // key and possibly options given, get cookie... 74 options = value || {}; 75 var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; 76 return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 77}; 78; 79/*! LAB.js (LABjs :: Loading And Blocking JavaScript) 80 v2.0.3 (c) Kyle Simpson 81 MIT License 82*/ 83(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){a.finished_listeners[c]()}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g()}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){d=null;I(b)}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");
83if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){e.ready_listeners[a]()}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){j()}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j++]()}catch(err){}continue}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.unshift(d,1);[].splice.apply(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);; 84//Custom Event 85$(document).on('click submit', '[gaq]', function (e) { 86 //prevent both click and submit to happen at once 87 if (e.type.toLowerCase() == 'click' && this.nodeName.toLowerCase() == 'form') return; 88 var details = $(this).attr("gaq").replace(/\s*/g, '').split(","); 89 var type = title = ''; 90 if (details.length > 0) type = details[0]; 91 if (details.length > 1) title = details[1]; 92 try { 93 HDMdataLayer.push({ 94 'event': 'custom', 95 'category': type, 96 'action': document.location.pathname, 97 'label': title 98 }); 99 } catch (err) { 100 console.log('Custom Event', err); 101 } 102});; 103/* 104 Layout JS 105 - common scripts used throughout the site 106*/ 107 108window.$HDMLAB = (window.$HDMLAB || $LAB); 109 110function fullHeight() { 111 $('[data-type="fillHeight"]').each(function (idx, elem) { 112 var newHeight = $(window).height() * parseFloat($(elem).attr('data-height')) / 100; 113 $(elem).height(newHeight); 114 }); 115} 116$(window).resize(fullHeight); 117fullHeight(); 118 119window.$HDMLAB 120 .script("/js/bundle/site/wow.min.js") 121 .wait(function () { 122 new WOW().init(); 123 }); 124 125window.$HDMLAB 126 .script("/js/vendors/site/jquery.ba-hashchange.min.js") 127 .wait(function () { 128 $(window).on('hashchange', function () { 129 $(window).trigger('hash-change', [location.hash]); 130 }); 131 });
132 133// Fonts 134window.$HDMLAB 135 .script('/js/vendors/site/webfontloader.js') 136 .wait(function () { 137 WebFont.load({ 138 google: { 139 families: ['Nunito+Sans:ital,wght@0,200;0,400;0,600;0,700;1,400;1,600;1,70', 'Lora:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700', 'Mulish:wght@400;700', 'Montserrat:400,600&display=swap'] 140 }, 141 typekit: { 142 id: 'fzd1xrx' 143 }, 144 // typekit: { 145 // id: 'rjk6xfq' 146 // } 147 }); 148 }); 149 150/******** misc functions ***********/ 151function debounce(func, wait, immediate) { 152 var timeout; 153 return function () { 154 var context = this, args = arguments; 155 var later = function () { 156 timeout = null; 157 if (!immediate) func.apply(context, args); 158 }; 159 var callNow = immediate && !timeout; 160 clearTimeout(timeout); 161 timeout = setTimeout(later, wait); 162 if (callNow) func.apply(context, args); 163 }; 164}; 165 166//function preloadBackgroundImage($ele) { 167// var $link = $ele.children('a'); 168// if ($link.length !== 0) { 169// var imagePath = $link.attr('href'); 170// $('<img/>').on('load', function () { 171// $ele.css('background-image', "url('" + this.src + "')").removeClass('preload-image'); 172// }).attr('src', imagePath); 173// } 174//} 175 176 177// Promisifying XMLHttpRequest 178// https://developers.google.com/web/fundamentals/primers/promises 179function get(url) { 180 // Return a new promise. 181 return new Promise(function(resolve, reject) { 182 // Do the usual XHR stuff 183 var req = new XMLHttpRequest(); 184 req.open('GET', url); 185 186 req.onload = function() { 187 // This is called even on 404 etc so check the status 188 if (req.status == 200) { 189 // Resolve the promise with the response text 190 resolve(req.response); 191 } else { 192 // Otherwise reject with the status text 193 // which will hopefully be a meaningful error 194 reject(Error(req.statusText)); 195 } 196 }; 197 198 // Handle network errors 199 req.onerror = function() { 200 reject(Error("Network Error")); 201 }; 202 203 // Make the request 204 req.send(); 205 }); 206} 207 208 209// matches() polyfill 210if (!Element.prototype.matches) { 211 Element.prototype.matches = Element.prototype.msMatchesSelector || 212 Element.prototype.webkitMatchesSelector; 213} 214 215 216// Modify markup on pill buttons 217$('.btn-pill').each(function(i, el) { 218 const $this = $(el); 219 220 // check if this has already run.. 221 if ($this.find('.button-bg').length) return; 222 223 // wrap text in a span 224 $this.contents().wrap('<span></span>'); 225 // add bg div 226 $this.prepend('<span class="button-bg"></span>'); 227}); 228 229/***** Lazy load *****/ 230window.$HDMLAB 231 .script('/js/bundle/site/intersection-observer.js') 232 .wait(function () { 233 234 // Images 235 // Usage: <img data-lazy-src="/images/my-photo.jpg" alt=""> 236 const initLazyImages = function() { 237 238 const images = document.querySelectorAll('img[data-lazy-src]'); 239 const imagesArray = Array.prototype.slice.call(images); 240 241 const lazyConfig = { 242 rootMargin: '0px 0px 0px 0px', 243 threshold: .05 244 }; 245 246 let imgObserver = new IntersectionObserver(function(entries, self) { 247 entries.forEach(function(entry) { 248 if(entry.isIntersecting) { 249 preloadImage(entry.target); 250 self.unobserve(entry.target); 251 } 252 }); 253 }, lazyConfig); 254 255 imagesArray.forEach(function(image) { 256 imgObserver.observe(image); 257 }); 258 259 function preloadImage(img) { 260 let src = img.getAttribute('data-lazy-src'); 261 if(!src) return; 262 img.src = src; 263 264 if(img.classList.contains('fancy')) { 265 img.classList.add('lazy-fade-in-fancy'); 266 } else { 267 img.classList.add('lazy-fade-in'); 268 } 269 270 // refresh polyfill 271 //objectFitPolyfill(); 272 273 // cleanup 274 img.removeAttribute('data-lazy-src'); 275 } 276 277 }; 278 279
280 // Background images 281 // Usage: <div data-lazy-bg="/images/my-photo.jpg"></div> 282 const initLazyBgImages = function() { 283 284 const images = document.querySelectorAll('[data-lazy-bg]'); 285 const imagesArray = Array.prototype.slice.call(images); 286 287 const lazyConfig = { 288 rootMargin: '0px 0px 0px 0px', 289 threshold: .05 290 }; 291 292 let bgObserver = new IntersectionObserver(function(entries, self) { 293 entries.forEach(function(entry) { 294 if(entry.isIntersecting) { 295 preloadImage(entry.target); 296 self.unobserve(entry.target); 297 } 298 }); 299 }, lazyConfig); 300 301 imagesArray.forEach(function(image) { 302 bgObserver.observe(image); 303 }); 304 305 function preloadImage(img) { 306 let src = img.getAttribute('data-lazy-bg'); 307 if(!src) return; 308 img.style.backgroundImage = 'url(' + src + ')'; 309 310 // cleanup 311 img.removeAttribute('data-lazy-bg'); 312 } 313 314 }; 315 316 // init lazy load 317 initLazyImages(); 318 initLazyBgImages(); 319 320}); 321 322 323// lazy load sliders 324// usage: loadSlider('.my-slider', initMySlider); 325function loadSlider(sliderClass, callbackFunc) { 326 // config
327 let config = { 328 rootMargin: '0px 0px 50px 0px', 329 threshold: 0 330 }; 331 332 // element to observe 333 let slider = document.querySelector(sliderClass); 334 if(slider != null){ 335 // set up the observer 336 let observer = new IntersectionObserver(function(entry, self) { 337 if(entry[0].isIntersecting) { 338 callbackFunc(); 339 self.unobserve(entry[0].target); 340 } 341 }, config); 342 343 // begin observing 344 observer.observe(slider); 345 } 346} 347 348/* 349* Replace all SVG images with inline SVG 350*/ 351function inlineSVG(elem) { 352 353 document.querySelectorAll(elem).forEach(function(img){ 354 var imgID = img.id; 355 var imgClass = img.className; 356 var imgURL = img.src; 357 358 fetch(imgURL).then(function(response) { 359 return response.text(); 360 }).then(function(text){ 361 362 var parser = new DOMParser(); 363 var xmlDoc = parser.parseFromString(text, "text/xml"); 364 365 // Get the SVG tag, ignore the rest 366 var svg = xmlDoc.getElementsByTagName('svg')[0]; 367 368 // Add replaced image's ID to the new SVG 369 if(typeof imgID !== 'undefined') { 370 svg.setAttribute('id', imgID); 371 } 372 // Add replaced image's classes to the new SVG 373 if(typeof imgClass !== 'undefined') { 374 svg.setAttribute('class', imgClass+' replaced-svg'); 375 } 376 377 // Remove any invalid XML tags as per http://validator.w3.org 378 svg.removeAttribute('xmlns:a'); 379 380 // Check if the viewport is set, if the viewport is not set the SVG wont't scale. 381 if(!svg.getAttribute('viewBox') && svg.getAttribute('height') && svg.getAttribute('width')) { 382 svg.setAttribute('viewBox', '0 0 ' + svg.getAttribute('height') + ' ' + svg.getAttribute('width')) 383 } 384 385 // Replace image with new SVG 386 img.parentNode.replaceChild(svg, img); 387 388 }); 389 390 }); 391} 392 393// observe background videos to play/pause when in viewport 394function observeBgVideo(videoId, parentClass) { 395 let vidId = videoId.replace('#', ''); 396 const video = document.getElementById(vidId); 397 398 function playVideo() { 399 try { 400 video.play(); 401 } catch(err) { 402 console.log(err); 403 } 404 } 405 406 function pauseVideo() { 407 try { 408 video.pause(); 409 } catch(err) { 410 console.log(err); 411 } 412 } 413 414 // set up the observer 415 let config = { 416 rootMargin: '0px 0px 0px 0px', 417 threshold: 0 418 }; 419 420 let parentEl = document.querySelector(parentClass); 421 422 if (!parentEl) return; 423 424 let observer = new IntersectionObserver(function(entry, self) { 425 if(entry[0].isIntersecting) { 426 playVideo(); 427 } else { 428 pauseVideo(); 429 } 430 }, config); 431 432 observer.observe(parentEl); 433} 434 435 436// Observe Vimeo videos 437// - Be sure that SDK is loaded somewhere on page 438// - <uc1:header_script src="https://player.vimeo.com/api/player.js" async="True" runat="server"/> 439function observeBgVimeo(videoId, parentClass) { 440 let vidId = videoId.replace('#', ''); 441 const video = document.getElementById(vidId); 442 443 function playVideo() { 444 try { 445 video.play(); 446 } catch(err) { 447 console.log(err); 448 } 449 } 450 451 452 function pauseVideo() { 453 try { 454 video.pause(); 455 } catch(err) { 456 console.log(err); 457 } 458 } 459 460 // set up the observer 461 let config = { 462 rootMargin: '0px 0px 0px 0px', 463 threshold: 0 464 }; 465 466 let parentEl = document.querySelector(parentClass); 467 468 let observer = new IntersectionObserver(function(entry, self) { 469 if(entry[0].isIntersecting) { 470 playVideo(); 471 } else { 472 pauseVideo(); 473 } 474 }, config); 475 476 observer.observe(parentEl); 477} 478 479// Stay reserve buttons 480// MKBH 481$('.js-reserve-mkbh').on('click', function(e) { 482 e.preventDefault(); 483 // open booking 484 $('.js-btn-reserve').trigger('click'); 485 // select residences 486 $('#staySelect').val('KOAAK').trigger('change'); 487}); 488 489// Mauna Kea Beach Hotel microsite 490$('body').off('click').on('click', '.js-book-mkbh', function(e) { 491 e.preventDefault(); 492 // open booking 493 $('.js-resv-toggle').trigger('click'); 494}); 495 496 497// Westin 498$('.js-reserve-westin').on('click', function(e) { 499 e.preventDefault(); 500 // open booking 501 $('.js-btn-reserve').trigger('click'); 502 // select residences 503 $('#staySelect').val('KOAWI').trigger('change'); 504}); 505 506 507// Residences 508$('.js-reserve-residences').on('click', function(e) { 509 e.preventDefault(); 510 // open booking 511 $('.js-btn-reserve').trigger('click'); 512 // select residences 513 $('#staySelect').val('residences').trigger('change'); 514}); 515 516 517// Notify screen readers that a link opens in a new window 518function adaExternalLinks() { 519 const externalLinks = document.querySelectorAll('a[target="_blank"]'); 520 521 // check if admin mode 522 let isAdmin = document.querySelector('body').classList.contains('is-admin') || document.querySelector('body').classList.contains('admin'); 523 if (isAdmin) return; 524 525 externalLinks.forEach(function(el, i) { 526 let messageAppend = 'opens in a new window'; 527 528 // Check if link already has an aria label 529 if (el.getAttribute('aria-label')) { 530 let currAriaLabel = el.ariaLabel;
531 let currAriaLabelMessage = currAriaLabel + ' - ' + messageAppend; 532 533 el.setAttribute('aria-label', currAriaLabelMessage); 534 } 535 // Check if link has text 536 else if (el.textContent) { 537 let currLinkText = el.textContent; 538 let currAriaLabelMessage = currLinkText + ' - ' + messageAppend; 539 el.setAttribute('aria-label', currAriaLabelMessage); 540 } else { 541 el.setAttribute('aria-label', messageAppend); 542 } 543 544 }); 545} 546 547adaExternalLinks(); 548 549//Notify screen readers that tel links will call 550function adaPhoneLinks() { 551 const phoneLinks = document.querySelectorAll('a[href^="tel:"]'); 552 553 phoneLinks.forEach(function(el, i) { 554 const messagePrepend = 'Call at'; 555 const existingAriaLabel = el.getAttribute('aria-label'); 556 557 //No need to continue if the "Call at" message has already been added 558 if (existingAriaLabel && existingAriaLabel.startsWith(messagePrepend)) return; 559 560 let newLabel = ''; 561 562 // Check if link has text 563 if(el.textContent.trim()) { 564 let currLinkText = el.textContent.trim(); 565 566 newLabel = `${messagePrepend} ${currLinkText}`; 567 } 568 else { 569 newLabel = messagePrepend; 570 } 571 572 el.setAttribute('aria-label', newLabel); 573 }); 574} 575 576adaPhoneLinks(); 577 578//Notify screen readers that mailto links will email 579function adaEmailLinks() { 580 const emailLinks = document.querySelectorAll('a[href^="mailto:"]'); 581 582 emailLinks.forEach(function(el, i) { 583 const messagePrepend = 'Email at'; 584 const existingAriaLabel = el.getAttribute('aria-label'); 585 586 //No need to continue if the "Call at" message has already been added 587 if (existingAriaLabel && existingAriaLabel.startsWith(messagePrepend)) return; 588 589 let newLabel = ''; 590 591 // Check if link has text 592 if(el.textContent.trim()) { 593 let currLinkText = el.textContent.trim(); 594 595 newLabel = `${messagePrepend} ${currLinkText}`; 596 } 597 else { 598 newLabel = messagePrepend; 599 } 600 601 el.setAttribute('aria-label', newLabel); 602 }); 603} 604 605adaEmailLinks(); 606 607 608// Replace ampersands using Fraunces font 609function fixAmpersands() { 610 const items = document.querySelectorAll('.fix-amp'); 611 612 items.forEach((item) => { 613 let str = item.textContent; 614 const match1 = str.match(/ & /g); 615 const match2 = str.match(/ & /g); 616 let content = str.innerHTML; 617 618 if (match1) { 619 content = str.replace(/ & /g, ' <span>&</span> '); 620 item.innerHTML = content; 621 } 622 623 if (match2) { 624 content = str.replace(/ & /g, ' <span>&</span> '); 625 item.innerHTML = content; 626 } 627 }); 628} 629 630fixAmpersands(); 631 632 633// Fix recaptcha 634function fixRecaptcha(recaptchaId) { 635 let $el = $('#' + recaptchaId); 636 637 if ($el.length) { 638 $('<label for="' + recaptchaId + '" class="ada-hidden">Recaptcha</label>').insertBefore($el); 639 } 640}; 641(function webpackUniversalModuleDefinition(root, factory) { 642 if(typeof exports === 'object' && typeof module === 'object') 643 module.exports = factory(); 644 else if(typeof define === 'function' && define.amd) 645 define([], factory); 646 else if(typeof exports === 'object') 647 exports["Cleave"] = factory(); 648 else 649 root["Cleave"] = factory(); 650})(this, function() { 651return /******/ (function(modules) { // webpackBootstrap 652/******/ // The module cache 653/******/ var installedModules = {}; 654 655/******/ // The require function 656/******/ function __webpack_require__(moduleId) { 657 658/******/ // Check if module is in cache 659/******/ if(installedModules[moduleId]) 660/******/ return installedModules[moduleId].exports; 661 662/******/ // Create a new module (and put it into the cache) 663/******/ var module = installedModules[moduleId] = { 664/******/ exports: {}, 665/******/ id: moduleId, 666/******/ loaded: false 667/******/ }; 668 669/******/ // Execute the module function 670/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 671 672/******/ // Flag the module as loaded 673/******/ module.loaded = true; 674 675/******/ // Return the exports of the module 676/******/ return module.exports; 677/******/ } 678 679 680/******/ // expose the modules object (__webpack_modules__) 681/******/ __webpack_require__.m = modules; 682 683/******/ // expose the module cache 684/******/ __webpack_require__.c = installedModules; 685 686/******/ // __webpack_public_path__ 687/******/ __webpack_require__.p = ""; 688 689/******/ // Load entry module and return exports 690/******/ return __webpack_require__(0); 691/******/ }) 692/************************************************************************/ 693/******/ ([ 694/* 0 */ 695/***/ (function(module, exports, __webpack_require__) { 696 697 /* WEBPACK VAR INJECTION */(function(global) {'use strict'; 698 699 /** 700 * Construct a new Cleave instance by passing the configuration object 701 * 702 * @param {String | HTMLElement} element 703 * @param {Object} opts 704 */
vendor: 11,689 bytes, lines 705-1054
705 var Cleave = function (element, opts) { 706 var owner = this; 707 var hasMultipleElements = false; 708 709 if (typeof element === 'string') { 710 owner.element = document.querySelector(element); 711 hasMultipleElements = document.querySelectorAll(element).length > 1; 712 } else { 713 if (typeof element.length !== 'undefined' && element.length > 0) { 714 owner.element = element[0]; 715 hasMultipleElements = element.length > 1; 716 } else { 717 owner.element = element; 718 } 719 } 720 721 if (!owner.element) { 722 throw new Error('[cleave.js] Please check the element'); 723 } 724 725 if (hasMultipleElements) { 726 try { 727 // eslint-disable-next-line 728 console.warn('[cleave.js] Multiple input fields matched, cleave.js will only take the first one.'); 729 } catch (e) { 730 // Old IE 731 } 732 } 733 734 opts.initValue = owner.element.value; 735 736 owner.properties = Cleave.DefaultProperties.assign({}, opts); 737 738 owner.init(); 739 }; 740 741 Cleave.prototype = { 742 init: function () { 743 var owner = this, pps = owner.properties; 744 745 // no need to use this lib 746 if (!pps.numeral && !pps.phone && !pps.creditCard && !pps.time && !pps.date && (pps.blocksLength === 0 && !pps.prefix)) { 747 owner.onInput(pps.initValue); 748 749 return; 750 } 751 752 pps.maxLength = Cleave.Util.getMaxLength(pps.blocks); 753 754 owner.isAndroid = Cleave.Util.isAndroid(); 755 owner.lastInputValue = ''; 756 owner.isBackward = ''; 757 758 owner.onChangeListener = owner.onChange.bind(owner); 759 owner.onKeyDownListener = owner.onKeyDown.bind(owner); 760 owner.onFocusListener = owner.onFocus.bind(owner); 761 owner.onCutListener = owner.onCut.bind(owner); 762 owner.onCopyListener = owner.onCopy.bind(owner); 763 764 owner.initSwapHiddenInput(); 765 766 owner.element.addEventListener('input', owner.onChangeListener); 767 owner.element.addEventListener('keydown', owner.onKeyDownListener); 768 owner.element.addEventListener('focus', owner.onFocusListener); 769 owner.element.addEventListener('cut', owner.onCutListener); 770 owner.element.addEventListener('copy', owner.onCopyListener); 771 772 773 owner.initPhoneFormatter(); 774 owner.initDateFormatter(); 775 owner.initTimeFormatter(); 776 owner.initNumeralFormatter(); 777 778 // avoid touch input field if value is null 779 // otherwise Firefox will add red box-shadow for <input required /> 780 if (pps.initValue || (pps.prefix && !pps.noImmediatePrefix)) { 781 owner.onInput(pps.initValue); 782 } 783 }, 784 785 initSwapHiddenInput: function () { 786 var owner = this, pps = owner.properties; 787 if (!pps.swapHiddenInput) return; 788 789 var inputFormatter = owner.element.cloneNode(true); 790 owner.element.parentNode.insertBefore(inputFormatter, owner.element); 791 792 owner.elementSwapHidden = owner.element; 793 owner.elementSwapHidden.type = 'hidden'; 794 795 owner.element = inputFormatter; 796 owner.element.id = ''; 797 }, 798 799 initNumeralFormatter: function () { 800 var owner = this, pps = owner.properties; 801 802 if (!pps.numeral) { 803 return; 804 } 805 806 pps.numeralFormatter = new Cleave.NumeralFormatter( 807 pps.numeralDecimalMark, 808 pps.numeralIntegerScale, 809 pps.numeralDecimalScale, 810 pps.numeralThousandsGroupStyle, 811 pps.numeralPositiveOnly, 812 pps.stripLeadingZeroes, 813 pps.prefix, 814 pps.signBeforePrefix, 815 pps.tailPrefix, 816 pps.delimiter 817 ); 818 }, 819 820 initTimeFormatter: function() { 821 var owner = this, pps = owner.properties; 822 823 if (!pps.time) { 824 return; 825 } 826 827 pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern, pps.timeFormat); 828 pps.blocks = pps.timeFormatter.getBlocks(); 829 pps.blocksLength = pps.blocks.length; 830 pps.maxLength = Cleave.Util.getMaxLength(pps.blocks); 831 }, 832 833 initDateFormatter: function () { 834 var owner = this, pps = owner.properties; 835 836 if (!pps.date) { 837 return; 838 } 839 840 pps.dateFormatter = new Cleave.DateFormatter(pps.datePattern, pps.dateMin, pps.dateMax); 841 pps.blocks = pps.dateFormatter.getBlocks(); 842 pps.blocksLength = pps.blocks.length; 843 pps.maxLength = Cleave.Util.getMaxLength(pps.blocks); 844 }, 845 846 initPhoneFormatter: function () { 847 var owner = this, pps = owner.properties; 848 849 if (!pps.phone) { 850 return; 851 } 852 853 // Cleave.AsYouTypeFormatter should be provided by 854 // external google closure lib 855 try { 856 pps.phoneFormatter = new Cleave.PhoneFormatter( 857 new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode), 858 pps.delimiter 859 ); 860 } catch (ex) { 861 throw new Error('[cleave.js] Please include phone-type-formatter.{country}.js lib'); 862 } 863 }, 864 865 onKeyDown: function (event) { 866 var owner = this, 867 charCode = event.which || event.keyCode; 868 869 owner.lastInputValue = owner.element.value; 870 owner.isBackward = charCode === 8; 871 }, 872 873 onChange: function (event) { 874 var owner = this, pps = owner.properties, 875 Util = Cleave.Util; 876 877 owner.isBackward = owner.isBackward || event.inputType === 'deleteContentBackward'; 878 879 var postDelimiter = Util.getPostDelimiter(owner.lastInputValue, pps.delimiter, pps.delimiters); 880 881 if (owner.isBackward && postDelimiter) { 882 pps.postDelimiterBackspace = postDelimiter; 883 } else { 884 pps.postDelimiterBackspace = false; 885 } 886 887 this.onInput(this.element.value); 888 }, 889 890 onFocus: function () { 891 var owner = this, 892 pps = owner.properties; 893 owner.lastInputValue = owner.element.value; 894 895 if (pps.prefix && pps.noImmediatePrefix && !owner.element.value) { 896 this.onInput(pps.prefix); 897 } 898 899 Cleave.Util.fixPrefixCursor(owner.element, pps.prefix, pps.delimiter, pps.delimiters); 900 }, 901 902 onCut: function (e) { 903 if (!Cleave.Util.checkFullSelection(this.element.value)) return; 904 this.copyClipboardData(e); 905 this.onInput(''); 906 }, 907 908 onCopy: function (e) { 909 if (!Cleave.Util.checkFullSelection(this.element.value)) return; 910 this.copyClipboardData(e); 911 }, 912 913 copyClipboardData: function (e) { 914 var owner = this, 915 pps = owner.properties, 916 Util = Cleave.Util, 917 inputValue = owner.element.value, 918 textToCopy = ''; 919 920 if (!pps.copyDelimiter) { 921 textToCopy = Util.stripDelimiters(inputValue, pps.delimiter, pps.delimiters); 922 } else { 923 textToCopy = inputValue; 924 } 925 926 try { 927 if (e.clipboardData) { 928 e.clipboardData.setData('Text', textToCopy); 929 } else { 930 window.clipboardData.setData('Text', textToCopy); 931 } 932 933 e.preventDefault(); 934 } catch (ex) { 935 // empty 936 } 937 }, 938 939 onInput: function (value) { 940 var owner = this, pps = owner.properties, 941 Util = Cleave.Util; 942 943 // case 1: delete one more character "4" 944 // 1234*| -> hit backspace -> 123| 945 // case 2: last character is not delimiter which is: 946 // 12|34* -> hit backspace -> 1|34* 947 // note: no need to apply this for numeral mode 948 var postDelimiterAfter = Util.getPostDelimiter(value, pps.delimiter, pps.delimiters); 949 if (!pps.numeral && pps.postDelimiterBackspace && !postDelimiterAfter) { 950 value = Util.headStr(value, value.length - pps.postDelimiterBackspace.length); 951 } 952 953 // phone formatter 954 if (pps.phone) { 955 if (pps.prefix && (!pps.noImmediatePrefix || value.length)) { 956 pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length); 957 } else { 958 pps.result = pps.phoneFormatter.format(value); 959 } 960 owner.updateValueState(); 961 962 return; 963 } 964 965 // numeral formatter 966 if (pps.numeral) { 967 // Do not show prefix when noImmediatePrefix is specified 968 // This mostly because we need to show user the native input placeholder 969 if (pps.prefix && pps.noImmediatePrefix && value.length === 0) { 970 pps.result = ''; 971 } else { 972 pps.result = pps.numeralFormatter.format(value); 973 } 974 owner.updateValueState(); 975 976 return; 977 } 978 979 // date 980 if (pps.date) { 981 value = pps.dateFormatter.getValidatedDate(value); 982 } 983 984 // time 985 if (pps.time) { 986 value = pps.timeFormatter.getValidatedTime(value); 987 } 988 989 // strip delimiters 990 value = Util.stripDelimiters(value, pps.delimiter, pps.delimiters); 991 992 // strip prefix 993 value = Util.getPrefixStrippedValue(value, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix); 994 995 // strip non-numeric characters 996 value = pps.numericOnly ? Util.strip(value, /[^\d]/g) : value; 997 998 // convert case 999 value = pps.uppercase ? value.toUpperCase() : value; 1000 value = pps.lowercase ? value.toLowerCase() : value; 1001 1002 // prevent from showing prefix when no immediate option enabled with empty input value 1003 if (pps.prefix) { 1004 if (pps.tailPrefix) { 1005 value = value + pps.prefix; 1006 } else { 1007 value = pps.prefix + value; 1008 } 1009 1010 1011 // no blocks specified, no need to do formatting 1012 if (pps.blocksLength === 0) { 1013 pps.result = value; 1014 owner.updateValueState(); 1015 1016 return; 1017 } 1018 } 1019 1020 // update credit card props 1021 if (pps.creditCard) { 1022 owner.updateCreditCardPropsByValue(value); 1023 } 1024 1025 // strip over length characters 1026 value = Util.headStr(value, pps.maxLength); 1027 1028 // apply blocks 1029 pps.result = Util.getFormattedValue( 1030 value, 1031 pps.blocks, pps.blocksLength, 1032 pps.delimiter, pps.delimiters, pps.delimiterLazyShow 1033 ); 1034 1035 owner.updateValueState(); 1036 }, 1037 1038 updateCreditCardPropsByValue: function (value) { 1039 var owner = this, pps = owner.properties, 1040 Util = Cleave.Util, 1041 creditCardInfo; 1042 1043 // At least one of the first 4 characters has changed 1044 if (Util.headStr(pps.result, 4) === Util.headStr(value, 4)) { 1045 return; 1046 } 1047 1048 creditCardInfo = Cleave.CreditCardDetector.getInfo(value, pps.creditCardStrictMode); 1049 1050 pps.blocks = creditCardInfo.blocks; 1051 pps.blocksLength = pps.blocks.length; 1052 pps.maxLength = Util.getMaxLength(pps.blocks); 1053 1054 // credit card type changed
vendor: 4,617 bytes, lines 1055-1201
1055 if (pps.creditCardType !== creditCardInfo.type) { 1056 pps.creditCardType = creditCardInfo.type; 1057 1058 pps.onCreditCardTypeChanged.call(owner, pps.creditCardType); 1059 } 1060 }, 1061 1062 updateValueState: function () { 1063 var owner = this, 1064 Util = Cleave.Util, 1065 pps = owner.properties; 1066 1067 if (!owner.element) { 1068 return; 1069 } 1070 1071 var endPos = owner.element.selectionEnd; 1072 var oldValue = owner.element.value; 1073 var newValue = pps.result; 1074 1075 endPos = Util.getNextCursorPosition(endPos, oldValue, newValue, pps.delimiter, pps.delimiters); 1076 1077 // fix Android browser type="text" input field 1078 // cursor not jumping issue 1079 if (owner.isAndroid) { 1080 window.setTimeout(function () { 1081 owner.element.value = newValue; 1082 Util.setSelection(owner.element, endPos, pps.document, false); 1083 owner.callOnValueChanged(); 1084 }, 1); 1085 1086 return; 1087 } 1088 1089 owner.element.value = newValue; 1090 if (pps.swapHiddenInput) owner.elementSwapHidden.value = owner.getRawValue(); 1091 1092 Util.setSelection(owner.element, endPos, pps.document, false); 1093 owner.callOnValueChanged(); 1094 }, 1095 1096 callOnValueChanged: function () { 1097 var owner = this, 1098 pps = owner.properties; 1099 1100 pps.onValueChanged.call(owner, { 1101 target: { 1102 name: owner.element.name, 1103 value: pps.result, 1104 rawValue: owner.getRawValue() 1105 } 1106 }); 1107 }, 1108 1109 setPhoneRegionCode: function (phoneRegionCode) { 1110 var owner = this, pps = owner.properties; 1111 1112 pps.phoneRegionCode = phoneRegionCode; 1113 owner.initPhoneFormatter(); 1114 owner.onChange(); 1115 }, 1116 1117 setRawValue: function (value) { 1118 var owner = this, pps = owner.properties; 1119 1120 value = value !== undefined && value !== null ? value.toString() : ''; 1121 1122 if (pps.numeral) { 1123 value = value.replace('.', pps.numeralDecimalMark); 1124 } 1125 1126 pps.postDelimiterBackspace = false; 1127 1128 owner.element.value = value; 1129 owner.onInput(value); 1130 }, 1131 1132 getRawValue: function () { 1133 var owner = this, 1134 pps = owner.properties, 1135 Util = Cleave.Util, 1136 rawValue = owner.element.value; 1137 1138 if (pps.rawValueTrimPrefix) { 1139 rawValue = Util.getPrefixStrippedValue(rawValue, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix); 1140 } 1141 1142 if (pps.numeral) { 1143 rawValue = pps.numeralFormatter.getRawValue(rawValue); 1144 } else { 1145 rawValue = Util.stripDelimiters(rawValue, pps.delimiter, pps.delimiters); 1146 } 1147 1148 return rawValue; 1149 }, 1150 1151 getISOFormatDate: function () { 1152 var owner = this, 1153 pps = owner.properties; 1154 1155 return pps.date ? pps.dateFormatter.getISOFormatDate() : ''; 1156 }, 1157 1158 getISOFormatTime: function () { 1159 var owner = this, 1160 pps = owner.properties; 1161 1162 return pps.time ? pps.timeFormatter.getISOFormatTime() : ''; 1163 }, 1164 1165 getFormattedValue: function () { 1166 return this.element.value; 1167 }, 1168 1169 destroy: function () { 1170 var owner = this; 1171 1172 owner.element.removeEventListener('input', owner.onChangeListener); 1173 owner.element.removeEventListener('keydown', owner.onKeyDownListener); 1174 owner.element.removeEventListener('focus', owner.onFocusListener); 1175 owner.element.removeEventListener('cut', owner.onCutListener); 1176 owner.element.removeEventListener('copy', owner.onCopyListener); 1177 }, 1178 1179 toString: function () { 1180 return '[Cleave Object]'; 1181 } 1182 }; 1183 1184 Cleave.NumeralFormatter = __webpack_require__(1); 1185 Cleave.DateFormatter = __webpack_require__(2); 1186 Cleave.TimeFormatter = __webpack_require__(3); 1187 Cleave.PhoneFormatter = __webpack_require__(4); 1188 Cleave.CreditCardDetector = __webpack_require__(5); 1189 Cleave.Util = __webpack_require__(6); 1190 Cleave.DefaultProperties = __webpack_require__(7); 1191 1192 // for angular directive 1193 ((typeof global === 'object' && global) ? global : window)['Cleave'] = Cleave; 1194 1195 // CommonJS 1196 module.exports = Cleave; 1197 1198 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 1199 1200/***/ }), 1201/* 1 */
vendor: 34,482 bytes, lines 1202-2242
1202/***/ (function(module, exports) { 1203 1204 'use strict'; 1205 1206 var NumeralFormatter = function (numeralDecimalMark, 1207 numeralIntegerScale, 1208 numeralDecimalScale, 1209 numeralThousandsGroupStyle, 1210 numeralPositiveOnly, 1211 stripLeadingZeroes, 1212 prefix, 1213 signBeforePrefix, 1214 tailPrefix, 1215 delimiter) { 1216 var owner = this; 1217 1218 owner.numeralDecimalMark = numeralDecimalMark || '.'; 1219 owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0; 1220 owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2; 1221 owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand; 1222 owner.numeralPositiveOnly = !!numeralPositiveOnly; 1223 owner.stripLeadingZeroes = stripLeadingZeroes !== false; 1224 owner.prefix = (prefix || prefix === '') ? prefix : ''; 1225 owner.signBeforePrefix = !!signBeforePrefix; 1226 owner.tailPrefix = !!tailPrefix; 1227 owner.delimiter = (delimiter || delimiter === '') ? delimiter : ','; 1228 owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : ''; 1229 }; 1230 1231 NumeralFormatter.groupStyle = { 1232 thousand: 'thousand', 1233 lakh: 'lakh', 1234 wan: 'wan', 1235 none: 'none' 1236 }; 1237 1238 NumeralFormatter.prototype = { 1239 getRawValue: function (value) { 1240 return value.replace(this.delimiterRE, '').replace(this.numeralDecimalMark, '.'); 1241 }, 1242 1243 format: function (value) { 1244 var owner = this, parts, partSign, partSignAndPrefix, partInteger, partDecimal = ''; 1245 1246 // strip alphabet letters 1247 value = value.replace(/[A-Za-z]/g, '') 1248 // replace the first decimal mark with reserved placeholder 1249 .replace(owner.numeralDecimalMark, 'M') 1250 1251 // strip non numeric letters except minus and "M" 1252 // this is to ensure prefix has been stripped 1253 .replace(/[^\dM-]/g, '') 1254 1255 // replace the leading minus with reserved placeholder 1256 .replace(/^\-/, 'N') 1257 1258 // strip the other minus sign (if present) 1259 .replace(/\-/g, '') 1260 1261 // replace the minus sign (if present) 1262 .replace('N', owner.numeralPositiveOnly ? '' : '-') 1263 1264 // replace decimal mark 1265 .replace('M', owner.numeralDecimalMark); 1266 1267 // strip any leading zeros 1268 if (owner.stripLeadingZeroes) { 1269 value = value.replace(/^(-)?0+(?=\d)/, '$1'); 1270 } 1271 1272 partSign = value.slice(0, 1) === '-' ? '-' : ''; 1273 if (typeof owner.prefix != 'undefined') { 1274 if (owner.signBeforePrefix) { 1275 partSignAndPrefix = partSign + owner.prefix; 1276 } else { 1277 partSignAndPrefix = owner.prefix + partSign; 1278 } 1279 } else { 1280 partSignAndPrefix = partSign; 1281 } 1282 1283 partInteger = value; 1284 1285 if (value.indexOf(owner.numeralDecimalMark) >= 0) { 1286 parts = value.split(owner.numeralDecimalMark); 1287 partInteger = parts[0]; 1288 partDecimal = owner.numeralDecimalMark + parts[1].slice(0, owner.numeralDecimalScale); 1289 } 1290 1291 if(partSign === '-') { 1292 partInteger = partInteger.slice(1); 1293 } 1294 1295 if (owner.numeralIntegerScale > 0) { 1296 partInteger = partInteger.slice(0, owner.numeralIntegerScale); 1297 } 1298 1299 switch (owner.numeralThousandsGroupStyle) { 1300 case NumeralFormatter.groupStyle.lakh: 1301 partInteger = partInteger.replace(/(\d)(?=(\d\d)+\d$)/g, '$1' + owner.delimiter); 1302 1303 break; 1304 1305 case NumeralFormatter.groupStyle.wan: 1306 partInteger = partInteger.replace(/(\d)(?=(\d{4})+$)/g, '$1' + owner.delimiter); 1307 1308 break; 1309 1310 case NumeralFormatter.groupStyle.thousand: 1311 partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + owner.delimiter); 1312 1313 break; 1314 } 1315 1316 if (owner.tailPrefix) { 1317 return partSign + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '') + owner.prefix; 1318 } 1319 1320 return partSignAndPrefix + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : ''); 1321 } 1322 }; 1323 1324 module.exports = NumeralFormatter; 1325 1326 1327/***/ }), 1328/* 2 */ 1329/***/ (function(module, exports) { 1330 1331 'use strict'; 1332 1333 var DateFormatter = function (datePattern, dateMin, dateMax) { 1334 var owner = this; 1335 1336 owner.date = []; 1337 owner.blocks = []; 1338 owner.datePattern = datePattern; 1339 owner.dateMin = dateMin 1340 .split('-') 1341 .reverse() 1342 .map(function(x) { 1343 return parseInt(x, 10); 1344 }); 1345 if (owner.dateMin.length === 2) owner.dateMin.unshift(0); 1346 1347 owner.dateMax = dateMax 1348 .split('-') 1349 .reverse() 1350 .map(function(x) { 1351 return parseInt(x, 10); 1352 }); 1353 if (owner.dateMax.length === 2) owner.dateMax.unshift(0); 1354 1355 owner.initBlocks(); 1356 }; 1357 1358 DateFormatter.prototype = { 1359 initBlocks: function () { 1360 var owner = this; 1361 owner.datePattern.forEach(function (value) { 1362 if (value === 'Y') { 1363 owner.blocks.push(4); 1364 } else { 1365 owner.blocks.push(2); 1366 } 1367 }); 1368 }, 1369 1370 getISOFormatDate: function () { 1371 var owner = this, 1372 date = owner.date; 1373 1374 return date[2] ? ( 1375 date[2] + '-' + owner.addLeadingZero(date[1]) + '-' + owner.addLeadingZero(date[0]) 1376 ) : ''; 1377 }, 1378 1379 getBlocks: function () { 1380 return this.blocks; 1381 }, 1382 1383 getValidatedDate: function (value) { 1384 var owner = this, result = ''; 1385 1386 value = value.replace(/[^\d]/g, ''); 1387 1388 owner.blocks.forEach(function (length, index) { 1389 if (value.length > 0) { 1390 var sub = value.slice(0, length), 1391 sub0 = sub.slice(0, 1), 1392 rest = value.slice(length); 1393 1394 switch (owner.datePattern[index]) { 1395 case 'd': 1396 if (sub === '00') { 1397 sub = '01'; 1398 } else if (parseInt(sub0, 10) > 3) { 1399 sub = '0' + sub0; 1400 } else if (parseInt(sub, 10) > 31) { 1401 sub = '31'; 1402 } 1403 1404 break; 1405 1406 case 'm': 1407 if (sub === '00') { 1408 sub = '01'; 1409 } else if (parseInt(sub0, 10) > 1) { 1410 sub = '0' + sub0; 1411 } else if (parseInt(sub, 10) > 12) { 1412 sub = '12'; 1413 } 1414 1415 break; 1416 } 1417 1418 result += sub; 1419 1420 // update remaining string 1421 value = rest; 1422 } 1423 }); 1424 1425 return this.getFixedDateString(result); 1426 }, 1427 1428 getFixedDateString: function (value) { 1429 var owner = this, datePattern = owner.datePattern, date = [], 1430 dayIndex = 0, monthIndex = 0, yearIndex = 0, 1431 dayStartIndex = 0, monthStartIndex = 0, yearStartIndex = 0, 1432 day, month, year, fullYearDone = false; 1433 1434 // mm-dd || dd-mm 1435 if (value.length === 4 && datePattern[0].toLowerCase() !== 'y' && datePattern[1].toLowerCase() !== 'y') { 1436 dayStartIndex = datePattern[0] === 'd' ? 0 : 2; 1437 monthStartIndex = 2 - dayStartIndex; 1438 day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10); 1439 month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10); 1440 1441 date = this.getFixedDate(day, month, 0); 1442 } 1443 1444 // yyyy-mm-dd || yyyy-dd-mm || mm-dd-yyyy || dd-mm-yyyy || dd-yyyy-mm || mm-yyyy-dd 1445 if (value.length === 8) { 1446 datePattern.forEach(function (type, index) { 1447 switch (type) { 1448 case 'd': 1449 dayIndex = index; 1450 break; 1451 case 'm': 1452 monthIndex = index; 1453 break; 1454 default: 1455 yearIndex = index; 1456 break; 1457 } 1458 }); 1459 1460 yearStartIndex = yearIndex * 2; 1461 dayStartIndex = (dayIndex <= yearIndex) ? dayIndex * 2 : (dayIndex * 2 + 2); 1462 monthStartIndex = (monthIndex <= yearIndex) ? monthIndex * 2 : (monthIndex * 2 + 2); 1463 1464 day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10); 1465 month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10); 1466 year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10); 1467 1468 fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4; 1469 1470 date = this.getFixedDate(day, month, year); 1471 } 1472 1473 // mm-yy || yy-mm 1474 if (value.length === 4 && (datePattern[0] === 'y' || datePattern[1] === 'y')) { 1475 monthStartIndex = datePattern[0] === 'm' ? 0 : 2; 1476 yearStartIndex = 2 - monthStartIndex; 1477 month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10); 1478 year = parseInt(value.slice(yearStartIndex, yearStartIndex + 2), 10); 1479 1480 fullYearDone = value.slice(yearStartIndex, yearStartIndex + 2).length === 2; 1481 1482 date = [0, month, year]; 1483 } 1484 1485 // mm-yyyy || yyyy-mm 1486 if (value.length === 6 && (datePattern[0] === 'Y' || datePattern[1] === 'Y')) { 1487 monthStartIndex = datePattern[0] === 'm' ? 0 : 4; 1488 yearStartIndex = 2 - 0.5 * monthStartIndex; 1489 month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10); 1490 year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10); 1491 1492 fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4; 1493 1494 date = [0, month, year]; 1495 } 1496 1497 date = owner.getRangeFixedDate(date); 1498 owner.date = date; 1499 1500 var result = date.length === 0 ? value : datePattern.reduce(function (previous, current) { 1501 switch (current) { 1502 case 'd': 1503 return previous + (date[0] === 0 ? '' : owner.addLeadingZero(date[0])); 1504 case 'm': 1505 return previous + (date[1] === 0 ? '' : owner.addLeadingZero(date[1])); 1506 case 'y': 1507 return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], false) : ''); 1508 case 'Y': 1509 return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], true) : ''); 1510 } 1511 }, ''); 1512 1513 return result; 1514 }, 1515 1516 getRangeFixedDate: function (date) { 1517 var owner = this, 1518 datePattern = owner.datePattern, 1519 dateMin = owner.dateMin || [], 1520 dateMax = owner.dateMax || []; 1521 1522 if (!date.length || (dateMin.length < 3 && dateMax.length < 3)) return date; 1523 1524 if ( 1525 datePattern.find(function(x) { 1526 return x.toLowerCase() === 'y'; 1527 }) && 1528 date[2] === 0 1529 ) return date; 1530 1531 if (dateMax.length && (dateMax[2] < date[2] || ( 1532 dateMax[2] === date[2] && (dateMax[1] < date[1] || ( 1533 dateMax[1] === date[1] && dateMax[0] < date[0] 1534 )) 1535 ))) return dateMax; 1536 1537 if (dateMin.length && (dateMin[2] > date[2] || ( 1538 dateMin[2] === date[2] && (dateMin[1] > date[1] || ( 1539 dateMin[1] === date[1] && dateMin[0] > date[0] 1540 )) 1541 ))) return dateMin; 1542 1543 return date; 1544 }, 1545 1546 getFixedDate: function (day, month, year) { 1547 day = Math.min(day, 31); 1548 month = Math.min(month, 12); 1549 year = parseInt((year || 0), 10); 1550 1551 if ((month < 7 && month % 2 === 0) || (month > 8 && month % 2 === 1)) { 1552 day = Math.min(day, month === 2 ? (this.isLeapYear(year) ? 29 : 28) : 30); 1553 } 1554 1555 return [day, month, year]; 1556 }, 1557 1558 isLeapYear: function (year) { 1559 return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0); 1560 }, 1561 1562 addLeadingZero: function (number) { 1563 return (number < 10 ? '0' : '') + number; 1564 }, 1565 1566 addLeadingZeroForYear: function (number, fullYearMode) { 1567 if (fullYearMode) { 1568 return (number < 10 ? '000' : (number < 100 ? '00' : (number < 1000 ? '0' : ''))) + number; 1569 } 1570 1571 return (number < 10 ? '0' : '') + number; 1572 } 1573 }; 1574 1575 module.exports = DateFormatter; 1576 1577 1578/***/ }), 1579/* 3 */ 1580/***/ (function(module, exports) { 1581 1582 'use strict'; 1583 1584 var TimeFormatter = function (timePattern, timeFormat) { 1585 var owner = this; 1586 1587 owner.time = []; 1588 owner.blocks = []; 1589 owner.timePattern = timePattern; 1590 owner.timeFormat = timeFormat; 1591 owner.initBlocks(); 1592 }; 1593 1594 TimeFormatter.prototype = { 1595 initBlocks: function () { 1596 var owner = this; 1597 owner.timePattern.forEach(function () { 1598 owner.blocks.push(2); 1599 }); 1600 }, 1601 1602 getISOFormatTime: function () { 1603 var owner = this, 1604 time = owner.time; 1605 1606 return time[2] ? ( 1607 owner.addLeadingZero(time[0]) + ':' + owner.addLeadingZero(time[1]) + ':' + owner.addLeadingZero(time[2]) 1608 ) : ''; 1609 }, 1610 1611 getBlocks: function () { 1612 return this.blocks; 1613 }, 1614 1615 getTimeFormatOptions: function () { 1616 var owner = this; 1617 if (String(owner.timeFormat) === '12') { 1618 return { 1619 maxHourFirstDigit: 1, 1620 maxHours: 12, 1621 maxMinutesFirstDigit: 5, 1622 maxMinutes: 60 1623 }; 1624 } 1625 1626 return { 1627 maxHourFirstDigit: 2, 1628 maxHours: 23, 1629 maxMinutesFirstDigit: 5, 1630 maxMinutes: 60 1631 }; 1632 }, 1633 1634 getValidatedTime: function (value) { 1635 var owner = this, result = ''; 1636 1637 value = value.replace(/[^\d]/g, ''); 1638 1639 var timeFormatOptions = owner.getTimeFormatOptions(); 1640 1641 owner.blocks.forEach(function (length, index) { 1642 if (value.length > 0) { 1643 var sub = value.slice(0, length), 1644 sub0 = sub.slice(0, 1), 1645 rest = value.slice(length); 1646 1647 switch (owner.timePattern[index]) { 1648 1649 case 'h': 1650 if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) { 1651 sub = '0' + sub0; 1652 } else if (parseInt(sub, 10) > timeFormatOptions.maxHours) { 1653 sub = timeFormatOptions.maxHours + ''; 1654 } 1655 1656 break; 1657 1658 case 'm': 1659 case 's': 1660 if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) { 1661 sub = '0' + sub0; 1662 } else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) { 1663 sub = timeFormatOptions.maxMinutes + ''; 1664 } 1665 break; 1666 } 1667 1668 result += sub; 1669 1670 // update remaining string 1671 value = rest; 1672 } 1673 }); 1674 1675 return this.getFixedTimeString(result); 1676 }, 1677 1678 getFixedTimeString: function (value) { 1679 var owner = this, timePattern = owner.timePattern, time = [], 1680 secondIndex = 0, minuteIndex = 0, hourIndex = 0, 1681 secondStartIndex = 0, minuteStartIndex = 0, hourStartIndex = 0, 1682 second, minute, hour; 1683 1684 if (value.length === 6) { 1685 timePattern.forEach(function (type, index) { 1686 switch (type) { 1687 case 's': 1688 secondIndex = index * 2; 1689 break; 1690 case 'm': 1691 minuteIndex = index * 2; 1692 break; 1693 case 'h': 1694 hourIndex = index * 2; 1695 break; 1696 } 1697 }); 1698 1699 hourStartIndex = hourIndex; 1700 minuteStartIndex = minuteIndex; 1701 secondStartIndex = secondIndex; 1702 1703 second = parseInt(value.slice(secondStartIndex, secondStartIndex + 2), 10); 1704 minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10); 1705 hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10); 1706 1707 time = this.getFixedTime(hour, minute, second); 1708 } 1709 1710 if (value.length === 4 && owner.timePattern.indexOf('s') < 0) { 1711 timePattern.forEach(function (type, index) { 1712 switch (type) { 1713 case 'm': 1714 minuteIndex = index * 2; 1715 break; 1716 case 'h': 1717 hourIndex = index * 2; 1718 break; 1719 } 1720 }); 1721 1722 hourStartIndex = hourIndex; 1723 minuteStartIndex = minuteIndex; 1724 1725 second = 0; 1726 minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10); 1727 hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10); 1728 1729 time = this.getFixedTime(hour, minute, second); 1730 } 1731 1732 owner.time = time; 1733 1734 return time.length === 0 ? value : timePattern.reduce(function (previous, current) { 1735 switch (current) { 1736 case 's': 1737 return previous + owner.addLeadingZero(time[2]); 1738 case 'm': 1739 return previous + owner.addLeadingZero(time[1]); 1740 case 'h': 1741 return previous + owner.addLeadingZero(time[0]); 1742 } 1743 }, ''); 1744 }, 1745 1746 getFixedTime: function (hour, minute, second) { 1747 second = Math.min(parseInt(second || 0, 10), 60); 1748 minute = Math.min(minute, 60); 1749 hour = Math.min(hour, 60); 1750 1751 return [hour, minute, second]; 1752 }, 1753 1754 addLeadingZero: function (number) { 1755 return (number < 10 ? '0' : '') + number; 1756 } 1757 }; 1758 1759 module.exports = TimeFormatter; 1760 1761 1762/***/ }), 1763/* 4 */ 1764/***/ (function(module, exports) { 1765 1766 'use strict'; 1767 1768 var PhoneFormatter = function (formatter, delimiter) { 1769 var owner = this; 1770 1771 owner.delimiter = (delimiter || delimiter === '') ? delimiter : ' '; 1772 owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : ''; 1773 1774 owner.formatter = formatter; 1775 }; 1776 1777 PhoneFormatter.prototype = { 1778 setFormatter: function (formatter) { 1779 this.formatter = formatter; 1780 }, 1781 1782 format: function (phoneNumber) { 1783 var owner = this; 1784 1785 owner.formatter.clear(); 1786 1787 // only keep number and + 1788 phoneNumber = phoneNumber.replace(/[^\d+]/g, ''); 1789 1790 // strip non-leading + 1791 phoneNumber = phoneNumber.replace(/^\+/, 'B').replace(/\+/g, '').replace('B', '+'); 1792 1793 // strip delimiter 1794 phoneNumber = phoneNumber.replace(owner.delimiterRE, ''); 1795 1796 var result = '', current, validated = false; 1797 1798 for (var i = 0, iMax = phoneNumber.length; i < iMax; i++) { 1799 current = owner.formatter.inputDigit(phoneNumber.charAt(i)); 1800 1801 // has ()- or space inside 1802 if (/[\s()-]/g.test(current)) { 1803 result = current; 1804 1805 validated = true; 1806 } else { 1807 if (!validated) { 1808 result = current; 1809 } 1810 // else: over length input 1811 // it turns to invalid number again 1812 } 1813 } 1814 1815 // strip () 1816 // e.g. US: 7161234567 returns (716) 123-4567 1817 result = result.replace(/[()]/g, ''); 1818 // replace library delimiter with user customized delimiter 1819 result = result.replace(/[\s-]/g, owner.delimiter); 1820 1821 return result; 1822 } 1823 }; 1824 1825 module.exports = PhoneFormatter; 1826 1827 1828/***/ }), 1829/* 5 */ 1830/***/ (function(module, exports) { 1831 1832 'use strict'; 1833 1834 var CreditCardDetector = { 1835 blocks: { 1836 uatp: [4, 5, 6], 1837 amex: [4, 6, 5], 1838 diners: [4, 6, 4], 1839 discover: [4, 4, 4, 4], 1840 mastercard: [4, 4, 4, 4], 1841 dankort: [4, 4, 4, 4], 1842 instapayment: [4, 4, 4, 4], 1843 jcb15: [4, 6, 5], 1844 jcb: [4, 4, 4, 4], 1845 maestro: [4, 4, 4, 4], 1846 visa: [4, 4, 4, 4], 1847 mir: [4, 4, 4, 4], 1848 unionPay: [4, 4, 4, 4], 1849 general: [4, 4, 4, 4] 1850 }, 1851 1852 re: { 1853 // starts with 1; 15 digits, not starts with 1800 (jcb card) 1854 uatp: /^(?!1800)1\d{0,14}/, 1855 1856 // starts with 34/37; 15 digits 1857 amex: /^3[47]\d{0,13}/, 1858 1859 // starts with 6011/65/644-649; 16 digits 1860 discover: /^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/, 1861 1862 // starts with 300-305/309 or 36/38/39; 14 digits 1863 diners: /^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/, 1864 1865 // starts with 51-55/2221â2720; 16 digits 1866 mastercard: /^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/, 1867 1868 // starts with 5019/4175/4571; 16 digits 1869 dankort: /^(5019|4175|4571)\d{0,12}/, 1870 1871 // starts with 637-639; 16 digits 1872 instapayment: /^63[7-9]\d{0,13}/, 1873 1874 // starts with 2131/1800; 15 digits 1875 jcb15: /^(?:2131|1800)\d{0,11}/, 1876 1877 // starts with 2131/1800/35; 16 digits 1878 jcb: /^(?:35\d{0,2})\d{0,12}/, 1879 1880 // starts with 50/56-58/6304/67; 16 digits 1881 maestro: /^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/, 1882 1883 // starts with 22; 16 digits 1884 mir: /^220[0-4]\d{0,12}/, 1885 1886 // starts with 4; 16 digits 1887 visa: /^4\d{0,15}/, 1888 1889 // starts with 62/81; 16 digits 1890 unionPay: /^(62|81)\d{0,14}/ 1891 }, 1892 1893 getStrictBlocks: function (block) { 1894 var total = block.reduce(function (prev, current) { 1895 return prev + current; 1896 }, 0); 1897 1898 return block.concat(19 - total); 1899 }, 1900 1901 getInfo: function (value, strictMode) { 1902 var blocks = CreditCardDetector.blocks, 1903 re = CreditCardDetector.re; 1904 1905 // Some credit card can have up to 19 digits number. 1906 // Set strictMode to true will remove the 16 max-length restrain, 1907 // however, I never found any website validate card number like 1908 // this, hence probably you don't want to enable this option. 1909 strictMode = !!strictMode; 1910 1911 for (var key in re) { 1912 if (re[key].test(value)) { 1913 var matchedBlocks = blocks[key]; 1914 return { 1915 type: key, 1916 blocks: strictMode ? this.getStrictBlocks(matchedBlocks) : matchedBlocks 1917 }; 1918 } 1919 } 1920 1921 return { 1922 type: 'unknown', 1923 blocks: strictMode ? this.getStrictBlocks(blocks.general) : blocks.general 1924 }; 1925 } 1926 }; 1927 1928 module.exports = CreditCardDetector; 1929 1930 1931/***/ }), 1932/* 6 */ 1933/***/ (function(module, exports) { 1934 1935 'use strict'; 1936 1937 var Util = { 1938 noop: function () { 1939 }, 1940 1941 strip: function (value, re) { 1942 return value.replace(re, ''); 1943 }, 1944 1945 getPostDelimiter: function (value, delimiter, delimiters) { 1946 // single delimiter 1947 if (delimiters.length === 0) { 1948 return value.slice(-delimiter.length) === delimiter ? delimiter : ''; 1949 } 1950 1951 // multiple delimiters 1952 var matchedDelimiter = ''; 1953 delimiters.forEach(function (current) { 1954 if (value.slice(-current.length) === current) { 1955 matchedDelimiter = current; 1956 } 1957 }); 1958 1959 return matchedDelimiter; 1960 }, 1961 1962 getDelimiterREByDelimiter: function (delimiter) { 1963 return new RegExp(delimiter.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'), 'g'); 1964 }, 1965 1966 getNextCursorPosition: function (prevPos, oldValue, newValue, delimiter, delimiters) { 1967 // If cursor was at the end of value, just place it back. 1968 // Because new value could contain additional chars. 1969 if (oldValue.length === prevPos) { 1970 return newValue.length; 1971 } 1972 1973 return prevPos + this.getPositionOffset(prevPos, oldValue, newValue, delimiter ,delimiters); 1974 }, 1975 1976 getPositionOffset: function (prevPos, oldValue, newValue, delimiter, delimiters) { 1977 var oldRawValue, newRawValue, lengthOffset; 1978 1979 oldRawValue = this.stripDelimiters(oldValue.slice(0, prevPos), delimiter, delimiters); 1980 newRawValue = this.stripDelimiters(newValue.slice(0, prevPos), delimiter, delimiters); 1981 lengthOffset = oldRawValue.length - newRawValue.length; 1982 1983 return (lengthOffset !== 0) ? (lengthOffset / Math.abs(lengthOffset)) : 0; 1984 }, 1985 1986 stripDelimiters: function (value, delimiter, delimiters) { 1987 var owner = this; 1988 1989 // single delimiter 1990 if (delimiters.length === 0) { 1991 var delimiterRE = delimiter ? owner.getDelimiterREByDelimiter(delimiter) : ''; 1992 1993 return value.replace(delimiterRE, ''); 1994 } 1995 1996 // multiple delimiters 1997 delimiters.forEach(function (current) { 1998 current.split('').forEach(function (letter) { 1999 value = value.replace(owner.getDelimiterREByDelimiter(letter), ''); 2000 }); 2001 }); 2002 2003 return value; 2004 }, 2005 2006 headStr: function (str, length) { 2007 return str.slice(0, length); 2008 }, 2009 2010 getMaxLength: function (blocks) { 2011 return blocks.reduce(function (previous, current) { 2012 return previous + current; 2013 }, 0); 2014 }, 2015 2016 // strip prefix 2017 // Before type | After type | Return value 2018 // PEFIX-... | PEFIX-... | '' 2019 // PREFIX-123 | PEFIX-123 | 123 2020 // PREFIX-123 | PREFIX-23 | 23 2021 // PREFIX-123 | PREFIX-1234 | 1234 2022 getPrefixStrippedValue: function (value, prefix, prefixLength, prevResult, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix) { 2023 // No prefix 2024 if (prefixLength === 0) { 2025 return value; 2026 } 2027 2028 // Value is prefix 2029 if (value === prefix && value !== '') { 2030 return ''; 2031 } 2032 2033 if (signBeforePrefix && (value.slice(0, 1) == '-')) { 2034 var prev = (prevResult.slice(0, 1) == '-') ? prevResult.slice(1) : prevResult; 2035 return '-' + this.getPrefixStrippedValue(value.slice(1), prefix, prefixLength, prev, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix); 2036 } 2037 2038 // Pre result prefix string does not match pre-defined prefix 2039 if (prevResult.slice(0, prefixLength) !== prefix && !tailPrefix) { 2040 // Check if the first time user entered something 2041 if (noImmediatePrefix && !prevResult && value) return value; 2042 return ''; 2043 } else if (prevResult.slice(-prefixLength) !== prefix && tailPrefix) { 2044 // Check if the first time user entered something 2045 if (noImmediatePrefix && !prevResult && value) return value; 2046 return ''; 2047 } 2048 2049 var prevValue = this.stripDelimiters(prevResult, delimiter, delimiters); 2050 2051 // New value has issue, someone typed in between prefix letters 2052 // Revert to pre value 2053 if (value.slice(0, prefixLength) !== prefix && !tailPrefix) { 2054 return prevValue.slice(prefixLength); 2055 } else if (value.slice(-prefixLength) !== prefix && tailPrefix) { 2056 return prevValue.slice(0, -prefixLength - 1); 2057 } 2058 2059 // No issue, strip prefix for new value 2060 return tailPrefix ? value.slice(0, -prefixLength) : value.slice(prefixLength); 2061 }, 2062 2063 getFirstDiffIndex: function (prev, current) { 2064 var index = 0; 2065 2066 while (prev.charAt(index) === current.charAt(index)) { 2067 if (prev.charAt(index++) === '') { 2068 return -1; 2069 } 2070 } 2071 2072 return index; 2073 }, 2074 2075 getFormattedValue: function (value, blocks, blocksLength, delimiter, delimiters, delimiterLazyShow) { 2076 var result = '', 2077 multipleDelimiters = delimiters.length > 0, 2078 currentDelimiter = ''; 2079 2080 // no options, normal input 2081 if (blocksLength === 0) { 2082 return value; 2083 } 2084 2085 blocks.forEach(function (length, index) { 2086 if (value.length > 0) { 2087 var sub = value.slice(0, length), 2088 rest = value.slice(length); 2089 2090 if (multipleDelimiters) { 2091 currentDelimiter = delimiters[delimiterLazyShow ? (index - 1) : index] || currentDelimiter; 2092 } else { 2093 currentDelimiter = delimiter; 2094 } 2095 2096 if (delimiterLazyShow) { 2097 if (index > 0) { 2098 result += currentDelimiter; 2099 } 2100 2101 result += sub; 2102 } else { 2103 result += sub; 2104 2105 if (sub.length === length && index < blocksLength - 1) { 2106 result += currentDelimiter; 2107 } 2108 } 2109 2110 // update remaining string 2111 value = rest; 2112 } 2113 }); 2114 2115 return result; 2116 }, 2117 2118 // move cursor to the end 2119 // the first time user focuses on an input with prefix 2120 fixPrefixCursor: function (el, prefix, delimiter, delimiters) { 2121 if (!el) { 2122 return; 2123 } 2124 2125 var val = el.value, 2126 appendix = delimiter || (delimiters[0] || ' '); 2127 2128 if (!el.setSelectionRange || !prefix || (prefix.length + appendix.length) <= val.length) { 2129 return; 2130 } 2131 2132 var len = val.length * 2; 2133 2134 // set timeout to avoid blink 2135 setTimeout(function () { 2136 el.setSelectionRange(len, len); 2137 }, 1); 2138 }, 2139 2140 // Check if input field is fully selected 2141 checkFullSelection: function(value) { 2142 try { 2143 var selection = window.getSelection() || document.getSelection() || {}; 2144 return selection.toString().length === value.length; 2145 } catch (ex) { 2146 // Ignore 2147 } 2148 2149 return false; 2150 }, 2151 2152 setSelection: function (element, position, doc) { 2153 if (element !== this.getActiveElement(doc)) { 2154 return; 2155 } 2156 2157 // cursor is already in the end 2158 if (element && element.value.length <= position) { 2159 return; 2160 } 2161 2162 if (element.createTextRange) { 2163 var range = element.createTextRange(); 2164 2165 range.move('character', position); 2166 range.select(); 2167 } else { 2168 try { 2169 element.setSelectionRange(position, position); 2170 } catch (e) { 2171 // eslint-disable-next-line 2172 console.warn('The input element type does not support selection'); 2173 } 2174 } 2175 }, 2176 2177 getActiveElement: function(parent) { 2178 var activeElement = parent.activeElement; 2179 if (activeElement && activeElement.shadowRoot) { 2180 return this.getActiveElement(activeElement.shadowRoot); 2181 } 2182 return activeElement; 2183 }, 2184 2185 isAndroid: function () { 2186 return navigator && /android/i.test(navigator.userAgent); 2187 }, 2188 2189 // On Android chrome, the keyup and keydown events 2190 // always return key code 229 as a composition that 2191 // buffers the userâs keystrokes 2192 // see https://github.com/nosir/cleave.js/issues/147 2193 isAndroidBackspaceKeydown: function (lastInputValue, currentInputValue) { 2194 if (!this.isAndroid() || !lastInputValue || !currentInputValue) { 2195 return false; 2196 } 2197 2198 return currentInputValue === lastInputValue.slice(0, -1); 2199 } 2200 }; 2201 2202 module.exports = Util; 2203 2204 2205/***/ }), 2206/* 7 */ 2207/***/ (function(module, exports) { 2208 2209 /* WEBPACK VAR INJECTION */(function(global) {'use strict'; 2210 2211 /** 2212 * Props Assignment 2213 * 2214 * Separate this, so react module can share the usage 2215 */ 2216 var DefaultProperties = { 2217 // Maybe change to object-assign 2218 // for now just keep it as simple 2219 assign: function (target, opts) { 2220 target = target || {}; 2221 opts = opts || {}; 2222 2223 // credit card 2224 target.creditCard = !!opts.creditCard; 2225 target.creditCardStrictMode = !!opts.creditCardStrictMode; 2226 target.creditCardType = ''; 2227 target.onCreditCardTypeChanged = opts.onCreditCardTypeChanged || (function () {}); 2228 2229 // phone 2230 target.phone = !!opts.phone; 2231 target.phoneRegionCode = opts.phoneRegionCode || 'AU'; 2232 target.phoneFormatter = {}; 2233 2234 // time 2235 target.time = !!opts.time; 2236 target.timePattern = opts.timePattern || ['h', 'm', 's']; 2237 target.timeFormat = opts.timeFormat || '24'; 2238 target.timeFormatter = {}; 2239 2240 // date 2241 target.date = !!opts.date; 2242 target.datePattern = opts.datePattern || ['d', 'm', 'Y'];
2243 target.dateMin = opts.dateMin || ''; 2244 target.dateMax = opts.dateMax || ''; 2245 target.dateFormatter = {}; 2246 2247 // numeral 2248 target.numeral = !!opts.numeral; 2249 target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0; 2250 target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2; 2251 target.numeralDecimalMark = opts.numeralDecimalMark || '.'; 2252 target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand'; 2253 target.numeralPositiveOnly = !!opts.numeralPositiveOnly; 2254 target.stripLeadingZeroes = opts.stripLeadingZeroes !== false; 2255 target.signBeforePrefix = !!opts.signBeforePrefix; 2256 target.tailPrefix = !!opts.tailPrefix; 2257 2258 // others 2259 target.swapHiddenInput = !!opts.swapHiddenInput; 2260 2261 target.numericOnly = target.creditCard || target.date || !!opts.numericOnly; 2262 2263 target.uppercase = !!opts.uppercase; 2264 target.lowercase = !!opts.lowercase; 2265 2266 target.prefix = (target.creditCard || target.date) ? '' : (opts.prefix || ''); 2267 target.noImmediatePrefix = !!opts.noImmediatePrefix; 2268 target.prefixLength = target.prefix.length; 2269 target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix; 2270 target.copyDelimiter = !!opts.copyDelimiter; 2271 2272 target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : ''; 2273 2274 target.delimiter = 2275 (opts.delimiter || opts.delimiter === '') ? opts.delimiter : 2276 (opts.date ? '/' : 2277 (opts.time ? ':' : 2278 (opts.numeral ? ',' : 2279 (opts.phone ? ' ' : 2280 ' ')))); 2281 target.delimiterLength = target.delimiter.length; 2282 target.delimiterLazyShow = !!opts.delimiterLazyShow; 2283 target.delimiters = opts.delimiters || []; 2284 2285 target.blocks = opts.blocks || []; 2286 target.blocksLength = target.blocks.length; 2287 2288 target.root = (typeof global === 'object' && global) ? global : window; 2289 target.document = opts.document || target.root.document; 2290 2291 target.maxLength = 0; 2292 2293 target.backspace = false; 2294 target.result = ''; 2295 2296 target.onValueChanged = opts.onValueChanged || (function () {}); 2297 2298 return target; 2299 } 2300 }; 2301 2302 module.exports = DefaultProperties; 2303 2304 /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) 2305 2306/***/ }) 2307/******/ ]) 2308}); 2309;; 2310var Widgets = Widgets || {}; 2311 2312 2313Widgets.Utility = (function ($) { 2314 var instance; 2315 function constructor() { 2316 2317 function _getZIndex() { 2318 var zIndex = 0; 2319 $(document.body).children().each(function () { 2320 var index = parseInt($(this).css('z-index')); 2321 if (!isNaN(index)) 2322 zIndex = Math.max(zIndex, index); 2323 }); 2324 2325 //account for admin bar 2326 //var adminPanel = $('.admin_panel'); 2327 //if (adminPanel.length != 0) { 2328 // var adminPanelIndex = parseInt($('.admin_panel').css('z-index')); 2329 // zIndex = zIndex + 1 >= adminPanelIndex ? adminPanelIndex - 2 : zIndex; 2330 //} 2331 2332 return zIndex + 1; 2333 } 2334 2335 function _whichTransitionEvent() { 2336 var t, 2337 el = document.createElement("fakeelement"); 2338 2339 var transitions = { 2340 "transition": "transitionend", 2341 "OTransition": "oTransitionEnd", 2342 "MozTransition": "transitionend", 2343 "WebkitTransition": "webkitTransitionEnd" 2344 }; 2345 2346 for (t in transitions) { 2347 if (el.style[t] !== undefined) { 2348 return transitions[t]; 2349 } 2350 } 2351 } 2352 2353 function _whichAnimationEvent() { 2354 var t, 2355 el = document.createElement("fakeelement"); 2356 2357 var animations = { 2358 "animation": "animationend", 2359 "OAnimation": "oAnimationEnd", 2360 "MozAnimation": "animationend", 2361 "WebkitAnimation": "webkitAnimationEnd" 2362 } 2363 2364 for (t in animations) { 2365 if (el.style[t] !== undefined) { 2366 return animations[t]; 2367 } 2368 } 2369 } 2370 2371 function _getUniqueId() { 2372 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { 2373 var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); 2374 return v.toString(16); 2375 }); 2376 } 2377 2378 //-----Public Functions------ 2379 return { 2380 getZIndex: _getZIndex, 2381 whichAnimationEvent: _whichAnimationEvent, 2382 whichTransitionEvent: _whichTransitionEvent, 2383 getUniqueId: _getUniqueId 2384 } 2385 } 2386 2387 return { 2388 getInstance: function () { 2389 if (!instance) { instance = constructor(); } 2390 return instance; 2391 } 2392 }; 2393})(jQuery); 2394Widgets.Utility = Widgets.Utility.getInstance(); 2395 2396//Popup 2397/* 2398Usage: 2399 2400var popup = new Widgets.Popup({ 2401 container: ".content-id-or-class", 2402 onshow: function (container) { 2403 console.log('show: ', container); 2404 }, 2405 onhide: function (container) { 2406 console.log('hide: ', container); 2407 } 2408}); 2409 2410popup.show(); 2411popup.close(); 2412*/ 2413Widgets.Popup = function (options) { 2414 2415 var _options = { 2416 container: "", //selector or element 2417 animationClass: "", //separate with space 2418 duration: 700, //animate duration 2419 onshow: "", 2420 onhide: "", 2421 modal: false, 2422 adjustZIndex: 0, 2423 closeOnBgClick: true, 2424 zIndex: null //use to overwrite auto zindex 2425 }; 2426 2427 for (var o in options) if (typeof _options[o] !== undefined) _options[o] = options[o]; 2428 2429 //clean up animationClass 2430 _options.animationClass = _options.animationClass.replace(/\./, ''); 2431 2432 var container = $(_options.container); 2433 var containerParent = container.parent(); 2434 var isActive = false; 2435 var isBusy = false; 2436 2437 if (container.length === 0) 2438 return; 2439 2440 //var popup = $('.popup-outer'); 2441 //if (popup.length === 0) { 2442 var popup = $('<div class="popup-outer" />'); 2443 $('body').append(popup); 2444 //} 2445 2446 var close = $('<button class="ir popup-close">Close</button>'); 2447 2448 $(document).off('keyup', _handleKeyup).on('keyup', _handleKeyup); 2449 $(document).off('focusin.popup', _handleFocusin).on('focusin.popup', _handleFocusin); 2450 2451 function _handleFocusin(e) { 2452 if (e.target !== container[0] && !$.contains(container[0], e.target)) { 2453 close.focus(); 2454 return false; 2455 } 2456 } 2457 2458 function _handleKeyup(e) { 2459 if (e.keyCode === 27) close.click(); 2460 } 2461 2462 function _getZIndex() { 2463 var zIndex = 0; 2464 $(document.body).children().each(function(){ 2465 var index = parseInt($(this).css('z-index')); 2466 if(!isNaN(index)) 2467 zIndex = Math.max(zIndex, index); 2468 }); 2469 2470 //account for admin bar 2471 var adminPanel = $('.admin_panel'); 2472 if (adminPanel.length !== 0) { 2473 var adminPanelIndex = parseInt($('.admin_panel').css('z-index')); 2474 zIndex = zIndex + 1 >= adminPanelIndex ? adminPanelIndex - 2 : zIndex; 2475 } 2476 2477 return zIndex + 1 + _options.adjustZIndex; 2478 } 2479 2480 function _show() { 2481 isBusy = true; 2482 container.addClass('popup-inner ' + _options.animationClass).append(close); 2483 popup.empty().append(container.detach().show()); 2484 popup.removeAttr('style').fadeIn('fast'); 2485 2486 if (_options.zIndex !== null) 2487 popup.css('z-index', _options.zIndex); 2488 else if (_options.modal) 2489 popup.css('z-index', _getZIndex()); 2490 2491 setTimeout(function () { 2492 container.addClass('active'); 2493 }, 0); 2494 2495 setTimeout(function () { 2496 isBusy = false; 2497 }, _options.duration); 2498 2499 try { 2500 if (typeof _options.onshow === "function") 2501 _options.onshow(container); 2502 } catch (err) { } 2503 2504 isActive = true; 2505 2506 close.off('click').click(function () { 2507 var eleParent = $(this).parent(); 2508 closeWidget(eleParent); 2509 }); 2510 2511 2512 if (_options.closeOnBgClick) { 2513 popup.off('click').click(function () { 2514 var ele = $(this); 2515 closeWidget(ele.find(".popup-inner")); 2516 }); 2517 2518 popup.find('.popup-inner').off("click").click(function (e) { 2519 e.stopImmediatePropagation(); 2520 }); 2521 } 2522 } 2523 2524 function closeWidget(eleToClose){ 2525 eleToClose.removeClass('active'); 2526 popup.fadeOut(_options.duration); 2527 isBusy = true; 2528 setTimeout(_destroy, _options.duration); 2529 } 2530 2531 function _destroy() { 2532 container = popup.find('.popup-inner').detach(); 2533 container.removeClass('popup-inner ' + _options.animationClass).children('.popup-close').remove(); 2534 containerParent.append(container.removeAttr('style')); 2535 2536 try { 2537 if (typeof _options.onhide === "function") 2538 _options.onhide(container); 2539 } catch (err) { } 2540 2541 popup.remove(); 2542 2543 isActive = false; 2544 isBusy = false; 2545 } 2546 2547 function _hide() { 2548 if (isBusy) return; 2549 close.click(); 2550 } 2551 2552 function _toggle() { 2553 if (isBusy) return; 2554 2555 if (!isActive) 2556 _show(); 2557 else 2558 _hide(); 2559 } 2560 2561 return { 2562 isActive: isActive, 2563 toggle: _toggle, 2564 show: _show, 2565 hide: _hide, 2566 destroy: _destroy //same as hide but without animation 2567 }; 2568} 2569 2570Widgets.LayerEvents = { 2571 SHOW: 'Widgets.LayerEvents.SHOW', 2572 HIDE: 'Widgets.LayerEvents.HIDE', 2573 BEFORE_DESTROY: 'Widgets.LayerEvents.BEFORE_DESTROY', 2574 AFTER_DESTROY: 'Widgets.LayerEvents.AFTER_DESTROY' 2575}; 2576 2577//TODO: instead of using duration to time the animation, use browser event for transition animation instead. 2578//Bug: transitionend doesn't fire all the time for _destroy 2579Widgets.LayerFactory = (function ($) { 2580 var instance; 2581 function constructor() { 2582 var _vars = { 2583 holder: $('.hdm-layer-holder'), 2584 layers: [] 2585 }; 2586 2587 function _createLayer(options) { 2588 var rand = Math.random().toString().replace('.', ''); 2589 var layerElement = $('<div class="hdm-layer" id="hdm-layer-' + rand + '" />'); 2590 _vars.holder.append(layerElement); 2591 2592 options["layer"] = layerElement; 2593 2594 var layer = new Widgets.Layer(options); 2595 layer.options = options; 2596 _vars.layers.push(layer); 2597 return layer; 2598 } 2599 2600 function _removeLayer(e) { 2601 if (_vars.layers.length === 0) return; 2602 2603 var layer = _vars.layers[_vars.layers.length - 1]; 2604 var onBeforeClose = layer.getOnBeforeClose(); 2605 if (layer.isCloseOnBgClick()) { 2606 if (typeof onBeforeClose === 'function') { 2607 if (onBeforeClose()) layer.destroy(e); 2608 } 2609 else { 2610 layer.destroy(e); 2611 } 2612 } 2613 2614 } 2615 2616 function _destroy() { 2617 for (var k in _vars) { 2618 _vars[k] = null; 2619 } 2620 } 2621
2622 (function init() { 2623 if (_vars.holder.length === 0) { 2624 _vars.holder = $('<div class="hdm-layer-holder" />'); 2625 $(document.body).append(_vars.holder); 2626 } 2627 2628 $(document.body).on('click', '.hdm-layer-holder', _removeLayer); 2629 2630 var _holderZindex = 0; 2631 2632 $(document) 2633 .on(Widgets.LayerEvents.SHOW, function () { 2634 _vars.holder.addClass('active'); 2635 2636 if (_holderZindex === 0) 2637 _holderZindex = Widgets.Utility.getZIndex(); 2638 2639 if (_holderZindex >= 2000000000) 2640 _holderZindex = 150; 2641 2642 _vars.holder.css('z-index', _holderZindex);//always put holder in focus if it's being used 2643 2644 2645 //set the layer below to be inactive 2646 if (_vars.layers.length > 1) { 2647 _vars.layers[_vars.layers.length - 2].hide(); 2648 } 2649 }) 2650 .on(Widgets.LayerEvents.BEFORE_DESTROY, function () { 2651 _vars.layers.pop(); 2652 2653 if (_vars.layers.length > 0) { 2654 _vars.layers[_vars.layers.length - 1].focus(); 2655 } 2656 else { 2657 //_vars.holder.fadeOut(700, function () { 2658 // _vars.holder.toggleClass('active', _vars.layers != 0).removeAttr('style'); 2659 //}); 2660 2661 _vars.holder.toggleClass('active', _vars.layers !== 0); 2662 setTimeout(function () { 2663 _vars.holder.removeAttr('style'); 2664 }, 900); 2665 } 2666 2667 }) 2668 .on(Widgets.LayerEvents.AFTER_DESTROY, function () { 2669 2670 }); 2671 })(); 2672 2673 //-----Public Functions------ 2674 return { 2675 createLayer: _createLayer 2676 }; 2677 } 2678 2679 return { 2680 getInstance: function () { 2681 if (!instance) { instance = constructor(); } 2682 return instance; 2683 } 2684 }; 2685})(jQuery); 2686Widgets.LayerFactory = Widgets.LayerFactory.getInstance(); 2687 2688Widgets.Layer = function (options) { 2689 var _options = { 2690 container: "", //selector or element 2691 close: "", 2692 animationClass: "", //separate with space 2693 duration: 500, //animate duration 2694 onShow: "", 2695 onHide: "", 2696 onActive: "", 2697 onBeforeClose: null, 2698 //modal: false, 2699 //adjustZIndex: 0, 2700 closeOnBgClick: false, 2701 layer: null //layer element 2702 } 2703 for (var o in options) if (typeof (_options[o]) !== "undefined") _options[o] = options[o]; 2704 2705 var container = _options.container; 2706 2707 if (!_options.container instanceof jQuery) 2708 container = $(_options.container); 2709 2710 var containerParent = container.parent(); 2711 var isActive = false; 2712 var isBusy = false; 2713 2714 (function init() { 2715 2716 if (_options.close !== "") { 2717 $(document.body).on('click', '#' + _options.layer.attr('id') + " " + _options.close, function (e) { 2718 if (typeof _options.onBeforeClose === 'function') { 2719 if (_options.onBeforeClose()) _destroy(e); 2720 } 2721 else { 2722 _destroy(e); 2723 } 2724 }); 2725 } 2726 2727 if (_options.closeOnBgClick) { 2728 $(document.body).on('click', '#' + _options.layer.attr('id'), function (e) { 2729 var ele = $(this); 2730 if (ele.hasClass('active')) { 2731 e.stopImmediatePropagation(); 2732 } 2733 }); 2734 } 2735 })(); 2736 2737 function _focus() { 2738 _options.layer.removeClass('inactive').addClass('active'); 2739 try { 2740 if (typeof _options.onActive === "function") 2741 _options.onActive(container); 2742 } catch (err) { } 2743 } 2744 2745 function _show() { 2746 $(document).trigger(Widgets.LayerEvents.SHOW); 2747 2748 isBusy = true; 2749 2750 setTimeout(function () { 2751 isBusy = false; 2752 }, _options.duration); 2753 2754 //holder.addClass('active').children('.active').removeClass('active').addClass('inactive'); //toggle all active layers to be inactive 2755 setTimeout(function () { 2756 _options.layer.removeClass('inactive').append(container.detach().show()).addClass('active'); 2757 }, 1); 2758 2759 try { 2760 if (typeof _options.onShow === "function") 2761 _options.onShow(container); 2762 } catch (err) { } 2763 2764 return this; 2765 } 2766 2767 function _isCloseOnBgClick() { 2768 return _options.closeOnBgClick; 2769 } 2770 2771 function _getOnBeforeClose() { 2772 return _options.onBeforeClose; 2773 } 2774 2775 function _destroy(e) { 2776 if (isBusy) { 2777 return; 2778 } 2779 if (e) { 2780 e.stopPropagation(); 2781 } 2782 2783 $(document).trigger(Widgets.LayerEvents.BEFORE_DESTROY); 2784 isBusy = true; 2785 _options.layer.removeClass('active'); 2786 2787 setTimeout(function () { 2788 container = _options.layer.children().detach(); 2789 //container.removeClass('popup-inner ' + _options.animationClass).children('.close').remove(); 2790 containerParent.append(container.removeAttr('style')); 2791 2792 try { 2793 if (typeof _options.onHide === "function") 2794 _options.onHide(container); 2795 } catch (err) { } 2796 2797 _options.layer.remove(); 2798 2799 _reset(); 2800 $(document).trigger(Widgets.LayerEvents.AFTER_DESTROY); 2801 2802 }, _options.duration); 2803 } 2804 2805 function _reset() { 2806 for (var k in _options) { 2807 _options[k] = null; 2808 } 2809 container = null; 2810 containerParent = null; 2811 isActive = false; 2812 isBusy = false; 2813 } 2814 2815 function _hide() { 2816 _options.layer.removeClass('active').addClass('inactive'); 2817 } 2818 2819 return { 2820 //isActive: isActive, 2821 //container: _options.container, 2822 isCloseOnBgClick: _isCloseOnBgClick, 2823 getOnBeforeClose: _getOnBeforeClose, 2824 focus: _focus, 2825 show: _show, 2826 hide: _hide, 2827 destroy: _destroy 2828 }; 2829};
2830ImageUtility = { 2831 getNewImage: function (container, src, imageWidth, imageHeight) { 2832 if (!src || src === '') return; 2833 2834 var width = $(container).width(); 2835 2836 if (width > 1440 && width <= 1600) width = 1600; 2837 else if (width > 1280 && width <= 1440) width = 1440; 2838 else if (width > 640 && width <= 1280) width = 1280; 2839 else if (width <= 640) width = 640; 2840 else return src; 2841 2842 if (width >= imageWidth) return src; 2843 2844 var height = Math.round((width / imageWidth) * imageHeight); 2845 var path = width + 'x' + height + '/'; 2846 2847 var temp = src.split('/'); 2848 var filename = src; 2849 if (temp.length > 0) 2850 filename = temp[temp.length - 1]; 2851 2852 return src.replace(filename, path + filename); 2853 }, 2854 preloadNewImage: function (container, ele, imageWidth, imageHeight) { 2855 container = $(container); 2856 var dataImage = ele.attr('data-image'); 2857 var newImagePath = ImageUtility.getNewImage(container, dataImage, imageWidth, imageHeight); 2858 if (dataImage) { 2859 $('<img/>').load(function () { 2860 ele.css('background-image', 'url(' + newImagePath + ')'); 2861 }).error(function () { 2862 ele.css('background-image', 'url(' + dataImage + ')'); 2863 }).attr('src', newImagePath); 2864 } 2865 }, 2866 preloadBackgroundImage: function ($ele) { 2867 var $link = $ele.children('a'); 2868 if ($link.length !== 0) { 2869 var imagePath = $link.attr('href'); 2870 $('<img/>').on('load', function () { 2871 $ele.css('background-image', "url('" + this.src + "')").removeClass('preload-image'); 2872 }).attr('src', imagePath); 2873 } 2874 }, 2875 preloadImage: function ($ele) { 2876 var $link = $ele.children('a'); 2877 if ($link.length !== 0) { 2878 var imagePath = $link.attr('href'); 2879 $('<img/>').on('load', function () { 2880 $ele.prepend('<img src="' + this.src + '" alt="" />').removeClass('preload-image'); 2881 }).attr('src', imagePath); 2882 } 2883 } 2884}; 2885!function(){"use strict";if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=window.document,e=[];o.prototype.THROTTLE_TIMEOUT=100,o.prototype.POLL_INTERVAL=null,o.prototype.USE_MUTATION_OBSERVER=!0,o.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},o.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},o.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},o.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},o.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},o.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},o.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(i(window,"resize",this._checkForIntersections,!0),i(t,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in window&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},o.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,r(window,"resize",this._checkForIntersections,!0),r(t,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},o.prototype._checkForIntersections=function(){var t=this._rootIsInDom(),e=t?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};
2885this._observationTargets.forEach(function(o){var i=o.element,r=s(i),h=this._rootContainsTarget(i),c=o.entry,a=t&&h&&this._computeTargetAndRootIntersection(i,e),u=o.entry=new n({time:window.performance&&performance.now&&performance.now(),target:i,boundingClientRect:r,rootBounds:e,intersectionRect:a});c?t&&h?this._hasCrossedThreshold(c,u)&&this._queuedEntries.push(u):c&&c.isIntersecting&&this._queuedEntries.push(u):this._queuedEntries.push(u)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},o.prototype._computeTargetAndRootIntersection=function(e,n){if("none"!=window.getComputedStyle(e).display){for(var o,i,r,h,a,u,d,l,p=s(e),f=c(e),g=!1;!g;){var _=null,v=1==f.nodeType?window.getComputedStyle(f):{};if("none"==v.display)return;if(f==this.root||f==t?(g=!0,_=n):f!=t.body&&f!=t.documentElement&&"visible"!=v.overflow&&(_=s(f)),_&&(o=_,i=p,r=void 0,h=void 0,a=void 0,u=void 0,d=void 0,l=void 0,r=Math.max(o.top,i.top),h=Math.min(o.bottom,i.bottom),a=Math.max(o.left,i.left),u=Math.min(o.right,i.right),l=h-r,!(p=(d=u-a)>=0&&l>=0&&{top:r,bottom:h,left:a,right:u,width:d,height:l})))break;f=c(f)}return p}},o.prototype._getRootRect=function(){var e;if(this.root)e=s(this.root);else{var n=t.documentElement,o=t.body;e={top:0,left:0,right:n.clientWidth||o.clientWidth,width:n.clientWidth||o.clientWidth,bottom:n.clientHeight||o.clientHeight,height:n.clientHeight||o.clientHeight}}return this._expandRectByRootMargin(e)},o.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100}),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},o.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,o=e.isIntersecting?e.intersectionRatio||0:-1;if(n!==o)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==n||r==o||r<n!=r<o)return!0}},o.prototype._rootIsInDom=function(){return!this.root||h(t,this.root)},o.prototype._rootContainsTarget=function(e){return h(this.root||t,e)},o.prototype._registerInstance=function(){e.indexOf(this)<0&&e.push(this)},o.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},window.IntersectionObserver=o,window.IntersectionObserverEntry=n}function n(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0},this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,n=e.width*e.height,o=this.intersectionRect,i=o.width*o.height;this.intersectionRatio=n?Number((i/n).toFixed(4)):this.isIntersecting?1:0}function o(t,e){var n,o,i,r=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(r.root&&1!=r.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=(n=this._checkForIntersections.bind(this),o=this.THROTTLE_TIMEOUT,i=null,function(){i||(i=setTimeout(function(){n(),i=null},o))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(r.rootMargin),this.thresholds=this._initThresholds(r.threshold),this.root=r.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" ")}function i(t,e,n,o){"function"==typeof t.addEventListener?t.addEventListener(e,n,o||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function r(t,e,n,o){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function s(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function h(t,e){for(var n=e;n;){if(n==t)return!0;n=c(n)}return!1}function c(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e&&e.assignedSlot?e.assignedSlot.parentNode:e}}();; 2886/* 2887 Original Plugin by Osvaldas Valutis, www.osvaldas.info 2888 http://osvaldas.info/drop-down-navigation-responsive-and-touch-friendly 2889 Available for use under the MIT License 2890 */ 2891/** 2892 * jquery-doubleTapToGo plugin 2893 * Copyright 2017 DACHCOM.DIGITAL AG 2894 * @author Marco Rieser 2895 * @author Volker Andres 2896 * @author Stefan Hagspiel 2897 * @version 3.0.2 2898 * @see https://github.com/dachcom-digital/jquery-doubletaptogo 2899 */ 2900(function ($, window, document, undefined) { 2901 'use strict'; 2902 var pluginName = 'doubleTapToGo', 2903 defaults = { 2904 automatic: true, 2905 selectorClass: 'doubletap', 2906 selectorChain: 'li:has(ul)' 2907 }; 2908 2909 function DoubleTapToGo (element, options) { 2910 this.element = element; 2911 this.settings = $.extend({}, defaults, options); 2912 this._defaults = defaults; 2913 this._name = pluginName; 2914 this.init(); 2915 } 2916 2917 $.extend(DoubleTapToGo.prototype, { 2918 preventClick: false, 2919 currentTap: $(), 2920 init: function () { 2921 $(this.element) 2922 .on('touchstart', '.' + this.settings.selectorClass, this._tap.bind(this)) 2923 .on('click', '.' + this.settings.selectorClass, this._click.bind(this)) 2924 .on('remove', this._destroy.bind(this)); 2925 2926 this._addSelectors(); 2927 }, 2928 2929 _addSelectors: function () { 2930 if (this.settings.automatic !== true) { 2931 return; 2932 } 2933 $(this.element) 2934 .find(this.settings.selectorChain) 2935 .addClass(this.settings.selectorClass); 2936 }, 2937 2938 _click: function (event) { 2939 if (this.preventClick) { 2940 event.preventDefault(); 2941 } else { 2942 this.currentTap = $(); 2943 } 2944 }, 2945 2946 _tap: function (event) { 2947 var $target = $(event.target).closest('li'); 2948 if (!$target.hasClass(this.settings.selectorClass)) { 2949 this.preventClick = false; 2950 return; 2951 } 2952 if ($target.get(0) === this.currentTap.get(0)) { 2953 this.preventClick = false; 2954 return; 2955 } 2956 this.preventClick = true; 2957 this.currentTap = $target; 2958 event.stopPropagation(); 2959 }, 2960 2961 _destroy: function () { 2962 $(this.element).off(); 2963 }, 2964 2965 reset: function () { 2966 this.currentTap = $(); 2967 } 2968 });
vendor: 1,129 bytes, lines 2969-2994
2969 2970 $.fn[pluginName] = function (options) { 2971 var args = arguments, 2972 returns; 2973 if (options === undefined || typeof options === 'object') { 2974 return this.each(function () { 2975 if (!$.data(this, pluginName)) { 2976 $.data(this, pluginName, new DoubleTapToGo(this, options)); 2977 } 2978 }); 2979 } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') { 2980 this.each(function () { 2981 var instance = $.data(this, pluginName), 2982 methodName = (options === 'destroy' ? '_destroy' : options); 2983 if (instance instanceof DoubleTapToGo && typeof instance[methodName] === 'function') { 2984 returns = instance[methodName].apply(instance, Array.prototype.slice.call(args, 1)); 2985 } 2986 if (options === 'destroy') { 2987 $.data(this, pluginName, null); 2988 } 2989 }); 2990 return returns !== undefined ? returns : this; 2991 } 2992 }; 2993})(jQuery, window, document); 2994;
vendor: 95,406 bytes, lines 2995-5452
2995/* 2996== malihu jquery custom scrollbar plugin == 2997Version: 3.1.5 2998Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 2999Author: malihu 3000Author URI: http://manos.malihu.gr 3001License: MIT License (MIT) 3002*/ 3003 3004/* 3005Copyright Manos Malihutsakis (email: [email protected]) 3006 3007Permission is hereby granted, free of charge, to any person obtaining a copy 3008of this software and associated documentation files (the "Software"), to deal 3009in the Software without restriction, including without limitation the rights 3010to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 3011copies of the Software, and to permit persons to whom the Software is 3012furnished to do so, subject to the following conditions: 3013 3014The above copyright notice and this permission notice shall be included in 3015all copies or substantial portions of the Software. 3016 3017THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3018IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3019FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 3020AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 3021LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 3022OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 3023THE SOFTWARE. 3024*/ 3025 3026/* 3027The code below is fairly long, fully commented and should be normally used in development. 3028For production, use either the minified jquery.mCustomScrollbar.min.js script or 3029the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin 3030and dependencies (minified). 3031*/ 3032 3033(function(factory){ 3034 if(typeof define==="function" && define.amd){ 3035 define(["jquery"],factory); 3036 }else if(typeof module!=="undefined" && module.exports){ 3037 module.exports=factory; 3038 }else{ 3039 factory(jQuery,window,document); 3040 } 3041}(function($){ 3042(function(init){ 3043 var _rjs=typeof define==="function" && define.amd, /* RequireJS */ 3044 _njs=typeof module !== "undefined" && module.exports, /* NodeJS */ 3045 _dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */ 3046 _url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"; 3047 if(!_rjs){ 3048 if(_njs){ 3049 require("jquery-mousewheel")($); 3050 }else{ 3051 /* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS 3052 (works when mCustomScrollbar fn is called on window load) */ 3053 $.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E")); 3054 } 3055 } 3056 init(); 3057}(function(){ 3058 3059 /* 3060 ---------------------------------------- 3061 PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 3062 ---------------------------------------- 3063 */ 3064 3065 var pluginNS="mCustomScrollbar", 3066 pluginPfx="mCS", 3067 defaultSelector=".mCustomScrollbar", 3068 3069 3070 3071 3072 3073 /* 3074 ---------------------------------------- 3075 DEFAULT OPTIONS 3076 ---------------------------------------- 3077 */ 3078 3079 defaults={ 3080 /* 3081 set element/content width/height programmatically 3082 values: boolean, pixels, percentage 3083 option default 3084 ------------------------------------- 3085 setWidth false 3086 setHeight false 3087 */ 3088 /* 3089 set the initial css top property of content 3090 values: string (e.g. "-100px", "10%" etc.) 3091 */ 3092 setTop:0, 3093 /* 3094 set the initial css left property of content 3095 values: string (e.g. "-100px", "10%" etc.) 3096 */ 3097 setLeft:0, 3098 /* 3099 scrollbar axis (vertical and/or horizontal scrollbars) 3100 values (string): "y", "x", "yx" 3101 */ 3102 axis:"y", 3103 /* 3104 position of scrollbar relative to content 3105 values (string): "inside", "outside" ("outside" requires elements with position:relative) 3106 */ 3107 scrollbarPosition:"inside", 3108 /* 3109 scrolling inertia 3110 values: integer (milliseconds) 3111 */ 3112 scrollInertia:950, 3113 /* 3114 auto-adjust scrollbar dragger length 3115 values: boolean 3116 */ 3117 autoDraggerLength:true, 3118 /* 3119 auto-hide scrollbar when idle 3120 values: boolean 3121 option default 3122 ------------------------------------- 3123 autoHideScrollbar false 3124 */ 3125 /* 3126 auto-expands scrollbar on mouse-over and dragging 3127 values: boolean 3128 option default 3129 ------------------------------------- 3130 autoExpandScrollbar false 3131 */ 3132 /* 3133 always show scrollbar, even when there's nothing to scroll 3134 values: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean 3135 */ 3136 alwaysShowScrollbar:0, 3137 /* 3138 scrolling always snaps to a multiple of this number in pixels 3139 values: integer, array ([y,x]) 3140 option default 3141 ------------------------------------- 3142 snapAmount null 3143 */ 3144 /* 3145 when snapping, snap with this number in pixels as an offset 3146 values: integer 3147 */ 3148 snapOffset:0, 3149 /* 3150 mouse-wheel scrolling 3151 */ 3152 mouseWheel:{ 3153 /* 3154 enable mouse-wheel scrolling 3155 values: boolean 3156 */ 3157 enable:true, 3158 /* 3159 scrolling amount in pixels 3160 values: "auto", integer 3161 */ 3162 scrollAmount:"auto", 3163 /* 3164 mouse-wheel scrolling axis 3165 the default scrolling direction when both vertical and horizontal scrollbars are present 3166 values (string): "y", "x" 3167 */ 3168 axis:"y", 3169 /* 3170 prevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached 3171 values: boolean 3172 option default 3173 ------------------------------------- 3174 preventDefault null 3175 */ 3176 /* 3177 the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls. 3178 values: "auto", integer 3179 "auto" uses the default OS/browser value 3180 */ 3181 deltaFactor:"auto", 3182 /* 3183 normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) 3184 values: boolean 3185 option default 3186 ------------------------------------- 3187 normalizeDelta null 3188 */ 3189 /* 3190 invert mouse-wheel scrolling direction 3191 values: boolean 3192 option default 3193 ------------------------------------- 3194 invert null 3195 */ 3196 /* 3197 the tags that disable mouse-wheel when cursor is over them 3198 */ 3199 disableOver:["select","option","keygen","datalist","textarea"] 3200 }, 3201 /* 3202 scrollbar buttons 3203 */ 3204 scrollButtons:{ 3205 /* 3206 enable scrollbar buttons 3207 values: boolean 3208 option default 3209 ------------------------------------- 3210 enable null 3211 */ 3212 /* 3213 scrollbar buttons scrolling type 3214 values (string): "stepless", "stepped" 3215 */ 3216 scrollType:"stepless", 3217 /* 3218 scrolling amount in pixels 3219 values: "auto", integer 3220 */ 3221 scrollAmount:"auto" 3222 /* 3223 tabindex of the scrollbar buttons 3224 values: false, integer 3225 option default 3226 ------------------------------------- 3227 tabindex null 3228 */ 3229 }, 3230 /* 3231 keyboard scrolling 3232 */ 3233 keyboard:{ 3234 /* 3235 enable scrolling via keyboard 3236 values: boolean 3237 */ 3238 enable:true, 3239 /* 3240 keyboard scrolling type 3241 values (string): "stepless", "stepped" 3242 */ 3243 scrollType:"stepless", 3244 /* 3245 scrolling amount in pixels 3246 values: "auto", integer 3247 */ 3248 scrollAmount:"auto" 3249 }, 3250 /* 3251 enable content touch-swipe scrolling 3252 values: boolean, integer, string (number) 3253 integer values define the axis-specific minimum amount required for scrolling momentum 3254 */ 3255 contentTouchScroll:25, 3256 /* 3257 enable/disable document (default) touch-swipe scrolling 3258 */ 3259 documentTouchScroll:true, 3260 /* 3261 advanced option parameters 3262 */ 3263 advanced:{ 3264 /* 3265 auto-expand content horizontally (for "x" or "yx" axis) 3266 values: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method) 3267 option default 3268 ------------------------------------- 3269 autoExpandHorizontalScroll null 3270 */ 3271 /* 3272 auto-scroll to elements with focus 3273 */ 3274 autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']", 3275 /* 3276 auto-update scrollbars on content, element or viewport resize 3277 should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. 3278 values: boolean 3279 */ 3280 updateOnContentResize:true, 3281 /* 3282 auto-update scrollbars each time each image inside the element is fully loaded 3283 values: "auto", boolean 3284 */ 3285 updateOnImageLoad:"auto", 3286 /* 3287 auto-update scrollbars based on the amount and size changes of specific selectors 3288 useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size 3289 values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) 3290 a value of true (boolean) will auto-update scrollbars each time any element is changed 3291 option default 3292 ------------------------------------- 3293 updateOnSelectorChange null 3294 */ 3295 /* 3296 extra selectors that'll allow scrollbar dragging upon mousemove/up, pointermove/up, touchend etc. (e.g. "selector-1, selector-2") 3297 option default 3298 ------------------------------------- 3299 extraDraggableSelectors null 3300 */ 3301 /* 3302 extra selectors that'll release scrollbar dragging upon mouseup, pointerup, touchend etc. (e.g. "selector-1, selector-2") 3303 option default 3304 ------------------------------------- 3305 releaseDraggableSelectors null 3306 */ 3307 /* 3308 auto-update timeout 3309 values: integer (milliseconds) 3310 */ 3311 autoUpdateTimeout:60 3312 }, 3313 /* 3314 scrollbar theme 3315 values: string (see CSS/plugin URI for a list of ready-to-use themes) 3316 */ 3317 theme:"light", 3318 /* 3319 user defined callback functions 3320 */ 3321 callbacks:{ 3322 /* 3323 Available callbacks: 3324 callback default 3325 ------------------------------------- 3326 onCreate null 3327 onInit null 3328 onScrollStart null 3329 onScroll null 3330 onTotalScroll null 3331 onTotalScrollBack null 3332 whileScrolling null 3333 onOverflowY null 3334 onOverflowX null 3335 onOverflowYNone null 3336 onOverflowXNone null 3337 onImageLoad null 3338 onSelectorChange null 3339 onBeforeUpdate null 3340 onUpdate null 3341 */ 3342 onTotalScrollOffset:0, 3343 onTotalScrollBackOffset:0, 3344 alwaysTriggerOffsets:true 3345 } 3346 /* 3347 add scrollbar(s) on all elements matching the current selector, now and in the future 3348 values: boolean, string 3349 string values: "on" (enable), "once" (disable after first invocation), "off" (disable) 3350 liveSelector values: string (selector) 3351 option default 3352 ------------------------------------- 3353 live false 3354 liveSelector null 3355 */ 3356 }, 3357 3358 3359 3360 3361 3362 /* 3363 ---------------------------------------- 3364 VARS, CONSTANTS 3365 ---------------------------------------- 3366 */ 3367 3368 totalInstances=0, /* plugin instances amount */ 3369 liveTimers={}, /* live option timers */ 3370 oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */ 3371 touchActive=false,touchable, /* global touch vars (for touch and pointer events) */ 3372 /* general plugin classes */ 3373 classes=[ 3374 "mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar", 3375 "mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer", 3376 "mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight" 3377 ], 3378 3379 3380 3381 3382 3383 /* 3384 ---------------------------------------- 3385 METHODS 3386 ---------------------------------------- 3387 */ 3388 3389 methods={ 3390 3391 /* 3392 plugin initialization method 3393 creates the scrollbar(s), plugin data object and options 3394 ---------------------------------------- 3395 */ 3396 3397 init:function(options){ 3398 3399 var options=$.extend(true,{},defaults,options), 3400 selector=_selector.call(this); /* validate selector */ 3401 3402 /* 3403 if live option is enabled, monitor for elements matching the current selector and 3404 apply scrollbar(s) when found (now and in the future) 3405 */ 3406 if(options.live){ 3407 var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */ 3408 $liveSelector=$(liveSelector); /* live selector(s) as jquery object */ 3409 if(options.live==="off"){ 3410 /* 3411 disable live if requested 3412 usage: $(selector).mCustomScrollbar({live:"off"}); 3413 */ 3414 removeLiveTimers(liveSelector); 3415 return; 3416 } 3417 liveTimers[liveSelector]=setTimeout(function(){ 3418 /* call mCustomScrollbar fn on live selector(s) every half-second */ 3419 $liveSelector.mCustomScrollbar(options); 3420 if(options.live==="once" && $liveSelector.length){ 3421 /* disable live after first invocation */ 3422 removeLiveTimers(liveSelector); 3423 } 3424 },500); 3425 }else{ 3426 removeLiveTimers(liveSelector); 3427 } 3428 3429 /* options backward compatibility (for versions < 3.0.0) and normalization */ 3430 options.setWidth=(options.set_width) ? options.set_width : options.setWidth; 3431 options.setHeight=(options.set_height) ? options.set_height : options.setHeight; 3432 options.axis=(options.horizontalScroll) ? "x" : _findAxis(options.axis); 3433 options.scrollInertia=options.scrollInertia>0 && options.scrollInertia<17 ? 17 : options.scrollInertia; 3434 if(typeof options.mouseWheel!=="object" && options.mouseWheel==true){ /* old school mouseWheel option (non-object) */ 3435 options.mouseWheel={enable:true,scrollAmount:"auto",axis:"y",preventDefault:false,deltaFactor:"auto",normalizeDelta:false,invert:false} 3436 } 3437 options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels; 3438 options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta; 3439 options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); 3440 3441 _theme(options); /* theme-specific options */ 3442 3443 /* plugin constructor */ 3444 return $(selector).each(function(){ 3445 3446 var $this=$(this); 3447 3448 if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */ 3449 3450 /* store options and create objects in jquery data */ 3451 $this.data(pluginPfx,{ 3452 idx:++totalInstances, /* instance index */ 3453 opt:options, /* options */ 3454 scrollRatio:{y:null,x:null}, /* scrollbar to content ratio */ 3455 overflowed:null, /* overflowed axis */ 3456 contentReset:{y:null,x:null}, /* object to check when content resets */ 3457 bindEvents:false, /* object to check if events are bound */ 3458 tweenRunning:false, /* object to check if tween is running */ 3459 sequential:{}, /* sequential scrolling object */ 3460 langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */ 3461 cbOffsets:null, /* object to check whether callback offsets always trigger */ 3462 /* 3463 object to check how scrolling events where last triggered 3464 "internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) 3465 usage: object.data("mCS").trigger 3466 */ 3467 trigger:null, 3468 /* 3469 object to check for changes in elements in order to call the update method automatically 3470 */ 3471 poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}} 3472 }); 3473 3474 var d=$this.data(pluginPfx),o=d.opt, 3475 /* HTML data attributes */ 3476 htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme"); 3477 3478 if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */ 3479 if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */ 3480 if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */ 3481 o.theme=htmlDataTheme; 3482 _theme(o); /* theme-specific options */ 3483 } 3484 3485 _pluginMarkup.call(this); /* add plugin markup */ 3486 3487 if(d && o.callbacks.onCreate && typeof o.callbacks.onCreate==="function"){o.callbacks.onCreate.call(this);} /* callbacks: onCreate */ 3488 3489 $("#mCSB_"+d.idx+"_container img:not(."+classes[2]+")").addClass(classes[2]); /* flag loaded images */ 3490 3491 methods.update.call(null,$this); /* call the update method */ 3492 3493 } 3494 3495 }); 3496 3497 }, 3498 /* ---------------------------------------- */ 3499 3500 3501 3502 /* 3503 plugin update method 3504 updates content and scrollbar(s) values, events and status 3505 ---------------------------------------- 3506 usage: $(selector).mCustomScrollbar("update"); 3507 */ 3508 3509 update:function(el,cb){ 3510 3511 var selector=el || _selector.call(this); /* validate selector */ 3512 3513 return $(selector).each(function(){ 3514 3515 var $this=$(this); 3516 3517 if($this.data(pluginPfx)){ /* check if plugin has initialized */ 3518 3519 var d=$this.data(pluginPfx),o=d.opt, 3520 mCSB_container=$("#mCSB_"+d.idx+"_container"), 3521 mCustomScrollBox=$("#mCSB_"+d.idx), 3522 mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")]; 3523 3524 if(!mCSB_container.length){return;} 3525 3526 if(d.tweenRunning){_stop($this);} /* stop any running tweens while updating */ 3527 3528 if(cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate==="function"){o.callbacks.onBeforeUpdate.call(this);} /* callbacks: onBeforeUpdate */ 3529 3530 /* if element was disabled or destroyed, remove class(es) */ 3531 if($this.hasClass(classes[3])){$this.removeClass(classes[3]);} 3532 if($this.hasClass(classes[4])){$this.removeClass(classes[4]);} 3533 3534 /* css flexbox fix, detect/set max-height */ 3535 mCustomScrollBox.css("max-height","none"); 3536 if(mCustomScrollBox.height()!==$this.height()){mCustomScrollBox.css("max-height",$this.height());} 3537 3538 _expandContentHorizontally.call(this); /* expand content horizontally */ 3539 3540 if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){ 3541 mCSB_container.css("width",_contentWidth(mCSB_container)); 3542 } 3543 3544 d.overflowed=_overflowed.call(this); /* determine if scrolling is required */ 3545 3546 _scrollbarVisibility.call(this); /* show/hide scrollbar(s) */ 3547 3548 /* auto-adjust scrollbar dragger length analogous to content */ 3549 if(o.autoDraggerLength){_setDraggerLength.call(this);} 3550 3551 _scrollRatio.call(this); /* calculate and store scrollbar to content ratio */ 3552 3553 _bindEvents.call(this); /* bind scrollbar events */ 3554 3555 /* reset scrolling position and/or events */ 3556 var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)]; 3557 if(o.axis!=="x"){ /* y/yx axis */ 3558 if(!d.overflowed[0]){ /* y scrolling is not required */ 3559 _resetContentPosition.call(this); /* reset content position */ 3560 if(o.axis==="y"){ 3561 _unbindEvents.call(this); 3562 }else if(o.axis==="yx" && d.overflowed[1]){ 3563 _scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"}); 3564 } 3565 }else if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){ 3566 _resetContentPosition.call(this); /* reset content position */ 3567 }else{ /* y scrolling is required */ 3568 _scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"}); 3569 d.contentReset.y=null; 3570 } 3571 } 3572 if(o.axis!=="y"){ /* x/yx axis */ 3573 if(!d.overflowed[1]){ /* x scrolling is not required */ 3574 _resetContentPosition.call(this); /* reset content position */ 3575 if(o.axis==="x"){ 3576 _unbindEvents.call(this); 3577 }else if(o.axis==="yx" && d.overflowed[0]){ 3578 _scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"}); 3579 } 3580 }else if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){ 3581 _resetContentPosition.call(this); /* reset content position */ 3582 }else{ /* x scrolling is required */ 3583 _scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"}); 3584 d.contentReset.x=null; 3585 } 3586 } 3587 3588 /* callbacks: onImageLoad, onSelectorChange, onUpdate */ 3589 if(cb && d){ 3590 if(cb===2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad==="function"){ 3591 o.callbacks.onImageLoad.call(this); 3592 }else if(cb===3 && o.callbacks.onSelectorChange && typeof o.callbacks.onSelectorChange==="function"){ 3593 o.callbacks.onSelectorChange.call(this); 3594 }else if(o.callbacks.onUpdate && typeof o.callbacks.onUpdate==="function"){ 3595 o.callbacks.onUpdate.call(this); 3596 } 3597 } 3598 3599 _autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */ 3600 3601 } 3602 3603 }); 3604 3605 }, 3606 /* ---------------------------------------- */ 3607 3608 3609 3610 /* 3611 plugin scrollTo method 3612 triggers a scrolling event to a specific value 3613 ---------------------------------------- 3614 usage: $(selector).mCustomScrollbar("scrollTo",value,options); 3615 */ 3616 3617 scrollTo:function(val,options){ 3618 3619 /* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */ 3620 if(typeof val=="undefined" || val==null){return;} 3621 3622 var selector=_selector.call(this); /* validate selector */ 3623 3624 return $(selector).each(function(){ 3625 3626 var $this=$(this); 3627 3628 if($this.data(pluginPfx)){ /* check if plugin has initialized */ 3629 3630 var d=$this.data(pluginPfx),o=d.opt, 3631 /* method default options */ 3632 methodDefaults={ 3633 trigger:"external", /* method is by default triggered externally (e.g. from other scripts) */ 3634 scrollInertia:o.scrollInertia, /* scrolling inertia (animation duration) */ 3635 scrollEasing:"mcsEaseInOut", /* animation easing */ 3636 moveDragger:false, /* move dragger instead of content */ 3637 timeout:60, /* scroll-to delay */ 3638 callbacks:true, /* enable/disable callbacks */ 3639 onStart:true, 3640 onUpdate:true, 3641 onComplete:true 3642 }, 3643 methodOptions=$.extend(true,{},methodDefaults,options), 3644 to=_arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia; 3645 3646 /* translate yx values to actual scroll-to positions */ 3647 to[0]=_to.call(this,to[0],"y"); 3648 to[1]=_to.call(this,to[1],"x"); 3649 3650 /* 3651 check if scroll-to value moves the dragger instead of content. 3652 Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) 3653 */ 3654 if(methodOptions.moveDragger){ 3655 to[0]*=d.scrollRatio.y; 3656 to[1]*=d.scrollRatio.x; 3657 } 3658 3659 methodOptions.dur=_isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden 3660 3661 setTimeout(function(){ 3662 /* do the scrolling */ 3663 if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */ 3664 methodOptions.dir="y"; 3665 methodOptions.overwrite="all"; 3666 _scrollTo($this,to[0].toString(),methodOptions); 3667 } 3668 if(to[1]!==null && typeof to[1]!=="undefined" && o.axis!=="y" && d.overflowed[1]){ /* scroll x */ 3669 methodOptions.dir="x"; 3670 methodOptions.overwrite="none"; 3671 _scrollTo($this,to[1].toString(),methodOptions); 3672 } 3673 },methodOptions.timeout); 3674 3675 } 3676 3677 }); 3678 3679 }, 3680 /* ---------------------------------------- */ 3681 3682 3683 3684 /* 3685 plugin stop method 3686 stops scrolling animation 3687 ---------------------------------------- 3688 usage: $(selector).mCustomScrollbar("stop"); 3689 */ 3690 stop:function(){ 3691 3692 var selector=_selector.call(this); /* validate selector */ 3693 3694 return $(selector).each(function(){ 3695 3696 var $this=$(this); 3697 3698 if($this.data(pluginPfx)){ /* check if plugin has initialized */ 3699 3700 _stop($this); 3701 3702 } 3703 3704 }); 3705 3706 }, 3707 /* ---------------------------------------- */ 3708 3709 3710 3711 /* 3712 plugin disable method 3713 temporarily disables the scrollbar(s) 3714 ---------------------------------------- 3715 usage: $(selector).mCustomScrollbar("disable",reset); 3716 reset (boolean): resets content position to 0 3717 */ 3718 disable:function(r){ 3719 3720 var selector=_selector.call(this); /* validate selector */ 3721 3722 return $(selector).each(function(){ 3723 3724 var $this=$(this); 3725 3726 if($this.data(pluginPfx)){ /* check if plugin has initialized */ 3727 3728 var d=$this.data(pluginPfx); 3729 3730 _autoUpdate.call(this,"remove"); /* remove automatic updating */ 3731 3732 _unbindEvents.call(this); /* unbind events */ 3733 3734 if(r){_resetContentPosition.call(this);} /* reset content position */ 3735 3736 _scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */ 3737 3738 $this.addClass(classes[3]); /* add disable class */ 3739 3740 } 3741 3742 }); 3743 3744 }, 3745 /* ---------------------------------------- */ 3746 3747 3748 3749 /* 3750 plugin destroy method 3751 completely removes the scrollbar(s) and returns the element to its original state 3752 ---------------------------------------- 3753 usage: $(selector).mCustomScrollbar("destroy"); 3754 */ 3755 destroy:function(){ 3756 3757 var selector=_selector.call(this); /* validate selector */ 3758 3759 return $(selector).each(function(){ 3760 3761 var $this=$(this); 3762 3763 if($this.data(pluginPfx)){ /* check if plugin has initialized */ 3764 3765 var d=$this.data(pluginPfx),o=d.opt, 3766 mCustomScrollBox=$("#mCSB_"+d.idx), 3767 mCSB_container=$("#mCSB_"+d.idx+"_container"), 3768 scrollbar=$(".mCSB_"+d.idx+"_scrollbar"); 3769 3770 if(o.live){removeLiveTimers(o.liveSelector || $(selector).selector);} /* remove live timers */ 3771 3772 _autoUpdate.call(this,"remove"); /* remove automatic updating */ 3773 3774 _unbindEvents.call(this); /* unbind events */ 3775 3776 _resetContentPosition.call(this); /* reset content position */ 3777 3778 $this.removeData(pluginPfx); /* remove plugin data object */ 3779 3780 _delete(this,"mcs"); /* delete callbacks object */ 3781 3782 /* remove plugin markup */ 3783 scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */ 3784 mCSB_container.find("img."+classes[2]).removeClass(classes[2]); /* remove loaded images flag */ 3785 mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */ 3786 /* remove plugin classes from the element and add destroy class */ 3787 $this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" "+classes[6]+" "+classes[7]+" "+classes[5]+" "+classes[3]).addClass(classes[4]); 3788 3789 } 3790 3791 }); 3792 3793 } 3794 /* ---------------------------------------- */ 3795 3796 }, 3797 3798 3799 3800 3801 3802 /* 3803 ---------------------------------------- 3804 FUNCTIONS 3805 ---------------------------------------- 3806 */ 3807 3808 /* validates selector (if selector is invalid or undefined uses the default one) */ 3809 _selector=function(){ 3810 return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this; 3811 }, 3812 /* -------------------- */ 3813 3814 3815 /* changes options according to theme */ 3816 _theme=function(obj){ 3817 var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"], 3818 nonExpandedScrollbarThemes=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"], 3819 disabledScrollButtonsThemes=["minimal","minimal-dark"], 3820 enabledAutoHideScrollbarThemes=["minimal","minimal-dark"], 3821 scrollbarPositionOutsideThemes=["minimal","minimal-dark"]; 3822 obj.autoDraggerLength=$.inArray(obj.theme,fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength; 3823 obj.autoExpandScrollbar=$.inArray(obj.theme,nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar; 3824 obj.scrollButtons.enable=$.inArray(obj.theme,disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable; 3825 obj.autoHideScrollbar=$.inArray(obj.theme,enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar; 3826 obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition; 3827 }, 3828 /* -------------------- */ 3829 3830 3831 /* live option timers removal */ 3832 removeLiveTimers=function(selector){ 3833 if(liveTimers[selector]){ 3834 clearTimeout(liveTimers[selector]); 3835 _delete(liveTimers,selector); 3836 } 3837 }, 3838 /* -------------------- */ 3839 3840 3841 /* normalizes axis option to valid values: "y", "x", "yx" */ 3842 _findAxis=function(val){ 3843 return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y"; 3844 }, 3845 /* -------------------- */ 3846 3847 3848 /* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */ 3849 _findScrollButtonsType=function(val){ 3850 return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless"; 3851 }, 3852 /* -------------------- */ 3853 3854 3855 /* generates plugin markup */ 3856 _pluginMarkup=function(){ 3857 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 3858 expandClass=o.autoExpandScrollbar ? " "+classes[1]+"_expand" : "", 3859 scrollbar=["<div id='mCSB_"+d.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_vertical"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+d.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_horizontal"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"], 3860 wrapperClass=o.axis==="yx" ? "mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical", 3861 scrollbars=o.axis==="yx" ? scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0], 3862 contentWrapper=o.axis==="yx" ? "<div id='mCSB_"+d.idx+"_container_wrapper' class='mCSB_container_wrapper' />" : "", 3863 autoHideClass=o.autoHideScrollbar ? " "+classes[6] : "", 3864 scrollbarDirClass=(o.axis!=="x" && d.langDir==="rtl") ? " "+classes[7] : ""; 3865 if(o.setWidth){$this.css("width",o.setWidth);} /* set element width */ 3866 if(o.setHeight){$this.css("height",o.setHeight);} /* set element height */ 3867 o.setLeft=(o.axis!=="y" && d.langDir==="rtl") ? "989999px" : o.setLeft; /* adjust left position for rtl direction */ 3868 $this.addClass(pluginNS+" _"+pluginPfx+"_"+d.idx+autoHideClass+scrollbarDirClass).wrapInner("<div id='mCSB_"+d.idx+"' class='mCustomScrollBox mCS-"+o.theme+" "+wrapperClass+"'><div id='mCSB_"+d.idx+"_container' class='mCSB_container' style='position:relative; top:"+o.setTop+"; left:"+o.setLeft+";' dir='"+d.langDir+"' /></div>"); 3869 var mCustomScrollBox=$("#mCSB_"+d.idx), 3870 mCSB_container=$("#mCSB_"+d.idx+"_container"); 3871 if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){ 3872 mCSB_container.css("width",_contentWidth(mCSB_container)); 3873 } 3874 if(o.scrollbarPosition==="outside"){ 3875 if($this.css("position")==="static"){ /* requires elements with non-static position */ 3876 $this.css("position","relative"); 3877 } 3878 $this.css("overflow","visible"); 3879 mCustomScrollBox.addClass("mCSB_outside").after(scrollbars); 3880 }else{ 3881 mCustomScrollBox.addClass("mCSB_inside").append(scrollbars); 3882 mCSB_container.wrap(contentWrapper); 3883 } 3884 _scrollButtons.call(this); /* add scrollbar buttons */ 3885 /* minimum dragger length */ 3886 var mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")]; 3887 mCSB_dragger[0].css("min-height",mCSB_dragger[0].height()); 3888 mCSB_dragger[1].css("min-width",mCSB_dragger[1].width()); 3889 }, 3890 /* -------------------- */ 3891 3892 3893 /* calculates content width */ 3894 _contentWidth=function(el){ 3895 var val=[el[0].scrollWidth,Math.max.apply(Math,el.children().map(function(){return $(this).outerWidth(true);}).get())],w=el.parent().width(); 3896 return val[0]>w ? val[0] : val[1]>w ? val[1] : "100%"; 3897 }, 3898 /* -------------------- */ 3899 3900 3901 /* expands content horizontally */ 3902 _expandContentHorizontally=function(){ 3903 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 3904 mCSB_container=$("#mCSB_"+d.idx+"_container"); 3905 if(o.advanced.autoExpandHorizontalScroll && o.axis!=="y"){ 3906 /* calculate scrollWidth */ 3907 mCSB_container.css({"width":"auto","min-width":0,"overflow-x":"scroll"}); 3908 var w=Math.ceil(mCSB_container[0].scrollWidth); 3909 if(o.advanced.autoExpandHorizontalScroll===3 || (o.advanced.autoExpandHorizontalScroll!==2 && w>mCSB_container.parent().width())){ 3910 mCSB_container.css({"width":w,"min-width":"100%","overflow-x":"inherit"}); 3911 }else{ 3912 /* 3913 wrap content with an infinite width div and set its position to absolute and width to auto. 3914 Setting width to auto before calculating the actual width is important! 3915 We must let the browser set the width as browser zoom values are impossible to calculate. 3916 */ 3917 mCSB_container.css({"overflow-x":"inherit","position":"absolute"}) 3918 .wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />") 3919 .css({ /* set actual width, original position and un-wrap */ 3920 /* 3921 get the exact width (with decimals) and then round-up. 3922 Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width 3923 */ 3924 "width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)), 3925 "min-width":"100%", 3926 "position":"relative" 3927 }).unwrap(); 3928 } 3929 } 3930 }, 3931 /* -------------------- */ 3932 3933 3934 /* adds scrollbar buttons */ 3935 _scrollButtons=function(){ 3936 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 3937 mCSB_scrollTools=$(".mCSB_"+d.idx+"_scrollbar:first"), 3938 tabindex=!_isNumeric(o.scrollButtons.tabindex) ? "" : "tabindex='"+o.scrollButtons.tabindex+"'", 3939 btnHTML=[ 3940 "<a href='#' class='"+classes[13]+"' "+tabindex+" />", 3941 "<a href='#' class='"+classes[14]+"' "+tabindex+" />", 3942 "<a href='#' class='"+classes[15]+"' "+tabindex+" />", 3943 "<a href='#' class='"+classes[16]+"' "+tabindex+" />" 3944 ], 3945 btn=[(o.axis==="x" ? btnHTML[2] : btnHTML[0]),(o.axis==="x" ? btnHTML[3] : btnHTML[1]),btnHTML[2],btnHTML[3]]; 3946 if(o.scrollButtons.enable){ 3947 mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(".mCSB_scrollTools").prepend(btn[2]).append(btn[3]); 3948 } 3949 }, 3950 /* -------------------- */ 3951 3952 3953 /* auto-adjusts scrollbar dragger length */ 3954 _setDraggerLength=function(){ 3955 var $this=$(this),d=$this.data(pluginPfx), 3956 mCustomScrollBox=$("#mCSB_"+d.idx), 3957 mCSB_container=$("#mCSB_"+d.idx+"_container"), 3958 mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")], 3959 ratio=[mCustomScrollBox.height()/mCSB_container.outerHeight(false),mCustomScrollBox.width()/mCSB_container.outerWidth(false)], 3960 l=[ 3961 parseInt(mCSB_dragger[0].css("min-height")),Math.round(ratio[0]*mCSB_dragger[0].parent().height()), 3962 parseInt(mCSB_dragger[1].css("min-width")),Math.round(ratio[1]*mCSB_dragger[1].parent().width()) 3963 ], 3964 h=oldIE && (l[1]<l[0]) ? l[0] : l[1],w=oldIE && (l[3]<l[2]) ? l[2] : l[3]; 3965 mCSB_dragger[0].css({ 3966 "height":h,"max-height":(mCSB_dragger[0].parent().height()-10) 3967 }).find(".mCSB_dragger_bar").css({"line-height":l[0]+"px"}); 3968 mCSB_dragger[1].css({ 3969 "width":w,"max-width":(mCSB_dragger[1].parent().width()-10) 3970 }); 3971 }, 3972 /* -------------------- */ 3973 3974 3975 /* calculates scrollbar to content ratio */ 3976 _scrollRatio=function(){ 3977 var $this=$(this),d=$this.data(pluginPfx), 3978 mCustomScrollBox=$("#mCSB_"+d.idx), 3979 mCSB_container=$("#mCSB_"+d.idx+"_container"), 3980 mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")], 3981 scrollAmount=[mCSB_container.outerHeight(false)-mCustomScrollBox.height(),mCSB_container.outerWidth(false)-mCustomScrollBox.width()], 3982 ratio=[ 3983 scrollAmount[0]/(mCSB_dragger[0].parent().height()-mCSB_dragger[0].height()), 3984 scrollAmount[1]/(mCSB_dragger[1].parent().width()-mCSB_dragger[1].width()) 3985 ]; 3986 d.scrollRatio={y:ratio[0],x:ratio[1]}; 3987 }, 3988 /* -------------------- */ 3989 3990 3991 /* toggles scrolling classes */ 3992 _onDragClasses=function(el,action,xpnd){ 3993 var expandClass=xpnd ? classes[0]+"_expanded" : "", 3994 scrollbar=el.closest(".mCSB_scrollTools"); 3995 if(action==="active"){ 3996 el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); 3997 el[0]._draggable=el[0]._draggable ? 0 : 1; 3998 }else{ 3999 if(!el[0]._draggable){ 4000 if(action==="hide"){ 4001 el.removeClass(classes[0]); scrollbar.removeClass(classes[1]); 4002 }else{ 4003 el.addClass(classes[0]); scrollbar.addClass(classes[1]); 4004 } 4005 } 4006 } 4007 }, 4008 /* -------------------- */ 4009 4010 4011 /* checks if content overflows its container to determine if scrolling is required */ 4012 _overflowed=function(){ 4013 var $this=$(this),d=$this.data(pluginPfx), 4014 mCustomScrollBox=$("#mCSB_"+d.idx), 4015 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4016 contentHeight=d.overflowed==null ? mCSB_container.height() : mCSB_container.outerHeight(false), 4017 contentWidth=d.overflowed==null ? mCSB_container.width() : mCSB_container.outerWidth(false), 4018 h=mCSB_container[0].scrollHeight,w=mCSB_container[0].scrollWidth; 4019 if(h>contentHeight){contentHeight=h;} 4020 if(w>contentWidth){contentWidth=w;} 4021 return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()]; 4022 }, 4023 /* -------------------- */ 4024 4025 4026 /* resets content position to 0 */ 4027 _resetContentPosition=function(){ 4028 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4029 mCustomScrollBox=$("#mCSB_"+d.idx), 4030 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4031 mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")]; 4032 _stop($this); /* stop any current scrolling before resetting */ 4033 if((o.axis!=="x" && !d.overflowed[0]) || (o.axis==="y" && d.overflowed[0])){ /* reset y */ 4034 mCSB_dragger[0].add(mCSB_container).css("top",0); 4035 _scrollTo($this,"_resetY"); 4036 } 4037 if((o.axis!=="y" && !d.overflowed[1]) || (o.axis==="x" && d.overflowed[1])){ /* reset x */ 4038 var cx=dx=0; 4039 if(d.langDir==="rtl"){ /* adjust left position for rtl direction */ 4040 cx=mCustomScrollBox.width()-mCSB_container.outerWidth(false); 4041 dx=Math.abs(cx/d.scrollRatio.x); 4042 } 4043 mCSB_container.css("left",cx); 4044 mCSB_dragger[1].css("left",dx); 4045 _scrollTo($this,"_resetX"); 4046 } 4047 }, 4048 /* -------------------- */ 4049 4050 4051 /* binds scrollbar events */ 4052 _bindEvents=function(){ 4053 var $this=$(this),d=$this.data(pluginPfx),o=d.opt; 4054 if(!d.bindEvents){ /* check if events are already bound */ 4055 _draggable.call(this); 4056 if(o.contentTouchScroll){_contentDraggable.call(this);} 4057 _selectable.call(this); 4058 if(o.mouseWheel.enable){ /* bind mousewheel fn when plugin is available */ 4059 function _mwt(){ 4060 mousewheelTimeout=setTimeout(function(){ 4061 if(!$.event.special.mousewheel){ 4062 _mwt(); 4063 }else{ 4064 clearTimeout(mousewheelTimeout); 4065 _mousewheel.call($this[0]); 4066 } 4067 },100); 4068 } 4069 var mousewheelTimeout; 4070 _mwt(); 4071 } 4072 _draggerRail.call(this); 4073 _wrapperScroll.call(this); 4074 if(o.advanced.autoScrollOnFocus){_focus.call(this);} 4075 if(o.scrollButtons.enable){_buttons.call(this);} 4076 if(o.keyboard.enable){_keyboard.call(this);} 4077 d.bindEvents=true; 4078 } 4079 }, 4080 /* -------------------- */ 4081 4082 4083 /* unbinds scrollbar events */ 4084 _unbindEvents=function(){ 4085 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4086 namespace=pluginPfx+"_"+d.idx, 4087 sb=".mCSB_"+d.idx+"_scrollbar", 4088 sel=$("#mCSB_"+d.idx+",#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,"+sb+" ."+classes[12]+",#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal,"+sb+">a"), 4089 mCSB_container=$("#mCSB_"+d.idx+"_container"); 4090 if(o.advanced.releaseDraggableSelectors){sel.add($(o.advanced.releaseDraggableSelectors));} 4091 if(o.advanced.extraDraggableSelectors){sel.add($(o.advanced.extraDraggableSelectors));} 4092 if(d.bindEvents){ /* check if events are bound */ 4093 /* unbind namespaced events from document/selectors */ 4094 $(document).add($(!_canAccessIFrame() || top.document)).unbind("."+namespace); 4095 sel.each(function(){ 4096 $(this).unbind("."+namespace); 4097 }); 4098 /* clear and delete timeouts/objects */ 4099 clearTimeout($this[0]._focusTimeout); _delete($this[0],"_focusTimeout"); 4100 clearTimeout(d.sequential.step); _delete(d.sequential,"step"); 4101 clearTimeout(mCSB_container[0].onCompleteTimeout); _delete(mCSB_container[0],"onCompleteTimeout"); 4102 d.bindEvents=false; 4103 } 4104 }, 4105 /* -------------------- */ 4106 4107 4108 /* toggles scrollbar visibility */ 4109 _scrollbarVisibility=function(disabled){ 4110 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4111 contentWrapper=$("#mCSB_"+d.idx+"_container_wrapper"), 4112 content=contentWrapper.length ? contentWrapper : $("#mCSB_"+d.idx+"_container"), 4113 scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")], 4114 mCSB_dragger=[scrollbar[0].find(".mCSB_dragger"),scrollbar[1].find(".mCSB_dragger")]; 4115 if(o.axis!=="x"){ 4116 if(d.overflowed[0] && !disabled){ 4117 scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children("a")).css("display","block"); 4118 content.removeClass(classes[8]+" "+classes[10]); 4119 }else{ 4120 if(o.alwaysShowScrollbar){ 4121 if(o.alwaysShowScrollbar!==2){mCSB_dragger[0].css("display","none");} 4122 content.removeClass(classes[10]); 4123 }else{ 4124 scrollbar[0].css("display","none"); 4125 content.addClass(classes[10]); 4126 } 4127 content.addClass(classes[8]); 4128 } 4129 } 4130 if(o.axis!=="y"){ 4131 if(d.overflowed[1] && !disabled){ 4132 scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children("a")).css("display","block"); 4133 content.removeClass(classes[9]+" "+classes[11]); 4134 }else{ 4135 if(o.alwaysShowScrollbar){ 4136 if(o.alwaysShowScrollbar!==2){mCSB_dragger[1].css("display","none");} 4137 content.removeClass(classes[11]); 4138 }else{ 4139 scrollbar[1].css("display","none"); 4140 content.addClass(classes[11]); 4141 } 4142 content.addClass(classes[9]); 4143 } 4144 } 4145 if(!d.overflowed[0] && !d.overflowed[1]){ 4146 $this.addClass(classes[5]); 4147 }else{ 4148 $this.removeClass(classes[5]); 4149 } 4150 }, 4151 /* -------------------- */ 4152 4153 4154 /* returns input coordinates of pointer, touch and mouse events (relative to document) */ 4155 _coordinates=function(e){ 4156 var t=e.type,o=e.target.ownerDocument!==document && frameElement!==null ? [$(frameElement).offset().top,$(frameElement).offset().left] : null, 4157 io=_canAccessIFrame() && e.target.ownerDocument!==top.document && frameElement!==null ? [$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : [0,0]; 4158 switch(t){ 4159 case "pointerdown": case "MSPointerDown": case "pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp": 4160 return o ? [e.originalEvent.pageY-o[0]+io[0],e.originalEvent.pageX-o[1]+io[1],false] : [e.originalEvent.pageY,e.originalEvent.pageX,false]; 4161 break; 4162 case "touchstart": case "touchmove": case "touchend": 4163 var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0], 4164 touches=e.originalEvent.touches.length || e.originalEvent.changedTouches.length; 4165 return e.target.ownerDocument!==document ? [touch.screenY,touch.screenX,touches>1] : [touch.pageY,touch.pageX,touches>1]; 4166 break; 4167 default: 4168 return o ? [e.pageY-o[0]+io[0],e.pageX-o[1]+io[1],false] : [e.pageY,e.pageX,false]; 4169 } 4170 }, 4171 /* -------------------- */ 4172 4173 4174 /* 4175 SCROLLBAR DRAG EVENTS 4176 scrolls content via scrollbar dragging 4177 */ 4178 _draggable=function(){ 4179 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4180 namespace=pluginPfx+"_"+d.idx, 4181 draggerId=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"], 4182 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4183 mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]), 4184 draggable,dragY,dragX, 4185 rds=o.advanced.releaseDraggableSelectors ? mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger, 4186 eds=o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document); 4187 mCSB_dragger.bind("contextmenu."+namespace,function(e){ 4188 e.preventDefault(); //prevent right click 4189 }).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){ 4190 e.stopImmediatePropagation(); 4191 e.preventDefault(); 4192 if(!_mouseBtnLeft(e)){return;} /* left mouse button only */ 4193 touchActive=true; 4194 if(oldIE){document.onselectstart=function(){return false;}} /* disable text selection for IE < 9 */ 4195 _iframe.call(mCSB_container,false); /* enable scrollbar dragging over iframes by disabling their events */ 4196 _stop($this); 4197 draggable=$(this); 4198 var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left, 4199 h=draggable.height()+offset.top,w=draggable.width()+offset.left; 4200 if(y<h && y>0 && x<w && x>0){ 4201 dragY=y; 4202 dragX=x; 4203 } 4204 _onDragClasses(draggable,"active",o.autoExpandScrollbar); 4205 }).bind("touchmove."+namespace,function(e){ 4206 e.stopImmediatePropagation(); 4207 e.preventDefault(); 4208 var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left; 4209 _drag(dragY,dragX,y,x); 4210 }); 4211 $(document).add(eds).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){ 4212 if(draggable){ 4213 var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left; 4214 if(dragY===y && dragX===x){return;} /* has it really moved? */ 4215 _drag(dragY,dragX,y,x); 4216 } 4217 }).add(rds).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){ 4218 if(draggable){ 4219 _onDragClasses(draggable,"active",o.autoExpandScrollbar); 4220 draggable=null; 4221 } 4222 touchActive=false; 4223 if(oldIE){document.onselectstart=null;} /* enable text selection for IE < 9 */ 4224 _iframe.call(mCSB_container,true); /* enable iframes events */ 4225 }); 4226 function _drag(dragY,dragX,y,x){ 4227 mCSB_container[0].idleTimer=o.scrollInertia<233 ? 250 : 0; 4228 if(draggable.attr("id")===draggerId[1]){ 4229 var dir="x",to=((draggable[0].offsetLeft-dragX)+x)*d.scrollRatio.x; 4230 }else{ 4231 var dir="y",to=((draggable[0].offsetTop-dragY)+y)*d.scrollRatio.y; 4232 } 4233 _scrollTo($this,to.toString(),{dir:dir,drag:true}); 4234 } 4235 }, 4236 /* -------------------- */ 4237 4238 4239 /* 4240 TOUCH SWIPE EVENTS 4241 scrolls content via touch swipe 4242 Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices 4243 */ 4244 _contentDraggable=function(){ 4245 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4246 namespace=pluginPfx+"_"+d.idx, 4247 mCustomScrollBox=$("#mCSB_"+d.idx), 4248 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4249 mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")], 4250 draggable,dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount, 4251 durA=0,durB,overwrite=o.axis==="yx" ? "none" : "all",touchIntent=[],touchDrag,docDrag, 4252 iframe=mCSB_container.find("iframe"), 4253 events=[ 4254 "touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace, //start 4255 "touchmove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace, //move 4256 "touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace //end 4257 ], 4258 touchAction=document.body.style.touchAction!==undefined && document.body.style.touchAction!==""; 4259 mCSB_container.bind(events[0],function(e){ 4260 _onTouchstart(e); 4261 }).bind(events[1],function(e){ 4262 _onTouchmove(e); 4263 }); 4264 mCustomScrollBox.bind(events[0],function(e){ 4265 _onTouchstart2(e); 4266 }).bind(events[2],function(e){ 4267 _onTouchend(e); 4268 }); 4269 if(iframe.length){ 4270 iframe.each(function(){ 4271 $(this).bind("load",function(){ 4272 /* bind events on accessible iframes */ 4273 if(_canAccessIFrame(this)){ 4274 $(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){ 4275 _onTouchstart(e); 4276 _onTouchstart2(e); 4277 }).bind(events[1],function(e){ 4278 _onTouchmove(e); 4279 }).bind(events[2],function(e){ 4280 _onTouchend(e); 4281 }); 4282 } 4283 }); 4284 }); 4285 } 4286 function _onTouchstart(e){ 4287 if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;} 4288 touchable=1; touchDrag=0; docDrag=0; draggable=1; 4289 $this.removeClass("mCS_touch_action"); 4290 var offset=mCSB_container.offset(); 4291 dragY=_coordinates(e)[0]-offset.top; 4292 dragX=_coordinates(e)[1]-offset.left; 4293 touchIntent=[_coordinates(e)[0],_coordinates(e)[1]]; 4294 } 4295 function _onTouchmove(e){ 4296 if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;} 4297 if(!o.documentTouchScroll){e.preventDefault();} 4298 e.stopImmediatePropagation(); 4299 if(docDrag && !touchDrag){return;} 4300 if(draggable){ 4301 runningTime=_getTime(); 4302 var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left, 4303 easing="mcsLinearOut"; 4304 touchMoveY.push(y); 4305 touchMoveX.push(x); 4306 touchIntent[2]=Math.abs(_coordinates(e)[0]-touchIntent[0]); touchIntent[3]=Math.abs(_coordinates(e)[1]-touchIntent[1]); 4307 if(d.overflowed[0]){ 4308 var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(), 4309 prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y) && (touchIntent[3]*2<touchIntent[2] || o.axis==="yx")); 4310 } 4311 if(d.overflowed[1]){ 4312 var limitX=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(), 4313 preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x) && (touchIntent[2]*2<touchIntent[3] || o.axis==="yx")); 4314 } 4315 if(prevent || preventX){ /* prevent native document scrolling */ 4316 if(!touchAction){e.preventDefault();} 4317 touchDrag=1; 4318 }else{ 4319 docDrag=1; 4320 $this.addClass("mCS_touch_action"); 4321 } 4322 if(touchAction){e.preventDefault();} 4323 amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null]; 4324 mCSB_container[0].idleTimer=250; 4325 if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);} 4326 if(d.overflowed[1]){_drag(amount[1],durA,easing,"x",overwrite,true);} 4327 } 4328 } 4329 function _onTouchstart2(e){ 4330 if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;} 4331 touchable=1; 4332 e.stopImmediatePropagation(); 4333 _stop($this); 4334 startTime=_getTime(); 4335 var offset=mCustomScrollBox.offset(); 4336 touchStartY=_coordinates(e)[0]-offset.top; 4337 touchStartX=_coordinates(e)[1]-offset.left; 4338 touchMoveY=[]; touchMoveX=[]; 4339 } 4340 function _onTouchend(e){ 4341 if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;} 4342 draggable=0; 4343 e.stopImmediatePropagation(); 4344 touchDrag=0; docDrag=0; 4345 endTime=_getTime(); 4346 var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left; 4347 if((endTime-runningTime)>30){return;} 4348 speed=1000/(endTime-startTime); 4349 var easing="mcsEaseOut",slow=speed<2.5, 4350 diff=slow ? [touchMoveY[touchMoveY.length-2],touchMoveX[touchMoveX.length-2]] : [0,0]; 4351 distance=slow ? [(y-diff[0]),(x-diff[1])] : [y-touchStartY,x-touchStartX]; 4352 var absDistance=[Math.abs(distance[0]),Math.abs(distance[1])]; 4353 speed=slow ? [Math.abs(distance[0]/4),Math.abs(distance[1]/4)] : [speed,speed]; 4354 var a=[ 4355 Math.abs(mCSB_container[0].offsetTop)-(distance[0]*_m((absDistance[0]/speed[0]),speed[0])), 4356 Math.abs(mCSB_container[0].offsetLeft)-(distance[1]*_m((absDistance[1]/speed[1]),speed[1])) 4357 ]; 4358 amount=o.axis==="yx" ? [a[0],a[1]] : o.axis==="x" ? [null,a[1]] : [a[0],null]; 4359 durB=[(absDistance[0]*4)+o.scrollInertia,(absDistance[1]*4)+o.scrollInertia]; 4360 var md=parseInt(o.contentTouchScroll) || 0; /* absolute minimum distance required */ 4361 amount[0]=absDistance[0]>md ? amount[0] : 0; 4362 amount[1]=absDistance[1]>md ? amount[1] : 0; 4363 if(d.overflowed[0]){_drag(amount[0],durB[0],easing,"y",overwrite,false);} 4364 if(d.overflowed[1]){_drag(amount[1],durB[1],easing,"x",overwrite,false);} 4365 } 4366 function _m(ds,s){ 4367 var r=[s*1.5,s*2,s/1.5,s/2]; 4368 if(ds>90){ 4369 return s>4 ? r[0] : r[3]; 4370 }else if(ds>60){ 4371 return s>3 ? r[3] : r[2]; 4372 }else if(ds>30){ 4373 return s>8 ? r[1] : s>6 ? r[0] : s>4 ? s : r[2]; 4374 }else{ 4375 return s>8 ? s : r[3]; 4376 } 4377 } 4378 function _drag(amount,dur,easing,dir,overwrite,drag){ 4379 if(!amount){return;} 4380 _scrollTo($this,amount.toString(),{dur:dur,scrollEasing:easing,dir:dir,overwrite:overwrite,drag:drag}); 4381 } 4382 }, 4383 /* -------------------- */ 4384 4385 4386 /* 4387 SELECT TEXT EVENTS 4388 scrolls content when text is selected 4389 */ 4390 _selectable=function(){ 4391 var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential, 4392 namespace=pluginPfx+"_"+d.idx, 4393 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4394 wrapper=mCSB_container.parent(), 4395 action; 4396 mCSB_container.bind("mousedown."+namespace,function(e){ 4397 if(touchable){return;} 4398 if(!action){action=1; touchActive=true;} 4399 }).add(document).bind("mousemove."+namespace,function(e){ 4400 if(!touchable && action && _sel()){ 4401 var offset=mCSB_container.offset(), 4402 y=_coordinates(e)[0]-offset.top+mCSB_container[0].offsetTop,x=_coordinates(e)[1]-offset.left+mCSB_container[0].offsetLeft; 4403 if(y>0 && y<wrapper.height() && x>0 && x<wrapper.width()){ 4404 if(seq.step){_seq("off",null,"stepped");} 4405 }else{ 4406 if(o.axis!=="x" && d.overflowed[0]){ 4407 if(y<0){ 4408 _seq("on",38); 4409 }else if(y>wrapper.height()){ 4410 _seq("on",40); 4411 } 4412 } 4413 if(o.axis!=="y" && d.overflowed[1]){ 4414 if(x<0){ 4415 _seq("on",37); 4416 }else if(x>wrapper.width()){ 4417 _seq("on",39); 4418 } 4419 } 4420 } 4421 } 4422 }).bind("mouseup."+namespace+" dragend."+namespace,function(e){ 4423 if(touchable){return;} 4424 if(action){action=0; _seq("off",null);} 4425 touchActive=false; 4426 }); 4427 function _sel(){ 4428 return window.getSelection ? window.getSelection().toString() : 4429 document.selection && document.selection.type!="Control" ? document.selection.createRange().text : 0; 4430 } 4431 function _seq(a,c,s){ 4432 seq.type=s && action ? "stepped" : "stepless"; 4433 seq.scrollAmount=10; 4434 _sequentialScroll($this,a,c,"mcsLinearOut",s ? 60 : null); 4435 } 4436 }, 4437 /* -------------------- */ 4438 4439 4440 /* 4441 MOUSE WHEEL EVENT 4442 scrolls content via mouse-wheel 4443 via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel) 4444 */ 4445 _mousewheel=function(){ 4446 if(!$(this).data(pluginPfx)){return;} /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */ 4447 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4448 namespace=pluginPfx+"_"+d.idx, 4449 mCustomScrollBox=$("#mCSB_"+d.idx), 4450 mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")], 4451 iframe=$("#mCSB_"+d.idx+"_container").find("iframe"); 4452 if(iframe.length){ 4453 iframe.each(function(){ 4454 $(this).bind("load",function(){ 4455 /* bind events on accessible iframes */ 4456 if(_canAccessIFrame(this)){ 4457 $(this.contentDocument || this.contentWindow.document).bind("mousewheel."+namespace,function(e,delta){ 4458 _onMousewheel(e,delta); 4459 }); 4460 } 4461 }); 4462 }); 4463 } 4464 mCustomScrollBox.bind("mousewheel."+namespace,function(e,delta){ 4465 _onMousewheel(e,delta); 4466 }); 4467 function _onMousewheel(e,delta){ 4468 _stop($this); 4469 if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */ 4470 var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100, 4471 dur=o.scrollInertia; 4472 if(o.axis==="x" || o.mouseWheel.axis==="x"){ 4473 var dir="x", 4474 px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)], 4475 amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.width() ? mCustomScrollBox.width()*0.9 : px[0], 4476 contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetLeft), 4477 draggerPos=mCSB_dragger[1][0].offsetLeft, 4478 limit=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(), 4479 dlt=o.mouseWheel.axis==="y" ? (e.deltaY || delta) : e.deltaX; 4480 }else{ 4481 var dir="y", 4482 px=[Math.round(deltaFactor*d.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)], 4483 amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.height() ? mCustomScrollBox.height()*0.9 : px[0], 4484 contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetTop), 4485 draggerPos=mCSB_dragger[0][0].offsetTop, 4486 limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(), 4487 dlt=e.deltaY || delta; 4488 } 4489 if((dir==="y" && !d.overflowed[0]) || (dir==="x" && !d.overflowed[1])){return;} 4490 if(o.mouseWheel.invert || e.webkitDirectionInvertedFromDevice){dlt=-dlt;} 4491 if(o.mouseWheel.normalizeDelta){dlt=dlt<0 ? -1 : 1;} 4492 if((dlt>0 && draggerPos!==0) || (dlt<0 && draggerPos!==limit) || o.mouseWheel.preventDefault){ 4493 e.stopImmediatePropagation(); 4494 e.preventDefault(); 4495 } 4496 if(e.deltaFactor<5 && !o.mouseWheel.normalizeDelta){ 4497 //very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly 4498 amount=e.deltaFactor; dur=17; 4499 } 4500 _scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur}); 4501 } 4502 }, 4503 /* -------------------- */ 4504 4505 4506 /* checks if iframe can be accessed */ 4507 _canAccessIFrameCache=new Object(), 4508 _canAccessIFrame=function(iframe){ 4509 var result=false,cacheKey=false,html=null; 4510 if(iframe===undefined){ 4511 cacheKey="#empty"; 4512 }else if($(iframe).attr("id")!==undefined){ 4513 cacheKey=$(iframe).attr("id"); 4514 } 4515 if(cacheKey!==false && _canAccessIFrameCache[cacheKey]!==undefined){ 4516 return _canAccessIFrameCache[cacheKey]; 4517 } 4518 if(!iframe){ 4519 try{ 4520 var doc=top.document; 4521 html=doc.body.innerHTML; 4522 }catch(err){/* do nothing */} 4523 result=(html!==null); 4524 }else{ 4525 try{ 4526 var doc=iframe.contentDocument || iframe.contentWindow.document; 4527 html=doc.body.innerHTML; 4528 }catch(err){/* do nothing */} 4529 result=(html!==null); 4530 } 4531 if(cacheKey!==false){_canAccessIFrameCache[cacheKey]=result;} 4532 return result; 4533 }, 4534 /* -------------------- */ 4535 4536 4537 /* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */ 4538 _iframe=function(evt){ 4539 var el=this.find("iframe"); 4540 if(!el.length){return;} /* check if content contains iframes */ 4541 var val=!evt ? "none" : "auto"; 4542 el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */ 4543 }, 4544 /* -------------------- */ 4545 4546 4547 /* disables mouse-wheel when hovering specific elements like select, datalist etc. */ 4548 _disableMousewheel=function(el,target){ 4549 var tag=target.nodeName.toLowerCase(), 4550 tags=el.data(pluginPfx).opt.mouseWheel.disableOver, 4551 /* elements that require focus */ 4552 focusTags=["select","textarea"]; 4553 return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus")); 4554 }, 4555 /* -------------------- */ 4556 4557 4558 /* 4559 DRAGGER RAIL CLICK EVENT 4560 scrolls content via dragger rail 4561 */ 4562 _draggerRail=function(){ 4563 var $this=$(this),d=$this.data(pluginPfx), 4564 namespace=pluginPfx+"_"+d.idx, 4565 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4566 wrapper=mCSB_container.parent(), 4567 mCSB_draggerContainer=$(".mCSB_"+d.idx+"_scrollbar ."+classes[12]), 4568 clickable; 4569 mCSB_draggerContainer.bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){ 4570 touchActive=true; 4571 if(!$(e.target).hasClass("mCSB_dragger")){clickable=1;} 4572 }).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){ 4573 touchActive=false; 4574 }).bind("click."+namespace,function(e){ 4575 if(!clickable){return;} 4576 clickable=0; 4577 if($(e.target).hasClass(classes[12]) || $(e.target).hasClass("mCSB_draggerRail")){ 4578 _stop($this); 4579 var el=$(this),mCSB_dragger=el.find(".mCSB_dragger"); 4580 if(el.parent(".mCSB_scrollTools_horizontal").length>0){ 4581 if(!d.overflowed[1]){return;} 4582 var dir="x", 4583 clickDir=e.pageX>mCSB_dragger.offset().left ? -1 : 1, 4584 to=Math.abs(mCSB_container[0].offsetLeft)-(clickDir*(wrapper.width()*0.9)); 4585 }else{ 4586 if(!d.overflowed[0]){return;} 4587 var dir="y", 4588 clickDir=e.pageY>mCSB_dragger.offset().top ? -1 : 1, 4589 to=Math.abs(mCSB_container[0].offsetTop)-(clickDir*(wrapper.height()*0.9)); 4590 } 4591 _scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"}); 4592 } 4593 }); 4594 }, 4595 /* -------------------- */ 4596 4597 4598 /* 4599 FOCUS EVENT 4600 scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.) 4601 */ 4602 _focus=function(){ 4603 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4604 namespace=pluginPfx+"_"+d.idx, 4605 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4606 wrapper=mCSB_container.parent(); 4607 mCSB_container.bind("focusin."+namespace,function(e){ 4608 var el=$(document.activeElement), 4609 nested=mCSB_container.find(".mCustomScrollBox").length, 4610 dur=0; 4611 if(!el.is(o.advanced.autoScrollOnFocus)){return;} 4612 _stop($this); 4613 clearTimeout($this[0]._focusTimeout); 4614 $this[0]._focusTimer=nested ? (dur+17)*nested : 0; 4615 $this[0]._focusTimeout=setTimeout(function(){ 4616 var to=[_childPos(el)[0],_childPos(el)[1]], 4617 contentPos=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], 4618 isVisible=[ 4619 (contentPos[0]+to[0]>=0 && contentPos[0]+to[0]<wrapper.height()-el.outerHeight(false)), 4620 (contentPos[1]+to[1]>=0 && contentPos[0]+to[1]<wrapper.width()-el.outerWidth(false)) 4621 ], 4622 overwrite=(o.axis==="yx" && !isVisible[0] && !isVisible[1]) ? "none" : "all"; 4623 if(o.axis!=="x" && !isVisible[0]){ 4624 _scrollTo($this,to[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur}); 4625 } 4626 if(o.axis!=="y" && !isVisible[1]){ 4627 _scrollTo($this,to[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur}); 4628 } 4629 },$this[0]._focusTimer); 4630 }); 4631 }, 4632 /* -------------------- */ 4633 4634 4635 /* sets content wrapper scrollTop/scrollLeft always to 0 */ 4636 _wrapperScroll=function(){ 4637 var $this=$(this),d=$this.data(pluginPfx), 4638 namespace=pluginPfx+"_"+d.idx, 4639 wrapper=$("#mCSB_"+d.idx+"_container").parent(); 4640 wrapper.bind("scroll."+namespace,function(e){ 4641 if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){ 4642 $(".mCSB_"+d.idx+"_scrollbar").css("visibility","hidden"); /* hide scrollbar(s) */ 4643 } 4644 }); 4645 }, 4646 /* -------------------- */ 4647 4648 4649 /* 4650 BUTTONS EVENTS 4651 scrolls content via up, down, left and right buttons 4652 */ 4653 _buttons=function(){ 4654 var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential, 4655 namespace=pluginPfx+"_"+d.idx, 4656 sel=".mCSB_"+d.idx+"_scrollbar", 4657 btn=$(sel+">a"); 4658 btn.bind("contextmenu."+namespace,function(e){ 4659 e.preventDefault(); //prevent right click 4660 }).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace+" mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace+" mouseout."+namespace+" pointerout."+namespace+" MSPointerOut."+namespace+" click."+namespace,function(e){ 4661 e.preventDefault(); 4662 if(!_mouseBtnLeft(e)){return;} /* left mouse button only */ 4663 var btnClass=$(this).attr("class"); 4664 seq.type=o.scrollButtons.scrollType; 4665 switch(e.type){ 4666 case "mousedown": case "touchstart": case "pointerdown": case "MSPointerDown": 4667 if(seq.type==="stepped"){return;} 4668 touchActive=true; 4669 d.tweenRunning=false; 4670 _seq("on",btnClass); 4671 break; 4672 case "mouseup": case "touchend": case "pointerup": case "MSPointerUp": 4673 case "mouseout": case "pointerout": case "MSPointerOut": 4674 if(seq.type==="stepped"){return;} 4675 touchActive=false; 4676 if(seq.dir){_seq("off",btnClass);} 4677 break; 4678 case "click": 4679 if(seq.type!=="stepped" || d.tweenRunning){return;} 4680 _seq("on",btnClass); 4681 break; 4682 } 4683 function _seq(a,c){ 4684 seq.scrollAmount=o.scrollButtons.scrollAmount; 4685 _sequentialScroll($this,a,c); 4686 } 4687 }); 4688 }, 4689 /* -------------------- */ 4690 4691 4692 /* 4693 KEYBOARD EVENTS 4694 scrolls content via keyboard 4695 Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End 4696 */ 4697 _keyboard=function(){ 4698 var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential, 4699 namespace=pluginPfx+"_"+d.idx, 4700 mCustomScrollBox=$("#mCSB_"+d.idx), 4701 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4702 wrapper=mCSB_container.parent(), 4703 editables="input,textarea,select,datalist,keygen,[contenteditable='true']", 4704 iframe=mCSB_container.find("iframe"), 4705 events=["blur."+namespace+" keydown."+namespace+" keyup."+namespace]; 4706 if(iframe.length){ 4707 iframe.each(function(){ 4708 $(this).bind("load",function(){ 4709 /* bind events on accessible iframes */ 4710 if(_canAccessIFrame(this)){ 4711 $(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){ 4712 _onKeyboard(e); 4713 }); 4714 } 4715 }); 4716 }); 4717 } 4718 mCustomScrollBox.attr("tabindex","0").bind(events[0],function(e){ 4719 _onKeyboard(e); 4720 }); 4721 function _onKeyboard(e){ 4722 switch(e.type){ 4723 case "blur": 4724 if(d.tweenRunning && seq.dir){_seq("off",null);} 4725 break; 4726 case "keydown": case "keyup": 4727 var code=e.keyCode ? e.keyCode : e.which,action="on"; 4728 if((o.axis!=="x" && (code===38 || code===40)) || (o.axis!=="y" && (code===37 || code===39))){ 4729 /* up (38), down (40), left (37), right (39) arrows */ 4730 if(((code===38 || code===40) && !d.overflowed[0]) || ((code===37 || code===39) && !d.overflowed[1])){return;} 4731 if(e.type==="keyup"){action="off";} 4732 if(!$(document.activeElement).is(editables)){ 4733 e.preventDefault(); 4734 e.stopImmediatePropagation(); 4735 _seq(action,code); 4736 } 4737 }else if(code===33 || code===34){ 4738 /* PgUp (33), PgDn (34) */ 4739 if(d.overflowed[0] || d.overflowed[1]){ 4740 e.preventDefault(); 4741 e.stopImmediatePropagation(); 4742 } 4743 if(e.type==="keyup"){ 4744 _stop($this); 4745 var keyboardDir=code===34 ? -1 : 1; 4746 if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){ 4747 var dir="x",to=Math.abs(mCSB_container[0].offsetLeft)-(keyboardDir*(wrapper.width()*0.9)); 4748 }else{ 4749 var dir="y",to=Math.abs(mCSB_container[0].offsetTop)-(keyboardDir*(wrapper.height()*0.9)); 4750 } 4751 _scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"}); 4752 } 4753 }else if(code===35 || code===36){ 4754 /* End (35), Home (36) */ 4755 if(!$(document.activeElement).is(editables)){ 4756 if(d.overflowed[0] || d.overflowed[1]){ 4757 e.preventDefault(); 4758 e.stopImmediatePropagation(); 4759 } 4760 if(e.type==="keyup"){ 4761 if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){ 4762 var dir="x",to=code===35 ? Math.abs(wrapper.width()-mCSB_container.outerWidth(false)) : 0; 4763 }else{ 4764 var dir="y",to=code===35 ? Math.abs(wrapper.height()-mCSB_container.outerHeight(false)) : 0; 4765 } 4766 _scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"}); 4767 } 4768 } 4769 } 4770 break; 4771 } 4772 function _seq(a,c){ 4773 seq.type=o.keyboard.scrollType; 4774 seq.scrollAmount=o.keyboard.scrollAmount; 4775 if(seq.type==="stepped" && d.tweenRunning){return;} 4776 _sequentialScroll($this,a,c); 4777 } 4778 } 4779 }, 4780 /* -------------------- */ 4781 4782 4783 /* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */ 4784 _sequentialScroll=function(el,action,trigger,e,s){ 4785 var d=el.data(pluginPfx),o=d.opt,seq=d.sequential, 4786 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4787 once=seq.type==="stepped" ? true : false, 4788 steplessSpeed=o.scrollInertia < 26 ? 26 : o.scrollInertia, /* 26/1.5=17 */ 4789 steppedSpeed=o.scrollInertia < 1 ? 17 : o.scrollInertia; 4790 switch(action){ 4791 case "on": 4792 seq.dir=[ 4793 (trigger===classes[16] || trigger===classes[15] || trigger===39 || trigger===37 ? "x" : "y"), 4794 (trigger===classes[13] || trigger===classes[15] || trigger===38 || trigger===37 ? -1 : 1) 4795 ]; 4796 _stop(el); 4797 if(_isNumeric(trigger) && seq.type==="stepped"){return;} 4798 _on(once); 4799 break; 4800 case "off": 4801 _off(); 4802 if(once || (d.tweenRunning && seq.dir)){ 4803 _on(true); 4804 } 4805 break; 4806 } 4807 4808 /* starts sequence */ 4809 function _on(once){ 4810 if(o.snapAmount){seq.scrollAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0]==="x" ? o.snapAmount[1] : o.snapAmount[0];} /* scrolling snapping */ 4811 var c=seq.type!=="stepped", /* continuous scrolling */ 4812 t=s ? s : !once ? 1000/60 : c ? steplessSpeed/1.5 : steppedSpeed, /* timer */ 4813 m=!once ? 2.5 : c ? 7.5 : 40, /* multiplier */ 4814 contentPos=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)], 4815 ratio=[d.scrollRatio.y>10 ? 10 : d.scrollRatio.y,d.scrollRatio.x>10 ? 10 : d.scrollRatio.x], 4816 amount=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*(ratio[1]*m)) : contentPos[0]+(seq.dir[1]*(ratio[0]*m)), 4817 px=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*parseInt(seq.scrollAmount)) : contentPos[0]+(seq.dir[1]*parseInt(seq.scrollAmount)), 4818 to=seq.scrollAmount!=="auto" ? px : amount, 4819 easing=e ? e : !once ? "mcsLinear" : c ? "mcsLinearOut" : "mcsEaseInOut", 4820 onComplete=!once ? false : true; 4821 if(once && t<17){ 4822 to=seq.dir[0]==="x" ? contentPos[1] : contentPos[0]; 4823 } 4824 _scrollTo(el,to.toString(),{dir:seq.dir[0],scrollEasing:easing,dur:t,onComplete:onComplete}); 4825 if(once){ 4826 seq.dir=false; 4827 return; 4828 } 4829 clearTimeout(seq.step); 4830 seq.step=setTimeout(function(){ 4831 _on(); 4832 },t); 4833 } 4834 /* stops sequence */ 4835 function _off(){ 4836 clearTimeout(seq.step); 4837 _delete(seq,"step"); 4838 _stop(el); 4839 } 4840 }, 4841 /* -------------------- */ 4842 4843 4844 /* returns a yx array from value */ 4845 _arr=function(val){ 4846 var o=$(this).data(pluginPfx).opt,vals=[]; 4847 if(typeof val==="function"){val=val();} /* check if the value is a single anonymous function */ 4848 /* check if value is object or array, its length and create an array with yx values */ 4849 if(!(val instanceof Array)){ /* object value (e.g. {y:"100",x:"100"}, 100 etc.) */ 4850 vals[0]=val.y ? val.y : val.x || o.axis==="x" ? null : val; 4851 vals[1]=val.x ? val.x : val.y || o.axis==="y" ? null : val; 4852 }else{ /* array value (e.g. [100,100]) */ 4853 vals=val.length>1 ? [val[0],val[1]] : o.axis==="x" ? [null,val[0]] : [val[0],null]; 4854 } 4855 /* check if array values are anonymous functions */ 4856 if(typeof vals[0]==="function"){vals[0]=vals[0]();} 4857 if(typeof vals[1]==="function"){vals[1]=vals[1]();} 4858 return vals; 4859 }, 4860 /* -------------------- */ 4861 4862 4863 /* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */ 4864 _to=function(val,dir){ 4865 if(val==null || typeof val=="undefined"){return;} 4866 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4867 mCSB_container=$("#mCSB_"+d.idx+"_container"), 4868 wrapper=mCSB_container.parent(), 4869 t=typeof val; 4870 if(!dir){dir=o.axis==="x" ? "x" : "y";} 4871 var contentLength=dir==="x" ? mCSB_container.outerWidth(false)-wrapper.width() : mCSB_container.outerHeight(false)-wrapper.height(), 4872 contentPos=dir==="x" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop, 4873 cssProp=dir==="x" ? "left" : "top"; 4874 switch(t){ 4875 case "function": /* this currently is not used. Consider removing it */ 4876 return val(); 4877 break; 4878 case "object": /* js/jquery object */ 4879 var obj=val.jquery ? val : $(val); 4880 if(!obj.length){return;} 4881 return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0]; 4882 break; 4883 case "string": case "number": 4884 if(_isNumeric(val)){ /* numeric value */ 4885 return Math.abs(val); 4886 }else if(val.indexOf("%")!==-1){ /* percentage value */ 4887 return Math.abs(contentLength*parseInt(val)/100); 4888 }else if(val.indexOf("-=")!==-1){ /* decrease value */ 4889 return Math.abs(contentPos-parseInt(val.split("-=")[1])); 4890 }else if(val.indexOf("+=")!==-1){ /* inrease value */ 4891 var p=(contentPos+parseInt(val.split("+=")[1])); 4892 return p>=0 ? 0 : Math.abs(p); 4893 }else if(val.indexOf("px")!==-1 && _isNumeric(val.split("px")[0])){ /* pixels string value (e.g. "100px") */ 4894 return Math.abs(val.split("px")[0]); 4895 }else{ 4896 if(val==="top" || val==="left"){ /* special strings */ 4897 return 0; 4898 }else if(val==="bottom"){ 4899 return Math.abs(wrapper.height()-mCSB_container.outerHeight(false)); 4900 }else if(val==="right"){ 4901 return Math.abs(wrapper.width()-mCSB_container.outerWidth(false)); 4902 }else if(val==="first" || val==="last"){ 4903 var obj=mCSB_container.find(":"+val); 4904 return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0]; 4905 }else{ 4906 if($(val).length){ /* jquery selector */ 4907 return dir==="x" ? _childPos($(val))[1] : _childPos($(val))[0]; 4908 }else{ /* other values (e.g. "100em") */ 4909 mCSB_container.css(cssProp,val); 4910 methods.update.call(null,$this[0]); 4911 return; 4912 } 4913 } 4914 } 4915 break; 4916 } 4917 }, 4918 /* -------------------- */ 4919 4920 4921 /* calls the update method automatically */ 4922 _autoUpdate=function(rem){ 4923 var $this=$(this),d=$this.data(pluginPfx),o=d.opt, 4924 mCSB_container=$("#mCSB_"+d.idx+"_container"); 4925 if(rem){ 4926 /* 4927 removes autoUpdate timer 4928 usage: _autoUpdate.call(this,"remove"); 4929 */ 4930 clearTimeout(mCSB_container[0].autoUpdate); 4931 _delete(mCSB_container[0],"autoUpdate"); 4932 return; 4933 } 4934 upd(); 4935 function upd(){ 4936 clearTimeout(mCSB_container[0].autoUpdate); 4937 if($this.parents("html").length===0){ 4938 /* check element in dom tree */ 4939 $this=null; 4940 return; 4941 } 4942 mCSB_container[0].autoUpdate=setTimeout(function(){ 4943 /* update on specific selector(s) length and size change */ 4944 if(o.advanced.updateOnSelectorChange){ 4945 d.poll.change.n=sizesSum(); 4946 if(d.poll.change.n!==d.poll.change.o){ 4947 d.poll.change.o=d.poll.change.n; 4948 doUpd(3); 4949 return; 4950 } 4951 } 4952 /* update on main element and scrollbar size changes */ 4953 if(o.advanced.updateOnContentResize){ 4954 d.poll.size.n=$this[0].scrollHeight+$this[0].scrollWidth+mCSB_container[0].offsetHeight+$this[0].offsetHeight+$this[0].offsetWidth; 4955 if(d.poll.size.n!==d.poll.size.o){ 4956 d.poll.size.o=d.poll.size.n; 4957 doUpd(1); 4958 return; 4959 } 4960 } 4961 /* update on image load */ 4962 if(o.advanced.updateOnImageLoad){ 4963 if(!(o.advanced.updateOnImageLoad==="auto" && o.axis==="y")){ //by default, it doesn't run on vertical content 4964 d.poll.img.n=mCSB_container.find("img").length; 4965 if(d.poll.img.n!==d.poll.img.o){ 4966 d.poll.img.o=d.poll.img.n; 4967 mCSB_container.find("img").each(function(){ 4968 imgLoader(this); 4969 }); 4970 return; 4971 } 4972 } 4973 } 4974 if(o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad){upd();} 4975 },o.advanced.autoUpdateTimeout); 4976 } 4977 /* a tiny image loader */ 4978 function imgLoader(el){ 4979 if($(el).hasClass(classes[2])){doUpd(); return;} 4980 var img=new Image(); 4981 function createDelegate(contextObject,delegateMethod){ 4982 return function(){return delegateMethod.apply(contextObject,arguments);} 4983 } 4984 function imgOnLoad(){ 4985 this.onload=null; 4986 $(el).addClass(classes[2]); 4987 doUpd(2); 4988 } 4989 img.onload=createDelegate(img,imgOnLoad); 4990 img.src=el.src; 4991 } 4992 /* returns the total height and width sum of all elements matching the selector */ 4993 function sizesSum(){ 4994 if(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange="*";} 4995 var total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange); 4996 if(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=this.offsetHeight+this.offsetWidth;});} 4997 return total; 4998 } 4999 /* calls the update method */ 5000 function doUpd(cb){ 5001 clearTimeout(mCSB_container[0].autoUpdate); 5002 methods.update.call(null,$this[0],cb); 5003 } 5004 }, 5005 /* -------------------- */ 5006 5007 5008 /* snaps scrolling to a multiple of a pixels number */ 5009 _snapAmount=function(to,amount,offset){ 5010 return (Math.round(to/amount)*amount-offset); 5011 }, 5012 /* -------------------- */ 5013 5014 5015 /* stops content and scrollbar animations */ 5016 _stop=function(el){ 5017 var d=el.data(pluginPfx), 5018 sel=$("#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal"); 5019 sel.each(function(){ 5020 _stopTween.call(this); 5021 }); 5022 }, 5023 /* -------------------- */ 5024 5025 5026 /* 5027 ANIMATES CONTENT 5028 This is where the actual scrolling happens 5029 */ 5030 _scrollTo=function(el,to,options){ 5031 var d=el.data(pluginPfx),o=d.opt, 5032 defaults={ 5033 trigger:"internal", 5034 dir:"y", 5035 scrollEasing:"mcsEaseOut", 5036 drag:false, 5037 dur:o.scrollInertia, 5038 overwrite:"all", 5039 callbacks:true, 5040 onStart:true, 5041 onUpdate:true, 5042 onComplete:true 5043 }, 5044 options=$.extend(defaults,options), 5045 dur=[options.dur,(options.drag ? 0 : options.dur)], 5046 mCustomScrollBox=$("#mCSB_"+d.idx), 5047 mCSB_container=$("#mCSB_"+d.idx+"_container"), 5048 wrapper=mCSB_container.parent(), 5049 totalScrollOffsets=o.callbacks.onTotalScrollOffset ? _arr.call(el,o.callbacks.onTotalScrollOffset) : [0,0], 5050 totalScrollBackOffsets=o.callbacks.onTotalScrollBackOffset ? _arr.call(el,o.callbacks.onTotalScrollBackOffset) : [0,0]; 5051 d.trigger=options.trigger; 5052 if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){ /* always reset scrollTop/Left */ 5053 $(".mCSB_"+d.idx+"_scrollbar").css("visibility","visible"); 5054 wrapper.scrollTop(0).scrollLeft(0); 5055 } 5056 if(to==="_resetY" && !d.contentReset.y){ 5057 /* callbacks: onOverflowYNone */ 5058 if(_cb("onOverflowYNone")){o.callbacks.onOverflowYNone.call(el[0]);} 5059 d.contentReset.y=1; 5060 } 5061 if(to==="_resetX" && !d.contentReset.x){ 5062 /* callbacks: onOverflowXNone */ 5063 if(_cb("onOverflowXNone")){o.callbacks.onOverflowXNone.call(el[0]);} 5064 d.contentReset.x=1; 5065 } 5066 if(to==="_resetY" || to==="_resetX"){return;} 5067 if((d.contentReset.y || !el[0].mcs) && d.overflowed[0]){ 5068 /* callbacks: onOverflowY */ 5069 if(_cb("onOverflowY")){o.callbacks.onOverflowY.call(el[0]);} 5070 d.contentReset.x=null; 5071 } 5072 if((d.contentReset.x || !el[0].mcs) && d.overflowed[1]){ 5073 /* callbacks: onOverflowX */ 5074 if(_cb("onOverflowX")){o.callbacks.onOverflowX.call(el[0]);} 5075 d.contentReset.x=null; 5076 } 5077 if(o.snapAmount){ /* scrolling snapping */ 5078 var snapAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : options.dir==="x" ? o.snapAmount[1] : o.snapAmount[0]; 5079 to=_snapAmount(to,snapAmount,o.snapOffset); 5080 } 5081 switch(options.dir){ 5082 case "x": 5083 var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_horizontal"), 5084 property="left", 5085 contentPos=mCSB_container[0].offsetLeft, 5086 limit=[ 5087 mCustomScrollBox.width()-mCSB_container.outerWidth(false), 5088 mCSB_dragger.parent().width()-mCSB_dragger.width() 5089 ], 5090 scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.x)], 5091 tso=totalScrollOffsets[1], 5092 tsbo=totalScrollBackOffsets[1], 5093 totalScrollOffset=tso>0 ? tso/d.scrollRatio.x : 0, 5094 totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.x : 0; 5095 break; 5096 case "y": 5097 var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_vertical"), 5098 property="top", 5099 contentPos=mCSB_container[0].offsetTop, 5100 limit=[ 5101 mCustomScrollBox.height()-mCSB_container.outerHeight(false), 5102 mCSB_dragger.parent().height()-mCSB_dragger.height() 5103 ], 5104 scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.y)], 5105 tso=totalScrollOffsets[0], 5106 tsbo=totalScrollBackOffsets[0], 5107 totalScrollOffset=tso>0 ? tso/d.scrollRatio.y : 0, 5108 totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.y : 0; 5109 break; 5110 } 5111 if(scrollTo[1]<0 || (scrollTo[0]===0 && scrollTo[1]===0)){ 5112 scrollTo=[0,0]; 5113 }else if(scrollTo[1]>=limit[1]){ 5114 scrollTo=[limit[0],limit[1]]; 5115 }else{ 5116 scrollTo[0]=-scrollTo[0]; 5117 } 5118 if(!el[0].mcs){ 5119 _mcs(); /* init mcs object (once) to make it available before callbacks */ 5120 if(_cb("onInit")){o.callbacks.onInit.call(el[0]);} /* callbacks: onInit */ 5121 } 5122 clearTimeout(mCSB_container[0].onCompleteTimeout); 5123 _tweenTo(mCSB_dragger[0],property,Math.round(scrollTo[1]),dur[1],options.scrollEasing); 5124 if(!d.tweenRunning && ((contentPos===0 && scrollTo[0]>=0) || (contentPos===limit[0] && scrollTo[0]<=limit[0]))){return;} 5125 _tweenTo(mCSB_container[0],property,Math.round(scrollTo[0]),dur[0],options.scrollEasing,options.overwrite,{ 5126 onStart:function(){ 5127 if(options.callbacks && options.onStart && !d.tweenRunning){ 5128 /* callbacks: onScrollStart */ 5129 if(_cb("onScrollStart")){_mcs(); o.callbacks.onScrollStart.call(el[0]);} 5130 d.tweenRunning=true; 5131 _onDragClasses(mCSB_dragger); 5132 d.cbOffsets=_cbOffsets(); 5133 } 5134 },onUpdate:function(){ 5135 if(options.callbacks && options.onUpdate){ 5136 /* callbacks: whileScrolling */ 5137 if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);} 5138 } 5139 },onComplete:function(){ 5140 if(options.callbacks && options.onComplete){ 5141 if(o.axis==="yx"){clearTimeout(mCSB_container[0].onCompleteTimeout);} 5142 var t=mCSB_container[0].idleTimer || 0; 5143 mCSB_container[0].onCompleteTimeout=setTimeout(function(){ 5144 /* callbacks: onScroll, onTotalScroll, onTotalScrollBack */ 5145 if(_cb("onScroll")){_mcs(); o.callbacks.onScroll.call(el[0]);} 5146 if(_cb("onTotalScroll") && scrollTo[1]>=limit[1]-totalScrollOffset && d.cbOffsets[0]){_mcs(); o.callbacks.onTotalScroll.call(el[0]);} 5147 if(_cb("onTotalScrollBack") && scrollTo[1]<=totalScrollBackOffset && d.cbOffsets[1]){_mcs(); o.callbacks.onTotalScrollBack.call(el[0]);} 5148 d.tweenRunning=false; 5149 mCSB_container[0].idleTimer=0; 5150 _onDragClasses(mCSB_dragger,"hide"); 5151 },t); 5152 } 5153 } 5154 }); 5155 /* checks if callback function exists */ 5156 function _cb(cb){ 5157 return d && o.callbacks[cb] && typeof o.callbacks[cb]==="function"; 5158 } 5159 /* checks whether callback offsets always trigger */ 5160 function _cbOffsets(){ 5161 return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo]; 5162 } 5163 /* 5164 populates object with useful values for the user 5165 values: 5166 content: this.mcs.content 5167 content top position: this.mcs.top 5168 content left position: this.mcs.left 5169 dragger top position: this.mcs.draggerTop 5170 dragger left position: this.mcs.draggerLeft 5171 scrolling y percentage: this.mcs.topPct 5172 scrolling x percentage: this.mcs.leftPct 5173 scrolling direction: this.mcs.direction 5174 */ 5175 function _mcs(){ 5176 var cp=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], /* content position */ 5177 dp=[mCSB_dragger[0].offsetTop,mCSB_dragger[0].offsetLeft], /* dragger position */ 5178 cl=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false)], /* content length */ 5179 pl=[mCustomScrollBox.height(),mCustomScrollBox.width()]; /* content parent length */ 5180 el[0].mcs={ 5181 content:mCSB_container, /* original content wrapper as jquery object */ 5182 top:cp[0],left:cp[1],draggerTop:dp[0],draggerLeft:dp[1], 5183 topPct:Math.round((100*Math.abs(cp[0]))/(Math.abs(cl[0])-pl[0])),leftPct:Math.round((100*Math.abs(cp[1]))/(Math.abs(cl[1])-pl[1])), 5184 direction:options.dir 5185 }; 5186 /* 5187 this refers to the original element containing the scrollbar(s) 5188 usage: this.mcs.top, this.mcs.leftPct etc. 5189 */ 5190 } 5191 }, 5192 /* -------------------- */ 5193 5194 5195 /* 5196 CUSTOM JAVASCRIPT ANIMATION TWEEN 5197 Lighter and faster than jquery animate() and css transitions 5198 Animates top/left properties and includes easings 5199 */ 5200 _tweenTo=function(el,prop,to,duration,easing,overwrite,callbacks){ 5201 if(!el._mTween){el._mTween={top:{},left:{}};} 5202 var callbacks=callbacks || {}, 5203 onStart=callbacks.onStart || function(){},onUpdate=callbacks.onUpdate || function(){},onComplete=callbacks.onComplete || function(){}, 5204 startTime=_getTime(),_delay,progress=0,from=el.offsetTop,elStyle=el.style,_request,tobj=el._mTween[prop]; 5205 if(prop==="left"){from=el.offsetLeft;} 5206 var diff=to-from; 5207 tobj.stop=0; 5208 if(overwrite!=="none"){_cancelTween();} 5209 _startTween(); 5210 function _step(){ 5211 if(tobj.stop){return;} 5212 if(!progress){onStart.call();} 5213 progress=_getTime()-startTime; 5214 _tween(); 5215 if(progress>=tobj.time){ 5216 tobj.time=(progress>tobj.time) ? progress+_delay-(progress-tobj.time) : progress+_delay-1; 5217 if(tobj.time<progress+1){tobj.time=progress+1;} 5218 } 5219 if(tobj.time<duration){tobj.id=_request(_step);}else{onComplete.call();} 5220 } 5221 function _tween(){ 5222 if(duration>0){ 5223 tobj.currVal=_ease(tobj.time,from,diff,duration,easing); 5224 elStyle[prop]=Math.round(tobj.currVal)+"px"; 5225 }else{ 5226 elStyle[prop]=to+"px"; 5227 } 5228 onUpdate.call(); 5229 } 5230 function _startTween(){ 5231 _delay=1000/60; 5232 tobj.time=progress+_delay; 5233 _request=(!window.requestAnimationFrame) ? function(f){_tween(); return setTimeout(f,0.01);} : window.requestAnimationFrame; 5234 tobj.id=_request(_step); 5235 } 5236 function _cancelTween(){ 5237 if(tobj.id==null){return;} 5238 if(!window.requestAnimationFrame){clearTimeout(tobj.id); 5239 }else{window.cancelAnimationFrame(tobj.id);} 5240 tobj.id=null; 5241 } 5242 function _ease(t,b,c,d,type){ 5243 switch(type){ 5244 case "linear": case "mcsLinear": 5245 return c*t/d + b; 5246 break; 5247 case "mcsLinearOut": 5248 t/=d; t--; return c * Math.sqrt(1 - t*t) + b; 5249 break; 5250 case "easeInOutSmooth": 5251 t/=d/2; 5252 if(t<1) return c/2*t*t + b; 5253 t--; 5254 return -c/2 * (t*(t-2) - 1) + b; 5255 break; 5256 case "easeInOutStrong": 5257 t/=d/2; 5258 if(t<1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b; 5259 t--; 5260 return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b; 5261 break; 5262 case "easeInOut": case "mcsEaseInOut": 5263 t/=d/2; 5264 if(t<1) return c/2*t*t*t + b; 5265 t-=2; 5266 return c/2*(t*t*t + 2) + b; 5267 break; 5268 case "easeOutSmooth": 5269 t/=d; t--; 5270 return -c * (t*t*t*t - 1) + b; 5271 break; 5272 case "easeOutStrong": 5273 return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b; 5274 break; 5275 case "easeOut": case "mcsEaseOut": default: 5276 var ts=(t/=d)*t,tc=ts*t; 5277 return b+c*(0.499999999999997*tc*ts + -2.5*ts*ts + 5.5*tc + -6.5*ts + 4*t); 5278 } 5279 } 5280 }, 5281 /* -------------------- */ 5282 5283 5284 /* returns current time */ 5285 _getTime=function(){ 5286 if(window.performance && window.performance.now){ 5287 return window.performance.now(); 5288 }else{ 5289 if(window.performance && window.performance.webkitNow){ 5290 return window.performance.webkitNow(); 5291 }else{ 5292 if(Date.now){return Date.now();}else{return new Date().getTime();} 5293 } 5294 } 5295 }, 5296 /* -------------------- */ 5297 5298 5299 /* stops a tween */ 5300 _stopTween=function(){ 5301 var el=this; 5302 if(!el._mTween){el._mTween={top:{},left:{}};} 5303 var props=["top","left"]; 5304 for(var i=0; i<props.length; i++){ 5305 var prop=props[i]; 5306 if(el._mTween[prop].id){ 5307 if(!window.requestAnimationFrame){clearTimeout(el._mTween[prop].id); 5308 }else{window.cancelAnimationFrame(el._mTween[prop].id);} 5309 el._mTween[prop].id=null; 5310 el._mTween[prop].stop=1; 5311 } 5312 } 5313 }, 5314 /* -------------------- */ 5315 5316 5317 /* deletes a property (avoiding the exception thrown by IE) */ 5318 _delete=function(c,m){ 5319 try{delete c[m];}catch(e){c[m]=null;} 5320 }, 5321 /* -------------------- */ 5322 5323 5324 /* detects left mouse button */ 5325 _mouseBtnLeft=function(e){ 5326 return !(e.which && e.which!==1); 5327 }, 5328 /* -------------------- */ 5329 5330 5331 /* detects if pointer type event is touch */ 5332 _pointerTouch=function(e){ 5333 var t=e.originalEvent.pointerType; 5334 return !(t && t!=="touch" && t!==2); 5335 }, 5336 /* -------------------- */ 5337 5338 5339 /* checks if value is numeric */ 5340 _isNumeric=function(val){ 5341 return !isNaN(parseFloat(val)) && isFinite(val); 5342 }, 5343 /* -------------------- */ 5344 5345 5346 /* returns element position according to content */ 5347 _childPos=function(el){ 5348 var p=el.parents(".mCSB_container"); 5349 return [el.offset().top-p.offset().top,el.offset().left-p.offset().left]; 5350 }, 5351 /* -------------------- */ 5352 5353 5354 /* checks if browser tab is hidden/inactive via Page Visibility API */ 5355 _isTabHidden=function(){ 5356 var prop=_getHiddenProp(); 5357 if(!prop) return false; 5358 return document[prop]; 5359 function _getHiddenProp(){ 5360 var pfx=["webkit","moz","ms","o"]; 5361 if("hidden" in document) return "hidden"; //natively supported 5362 for(var i=0; i<pfx.length; i++){ //prefixed 5363 if((pfx[i]+"Hidden") in document) 5364 return pfx[i]+"Hidden"; 5365 } 5366 return null; //not supported 5367 } 5368 }; 5369 /* -------------------- */ 5370 5371 5372 5373 5374 5375 /* 5376 ---------------------------------------- 5377 PLUGIN SETUP 5378 ---------------------------------------- 5379 */ 5380 5381 /* plugin constructor functions */ 5382 $.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */ 5383 if(methods[method]){ 5384 return methods[method].apply(this,Array.prototype.slice.call(arguments,1)); 5385 }else if(typeof method==="object" || !method){ 5386 return methods.init.apply(this,arguments); 5387 }else{ 5388 $.error("Method "+method+" does not exist"); 5389 } 5390 }; 5391 $[pluginNS]=function(method){ /* usage: $.mCustomScrollbar(); */ 5392 if(methods[method]){ 5393 return methods[method].apply(this,Array.prototype.slice.call(arguments,1)); 5394 }else if(typeof method==="object" || !method){ 5395 return methods.init.apply(this,arguments); 5396 }else{ 5397 $.error("Method "+method+" does not exist"); 5398 } 5399 }; 5400 5401 /* 5402 allow setting plugin default options. 5403 usage: $.mCustomScrollbar.defaults.scrollInertia=500; 5404 to apply any changed default options on default selectors (below), use inside document ready fn 5405 e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; }); 5406 */ 5407 $[pluginNS].defaults=defaults; 5408 5409 /* 5410 add window object (window.mCustomScrollbar) 5411 usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");} 5412 */ 5413 window[pluginNS]=true; 5414 5415 $(window).bind("load",function(){ 5416 5417 $(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */ 5418 5419 /* extend jQuery expressions */ 5420 $.extend($.expr[":"],{ 5421 /* checks if element is within scrollable viewport */ 5422 mcsInView:$.expr[":"].mcsInView || function(el){ 5423 var $el=$(el),content=$el.parents(".mCSB_container"),wrapper,cPos; 5424 if(!content.length){return;} 5425 wrapper=content.parent(); 5426 cPos=[content[0].offsetTop,content[0].offsetLeft]; 5427 return cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && 5428 cPos[1]+_childPos($el)[1]>=0 && cPos[1]+_childPos($el)[1]<wrapper.width()-$el.outerWidth(false); 5429 }, 5430 /* checks if element or part of element is in view of scrollable viewport */ 5431 mcsInSight:$.expr[":"].mcsInSight || function(el,i,m){ 5432 var $el=$(el),elD,content=$el.parents(".mCSB_container"),wrapperView,pos,wrapperViewPct, 5433 pctVals=m[3]==="exact" ? [[1,0],[1,0]] : [[0.9,0.1],[0.6,0.4]]; 5434 if(!content.length){return;} 5435 elD=[$el.outerHeight(false),$el.outerWidth(false)]; 5436 pos=[content[0].offsetTop+_childPos($el)[0],content[0].offsetLeft+_childPos($el)[1]]; 5437 wrapperView=[content.parent()[0].offsetHeight,content.parent()[0].offsetWidth]; 5438 wrapperViewPct=[elD[0]<wrapperView[0] ? pctVals[0] : pctVals[1],elD[1]<wrapperView[1] ? pctVals[0] : pctVals[1]]; 5439 return pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && 5440 pos[1]-(wrapperView[1]*wrapperViewPct[1][0])<0 && pos[1]+elD[1]-(wrapperView[1]*wrapperViewPct[1][1])>=0; 5441 }, 5442 /* checks if element is overflowed having visible scrollbar(s) */ 5443 mcsOverflow:$.expr[":"].mcsOverflow || function(el){ 5444 var d=$(el).data(pluginPfx); 5445 if(!d){return;} 5446 return d.overflowed[0] || d.overflowed[1]; 5447 } 5448 }); 5449 5450 }); 5451 5452}))}));
5452; 5453/*---------------------------------------- 5454 * objectFitPolyfill 2.1.1 5455 * 5456 * Made by Constance Chen 5457 * Released under the MIT license 5458 * 5459 * https://github.com/constancecchen/object-fit-polyfill 5460 *--------------------------------------*/ 5461 5462(function(){ 5463 "use strict"; 5464 5465 // if the page is being rendered on the server, don't continue 5466 if (typeof window === "undefined") { 5467 return; 5468 } 5469 5470 // Workaround for Edge 16+, which only implemented object-fit for <img> tags 5471 // TODO: Keep an eye on Edge to determine which version has full final support 5472 var edgeVersion = window.navigator.userAgent.match(/Edge\/(\d{2})\./); 5473 var edgePartialSupport = (edgeVersion) ? (parseInt(edgeVersion[1], 10) >= 16) : false; 5474 5475 // If the browser does support object-fit, we don't need to continue 5476 if ("objectFit" in document.documentElement.style !== false && !edgePartialSupport) { 5477 window.objectFitPolyfill = function() { return false }; 5478 return; 5479 } 5480 5481 /** 5482 * Check the container's parent element to make sure it will 5483 * correctly handle and clip absolutely positioned children 5484 * 5485 * @param {node} $container - parent element 5486 */ 5487 var checkParentContainer = function($container) { 5488 var styles = window.getComputedStyle($container, null); 5489 var position = styles.getPropertyValue("position"); 5490 var overflow = styles.getPropertyValue("overflow"); 5491 var display = styles.getPropertyValue("display"); 5492 5493 if (!position || position === "static") { 5494 $container.style.position = "relative"; 5495 } 5496 if (overflow !== "hidden") { 5497 $container.style.overflow = "hidden"; 5498 } 5499 // Guesstimating that people want the parent to act like full width/height wrapper here. 5500 // Mostly attempts to target <picture> elements, which default to inline. 5501 if (!display || display === "inline") { 5502 $container.style.display = "block"; 5503 } 5504 if ($container.clientHeight === 0) { 5505 $container.style.height = "100%"; 5506 } 5507 5508 // Add a CSS class hook, in case people need to override styles for any reason. 5509 if ($container.className.indexOf("object-fit-polyfill") === -1) { 5510 $container.className = $container.className + " object-fit-polyfill"; 5511 } 5512 }; 5513 5514 /** 5515 * Check for pre-set max-width/height, min-width/height, 5516 * positioning, or margins, which can mess up image calculations 5517 * 5518 * @param {node} $media - img/video element 5519 */ 5520 var checkMediaProperties = function($media) { 5521 var styles = window.getComputedStyle($media, null); 5522 var constraints = { 5523 "max-width": "none", 5524 "max-height": "none", 5525 "min-width": "0px", 5526 "min-height": "0px", 5527 "top": "auto", 5528 "right": "auto", 5529 "bottom": "auto", 5530 "left": "auto", 5531 "margin-top": "0px", 5532 "margin-right": "0px", 5533 "margin-bottom": "0px", 5534 "margin-left": "0px", 5535 }; 5536 5537 for (var property in constraints) { 5538 var constraint = styles.getPropertyValue(property); 5539 5540 if (constraint !== constraints[property]) { 5541 $media.style[property] = constraints[property]; 5542 } 5543 } 5544 }; 5545 5546 /** 5547 * Calculate & set object-position 5548 * 5549 * @param {string} axis - either "x" or "y" 5550 * @param {node} $media - img or video element 5551 * @param {string} objectPosition - e.g. "50% 50%", "top bottom" 5552 */ 5553 var setPosition = function(axis, $media, objectPosition) { 5554 var position, other, start, end, side; 5555 objectPosition = objectPosition.split(" "); 5556 5557 if (objectPosition.length < 2) { 5558 objectPosition[1] = objectPosition[0]; 5559 } 5560 5561 if (axis === "x") { 5562 position = objectPosition[0]; 5563 other = objectPosition[1]; 5564 start = "left"; 5565 end = "right"; 5566 side = $media.clientWidth; 5567 } 5568 else if (axis === "y") { 5569 position = objectPosition[1]; 5570 other = objectPosition[0]; 5571 start = "top"; 5572 end = "bottom"; 5573 side = $media.clientHeight; 5574 } 5575 else { 5576 return; // Neither x or y axis specified 5577 } 5578 5579 if (position === start || other === start) { 5580 $media.style[start] = "0"; 5581 return; 5582 } 5583 5584 if (position === end || other === end) { 5585 $media.style[end] = "0"; 5586 return; 5587 } 5588 5589 if (position === "center" || position === "50%") { 5590 $media.style[start] = "50%"; 5591 $media.style["margin-" + start] = (side / -2) + "px"; 5592 return; 5593 } 5594 5595 // Percentage values (e.g., 30% 10%) 5596 if (position.indexOf("%") >= 0) { 5597 position = parseInt(position); 5598 5599 if (position < 50) { 5600 $media.style[start] = position + "%"; 5601 $media.style["margin-" + start] = side * (position / -100) + "px"; 5602 } 5603 else { 5604 position = 100 - position; 5605 $media.style[end] = position + "%"; 5606 $media.style["margin-" + end] = side * (position / -100) + "px"; 5607 } 5608 5609 return; 5610 } 5611 // Length-based values (e.g. 10px / 10em) 5612 else { 5613 $media.style[start] = position; 5614 } 5615 5616 }; 5617 5618 /** 5619 * Calculate & set object-fit 5620 * 5621 * @param {node} $media - img/video/picture element 5622 */ 5623 var objectFit = function($media) { 5624 // Fallbacks, IE 10- data 5625 var fit = ($media.dataset) ? $media.dataset.objectFit : $media.getAttribute("data-object-fit"); 5626 var position = ($media.dataset) ? $media.dataset.objectPosition : $media.getAttribute("data-object-position"); 5627 fit = fit || "cover"; 5628 position = position || "50% 50%"; 5629 5630 // If necessary, make the parent container work with absolutely positioned elements 5631 var $container = $media.parentNode; 5632 checkParentContainer($container); 5633 5634 // Check for any pre-set CSS which could mess up image calculations
5635 checkMediaProperties($media); 5636 5637 // Mathematically figure out which side needs covering, and add CSS positioning & centering 5638 $media.style.position = "absolute"; 5639 $media.style.height = "100%"; 5640 $media.style.width = "auto"; 5641 5642 if (fit === "scale-down") { 5643 $media.style.height = "auto"; 5644 5645 if ( 5646 $media.clientWidth < $container.clientWidth && 5647 $media.clientHeight < $container.clientHeight 5648 ) { 5649 setPosition("x", $media, position); 5650 setPosition("y", $media, position); 5651 } 5652 else { 5653 fit = "contain"; 5654 $media.style.height = "100%"; 5655 } 5656 } 5657 5658 if (fit === "none") { 5659 $media.style.width = "auto"; 5660 $media.style.height = "auto"; 5661 setPosition("x", $media, position); 5662 setPosition("y", $media, position); 5663 } 5664 else if ( 5665 fit === "cover" && $media.clientWidth > $container.clientWidth || 5666 fit === "contain" && $media.clientWidth < $container.clientWidth 5667 ) { 5668 $media.style.top = "0"; 5669 $media.style.marginTop = "0"; 5670 setPosition("x", $media, position); 5671 } 5672 else if (fit !== "scale-down") { 5673 $media.style.width = "100%"; 5674 $media.style.height = "auto"; 5675 $media.style.left = "0"; 5676 $media.style.marginLeft = "0"; 5677 setPosition("y", $media, position); 5678 } 5679 }; 5680 5681 /** 5682 * Initialize plugin 5683 * 5684 * @param {node} media - Optional specific DOM node(s) to be polyfilled 5685 */ 5686 var objectFitPolyfill = function(media) { 5687 if (typeof media === "undefined") { 5688 // If left blank, all media on the page will be polyfilled. 5689 media = document.querySelectorAll("[data-object-fit]"); 5690 } else if (media && media.nodeName) { 5691 // If it's a single node, wrap it in an array so it works. 5692 media = [media]; 5693 } else if (typeof media === "object" && media.length && media[0].nodeName) { 5694 // If it's an array of DOM nodes (e.g. a jQuery selector), it's fine as-is. 5695 media = media; 5696 } else { 5697 // Otherwise, if it's invalid or an incorrect type, return false to let people know. 5698 return false; 5699 } 5700 5701 for (var i = 0; i < media.length; i++) { 5702 if (!media[i].nodeName) { continue; } 5703 5704 var mediaType = media[i].nodeName.toLowerCase(); 5705 5706 if (mediaType === "img" && !edgePartialSupport) { 5707 if (media[i].complete) { 5708 objectFit(media[i]); 5709 } 5710 else { 5711 media[i].addEventListener("load", function() { 5712 objectFit(this); 5713 }); 5714 } 5715 } 5716 else if (mediaType === "video") { 5717 if (media[i].readyState > 0) { 5718 objectFit(media[i]); 5719 } 5720 else { 5721 media[i].addEventListener("loadedmetadata", function() { 5722 objectFit(this); 5723 }); 5724 } 5725 } 5726 } 5727 5728 return true; 5729 }; 5730 5731 document.addEventListener("DOMContentLoaded", function() { 5732 objectFitPolyfill(); 5733 }); 5734 window.addEventListener("resize", function() { 5735 objectFitPolyfill(); 5736 }); 5737 5738 window.objectFitPolyfill = objectFitPolyfill; 5739 5740})(); 5741; 5742/* 5743 _ _ _ _ 5744 ___| (_) ___| | __ (_)___ 5745/ __| | |/ __| |/ / | / __| 5746\__ \ | | (__| < _ | \__ \ 5747|___/_|_|\___|_|\_(_)/ |___/ 5748 |__/ 5749 5750 Version: 1.7.1 5751 Author: Ken Wheeler 5752 Website: http://kenwheeler.github.io 5753 Docs: http://kenwheeler.github.io/slick 5754 Repo: http://github.com/kenwheeler/slick 5755 Issues: http://github.com/kenwheeler/slick/issues 5756 5757 */ 5758/* global window, document, define, jQuery, setInterval, clearInterval */ 5759;(function(factory) { 5760 'use strict'; 5761 if (typeof define === 'function' && define.amd) { 5762 define(['jquery'], factory); 5763 } else if (typeof exports !== 'undefined') { 5764 module.exports = factory(require('jquery')); 5765 } else { 5766 factory(jQuery); 5767 } 5768 5769}(function($) { 5770 'use strict'; 5771 var Slick = window.Slick || {}; 5772 5773 Slick = (function() { 5774 5775 var instanceUid = 0; 5776 5777 function Slick(element, settings) { 5778 5779 var _ = this, dataSettings; 5780 5781 _.defaults = { 5782 accessibility: true, 5783 adaptiveHeight: false, 5784 appendArrows: $(element), 5785 appendDots: $(element), 5786 arrows: true, 5787 asNavFor: null, 5788 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 5789 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 5790 autoplay: false, 5791 autoplaySpeed: 3000, 5792 centerMode: false, 5793 centerPadding: '50px', 5794 cssEase: 'ease', 5795 customPaging: function(slider, i) { 5796 return $('<button type="button" />').text(i + 1); 5797 }, 5798 dots: false, 5799 dotsClass: 'slick-dots', 5800 draggable: true, 5801 easing: 'linear', 5802 edgeFriction: 0.35, 5803 fade: false, 5804 focusOnSelect: false, 5805 focusOnChange: false, 5806 infinite: true, 5807 initialSlide: 0, 5808 lazyLoad: 'ondemand', 5809 mobileFirst: false, 5810 pauseOnHover: true, 5811 pauseOnFocus: true, 5812 pauseOnDotsHover: false, 5813 respondTo: 'window', 5814 responsive: null, 5815 rows: 1, 5816 rtl: false, 5817 slide: '', 5818 slidesPerRow: 1, 5819 slidesToShow: 1, 5820 slidesToScroll: 1, 5821 speed: 500, 5822 swipe: true, 5823 swipeToSlide: false, 5824 touchMove: true, 5825 touchThreshold: 5, 5826 useCSS: true, 5827 useTransform: true, 5828 variableWidth: false, 5829 vertical: false, 5830 verticalSwiping: false, 5831 waitForAnimate: true, 5832 zIndex: 1000 5833 }; 5834 5835 _.initials = { 5836 animating: false, 5837 dragging: false, 5838 autoPlayTimer: null, 5839 currentDirection: 0, 5840 currentLeft: null, 5841 currentSlide: 0, 5842 direction: 1, 5843 $dots: null, 5844 listWidth: null, 5845 listHeight: null, 5846 loadIndex: 0, 5847 $nextArrow: null, 5848 $prevArrow: null, 5849 scrolling: false, 5850 slideCount: null, 5851 slideWidth: null, 5852 $slideTrack: null, 5853 $slides: null, 5854 sliding: false, 5855 slideOffset: 0, 5856 swipeLeft: null, 5857 swiping: false, 5858 $list: null, 5859 touchObject: {}, 5860 transformsEnabled: false,
vendor: 84,746 bytes, lines 5861-8644
5861 unslicked: false 5862 }; 5863 5864 $.extend(_, _.initials); 5865 5866 _.activeBreakpoint = null; 5867 _.animType = null; 5868 _.animProp = null; 5869 _.breakpoints = []; 5870 _.breakpointSettings = []; 5871 _.cssTransitions = false; 5872 _.focussed = false; 5873 _.interrupted = false; 5874 _.hidden = 'hidden'; 5875 _.paused = true; 5876 _.positionProp = null; 5877 _.respondTo = null; 5878 _.rowCount = 1; 5879 _.shouldClick = true; 5880 _.$slider = $(element); 5881 _.$slidesCache = null; 5882 _.transformType = null; 5883 _.transitionType = null; 5884 _.visibilityChange = 'visibilitychange'; 5885 _.windowWidth = 0; 5886 _.windowTimer = null; 5887 5888 dataSettings = $(element).data('slick') || {}; 5889 5890 _.options = $.extend({}, _.defaults, settings, dataSettings); 5891 5892 _.currentSlide = _.options.initialSlide; 5893 5894 _.originalSettings = _.options; 5895 5896 if (typeof document.mozHidden !== 'undefined') { 5897 _.hidden = 'mozHidden'; 5898 _.visibilityChange = 'mozvisibilitychange'; 5899 } else if (typeof document.webkitHidden !== 'undefined') { 5900 _.hidden = 'webkitHidden'; 5901 _.visibilityChange = 'webkitvisibilitychange'; 5902 } 5903 5904 _.autoPlay = $.proxy(_.autoPlay, _); 5905 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 5906 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 5907 _.changeSlide = $.proxy(_.changeSlide, _); 5908 _.clickHandler = $.proxy(_.clickHandler, _); 5909 _.selectHandler = $.proxy(_.selectHandler, _); 5910 _.setPosition = $.proxy(_.setPosition, _); 5911 _.swipeHandler = $.proxy(_.swipeHandler, _); 5912 _.dragHandler = $.proxy(_.dragHandler, _); 5913 _.keyHandler = $.proxy(_.keyHandler, _); 5914 5915 _.instanceUid = instanceUid++; 5916 5917 // A simple way to check for HTML strings 5918 // Strict HTML recognition (must start with <) 5919 // Extracted from jQuery v1.11 source 5920 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 5921 5922 5923 _.registerBreakpoints(); 5924 _.init(true); 5925 5926 } 5927 5928 return Slick; 5929 5930 }()); 5931 5932 Slick.prototype.activateADA = function() { 5933 var _ = this; 5934 5935 _.$slideTrack.find('.slick-active').attr({ 5936 'aria-hidden': 'false' 5937 }).find('a, input, button, select').attr({ 5938 'tabindex': '0' 5939 }); 5940 5941 }; 5942 5943 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 5944 5945 var _ = this; 5946 5947 if (typeof(index) === 'boolean') { 5948 addBefore = index; 5949 index = null; 5950 } else if (index < 0 || (index >= _.slideCount)) { 5951 return false; 5952 } 5953 5954 _.unload(); 5955 5956 if (typeof(index) === 'number') { 5957 if (index === 0 && _.$slides.length === 0) { 5958 $(markup).appendTo(_.$slideTrack); 5959 } else if (addBefore) { 5960 $(markup).insertBefore(_.$slides.eq(index)); 5961 } else { 5962 $(markup).insertAfter(_.$slides.eq(index)); 5963 } 5964 } else { 5965 if (addBefore === true) { 5966 $(markup).prependTo(_.$slideTrack); 5967 } else { 5968 $(markup).appendTo(_.$slideTrack); 5969 } 5970 } 5971 5972 _.$slides = _.$slideTrack.children(this.options.slide); 5973 5974 _.$slideTrack.children(this.options.slide).detach(); 5975 5976 _.$slideTrack.append(_.$slides); 5977 5978 _.$slides.each(function(index, element) { 5979 $(element).attr('data-slick-index', index); 5980 }); 5981 5982 _.$slidesCache = _.$slides; 5983 5984 _.reinit(); 5985 5986 }; 5987 5988 Slick.prototype.animateHeight = function() { 5989 var _ = this; 5990 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 5991 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 5992 _.$list.animate({ 5993 height: targetHeight 5994 }, _.options.speed); 5995 } 5996 }; 5997 5998 Slick.prototype.animateSlide = function(targetLeft, callback) { 5999 6000 var animProps = {}, 6001 _ = this; 6002 6003 _.animateHeight(); 6004 6005 if (_.options.rtl === true && _.options.vertical === false) { 6006 targetLeft = -targetLeft; 6007 } 6008 if (_.transformsEnabled === false) { 6009 if (_.options.vertical === false) { 6010 _.$slideTrack.animate({ 6011 left: targetLeft 6012 }, _.options.speed, _.options.easing, callback); 6013 } else { 6014 _.$slideTrack.animate({ 6015 top: targetLeft 6016 }, _.options.speed, _.options.easing, callback); 6017 } 6018 6019 } else { 6020 6021 if (_.cssTransitions === false) { 6022 if (_.options.rtl === true) { 6023 _.currentLeft = -(_.currentLeft); 6024 } 6025 $({ 6026 animStart: _.currentLeft 6027 }).animate({ 6028 animStart: targetLeft 6029 }, { 6030 duration: _.options.speed, 6031 easing: _.options.easing, 6032 step: function(now) { 6033 now = Math.ceil(now); 6034 if (_.options.vertical === false) { 6035 animProps[_.animType] = 'translate(' + 6036 now + 'px, 0px)'; 6037 _.$slideTrack.css(animProps); 6038 } else { 6039 animProps[_.animType] = 'translate(0px,' + 6040 now + 'px)'; 6041 _.$slideTrack.css(animProps); 6042 } 6043 }, 6044 complete: function() { 6045 if (callback) { 6046 callback.call(); 6047 } 6048 } 6049 }); 6050 6051 } else { 6052 6053 _.applyTransition(); 6054 targetLeft = Math.ceil(targetLeft); 6055 6056 if (_.options.vertical === false) { 6057 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 6058 } else { 6059 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 6060 } 6061 _.$slideTrack.css(animProps); 6062 6063 if (callback) { 6064 setTimeout(function() { 6065 6066 _.disableTransition(); 6067 6068 callback.call(); 6069 }, _.options.speed); 6070 } 6071 6072 } 6073 6074 } 6075 6076 }; 6077 6078 Slick.prototype.getNavTarget = function() { 6079 6080 var _ = this, 6081 asNavFor = _.options.asNavFor; 6082 6083 if ( asNavFor && asNavFor !== null ) { 6084 asNavFor = $(asNavFor).not(_.$slider); 6085 } 6086 6087 return asNavFor; 6088 6089 }; 6090 6091 Slick.prototype.asNavFor = function(index) { 6092 6093 var _ = this, 6094 asNavFor = _.getNavTarget(); 6095 6096 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 6097 asNavFor.each(function() { 6098 var target = $(this).slick('getSlick'); 6099 if(!target.unslicked) { 6100 target.slideHandler(index, true); 6101 } 6102 }); 6103 } 6104 6105 }; 6106 6107 Slick.prototype.applyTransition = function(slide) { 6108 6109 var _ = this, 6110 transition = {}; 6111 6112 if (_.options.fade === false) { 6113 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 6114 } else { 6115 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 6116 } 6117 6118 if (_.options.fade === false) { 6119 _.$slideTrack.css(transition); 6120 } else { 6121 _.$slides.eq(slide).css(transition); 6122 } 6123 6124 }; 6125 6126 Slick.prototype.autoPlay = function() { 6127 6128 var _ = this; 6129 6130 _.autoPlayClear(); 6131 6132 if ( _.slideCount > _.options.slidesToShow ) { 6133 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 6134 } 6135 6136 }; 6137 6138 Slick.prototype.autoPlayClear = function() { 6139 6140 var _ = this; 6141 6142 if (_.autoPlayTimer) { 6143 clearInterval(_.autoPlayTimer); 6144 } 6145 6146 }; 6147 6148 Slick.prototype.autoPlayIterator = function() { 6149 6150 var _ = this, 6151 slideTo = _.currentSlide + _.options.slidesToScroll; 6152 6153 if ( !_.paused && !_.interrupted && !_.focussed ) { 6154 6155 if ( _.options.infinite === false ) { 6156 6157 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 6158 _.direction = 0; 6159 } 6160 6161 else if ( _.direction === 0 ) { 6162 6163 slideTo = _.currentSlide - _.options.slidesToScroll; 6164 6165 if ( _.currentSlide - 1 === 0 ) { 6166 _.direction = 1; 6167 } 6168 6169 } 6170 6171 } 6172 6173 _.slideHandler( slideTo ); 6174 6175 } 6176 6177 }; 6178 6179 Slick.prototype.buildArrows = function() { 6180 6181 var _ = this; 6182 6183 if (_.options.arrows === true ) { 6184 6185 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 6186 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 6187 6188 if( _.slideCount > _.options.slidesToShow ) { 6189 6190 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 6191 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 6192 6193 if (_.htmlExpr.test(_.options.prevArrow)) { 6194 _.$prevArrow.prependTo(_.options.appendArrows); 6195 } 6196 6197 if (_.htmlExpr.test(_.options.nextArrow)) { 6198 _.$nextArrow.appendTo(_.options.appendArrows); 6199 } 6200 6201 if (_.options.infinite !== true) { 6202 _.$prevArrow 6203 .addClass('slick-disabled') 6204 .attr('aria-disabled', 'true'); 6205 } 6206 6207 } else { 6208 6209 _.$prevArrow.add( _.$nextArrow ) 6210 6211 .addClass('slick-hidden') 6212 .attr({ 6213 'aria-disabled': 'true', 6214 'tabindex': '-1' 6215 }); 6216 6217 } 6218 6219 } 6220 6221 }; 6222 6223 Slick.prototype.buildDots = function() { 6224 6225 var _ = this, 6226 i, dot; 6227 6228 if (_.options.dots === true) { 6229 6230 _.$slider.addClass('slick-dotted'); 6231 6232 dot = $('<ul />').addClass(_.options.dotsClass); 6233 6234 for (i = 0; i <= _.getDotCount(); i += 1) { 6235 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 6236 } 6237 6238 _.$dots = dot.appendTo(_.options.appendDots); 6239 6240 _.$dots.find('li').first().addClass('slick-active'); 6241 6242 } 6243 6244 }; 6245 6246 Slick.prototype.buildOut = function() { 6247 6248 var _ = this; 6249 6250 _.$slides = 6251 _.$slider 6252 .children( _.options.slide + ':not(.slick-cloned)') 6253 .addClass('slick-slide'); 6254 6255 _.slideCount = _.$slides.length; 6256 6257 _.$slides.each(function(index, element) { 6258 $(element) 6259 .attr('data-slick-index', index) 6260 .data('originalStyling', $(element).attr('style') || ''); 6261 }); 6262 6263 _.$slider.addClass('slick-slider'); 6264 6265 _.$slideTrack = (_.slideCount === 0) ? 6266 $('<div class="slick-track"/>').appendTo(_.$slider) : 6267 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 6268 6269 _.$list = _.$slideTrack.wrap( 6270 '<div class="slick-list"/>').parent(); 6271 _.$slideTrack.css('opacity', 0); 6272 6273 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 6274 _.options.slidesToScroll = 1; 6275 } 6276 6277 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 6278 6279 _.setupInfinite(); 6280 6281 _.buildArrows(); 6282 6283 _.buildDots(); 6284 6285 _.updateDots(); 6286 6287 6288 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 6289 6290 if (_.options.draggable === true) { 6291 _.$list.addClass('draggable'); 6292 } 6293 6294 }; 6295 6296 Slick.prototype.buildRows = function() { 6297 6298 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 6299 6300 newSlides = document.createDocumentFragment(); 6301 originalSlides = _.$slider.children(); 6302 6303 if(_.options.rows > 1) { 6304 6305 slidesPerSection = _.options.slidesPerRow * _.options.rows; 6306 numOfSlides = Math.ceil( 6307 originalSlides.length / slidesPerSection 6308 ); 6309 6310 for(a = 0; a < numOfSlides; a++){ 6311 var slide = document.createElement('div'); 6312 for(b = 0; b < _.options.rows; b++) { 6313 var row = document.createElement('div'); 6314 for(c = 0; c < _.options.slidesPerRow; c++) { 6315 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 6316 if (originalSlides.get(target)) { 6317 row.appendChild(originalSlides.get(target)); 6318 } 6319 } 6320 slide.appendChild(row); 6321 } 6322 newSlides.appendChild(slide); 6323 } 6324 6325 _.$slider.empty().append(newSlides); 6326 _.$slider.children().children().children() 6327 .css({ 6328 'width':(100 / _.options.slidesPerRow) + '%', 6329 'display': 'inline-block' 6330 }); 6331 6332 } 6333 6334 }; 6335 6336 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 6337 6338 var _ = this, 6339 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 6340 var sliderWidth = _.$slider.width(); 6341 var windowWidth = window.innerWidth || $(window).width(); 6342 6343 if (_.respondTo === 'window') { 6344 respondToWidth = windowWidth; 6345 } else if (_.respondTo === 'slider') { 6346 respondToWidth = sliderWidth; 6347 } else if (_.respondTo === 'min') { 6348 respondToWidth = Math.min(windowWidth, sliderWidth); 6349 } 6350 6351 if ( _.options.responsive && 6352 _.options.responsive.length && 6353 _.options.responsive !== null) { 6354 6355 targetBreakpoint = null; 6356 6357 for (breakpoint in _.breakpoints) { 6358 if (_.breakpoints.hasOwnProperty(breakpoint)) { 6359 if (_.originalSettings.mobileFirst === false) { 6360 if (respondToWidth < _.breakpoints[breakpoint]) { 6361 targetBreakpoint = _.breakpoints[breakpoint]; 6362 } 6363 } else { 6364 if (respondToWidth > _.breakpoints[breakpoint]) { 6365 targetBreakpoint = _.breakpoints[breakpoint]; 6366 } 6367 } 6368 } 6369 } 6370 6371 if (targetBreakpoint !== null) { 6372 if (_.activeBreakpoint !== null) { 6373 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 6374 _.activeBreakpoint = 6375 targetBreakpoint; 6376 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 6377 _.unslick(targetBreakpoint); 6378 } else { 6379 _.options = $.extend({}, _.originalSettings, 6380 _.breakpointSettings[ 6381 targetBreakpoint]); 6382 if (initial === true) { 6383 _.currentSlide = _.options.initialSlide; 6384 } 6385 _.refresh(initial); 6386 } 6387 triggerBreakpoint = targetBreakpoint; 6388 } 6389 } else { 6390 _.activeBreakpoint = targetBreakpoint; 6391 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 6392 _.unslick(targetBreakpoint); 6393 } else { 6394 _.options = $.extend({}, _.originalSettings, 6395 _.breakpointSettings[ 6396 targetBreakpoint]); 6397 if (initial === true) { 6398 _.currentSlide = _.options.initialSlide; 6399 } 6400 _.refresh(initial); 6401 } 6402 triggerBreakpoint = targetBreakpoint; 6403 } 6404 } else { 6405 if (_.activeBreakpoint !== null) { 6406 _.activeBreakpoint = null; 6407 _.options = _.originalSettings; 6408 if (initial === true) { 6409 _.currentSlide = _.options.initialSlide; 6410 } 6411 _.refresh(initial); 6412 triggerBreakpoint = targetBreakpoint; 6413 } 6414 } 6415 6416 // only trigger breakpoints during an actual break. not on initialize. 6417 if( !initial && triggerBreakpoint !== false ) { 6418 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 6419 } 6420 } 6421 6422 }; 6423 6424 Slick.prototype.changeSlide = function(event, dontAnimate) { 6425 6426 var _ = this, 6427 $target = $(event.currentTarget), 6428 indexOffset, slideOffset, unevenOffset; 6429 6430 // If target is a link, prevent default action. 6431 if($target.is('a')) { 6432 event.preventDefault(); 6433 } 6434 6435 // If target is not the <li> element (ie: a child), find the <li>. 6436 if(!$target.is('li')) { 6437 $target = $target.closest('li'); 6438 } 6439 6440 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 6441 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 6442 6443 switch (event.data.message) { 6444 6445 case 'previous': 6446 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 6447 if (_.slideCount > _.options.slidesToShow) { 6448 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 6449 } 6450 break; 6451 6452 case 'next': 6453 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 6454 if (_.slideCount > _.options.slidesToShow) { 6455 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 6456 } 6457 break; 6458 6459 case 'index': 6460 var index = event.data.index === 0 ? 0 : 6461 event.data.index || $target.index() * _.options.slidesToScroll; 6462 6463 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 6464 $target.children().trigger('focus'); 6465 break; 6466 6467 default: 6468 return; 6469 } 6470 6471 }; 6472 6473 Slick.prototype.checkNavigable = function(index) { 6474 6475 var _ = this, 6476 navigables, prevNavigable; 6477 6478 navigables = _.getNavigableIndexes(); 6479 prevNavigable = 0; 6480 if (index > navigables[navigables.length - 1]) { 6481 index = navigables[navigables.length - 1]; 6482 } else { 6483 for (var n in navigables) { 6484 if (index < navigables[n]) { 6485 index = prevNavigable; 6486 break; 6487 } 6488 prevNavigable = navigables[n]; 6489 } 6490 } 6491 6492 return index; 6493 }; 6494 6495 Slick.prototype.cleanUpEvents = function() { 6496 6497 var _ = this; 6498 6499 if (_.options.dots && _.$dots !== null) { 6500 6501 $('li', _.$dots) 6502 .off('click.slick', _.changeSlide) 6503 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 6504 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 6505 6506 if (_.options.accessibility === true) { 6507 _.$dots.off('keydown.slick', _.keyHandler); 6508 } 6509 } 6510 6511 _.$slider.off('focus.slick blur.slick'); 6512 6513 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 6514 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 6515 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 6516 6517 if (_.options.accessibility === true) { 6518 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 6519 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 6520 } 6521 } 6522 6523 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 6524 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 6525 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 6526 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 6527 6528 _.$list.off('click.slick', _.clickHandler); 6529 6530 $(document).off(_.visibilityChange, _.visibility); 6531 6532 _.cleanUpSlideEvents(); 6533 6534 if (_.options.accessibility === true) { 6535 _.$list.off('keydown.slick', _.keyHandler); 6536 } 6537 6538 if (_.options.focusOnSelect === true) { 6539 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 6540 } 6541 6542 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 6543 6544 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 6545 6546 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 6547 6548 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 6549 6550 }; 6551 6552 Slick.prototype.cleanUpSlideEvents = function() { 6553 6554 var _ = this; 6555 6556 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 6557 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 6558 6559 }; 6560 6561 Slick.prototype.cleanUpRows = function() { 6562 6563 var _ = this, originalSlides; 6564 6565 if(_.options.rows > 1) { 6566 originalSlides = _.$slides.children().children(); 6567 originalSlides.removeAttr('style'); 6568 _.$slider.empty().append(originalSlides); 6569 } 6570 6571 }; 6572 6573 Slick.prototype.clickHandler = function(event) { 6574 6575 var _ = this; 6576 6577 if (_.shouldClick === false) { 6578 event.stopImmediatePropagation(); 6579 event.stopPropagation(); 6580 event.preventDefault(); 6581 } 6582 6583 }; 6584 6585 Slick.prototype.destroy = function(refresh) { 6586 6587 var _ = this; 6588 6589 _.autoPlayClear(); 6590 6591 _.touchObject = {}; 6592 6593 _.cleanUpEvents(); 6594 6595 $('.slick-cloned', _.$slider).detach(); 6596 6597 if (_.$dots) { 6598 _.$dots.remove(); 6599 } 6600 6601 if ( _.$prevArrow && _.$prevArrow.length ) { 6602 6603 _.$prevArrow 6604 .removeClass('slick-disabled slick-arrow slick-hidden') 6605 .removeAttr('aria-hidden aria-disabled tabindex') 6606 .css('display',''); 6607 6608 if ( _.htmlExpr.test( _.options.prevArrow )) { 6609 _.$prevArrow.remove(); 6610 } 6611 } 6612 6613 if ( _.$nextArrow && _.$nextArrow.length ) { 6614 6615 _.$nextArrow 6616 .removeClass('slick-disabled slick-arrow slick-hidden') 6617 .removeAttr('aria-hidden aria-disabled tabindex') 6618 .css('display',''); 6619 6620 if ( _.htmlExpr.test( _.options.nextArrow )) { 6621 _.$nextArrow.remove(); 6622 } 6623 } 6624 6625 6626 if (_.$slides) { 6627 6628 _.$slides 6629 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 6630 .removeAttr('aria-hidden') 6631 .removeAttr('data-slick-index') 6632 .each(function(){ 6633 $(this).attr('style', $(this).data('originalStyling')); 6634 }); 6635 6636 _.$slideTrack.children(this.options.slide).detach(); 6637 6638 _.$slideTrack.detach(); 6639 6640 _.$list.detach(); 6641 6642 _.$slider.append(_.$slides); 6643 } 6644 6645 _.cleanUpRows(); 6646 6647 _.$slider.removeClass('slick-slider'); 6648 _.$slider.removeClass('slick-initialized'); 6649 _.$slider.removeClass('slick-dotted'); 6650 6651 _.unslicked = true; 6652 6653 if(!refresh) { 6654 _.$slider.trigger('destroy', [_]); 6655 } 6656 6657 }; 6658 6659 Slick.prototype.disableTransition = function(slide) { 6660 6661 var _ = this, 6662 transition = {}; 6663 6664 transition[_.transitionType] = ''; 6665 6666 if (_.options.fade === false) { 6667 _.$slideTrack.css(transition); 6668 } else { 6669 _.$slides.eq(slide).css(transition); 6670 } 6671 6672 }; 6673 6674 Slick.prototype.fadeSlide = function(slideIndex, callback) { 6675 6676 var _ = this; 6677 6678 if (_.cssTransitions === false) { 6679 6680 _.$slides.eq(slideIndex).css({ 6681 zIndex: _.options.zIndex 6682 }); 6683 6684 _.$slides.eq(slideIndex).animate({ 6685 opacity: 1 6686 }, _.options.speed, _.options.easing, callback); 6687 6688 } else { 6689 6690 _.applyTransition(slideIndex); 6691 6692 _.$slides.eq(slideIndex).css({ 6693 opacity: 1, 6694 zIndex: _.options.zIndex 6695 }); 6696 6697 if (callback) { 6698 setTimeout(function() { 6699 6700 _.disableTransition(slideIndex); 6701 6702 callback.call(); 6703 }, _.options.speed); 6704 } 6705 6706 } 6707 6708 }; 6709 6710 Slick.prototype.fadeSlideOut = function(slideIndex) { 6711 6712 var _ = this; 6713 6714 if (_.cssTransitions === false) { 6715 6716 _.$slides.eq(slideIndex).animate({ 6717 opacity: 0, 6718 zIndex: _.options.zIndex - 2 6719 }, _.options.speed, _.options.easing); 6720 6721 } else { 6722 6723 _.applyTransition(slideIndex); 6724 6725 _.$slides.eq(slideIndex).css({ 6726 opacity: 0, 6727 zIndex: _.options.zIndex - 2 6728 }); 6729 6730 } 6731 6732 }; 6733 6734 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 6735 6736 var _ = this; 6737 6738 if (filter !== null) { 6739 6740 _.$slidesCache = _.$slides; 6741 6742 _.unload(); 6743 6744 _.$slideTrack.children(this.options.slide).detach(); 6745 6746 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 6747 6748 _.reinit(); 6749 6750 } 6751 6752 }; 6753 6754 Slick.prototype.focusHandler = function() { 6755 6756 var _ = this; 6757 6758 _.$slider 6759 .off('focus.slick blur.slick') 6760 .on('focus.slick blur.slick', '*', function(event) { 6761 6762 event.stopImmediatePropagation(); 6763 var $sf = $(this); 6764 6765 setTimeout(function() { 6766 6767 if( _.options.pauseOnFocus ) { 6768 _.focussed = $sf.is(':focus'); 6769 _.autoPlay(); 6770 } 6771 6772 }, 0); 6773 6774 }); 6775 }; 6776 6777 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 6778 6779 var _ = this; 6780 return _.currentSlide; 6781 6782 }; 6783 6784 Slick.prototype.getDotCount = function() { 6785 6786 var _ = this; 6787 6788 var breakPoint = 0; 6789 var counter = 0; 6790 var pagerQty = 0; 6791 6792 if (_.options.infinite === true) { 6793 if (_.slideCount <= _.options.slidesToShow) { 6794 ++pagerQty; 6795 } else { 6796 while (breakPoint < _.slideCount) { 6797 ++pagerQty; 6798 breakPoint = counter + _.options.slidesToScroll; 6799 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 6800 } 6801 } 6802 } else if (_.options.centerMode === true) { 6803 pagerQty = _.slideCount; 6804 } else if(!_.options.asNavFor) { 6805 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 6806 }else { 6807 while (breakPoint < _.slideCount) { 6808 ++pagerQty; 6809 breakPoint = counter + _.options.slidesToScroll; 6810 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 6811 } 6812 } 6813 6814 return pagerQty - 1; 6815 6816 }; 6817 6818 Slick.prototype.getLeft = function(slideIndex) { 6819 6820 var _ = this, 6821 targetLeft, 6822 verticalHeight, 6823 verticalOffset = 0, 6824 targetSlide, 6825 coef; 6826 6827 _.slideOffset = 0; 6828 verticalHeight = _.$slides.first().outerHeight(true); 6829 6830 if (_.options.infinite === true) { 6831 if (_.slideCount > _.options.slidesToShow) { 6832 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 6833 coef = -1 6834 6835 if (_.options.vertical === true && _.options.centerMode === true) { 6836 if (_.options.slidesToShow === 2) { 6837 coef = -1.5; 6838 } else if (_.options.slidesToShow === 1) { 6839 coef = -2 6840 } 6841 } 6842 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 6843 } 6844 if (_.slideCount % _.options.slidesToScroll !== 0) { 6845 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 6846 if (slideIndex > _.slideCount) { 6847 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 6848 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 6849 } else { 6850 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 6851 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 6852 } 6853 } 6854 } 6855 } else { 6856 if (slideIndex + _.options.slidesToShow > _.slideCount) { 6857 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 6858 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 6859 } 6860 } 6861 6862 if (_.slideCount <= _.options.slidesToShow) { 6863 _.slideOffset = 0; 6864 verticalOffset = 0; 6865 } 6866 6867 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 6868 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 6869 } else if (_.options.centerMode === true && _.options.infinite === true) { 6870 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 6871 } else if (_.options.centerMode === true) { 6872 _.slideOffset = 0; 6873 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 6874 } 6875 6876 if (_.options.vertical === false) { 6877 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 6878 } else { 6879 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 6880 } 6881 6882 if (_.options.variableWidth === true) { 6883 6884 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 6885 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 6886 } else { 6887 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 6888 } 6889 6890 if (_.options.rtl === true) { 6891 if (targetSlide[0]) { 6892 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 6893 } else { 6894 targetLeft = 0; 6895 } 6896 } else { 6897 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 6898 } 6899 6900 if (_.options.centerMode === true) { 6901 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 6902 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 6903 } else { 6904 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 6905 } 6906 6907 if (_.options.rtl === true) { 6908 if (targetSlide[0]) { 6909 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 6910 } else { 6911 targetLeft = 0; 6912 } 6913 } else { 6914 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 6915 } 6916 6917 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 6918 } 6919 } 6920 6921 return targetLeft; 6922 6923 }; 6924 6925 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 6926 6927 var _ = this; 6928 6929 return _.options[option]; 6930 6931 }; 6932 6933 Slick.prototype.getNavigableIndexes = function() { 6934 6935 var _ = this, 6936 breakPoint = 0, 6937 counter = 0, 6938 indexes = [], 6939 max; 6940 6941 if (_.options.infinite === false) { 6942 max = _.slideCount; 6943 } else { 6944 breakPoint = _.options.slidesToScroll * -1; 6945 counter = _.options.slidesToScroll * -1; 6946 max = _.slideCount * 2; 6947 } 6948 6949 while (breakPoint < max) { 6950 indexes.push(breakPoint); 6951 breakPoint = counter + _.options.slidesToScroll; 6952 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 6953 } 6954 6955 return indexes; 6956 6957 }; 6958 6959 Slick.prototype.getSlick = function() { 6960 6961 return this; 6962 6963 }; 6964 6965 Slick.prototype.getSlideCount = function() { 6966 6967 var _ = this, 6968 slidesTraversed, swipedSlide, centerOffset; 6969 6970 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 6971 6972 if (_.options.swipeToSlide === true) { 6973 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 6974 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 6975 swipedSlide = slide; 6976 return false; 6977 } 6978 }); 6979 6980 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 6981 6982 return slidesTraversed; 6983 6984 } else { 6985 return _.options.slidesToScroll; 6986 } 6987 6988 }; 6989 6990 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 6991 6992 var _ = this; 6993 6994 _.changeSlide({ 6995 data: { 6996 message: 'index', 6997 index: parseInt(slide) 6998 } 6999 }, dontAnimate); 7000 7001 }; 7002 7003 Slick.prototype.init = function(creation) { 7004 7005 var _ = this; 7006 7007 if (!$(_.$slider).hasClass('slick-initialized')) { 7008 7009 $(_.$slider).addClass('slick-initialized'); 7010 7011 _.buildRows(); 7012 _.buildOut(); 7013 _.setProps(); 7014 _.startLoad(); 7015 _.loadSlider(); 7016 _.initializeEvents(); 7017 _.updateArrows(); 7018 _.updateDots(); 7019 _.checkResponsive(true); 7020 _.focusHandler(); 7021 7022 } 7023 7024 if (creation) { 7025 _.$slider.trigger('init', [_]); 7026 } 7027 7028 if (_.options.accessibility === true) { 7029 _.initADA(); 7030 } 7031 7032 if ( _.options.autoplay ) { 7033 7034 _.paused = false; 7035 _.autoPlay(); 7036 7037 } 7038 7039 }; 7040 7041 Slick.prototype.initADA = function() { 7042 var _ = this, 7043 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 7044 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 7045 return (val >= 0) && (val < _.slideCount); 7046 }); 7047 7048 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 7049 'aria-hidden': 'true', 7050 'tabindex': '-1' 7051 }).find('a, input, button, select').attr({ 7052 'tabindex': '-1' 7053 }); 7054 7055 if (_.$dots !== null) { 7056 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 7057 var slideControlIndex = tabControlIndexes.indexOf(i); 7058 7059 $(this).attr({ 7060 'role': 'tabpanel', 7061 'id': 'slick-slide' + _.instanceUid + i, 7062 'tabindex': -1 7063 }); 7064 7065 if (slideControlIndex !== -1) { 7066 $(this).attr({ 7067 'aria-describedby': 'slick-slide-control' + _.instanceUid + slideControlIndex 7068 }); 7069 } 7070 }); 7071 7072 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 7073 var mappedSlideIndex = tabControlIndexes[i]; 7074 7075 $(this).attr({ 7076 'role': 'presentation' 7077 }); 7078 7079 $(this).find('button').first().attr({ 7080 'role': 'tab', 7081 'id': 'slick-slide-control' + _.instanceUid + i, 7082 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 7083 'aria-label': (i + 1) + ' of ' + numDotGroups, 7084 'aria-selected': null, 7085 'tabindex': '-1' 7086 }); 7087 7088 }).eq(_.currentSlide).find('button').attr({ 7089 'aria-selected': 'true', 7090 'tabindex': '0' 7091 }).end(); 7092 } 7093 7094 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 7095 _.$slides.eq(i).attr('tabindex', 0); 7096 } 7097 7098 _.activateADA(); 7099 7100 }; 7101 7102 Slick.prototype.initArrowEvents = function() { 7103 7104 var _ = this; 7105 7106 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 7107 _.$prevArrow 7108 .off('click.slick') 7109 .on('click.slick', { 7110 message: 'previous' 7111 }, _.changeSlide); 7112 _.$nextArrow 7113 .off('click.slick') 7114 .on('click.slick', { 7115 message: 'next' 7116 }, _.changeSlide); 7117 7118 if (_.options.accessibility === true) { 7119 _.$prevArrow.on('keydown.slick', _.keyHandler); 7120 _.$nextArrow.on('keydown.slick', _.keyHandler); 7121 } 7122 } 7123 7124 }; 7125 7126 Slick.prototype.initDotEvents = function() { 7127 7128 var _ = this; 7129 7130 if (_.options.dots === true) { 7131 $('li', _.$dots).on('click.slick', { 7132 message: 'index' 7133 }, _.changeSlide); 7134 7135 if (_.options.accessibility === true) { 7136 _.$dots.on('keydown.slick', _.keyHandler); 7137 } 7138 } 7139 7140 if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) { 7141 7142 $('li', _.$dots) 7143 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 7144 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 7145 7146 } 7147 7148 }; 7149 7150 Slick.prototype.initSlideEvents = function() { 7151 7152 var _ = this; 7153 7154 if ( _.options.pauseOnHover ) { 7155 7156 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 7157 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 7158 7159 } 7160 7161 }; 7162 7163 Slick.prototype.initializeEvents = function() { 7164 7165 var _ = this; 7166 7167 _.initArrowEvents(); 7168 7169 _.initDotEvents(); 7170 _.initSlideEvents(); 7171 7172 _.$list.on('touchstart.slick mousedown.slick', { 7173 action: 'start' 7174 }, _.swipeHandler); 7175 _.$list.on('touchmove.slick mousemove.slick', { 7176 action: 'move' 7177 }, _.swipeHandler); 7178 _.$list.on('touchend.slick mouseup.slick', { 7179 action: 'end' 7180 }, _.swipeHandler); 7181 _.$list.on('touchcancel.slick mouseleave.slick', { 7182 action: 'end' 7183 }, _.swipeHandler); 7184 7185 _.$list.on('click.slick', _.clickHandler); 7186 7187 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 7188 7189 if (_.options.accessibility === true) { 7190 _.$list.on('keydown.slick', _.keyHandler); 7191 } 7192 7193 if (_.options.focusOnSelect === true) { 7194 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 7195 } 7196 7197 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 7198 7199 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 7200 7201 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 7202 7203 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 7204 $(_.setPosition); 7205 7206 }; 7207 7208 Slick.prototype.initUI = function() { 7209 7210 var _ = this; 7211 7212 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 7213 7214 _.$prevArrow.show(); 7215 _.$nextArrow.show(); 7216 7217 } 7218 7219 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 7220 7221 _.$dots.show(); 7222 7223 } 7224 7225 }; 7226 7227 Slick.prototype.keyHandler = function(event) { 7228 7229 var _ = this; 7230 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 7231 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 7232 if (event.keyCode === 37 && _.options.accessibility === true) { 7233 _.changeSlide({ 7234 data: { 7235 message: _.options.rtl === true ? 'next' : 'previous' 7236 } 7237 }); 7238 } else if (event.keyCode === 39 && _.options.accessibility === true) { 7239 _.changeSlide({ 7240 data: { 7241 message: _.options.rtl === true ? 'previous' : 'next' 7242 } 7243 }); 7244 } 7245 } 7246 7247 }; 7248 7249 Slick.prototype.lazyLoad = function() { 7250 7251 var _ = this, 7252 loadRange, cloneRange, rangeStart, rangeEnd; 7253 7254 function loadImages(imagesScope) { 7255 7256 $('img[data-lazy]', imagesScope).each(function() { 7257 7258 var image = $(this), 7259 imageSource = $(this).attr('data-lazy'), 7260 imageSrcSet = $(this).attr('data-srcset'), 7261 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 7262 imageToLoad = document.createElement('img'); 7263 7264 imageToLoad.onload = function() { 7265 7266 image 7267 .animate({ opacity: 0 }, 100, function() { 7268 7269 if (imageSrcSet) { 7270 image 7271 .attr('srcset', imageSrcSet ); 7272 7273 if (imageSizes) { 7274 image 7275 .attr('sizes', imageSizes ); 7276 } 7277 } 7278 7279 image 7280 .attr('src', imageSource) 7281 .animate({ opacity: 1 }, 200, function() { 7282 image 7283 .removeAttr('data-lazy data-srcset data-sizes') 7284 .removeClass('slick-loading'); 7285 }); 7286 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 7287 }); 7288 7289 }; 7290 7291 imageToLoad.onerror = function() { 7292 7293 image 7294 .removeAttr( 'data-lazy' ) 7295 .removeClass( 'slick-loading' ) 7296 .addClass( 'slick-lazyload-error' ); 7297 7298 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 7299 7300 }; 7301 7302 imageToLoad.src = imageSource; 7303 7304 }); 7305 7306 } 7307 7308 if (_.options.centerMode === true) { 7309 if (_.options.infinite === true) { 7310 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 7311 rangeEnd = rangeStart + _.options.slidesToShow + 2; 7312 } else { 7313 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 7314 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 7315 } 7316 } else { 7317 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 7318 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 7319 if (_.options.fade === true) { 7320 if (rangeStart > 0) rangeStart--; 7321 if (rangeEnd <= _.slideCount) rangeEnd++; 7322 } 7323 } 7324 7325 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 7326 7327 if (_.options.lazyLoad === 'anticipated') { 7328 var prevSlide = rangeStart - 1, 7329 nextSlide = rangeEnd, 7330 $slides = _.$slider.find('.slick-slide'); 7331 7332 for (var i = 0; i < _.options.slidesToScroll; i++) { 7333 if (prevSlide < 0) prevSlide = _.slideCount - 1; 7334 loadRange = loadRange.add($slides.eq(prevSlide)); 7335 loadRange = loadRange.add($slides.eq(nextSlide)); 7336 prevSlide--; 7337 nextSlide++; 7338 } 7339 } 7340 7341 loadImages(loadRange); 7342 7343 if (_.slideCount <= _.options.slidesToShow) { 7344 cloneRange = _.$slider.find('.slick-slide'); 7345 loadImages(cloneRange); 7346 } else 7347 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 7348 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 7349 loadImages(cloneRange); 7350 } else if (_.currentSlide === 0) { 7351 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 7352 loadImages(cloneRange); 7353 } 7354 7355 }; 7356 7357 Slick.prototype.loadSlider = function() { 7358 7359 var _ = this; 7360 7361 _.setPosition(); 7362 7363 _.$slideTrack.css({ 7364 opacity: 1 7365 }); 7366 7367 _.$slider.removeClass('slick-loading'); 7368 7369 _.initUI(); 7370 7371 if (_.options.lazyLoad === 'progressive') { 7372 _.progressiveLazyLoad(); 7373 } 7374 7375 }; 7376 7377 Slick.prototype.next = Slick.prototype.slickNext = function() { 7378 7379 var _ = this; 7380 7381 _.changeSlide({ 7382 data: { 7383 message: 'next' 7384 } 7385 }); 7386 7387 }; 7388 7389 Slick.prototype.orientationChange = function() { 7390 7391 var _ = this; 7392 7393 _.checkResponsive(); 7394 _.setPosition(); 7395 7396 }; 7397 7398 Slick.prototype.pause = Slick.prototype.slickPause = function() { 7399 7400 var _ = this; 7401 7402 _.autoPlayClear(); 7403 _.paused = true; 7404 7405 }; 7406 7407 Slick.prototype.play = Slick.prototype.slickPlay = function() { 7408 7409 var _ = this; 7410 7411 _.autoPlay(); 7412 _.options.autoplay = true; 7413 _.paused = false; 7414 _.focussed = false; 7415 _.interrupted = false; 7416 7417 }; 7418 7419 Slick.prototype.postSlide = function(index) { 7420 7421 var _ = this; 7422 7423 if( !_.unslicked ) { 7424 7425 _.$slider.trigger('afterChange', [_, index]); 7426 7427 _.animating = false; 7428 7429 if (_.slideCount > _.options.slidesToShow) { 7430 _.setPosition(); 7431 } 7432 7433 _.swipeLeft = null; 7434 7435 if ( _.options.autoplay ) { 7436 _.autoPlay(); 7437 } 7438 7439 if (_.options.accessibility === true) { 7440 _.initADA(); 7441 7442 if (_.options.focusOnChange) { 7443 var $currentSlide = $(_.$slides.get(_.currentSlide)); 7444 $currentSlide.attr('tabindex', 0).focus(); 7445 } 7446 } 7447 7448 } 7449 7450 }; 7451 7452 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 7453 7454 var _ = this; 7455 7456 _.changeSlide({ 7457 data: { 7458 message: 'previous' 7459 } 7460 }); 7461 7462 }; 7463 7464 Slick.prototype.preventDefault = function(event) { 7465 7466 event.preventDefault(); 7467 7468 }; 7469 7470 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 7471 7472 tryCount = tryCount || 1; 7473 7474 var _ = this, 7475 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 7476 image, 7477 imageSource, 7478 imageSrcSet, 7479 imageSizes, 7480 imageToLoad; 7481 7482 if ( $imgsToLoad.length ) { 7483 7484 image = $imgsToLoad.first(); 7485 imageSource = image.attr('data-lazy'); 7486 imageSrcSet = image.attr('data-srcset'); 7487 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 7488 imageToLoad = document.createElement('img'); 7489 7490 imageToLoad.onload = function() { 7491 7492 if (imageSrcSet) { 7493 image 7494 .attr('srcset', imageSrcSet ); 7495 7496 if (imageSizes) { 7497 image 7498 .attr('sizes', imageSizes ); 7499 } 7500 } 7501 7502 image 7503 .attr( 'src', imageSource ) 7504 .removeAttr('data-lazy data-srcset data-sizes') 7505 .removeClass('slick-loading'); 7506 7507 if ( _.options.adaptiveHeight === true ) { 7508 _.setPosition(); 7509 } 7510 7511 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 7512 _.progressiveLazyLoad(); 7513 7514 }; 7515 7516 imageToLoad.onerror = function() { 7517 7518 if ( tryCount < 3 ) { 7519 7520 /** 7521 * try to load the image 3 times, 7522 * leave a slight delay so we don't get 7523 * servers blocking the request. 7524 */ 7525 setTimeout( function() { 7526 _.progressiveLazyLoad( tryCount + 1 ); 7527 }, 500 ); 7528 7529 } else { 7530 7531 image 7532 .removeAttr( 'data-lazy' ) 7533 .removeClass( 'slick-loading' ) 7534 .addClass( 'slick-lazyload-error' ); 7535 7536 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 7537 7538 _.progressiveLazyLoad(); 7539 7540 } 7541 7542 }; 7543 7544 imageToLoad.src = imageSource; 7545 7546 } else { 7547 7548 _.$slider.trigger('allImagesLoaded', [ _ ]); 7549 7550 } 7551 7552 }; 7553 7554 Slick.prototype.refresh = function( initializing ) { 7555 7556 var _ = this, currentSlide, lastVisibleIndex; 7557 7558 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 7559 7560 // in non-infinite sliders, we don't want to go past the 7561 // last visible index. 7562 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 7563 _.currentSlide = lastVisibleIndex; 7564 } 7565 7566 // if less slides than to show, go to start. 7567 if ( _.slideCount <= _.options.slidesToShow ) { 7568 _.currentSlide = 0; 7569 7570 } 7571 7572 currentSlide = _.currentSlide; 7573 7574 _.destroy(true); 7575 7576 $.extend(_, _.initials, { currentSlide: currentSlide }); 7577 7578 _.init(); 7579 7580 if( !initializing ) { 7581 7582 _.changeSlide({ 7583 data: { 7584 message: 'index', 7585 index: currentSlide 7586 } 7587 }, false); 7588 7589 } 7590 7591 }; 7592 7593 Slick.prototype.registerBreakpoints = function() { 7594 7595 var _ = this, breakpoint, currentBreakpoint, l, 7596 responsiveSettings = _.options.responsive || null; 7597 7598 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 7599 7600 _.respondTo = _.options.respondTo || 'window'; 7601 7602 for ( breakpoint in responsiveSettings ) { 7603 7604 l = _.breakpoints.length-1; 7605 7606 if (responsiveSettings.hasOwnProperty(breakpoint)) { 7607 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 7608 7609 // loop through the breakpoints and cut out any existing 7610 // ones with the same breakpoint number, we don't want dupes. 7611 while( l >= 0 ) { 7612 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 7613 _.breakpoints.splice(l,1); 7614 } 7615 l--; 7616 } 7617 7618 _.breakpoints.push(currentBreakpoint); 7619 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 7620 7621 } 7622 7623 } 7624 7625 _.breakpoints.sort(function(a, b) { 7626 return ( _.options.mobileFirst ) ? a-b : b-a; 7627 }); 7628 7629 } 7630 7631 }; 7632 7633 Slick.prototype.reinit = function() { 7634 7635 var _ = this; 7636 7637 _.$slides = 7638 _.$slideTrack 7639 .children(_.options.slide) 7640 .addClass('slick-slide'); 7641 7642 _.slideCount = _.$slides.length; 7643 7644 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 7645 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 7646 } 7647 7648 if (_.slideCount <= _.options.slidesToShow) { 7649 _.currentSlide = 0; 7650 } 7651 7652 _.registerBreakpoints(); 7653 7654 _.setProps(); 7655 _.setupInfinite(); 7656 _.buildArrows(); 7657 _.updateArrows(); 7658 _.initArrowEvents(); 7659 _.buildDots(); 7660 _.updateDots(); 7661 _.initDotEvents(); 7662 _.cleanUpSlideEvents(); 7663 _.initSlideEvents(); 7664 7665 _.checkResponsive(false, true); 7666 7667 if (_.options.focusOnSelect === true) { 7668 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 7669 } 7670 7671 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 7672 7673 _.setPosition(); 7674 _.focusHandler(); 7675 7676 _.paused = !_.options.autoplay; 7677 _.autoPlay(); 7678 7679 _.$slider.trigger('reInit', [_]); 7680 7681 }; 7682 7683 Slick.prototype.resize = function() { 7684 7685 var _ = this; 7686 7687 if ($(window).width() !== _.windowWidth) { 7688 clearTimeout(_.windowDelay); 7689 _.windowDelay = window.setTimeout(function() { 7690 _.windowWidth = $(window).width(); 7691 _.checkResponsive(); 7692 if( !_.unslicked ) { _.setPosition(); } 7693 }, 50); 7694 } 7695 }; 7696 7697 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 7698 7699 var _ = this; 7700 7701 if (typeof(index) === 'boolean') { 7702 removeBefore = index; 7703 index = removeBefore === true ? 0 : _.slideCount - 1; 7704 } else { 7705 index = removeBefore === true ? --index : index; 7706 } 7707 7708 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 7709 return false; 7710 } 7711 7712 _.unload(); 7713 7714 if (removeAll === true) { 7715 _.$slideTrack.children().remove(); 7716 } else { 7717 _.$slideTrack.children(this.options.slide).eq(index).remove(); 7718 } 7719 7720 _.$slides = _.$slideTrack.children(this.options.slide); 7721 7722 _.$slideTrack.children(this.options.slide).detach(); 7723 7724 _.$slideTrack.append(_.$slides); 7725 7726 _.$slidesCache = _.$slides; 7727 7728 _.reinit(); 7729 7730 }; 7731 7732 Slick.prototype.setCSS = function(position) { 7733 7734 var _ = this, 7735 positionProps = {}, 7736 x, y; 7737 7738 if (_.options.rtl === true) { 7739 position = -position; 7740 } 7741 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 7742 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 7743 7744 positionProps[_.positionProp] = position; 7745 7746 if (_.transformsEnabled === false) { 7747 _.$slideTrack.css(positionProps); 7748 } else { 7749 positionProps = {}; 7750 if (_.cssTransitions === false) { 7751 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 7752 _.$slideTrack.css(positionProps); 7753 } else { 7754 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 7755 _.$slideTrack.css(positionProps); 7756 } 7757 } 7758 7759 }; 7760 7761 Slick.prototype.setDimensions = function() { 7762 7763 var _ = this; 7764 7765 if (_.options.vertical === false) { 7766 if (_.options.centerMode === true) { 7767 _.$list.css({ 7768 padding: ('0px ' + _.options.centerPadding) 7769 }); 7770 } 7771 } else { 7772 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 7773 if (_.options.centerMode === true) { 7774 _.$list.css({ 7775 padding: (_.options.centerPadding + ' 0px') 7776 }); 7777 } 7778 } 7779 7780 _.listWidth = _.$list.width(); 7781 _.listHeight = _.$list.height(); 7782 7783 7784 if (_.options.vertical === false && _.options.variableWidth === false) { 7785 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 7786 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 7787 7788 } else if (_.options.variableWidth === true) { 7789 _.$slideTrack.width(5000 * _.slideCount); 7790 } else { 7791 _.slideWidth = Math.ceil(_.listWidth); 7792 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 7793 } 7794 7795 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 7796 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 7797 7798 }; 7799 7800 Slick.prototype.setFade = function() { 7801 7802 var _ = this, 7803 targetLeft; 7804 7805 _.$slides.each(function(index, element) { 7806 targetLeft = (_.slideWidth * index) * -1; 7807 if (_.options.rtl === true) { 7808 $(element).css({ 7809 position: 'relative', 7810 right: targetLeft, 7811 top: 0, 7812 zIndex: _.options.zIndex - 2, 7813 opacity: 0 7814 }); 7815 } else { 7816 $(element).css({ 7817 position: 'relative', 7818 left: targetLeft, 7819 top: 0, 7820 zIndex: _.options.zIndex - 2, 7821 opacity: 0 7822 }); 7823 } 7824 }); 7825 7826 _.$slides.eq(_.currentSlide).css({ 7827 zIndex: _.options.zIndex - 1, 7828 opacity: 1 7829 }); 7830 7831 }; 7832 7833 Slick.prototype.setHeight = function() { 7834 7835 var _ = this; 7836 7837 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 7838 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 7839 _.$list.css('height', targetHeight); 7840 } 7841 7842 }; 7843 7844 Slick.prototype.setOption = 7845 Slick.prototype.slickSetOption = function() { 7846 7847 /** 7848 * accepts arguments in format of: 7849 * 7850 * - for changing a single option's value: 7851 * .slick("setOption", option, value, refresh ) 7852 * 7853 * - for changing a set of responsive options: 7854 * .slick("setOption", 'responsive', [{}, ...], refresh ) 7855 * 7856 * - for updating multiple values at once (not responsive) 7857 * .slick("setOption", { 'option': value, ... }, refresh ) 7858 */ 7859 7860 var _ = this, l, item, option, value, refresh = false, type; 7861 7862 if( $.type( arguments[0] ) === 'object' ) { 7863 7864 option = arguments[0]; 7865 refresh = arguments[1]; 7866 type = 'multiple'; 7867 7868 } else if ( $.type( arguments[0] ) === 'string' ) { 7869 7870 option = arguments[0]; 7871 value = arguments[1]; 7872 refresh = arguments[2]; 7873 7874 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 7875 7876 type = 'responsive'; 7877 7878 } else if ( typeof arguments[1] !== 'undefined' ) { 7879 7880 type = 'single'; 7881 7882 } 7883 7884 } 7885 7886 if ( type === 'single' ) { 7887 7888 _.options[option] = value; 7889 7890 7891 } else if ( type === 'multiple' ) { 7892 7893 $.each( option , function( opt, val ) { 7894 7895 _.options[opt] = val; 7896 7897 }); 7898 7899 7900 } else if ( type === 'responsive' ) { 7901 7902 for ( item in value ) { 7903 7904 if( $.type( _.options.responsive ) !== 'array' ) { 7905 7906 _.options.responsive = [ value[item] ]; 7907 7908 } else { 7909 7910 l = _.options.responsive.length-1; 7911 7912 // loop through the responsive object and splice out duplicates. 7913 while( l >= 0 ) { 7914 7915 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 7916 7917 _.options.responsive.splice(l,1); 7918 7919 } 7920 7921 l--; 7922 7923 } 7924 7925 _.options.responsive.push( value[item] ); 7926 7927 } 7928 7929 } 7930 7931 } 7932 7933 if ( refresh ) { 7934 7935 _.unload(); 7936 _.reinit(); 7937 7938 } 7939 7940 }; 7941 7942 Slick.prototype.setPosition = function() { 7943 7944 var _ = this; 7945 7946 _.setDimensions(); 7947 7948 _.setHeight(); 7949 7950 if (_.options.fade === false) { 7951 _.setCSS(_.getLeft(_.currentSlide)); 7952 } else { 7953 _.setFade(); 7954 } 7955 7956 _.$slider.trigger('setPosition', [_]); 7957 7958 }; 7959 7960 Slick.prototype.setProps = function() { 7961 7962 var _ = this, 7963 bodyStyle = document.body.style; 7964 7965 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 7966 7967 if (_.positionProp === 'top') { 7968 _.$slider.addClass('slick-vertical'); 7969 } else { 7970 _.$slider.removeClass('slick-vertical'); 7971 } 7972 7973 if (bodyStyle.WebkitTransition !== undefined || 7974 bodyStyle.MozTransition !== undefined || 7975 bodyStyle.msTransition !== undefined) { 7976 if (_.options.useCSS === true) { 7977 _.cssTransitions = true; 7978 } 7979 } 7980 7981 if ( _.options.fade ) { 7982 if ( typeof _.options.zIndex === 'number' ) { 7983 if( _.options.zIndex < 3 ) { 7984 _.options.zIndex = 3; 7985 } 7986 } else { 7987 _.options.zIndex = _.defaults.zIndex; 7988 } 7989 } 7990 7991 if (bodyStyle.OTransform !== undefined) { 7992 _.animType = 'OTransform'; 7993 _.transformType = '-o-transform'; 7994 _.transitionType = 'OTransition'; 7995 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 7996 } 7997 if (bodyStyle.MozTransform !== undefined) { 7998 _.animType = 'MozTransform'; 7999 _.transformType = '-moz-transform'; 8000 _.transitionType = 'MozTransition'; 8001 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 8002 } 8003 if (bodyStyle.webkitTransform !== undefined) { 8004 _.animType = 'webkitTransform'; 8005 _.transformType = '-webkit-transform'; 8006 _.transitionType = 'webkitTransition'; 8007 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 8008 } 8009 if (bodyStyle.msTransform !== undefined) { 8010 _.animType = 'msTransform'; 8011 _.transformType = '-ms-transform'; 8012 _.transitionType = 'msTransition'; 8013 if (bodyStyle.msTransform === undefined) _.animType = false; 8014 } 8015 if (bodyStyle.transform !== undefined && _.animType !== false) { 8016 _.animType = 'transform'; 8017 _.transformType = 'transform'; 8018 _.transitionType = 'transition'; 8019 } 8020 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 8021 }; 8022 8023 8024 Slick.prototype.setSlideClasses = function(index) { 8025 8026 var _ = this, 8027 centerOffset, allSlides, indexOffset, remainder; 8028 8029 allSlides = _.$slider 8030 .find('.slick-slide') 8031 .removeClass('slick-active slick-center slick-current') 8032 .attr('aria-hidden', 'true'); 8033 8034 _.$slides 8035 .eq(index) 8036 .addClass('slick-current'); 8037 8038 if (_.options.centerMode === true) { 8039 8040 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 8041 8042 centerOffset = Math.floor(_.options.slidesToShow / 2); 8043 8044 if (_.options.infinite === true) { 8045 8046 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 8047 _.$slides 8048 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 8049 .addClass('slick-active') 8050 .attr('aria-hidden', 'false'); 8051 8052 } else { 8053 8054 indexOffset = _.options.slidesToShow + index; 8055 allSlides 8056 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 8057 .addClass('slick-active') 8058 .attr('aria-hidden', 'false'); 8059 8060 } 8061 8062 if (index === 0) { 8063 8064 allSlides 8065 .eq(allSlides.length - 1 - _.options.slidesToShow) 8066 .addClass('slick-center'); 8067 8068 } else if (index === _.slideCount - 1) { 8069 8070 allSlides 8071 .eq(_.options.slidesToShow) 8072 .addClass('slick-center'); 8073 8074 } 8075 8076 } 8077 8078 _.$slides 8079 .eq(index) 8080 .addClass('slick-center'); 8081 8082 } else { 8083 8084 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 8085 8086 _.$slides 8087 .slice(index, index + _.options.slidesToShow) 8088 .addClass('slick-active') 8089 .attr('aria-hidden', 'false'); 8090 8091 } else if (allSlides.length <= _.options.slidesToShow) { 8092 8093 allSlides 8094 .addClass('slick-active') 8095 .attr('aria-hidden', 'false'); 8096 8097 } else { 8098 8099 remainder = _.slideCount % _.options.slidesToShow; 8100 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 8101 8102 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 8103 8104 allSlides 8105 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 8106 .addClass('slick-active') 8107 .attr('aria-hidden', 'false'); 8108 8109 } else { 8110 8111 allSlides 8112 .slice(indexOffset, indexOffset + _.options.slidesToShow) 8113 .addClass('slick-active') 8114 .attr('aria-hidden', 'false'); 8115 8116 } 8117 8118 } 8119 8120 } 8121 8122 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 8123 _.lazyLoad(); 8124 } 8125 }; 8126 8127 Slick.prototype.setupInfinite = function() { 8128 8129 var _ = this, 8130 i, slideIndex, infiniteCount; 8131 8132 if (_.options.fade === true) { 8133 _.options.centerMode = false; 8134 } 8135 8136 if (_.options.infinite === true && _.options.fade === false) { 8137 8138 slideIndex = null; 8139 8140 if (_.slideCount > _.options.slidesToShow) { 8141 8142 if (_.options.centerMode === true) { 8143 infiniteCount = _.options.slidesToShow + 1; 8144 } else { 8145 infiniteCount = _.options.slidesToShow; 8146 } 8147 8148 for (i = _.slideCount; i > (_.slideCount - 8149 infiniteCount); i -= 1) { 8150 slideIndex = i - 1; 8151 $(_.$slides[slideIndex]).clone(true).attr('id', '') 8152 .attr('data-slick-index', slideIndex - _.slideCount) 8153 .prependTo(_.$slideTrack).addClass('slick-cloned'); 8154 } 8155 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 8156 slideIndex = i; 8157 $(_.$slides[slideIndex]).clone(true).attr('id', '') 8158 .attr('data-slick-index', slideIndex + _.slideCount) 8159 .appendTo(_.$slideTrack).addClass('slick-cloned'); 8160 } 8161 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 8162 $(this).attr('id', ''); 8163 }); 8164 8165 } 8166 8167 } 8168 8169 }; 8170 8171 Slick.prototype.interrupt = function( toggle ) { 8172 8173 var _ = this; 8174 8175 if( !toggle ) { 8176 _.autoPlay(); 8177 } 8178 _.interrupted = toggle; 8179 8180 }; 8181 8182 Slick.prototype.selectHandler = function(event) { 8183 8184 var _ = this; 8185 8186 var targetElement = 8187 $(event.target).is('.slick-slide') ? 8188 $(event.target) : 8189 $(event.target).parents('.slick-slide'); 8190 8191 var index = parseInt(targetElement.attr('data-slick-index')); 8192 8193 if (!index) index = 0; 8194 8195 if (_.slideCount <= _.options.slidesToShow) { 8196 8197 _.slideHandler(index, false, true); 8198 return; 8199 8200 } 8201 8202 _.slideHandler(index); 8203 8204 }; 8205 8206 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 8207 8208 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 8209 _ = this, navTarget; 8210 8211 sync = sync || false; 8212 8213 if (_.animating === true && _.options.waitForAnimate === true) { 8214 return; 8215 } 8216 8217 if (_.options.fade === true && _.currentSlide === index) { 8218 return; 8219 } 8220 8221 if (sync === false) { 8222 _.asNavFor(index); 8223 } 8224 8225 targetSlide = index; 8226 targetLeft = _.getLeft(targetSlide); 8227 slideLeft = _.getLeft(_.currentSlide); 8228 8229 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 8230 8231 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 8232 if (_.options.fade === false) { 8233 targetSlide = _.currentSlide; 8234 if (dontAnimate !== true) { 8235 _.animateSlide(slideLeft, function() { 8236 _.postSlide(targetSlide); 8237 }); 8238 } else { 8239 _.postSlide(targetSlide); 8240 } 8241 } 8242 return; 8243 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 8244 if (_.options.fade === false) { 8245 targetSlide = _.currentSlide; 8246 if (dontAnimate !== true) { 8247 _.animateSlide(slideLeft, function() { 8248 _.postSlide(targetSlide); 8249 }); 8250 } else { 8251 _.postSlide(targetSlide); 8252 } 8253 } 8254 return; 8255 } 8256 8257 if ( _.options.autoplay ) { 8258 clearInterval(_.autoPlayTimer); 8259 } 8260 8261 if (targetSlide < 0) { 8262 if (_.slideCount % _.options.slidesToScroll !== 0) { 8263 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 8264 } else { 8265 animSlide = _.slideCount + targetSlide; 8266 } 8267 } else if (targetSlide >= _.slideCount) { 8268 if (_.slideCount % _.options.slidesToScroll !== 0) { 8269 animSlide = 0; 8270 } else { 8271 animSlide = targetSlide - _.slideCount; 8272 } 8273 } else { 8274 animSlide = targetSlide; 8275 } 8276 8277 _.animating = true; 8278 8279 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 8280 8281 oldSlide = _.currentSlide; 8282 _.currentSlide = animSlide; 8283 8284 _.setSlideClasses(_.currentSlide); 8285 8286 if ( _.options.asNavFor ) { 8287 8288 navTarget = _.getNavTarget(); 8289 navTarget = navTarget.slick('getSlick'); 8290 8291 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 8292 navTarget.setSlideClasses(_.currentSlide); 8293 } 8294 8295 } 8296 8297 _.updateDots(); 8298 _.updateArrows(); 8299 8300 if (_.options.fade === true) { 8301 if (dontAnimate !== true) { 8302 8303 _.fadeSlideOut(oldSlide); 8304 8305 _.fadeSlide(animSlide, function() { 8306 _.postSlide(animSlide); 8307 }); 8308 8309 } else { 8310 _.postSlide(animSlide); 8311 } 8312 _.animateHeight(); 8313 return; 8314 } 8315 8316 if (dontAnimate !== true) { 8317 _.animateSlide(targetLeft, function() { 8318 _.postSlide(animSlide); 8319 }); 8320 } else { 8321 _.postSlide(animSlide); 8322 } 8323 8324 }; 8325 8326 Slick.prototype.startLoad = function() { 8327 8328 var _ = this; 8329 8330 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 8331 8332 _.$prevArrow.hide(); 8333 _.$nextArrow.hide(); 8334 8335 } 8336 8337 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 8338 8339 _.$dots.hide(); 8340 8341 } 8342 8343 _.$slider.addClass('slick-loading'); 8344 8345 }; 8346 8347 Slick.prototype.swipeDirection = function() { 8348 8349 var xDist, yDist, r, swipeAngle, _ = this; 8350 8351 xDist = _.touchObject.startX - _.touchObject.curX; 8352 yDist = _.touchObject.startY - _.touchObject.curY; 8353 r = Math.atan2(yDist, xDist); 8354 8355 swipeAngle = Math.round(r * 180 / Math.PI); 8356 if (swipeAngle < 0) { 8357 swipeAngle = 360 - Math.abs(swipeAngle); 8358 } 8359 8360 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 8361 return (_.options.rtl === false ? 'left' : 'right'); 8362 } 8363 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 8364 return (_.options.rtl === false ? 'left' : 'right'); 8365 } 8366 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 8367 return (_.options.rtl === false ? 'right' : 'left'); 8368 } 8369 if (_.options.verticalSwiping === true) { 8370 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 8371 return 'down'; 8372 } else { 8373 return 'up'; 8374 } 8375 } 8376 8377 return 'vertical'; 8378 8379 }; 8380 8381 Slick.prototype.swipeEnd = function(event) { 8382 8383 var _ = this, 8384 slideCount, 8385 direction; 8386 8387 _.dragging = false; 8388 _.swiping = false; 8389 8390 if (_.scrolling) { 8391 _.scrolling = false; 8392 return false; 8393 } 8394 8395 _.interrupted = false; 8396 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 8397 8398 if ( _.touchObject.curX === undefined ) { 8399 return false; 8400 } 8401 8402 if ( _.touchObject.edgeHit === true ) { 8403 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 8404 } 8405 8406 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 8407 8408 direction = _.swipeDirection(); 8409 8410 switch ( direction ) { 8411 8412 case 'left': 8413 case 'down': 8414 8415 slideCount = 8416 _.options.swipeToSlide ? 8417 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 8418 _.currentSlide + _.getSlideCount(); 8419 8420 _.currentDirection = 0; 8421 8422 break; 8423 8424 case 'right': 8425 case 'up': 8426 8427 slideCount = 8428 _.options.swipeToSlide ? 8429 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 8430 _.currentSlide - _.getSlideCount(); 8431 8432 _.currentDirection = 1; 8433 8434 break; 8435 8436 default: 8437 8438 8439 } 8440 8441 if( direction != 'vertical' ) { 8442 8443 _.slideHandler( slideCount ); 8444 _.touchObject = {}; 8445 _.$slider.trigger('swipe', [_, direction ]); 8446 8447 } 8448 8449 } else { 8450 8451 if ( _.touchObject.startX !== _.touchObject.curX ) { 8452 8453 _.slideHandler( _.currentSlide ); 8454 _.touchObject = {}; 8455 8456 } 8457 8458 } 8459 8460 }; 8461 8462 Slick.prototype.swipeHandler = function(event) { 8463 8464 var _ = this; 8465 8466 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 8467 return; 8468 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 8469 return; 8470 } 8471 8472 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 8473 event.originalEvent.touches.length : 1; 8474 8475 _.touchObject.minSwipe = _.listWidth / _.options 8476 .touchThreshold; 8477 8478 if (_.options.verticalSwiping === true) { 8479 _.touchObject.minSwipe = _.listHeight / _.options 8480 .touchThreshold; 8481 } 8482 8483 switch (event.data.action) { 8484 8485 case 'start': 8486 _.swipeStart(event); 8487 break; 8488 8489 case 'move': 8490 _.swipeMove(event); 8491 break; 8492 8493 case 'end': 8494 _.swipeEnd(event); 8495 break; 8496 8497 } 8498 8499 }; 8500 8501 Slick.prototype.swipeMove = function(event) { 8502 8503 var _ = this, 8504 edgeWasHit = false, 8505 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 8506 8507 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 8508 8509 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 8510 return false; 8511 } 8512 8513 curLeft = _.getLeft(_.currentSlide); 8514 8515 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 8516 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 8517 8518 _.touchObject.swipeLength = Math.round(Math.sqrt( 8519 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 8520 8521 verticalSwipeLength = Math.round(Math.sqrt( 8522 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 8523 8524 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 8525 _.scrolling = true; 8526 return false; 8527 } 8528 8529 if (_.options.verticalSwiping === true) { 8530 _.touchObject.swipeLength = verticalSwipeLength; 8531 } 8532 8533 swipeDirection = _.swipeDirection(); 8534 8535 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 8536 _.swiping = true; 8537 event.preventDefault(); 8538 } 8539 8540 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 8541 if (_.options.verticalSwiping === true) { 8542 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 8543 } 8544 8545 8546 swipeLength = _.touchObject.swipeLength; 8547 8548 _.touchObject.edgeHit = false; 8549 8550 if (_.options.infinite === false) { 8551 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 8552 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 8553 _.touchObject.edgeHit = true; 8554 } 8555 } 8556 8557 if (_.options.vertical === false) { 8558 _.swipeLeft = curLeft + swipeLength * positionOffset; 8559 } else { 8560 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 8561 } 8562 if (_.options.verticalSwiping === true) { 8563 _.swipeLeft = curLeft + swipeLength * positionOffset; 8564 } 8565 8566 if (_.options.fade === true || _.options.touchMove === false) { 8567 return false; 8568 } 8569 8570 if (_.animating === true) { 8571 _.swipeLeft = null; 8572 return false; 8573 } 8574 8575 _.setCSS(_.swipeLeft); 8576 8577 }; 8578 8579 Slick.prototype.swipeStart = function(event) { 8580 8581 var _ = this, 8582 touches; 8583 8584 _.interrupted = true; 8585 8586 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 8587 _.touchObject = {}; 8588 return false; 8589 } 8590 8591 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 8592 touches = event.originalEvent.touches[0]; 8593 } 8594 8595 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 8596 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 8597 8598 _.dragging = true; 8599 8600 }; 8601 8602 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 8603 8604 var _ = this; 8605 8606 if (_.$slidesCache !== null) { 8607 8608 _.unload(); 8609 8610 _.$slideTrack.children(this.options.slide).detach(); 8611 8612 _.$slidesCache.appendTo(_.$slideTrack); 8613 8614 _.reinit(); 8615 8616 } 8617 8618 }; 8619 8620 Slick.prototype.unload = function() { 8621 8622 var _ = this; 8623 8624 $('.slick-cloned', _.$slider).remove(); 8625 8626 if (_.$dots) { 8627 _.$dots.remove(); 8628 } 8629 8630 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 8631 _.$prevArrow.remove(); 8632 } 8633 8634 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 8635 _.$nextArrow.remove(); 8636 } 8637 8638 _.$slides 8639 .removeClass('slick-slide slick-active slick-visible slick-current') 8640 .attr('aria-hidden', 'true') 8641 .css('width', ''); 8642 8643 }; 8644
8645 Slick.prototype.unslick = function(fromBreakpoint) { 8646 8647 var _ = this; 8648 _.$slider.trigger('unslick', [_, fromBreakpoint]); 8649 _.destroy(); 8650 8651 }; 8652 8653 Slick.prototype.updateArrows = function() { 8654 8655 var _ = this, 8656 centerOffset; 8657 8658 centerOffset = Math.floor(_.options.slidesToShow / 2); 8659 8660 if ( _.options.arrows === true && 8661 _.slideCount > _.options.slidesToShow && 8662 !_.options.infinite ) { 8663 8664 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8665 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8666 8667 if (_.currentSlide === 0) { 8668 8669 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 8670 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8671 8672 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 8673 8674 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 8675 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8676 8677 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 8678 8679 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 8680 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 8681 8682 } 8683 8684 } 8685 8686 }; 8687 8688 Slick.prototype.updateDots = function() { 8689 8690 var _ = this; 8691 8692 if (_.$dots !== null) { 8693 8694 _.$dots 8695 .find('li') 8696 .removeClass('slick-active') 8697 .end(); 8698 8699 _.$dots 8700 .find('li') 8701 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 8702 .addClass('slick-active'); 8703 8704 } 8705 8706 }; 8707 8708 Slick.prototype.visibility = function() { 8709 8710 var _ = this; 8711 8712 if ( _.options.autoplay ) { 8713 8714 if ( document[_.hidden] ) { 8715 8716 _.interrupted = true; 8717 8718 } else { 8719 8720 _.interrupted = false; 8721 8722 } 8723 8724 } 8725 8726 }; 8727 8728 $.fn.slick = function() { 8729 var _ = this, 8730 opt = arguments[0], 8731 args = Array.prototype.slice.call(arguments, 1), 8732 l = _.length, 8733 i, 8734 ret; 8735 for (i = 0; i < l; i++) { 8736 if (typeof opt == 'object' || typeof opt == 'undefined') 8737 _[i].slick = new Slick(_[i], opt); 8738 else 8739 ret = _[i].slick[opt].apply(_[i].slick, args); 8740 if (typeof ret != 'undefined') return ret; 8741 } 8742 return _; 8743 }; 8744 8745})); 8746; 8747function stringCheck(form, name, required, max, prettyName) 8748{ 8749 var v = getValue(form,name); 8750 if ( !required && v == "" ) 8751 { 8752 return true; 8753 } 8754 if ( required && v == "" ) 8755 { 8756 alert("Please enter a value for " + prettyName); 8757 form[name].focus(); 8758 return false; 8759 } 8760 if ( v.length > max ) 8761 { 8762 alert("Maximum value for " + prettyName + " is " + max + " characters."); 8763 form[name].focus(); 8764 return false; 8765 } 8766 return true; 8767} 8768 8769function checkEmail(form, name, required, max, prettyName) 8770{ 8771 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 8772 var v = getValue(form,name); 8773 if ( !required && v == "" ) 8774 { 8775 return true; 8776 } 8777 //stringCheck makes sure if required then it's there 8778 if ( !stringCheck(form,name, required, max, prettyName)) 8779 { 8780 return false; 8781 } 8782 if (!filter.test(v)) 8783 { 8784 alert(v + " does not appear to be a valid email address.") 8785 form[name].focus(); 8786 return false; 8787 } 8788 return true; 8789} 8790/*use null for length if don't want it checked*/ 8791function checkPhone(form, name, required, length, prettyName) 8792{ 8793 var v = getValue(form,name); 8794 //if we dont need one... 8795 if ( !required && v == "" ) 8796 { 8797 return true; 8798 } 8799 //stringCheck makes sure if required then it's there 8800 if ( !stringCheck(form,name, required, 50, prettyName))//we assume numbers not bigger than 50 8801 { 8802 return false; 8803 } 8804 8805 var stripped = v.replace(/[\(\)\.\-\ ]/g, ''); 8806 //strip out acceptable non-numeric characters 8807 if (isNaN(parseInt(stripped))) 8808 {
8809 alert(prettyName + " appears to contain invalid characters."); 8810 form[name].focus(); 8811 return false; 8812 } 8813 if ( length!=null ) 8814 { 8815 if ( stripped.length<length ) 8816 { 8817 alert("The " + prettyName + " is not long enough. Is the area code missing?"); 8818 form[name].focus(); 8819 return false; 8820 } 8821 } 8822 return true; 8823} 8824 8825/*use null for length if don't want it checked*/ 8826function checkZip(form, name, required, length, prettyName) 8827{ 8828 var v = getValue(form,name); 8829 //if we dont need one... 8830 if ( !required && v == "" ) 8831 { 8832 return true; 8833 } 8834 //stringCheck makes sure if required then it's there 8835 if ( !stringCheck(form,name, required, 15, prettyName))//we assume numbers not bigger than 50 8836 { 8837 return false; 8838 } 8839 8840 var stripped = v.replace(/[\(\)\.\-\ ]/g, ''); 8841 //strip out acceptable non-numeric characters 8842 if (isNaN(parseInt(stripped))) 8843 { 8844 alert(prettyName + " appears to contain invalid characters."); 8845 form[name].focus(); 8846 return false; 8847 } 8848 if ( length!=null ) 8849 { 8850 if ( stripped.length<length ) 8851 { 8852 alert("The " + prettyName + " is not long enough."); 8853 form[name].focus(); 8854 return false; 8855 } 8856 } 8857 return true; 8858} 8859 8860function checkDropdown(form, name, prettyName) { 8861 8862 if (form[name].selectedIndex == 0) 8863 { 8864 alert("Please make selection for " + prettyName); 8865 form[name].focus(); 8866 return false; 8867 } 8868 return true; 8869} 8870 8871function checkRadio(form, name, prettyName) 8872{ 8873 checked = false; 8874 for ( var j = 0; j< form[name].length; j++) 8875 { 8876 if (form[name][j].checked) 8877 checked = true; 8878 } 8879 if ( checked == false ) 8880 { 8881 alert("Please make selection for " + prettyName); 8882 //form[name].focus(); 8883 return false; 8884 } 8885 return true; 8886} 8887 8888function checkLength(form, name, max, prettyName) 8889{ 8890 if ( form[name].value.length > max ) 8891 { 8892 alert(prettyName + " can contain at most " + max + " characters."); 8893 return false; 8894 } 8895 return true; 8896} 8897 8898function getValue(form, name) 8899{ 8900 var v = form[name].value; 8901 if ( v==null ) 8902 { 8903 alert(name + " does not appear to be form variable. See admin."); 8904 return v; 8905 } 8906 else 8907 return trim(v); 8908} 8909 8910function trim(v) 8911{ 8912 return v.replace(/^\s*|\s*$/g,""); 8913} 8914 8915 8916; 8917/*! WOW wow.js - v1.3.0 - 2016-10-04 8918* https://wowjs.uk 8919* Copyright (c) 2016 Thomas Grainger; Licensed MIT */!function(a,b){if("function"==typeof define&&define.amd)define(["module","exports"],b);else if("undefined"!=typeof exports)b(module,exports);else{var c={exports:{}};b(c,c.exports),a.WOW=c.exports}}(this,function(a,b){"use strict";function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){return b.indexOf(a)>=0}function e(a,b){for(var c in b)if(null==a[c]){var d=b[c];a[c]=d}return a}function f(a){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a)}function g(a){var b=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],c=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],d=arguments.length<=3||void 0===arguments[3]?null:arguments[3],e=void 0;return null!=document.createEvent?(e=document.createEvent("CustomEvent"),e.initCustomEvent(a,b,c,d)):null!=document.createEventObject?(e=document.createEventObject(),e.eventType=a):e.eventName=a,e}function h(a,b){null!=a.dispatchEvent?a.dispatchEvent(b):b in(null!=a)?a[b]():"on"+b in(null!=a)&&a["on"+b]()}function i(a,b,c){null!=a.addEventListener?a.addEventListener(b,c,!1):null!=a.attachEvent?a.attachEvent("on"+b,c):a[b]=c}function j(a,b,c){null!=a.removeEventListener?a.removeEventListener(b,c,!1):null!=a.detachEvent?a.detachEvent("on"+b,c):delete a[b]}function k(){return"innerHeight"in window?window.innerHeight:document.documentElement.clientHeight}Object.defineProperty(b,"__esModule",{value:!0});var l,m,n=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),o=window.WeakMap||window.MozWeakMap||function(){function a(){c(this,a),this.keys=[],this.values=[]}return n(a,[{key:"get",value:function(a){for(var b=0;b<this.keys.length;b++){var c=this.keys[b];
vendor: 5,844 bytes, line 8919
8919if(c===a)return this.values[b]}}},{key:"set",value:function(a,b){for(var c=0;c<this.keys.length;c++){var d=this.keys[c];if(d===a)return this.values[c]=b,this}return this.keys.push(a),this.values.push(b),this}}]),a}(),p=window.MutationObserver||window.WebkitMutationObserver||window.MozMutationObserver||(m=l=function(){function a(){c(this,a),"undefined"!=typeof console&&null!==console&&(console.warn("MutationObserver is not supported by your browser."),console.warn("WOW.js cannot detect dom mutations, please call .sync() after loading new content."))}return n(a,[{key:"observe",value:function(){}}]),a}(),l.notSupported=!0,m),q=window.getComputedStyle||function(a){var b=/(\-([a-z]){1})/g;return{getPropertyValue:function(c){"float"===c&&(c="styleFloat"),b.test(c)&&c.replace(b,function(a,b){return b.toUpperCase()});var d=a.currentStyle;return(null!=d?d[c]:void 0)||null}}},r=function(){function a(){var b=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];c(this,a),this.defaults={boxClass:"wow",animateClass:"animated",offset:0,mobile:!0,live:!0,callback:null,scrollContainer:null,resetAnimation:!0},this.animate=function(){return"requestAnimationFrame"in window?function(a){return window.requestAnimationFrame(a)}:function(a){return a()}}(),this.vendors=["moz","webkit"],this.start=this.start.bind(this),this.resetAnimation=this.resetAnimation.bind(this),this.scrollHandler=this.scrollHandler.bind(this),this.scrollCallback=this.scrollCallback.bind(this),this.scrolled=!0,this.config=e(b,this.defaults),null!=b.scrollContainer&&(this.config.scrollContainer=document.querySelector(b.scrollContainer)),this.animationNameCache=new o,this.wowEvent=g(this.config.boxClass)}return n(a,[{key:"init",value:function(){this.element=window.document.documentElement,d(document.readyState,["interactive","complete"])?this.start():i(document,"DOMContentLoaded",this.start),this.finished=[]}},{key:"start",value:function(){var a=this;if(this.stopped=!1,this.boxes=[].slice.call(this.element.querySelectorAll("."+this.config.boxClass)),this.all=this.boxes.slice(0),this.boxes.length)if(this.disabled())this.resetStyle();else for(var b=0;b<this.boxes.length;b++){var c=this.boxes[b];this.applyStyle(c,!0)}if(this.disabled()||(i(this.config.scrollContainer||window,"scroll",this.scrollHandler),i(window,"resize",this.scrollHandler),this.interval=setInterval(this.scrollCallback,50)),this.config.live){var d=new p(function(b){for(var c=0;c<b.length;c++)for(var d=b[c],e=0;e<d.addedNodes.length;e++){var f=d.addedNodes[e];a.doSync(f)}});d.observe(document.body,{childList:!0,subtree:!0})}}},{key:"stop",value:function(){this.stopped=!0,j(this.config.scrollContainer||window,"scroll",this.scrollHandler),j(window,"resize",this.scrollHandler),null!=this.interval&&clearInterval(this.interval)}},{key:"sync",value:function(){p.notSupported&&this.doSync(this.element)}},{key:"doSync",value:function(a){if("undefined"!=typeof a&&null!==a||(a=this.element),1===a.nodeType){a=a.parentNode||a;for(var b=a.querySelectorAll("."+this.config.boxClass),c=0;c<b.length;c++){var e=b[c];d(e,this.all)||(this.boxes.push(e),this.all.push(e),this.stopped||this.disabled()?this.resetStyle():this.applyStyle(e,!0),this.scrolled=!0)}}}},{key:"show",value:function(a){return this.applyStyle(a),a.className=a.className+" "+this.config.animateClass,null!=this.config.callback&&this.config.callback(a),h(a,this.wowEvent),this.config.resetAnimation&&(i(a,"animationend",this.resetAnimation),i(a,"oanimationend",this.resetAnimation),i(a,"webkitAnimationEnd",this.resetAnimation),i(a,"MSAnimationEnd",this.resetAnimation)),a}},{key:"applyStyle",value:function(a,b){var c=this,d=a.getAttribute("data-wow-duration"),e=a.getAttribute("data-wow-delay"),f=a.getAttribute("data-wow-iteration");return this.animate(function(){return c.customStyle(a,b,d,e,f)})}},{key:"resetStyle",value:function(){for(var a=0;a<this.boxes.length;a++){var b=this.boxes[a];b.style.visibility="visible"}}},{key:"resetAnimation",value:function(a){if(a.type.toLowerCase().indexOf("animationend")>=0){var b=a.target||a.srcElement;b.className=b.className.replace(this.config.animateClass,"").trim()}}},{key:"customStyle",value:function(a,b,c,d,e){return b&&this.cacheAnimationName(a),a.style.visibility=b?"hidden":"visible",c&&this.vendorSet(a.style,{animationDuration:c}),d&&this.vendorSet(a.style,{animationDelay:d}),e&&this.vendorSet(a.style,{animationIterationCount:e}),this.vendorSet(a.style,{animationName:b?"none":this.cachedAnimationName(a)}),a}},{key:"vendorSet",value:function(a,b){for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];a[""+c]=d;for(var e=0;e<this.vendors.length;e++){var f=this.vendors[e];a[""+f+c.charAt(0).toUpperCase()+c.substr(1)]=d}}}},{key:"vendorCSS",value:function(a,b){for(var c=q(a),d=c.getPropertyCSSValue(b),e=0;e<this.vendors.length;e++){var f=this.vendors[e];d=d||c.getPropertyCSSValue("-"+f+"-"+b)}return d}},{key:"animationName",value:function(a){var b=void 0;try{b=this.vendorCSS(a,"animation-name").cssText}catch(c){b=q(a).getPropertyValue("animation-name")}return"none"===b?"":b}},{key:"cacheAnimationName",value:function(a){return this.animationNameCache.set(a,this.animationName(a))}},{key:"cachedAnimationName",value:function(a){return this.animationNameCache.get(a)}},{key:"scrollHandler",value:function(){this.scrolled=!0}},{key:"scrollCallback",value:function(){if(this.scrolled){this.scrolled=!1;for(var a=[],b=0;b<this.boxes.length;b++){var c=this.boxes[b];if(c){if(this.isVisible(c)){this.show(c);continue}a.push(c)}}this.boxes=a,this.boxes.length||this.config.live||this.stop()}}},{key:"offsetTop",value:function(a){for(;void 0===a.offsetTop;)a=a.parentNode;for(var b=a.offsetTop;a.offsetParent;)a=a.offsetParent,b+=a.offsetTop;return b}},{key:"isVisible",value:function(a){var b=a.getAttribute("data-wow-offset")||this.config.offset,c=this.config.scrollC
8919ontainer&&this.config.scrollContainer.scrollTop||window.pageYOffset,d=c+Math.min(this.element.clientHeight,k())-b,e=this.offsetTop(a),f=e+a.clientHeight;return d>=e&&f>=c}},{key:"disabled",value:function(){return!this.config.mobile&&f(navigator.userAgent)}}]),a}();b["default"]=r,a.exports=b["default"]});; 8920var HDM = (function ($) { 8921 var _createNs, _getNSString; 8922 /** 8923 * @method createNs 8924 * 8925 * @param (String) n example "HDM.admin.wizard" 8926 * @param (Object) o example { "HDM" : { "admin": {} } } rarely used 8927 * I think I got this from tinymce. 8928 * Note that each node has a reference to its parent and a name. This makes 8929 * constructing the namespace tree string more efficient. Do I care? 8930 * Otherwise you have to right some recursive search for the path down the namespace 8931 * to the node. That search could run into infinite loops and is quite the pain. 8932 */ 8933 _createNs = function (n/*namespace*/, o/*starting place*/) { 8934 var i, v; 8935 o = o || window; 8936 n = n.split('.'); 8937 for (i = 0; i < n.length; i++) { 8938 v = n[i]; 8939 if (!o[v]) { 8940 o[v] = {"__name":v, "__parent": o};//we want to be able to go back up this tree as well 8941 } 8942 o = o[v]; 8943 } 8944 return o; //return last namespace object created 8945 }; 8946 8947 /** 8948 * Gets a string representing a namespace 8949 8950 * @param ns a namespace leaf object from the namespace. 8951 * The admin part of this { "HDM":{ {"admin": {}} }} 8952 @part optional for convience 8953 */ 8954 _getNSString = function (ns, part) { 8955 var nsString = ""; 8956 while (ns) { 8957 nsString = ns.__name + (nsString !== ""?".":"") + nsString; 8958 ns = ns.__parent; 8959 } 8960 if (part) { 8961 nsString = nsString + "." + part; 8962 } 8963 return nsString; 8964 }; 8965 return { 8966 createNs: _createNs, 8967 getNSString: _getNSString, 8968 __name: "HDM" 8969 }; 8970}(jQuery)); 8971 8972HDM.createNs("HDM.eventbus"); 8973/* 8974A very simple event bus. 8975//a good refernce https://github.com/krasimir/EventBus/blob/master/src/EventBus.js 8976*/ 8977HDM.eventbus.EventBus = (function () { 8978 8979 var _subscribe, _unsubscribe, _publish; 8980 8981 _subscribe = function (type, fn) { 8982 type = type || "any"; 8983 if (typeof this.subscribers[type] === "undefined") { 8984 this.subscribers[type] = []; 8985 } 8986 this.subscribers[type].push(fn); 8987 return { "type":type, "function":fn }; 8988 }; 8989 _unsubscribe = function (type, fn) { 8990 type = type || "any"; 8991 if (typeof this.subscribers[type] === "undefined") { 8992 this.subscribers[type] = []; 8993 } 8994 for (var i = 0; i < this.subscribers[type].length; i++) { 8995 if (this.subscribers[type][i] === fn) { 8996 this.subscribers[type].splice(i, 1); 8997 } 8998 } 8999 }; 9000 _publish = function (type, data) { 9001 type = type || "any"; 9002 if (!(type in this.subscribers)) { 9003 return; //no one subscribed 9004 } 9005 var who = this.subscribers[type]; 9006 for (var i = 0; i < who.length; i++) { 9007 who[i](data); 9008 } 9009 }; 9010 var Constr = function () { 9011 this.subscribers = {}; 9012 return this; 9013 }; 9014 9015 Constr.prototype = { 9016 subscribe: _subscribe, 9017 unsubscribe: _unsubscribe, 9018 publish: _publish 9019 }; 9020 return Constr; 9021} ()); 9022/* 9023* pubsub is a wrapper around the event bus so that 9024 event buses can be created, subscribed to, published to by anyone 9025 regardless of whether the main publisher has set it up yet. 9026*/ 9027HDM.pubsub = (function () { 9028 var pubsubs = {}, _subscribe, _unsubscribe, _publish, _getEventBus; 9029 9030 /* 9031 @param namespace is so we can have publishers have their own 9032 event bus. Making it easier to avoid event name collisions 9033 */ 9034 _subscribe = function (topic, fn, namespace) { 9035 var pubsub = _getEventBus(namespace); 9036 pubsub.subscribe(topic, fn); 9037 return { "type":topic, "function":fn, "namespace":namespace }; 9038 }; 9039 _unsubscribe = function (topic, fn, namespace) { 9040 var pubsub = _getEventBus(namespace); 9041 pubsub.unsubscribe(topic, fn); 9042 }; 9043 9044 /* 9045 @param namespace is so we can have publishers have their own 9046 event bus. Making it easier to avoid event name collisions 9047 */ 9048 _publish = function (topic, data, namespace) { 9049 var pubsub = _getEventBus(namespace); 9050 pubsub.publish(topic, data); 9051 }; 9052 /* 9053 @param namespace is a string. For those that publish or subscribe to many events 9054 it can be easier to just get a handle to the EventBus associated with 9055 that namespace and hold on to it. 9056 */ 9057 _getEventBus = function (namespace) { 9058 if (!namespace) { 9059 namespace = "_default"; 9060 } 9061 if (pubsubs[namespace]) { 9062 return pubsubs[namespace]; 9063 } 9064 var eventBus = new HDM.eventbus.EventBus(); 9065 pubsubs[namespace] = eventBus; 9066 return eventBus; 9067 }; 9068 return { 9069 subscribe: _subscribe, 9070 publish: _publish, 9071 /* this is public so we can not have to specify namespace all over the place 9072 like in classes that use the pubsub often */ 9073 getEventBus: _getEventBus 9074 9075 }; 9076} ());; 9077_hdmq.loadComplete();;
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.