|
|
Line 1: |
Line 1: |
− | /* Modernizr 2.6.2 (Custom Build) | MIT & BSD
| |
− | * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
| |
− | */
| |
− | ;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
| |
| | | |
− |
| |
− |
| |
− | /* ../vendor/jquery.js */
| |
− | /*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
| |
− | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.2",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
| |
− | return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{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:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)
| |
− | }m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
| |
− | ;
| |
− |
| |
− | /* ../vendor/jquery.easing.js */
| |
− | /*
| |
− | * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
| |
− | *
| |
− | * Uses the built in easing capabilities added In jQuery 1.1
| |
− | * to offer multiple easing options
| |
− | *
| |
− | * TERMS OF USE - jQuery Easing
| |
− | *
| |
− | * Open source under the BSD License.
| |
− | *
| |
− | * Copyright В© 2008 George McGinley Smith
| |
− | * All rights reserved.
| |
− | *
| |
− | * Redistribution and use in source and binary forms, with or without modification,
| |
− | * are permitted provided that the following conditions are met:
| |
− | *
| |
− | * Redistributions of source code must retain the above copyright notice, this list of
| |
− | * conditions and the following disclaimer.
| |
− | * Redistributions in binary form must reproduce the above copyright notice, this list
| |
− | * of conditions and the following disclaimer in the documentation and/or other materials
| |
− | * provided with the distribution.
| |
− | *
| |
− | * Neither the name of the author nor the names of contributors may be used to endorse
| |
− | * or promote products derived from this software without specific prior written permission.
| |
− | *
| |
− | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
| |
− | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
| |
− | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
| |
− | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
| |
− | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
| |
− | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
| |
− | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
| |
− | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
| |
− | * OF THE POSSIBILITY OF SUCH DAMAGE.
| |
− | *
| |
− | */
| |
− |
| |
− | // t: current time, b: begInnIng value, c: change In value, d: duration
| |
− | jQuery.easing['jswing'] = jQuery.easing['swing'];
| |
− |
| |
− | jQuery.extend( jQuery.easing,
| |
− | {
| |
− | def: 'easeOutQuad',
| |
− | swing: function (x, t, b, c, d) {
| |
− | //alert(jQuery.easing.default);
| |
− | return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
| |
− | },
| |
− | easeInQuad: function (x, t, b, c, d) {
| |
− | return c*(t/=d)*t + b;
| |
− | },
| |
− | easeOutQuad: function (x, t, b, c, d) {
| |
− | return -c *(t/=d)*(t-2) + b;
| |
− | },
| |
− | easeInOutQuad: function (x, t, b, c, d) {
| |
− | if ((t/=d/2) < 1) return c/2*t*t + b;
| |
− | return -c/2 * ((--t)*(t-2) - 1) + b;
| |
− | },
| |
− | easeInCubic: function (x, t, b, c, d) {
| |
− | return c*(t/=d)*t*t + b;
| |
− | },
| |
− | easeOutCubic: function (x, t, b, c, d) {
| |
− | return c*((t=t/d-1)*t*t + 1) + b;
| |
− | },
| |
− | easeInOutCubic: function (x, t, b, c, d) {
| |
− | if ((t/=d/2) < 1) return c/2*t*t*t + b;
| |
− | return c/2*((t-=2)*t*t + 2) + b;
| |
− | },
| |
− | easeInQuart: function (x, t, b, c, d) {
| |
− | return c*(t/=d)*t*t*t + b;
| |
− | },
| |
− | easeOutQuart: function (x, t, b, c, d) {
| |
− | return -c * ((t=t/d-1)*t*t*t - 1) + b;
| |
− | },
| |
− | easeInOutQuart: function (x, t, b, c, d) {
| |
− | if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
| |
− | return -c/2 * ((t-=2)*t*t*t - 2) + b;
| |
− | },
| |
− | easeInQuint: function (x, t, b, c, d) {
| |
− | return c*(t/=d)*t*t*t*t + b;
| |
− | },
| |
− | easeOutQuint: function (x, t, b, c, d) {
| |
− | return c*((t=t/d-1)*t*t*t*t + 1) + b;
| |
− | },
| |
− | easeInOutQuint: function (x, t, b, c, d) {
| |
− | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
| |
− | return c/2*((t-=2)*t*t*t*t + 2) + b;
| |
− | },
| |
− | easeInSine: function (x, t, b, c, d) {
| |
− | return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
| |
− | },
| |
− | easeOutSine: function (x, t, b, c, d) {
| |
− | return c * Math.sin(t/d * (Math.PI/2)) + b;
| |
− | },
| |
− | easeInOutSine: function (x, t, b, c, d) {
| |
− | return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
| |
− | },
| |
− | easeInExpo: function (x, t, b, c, d) {
| |
− | return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
| |
− | },
| |
− | easeOutExpo: function (x, t, b, c, d) {
| |
− | return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
| |
− | },
| |
− | easeInOutExpo: function (x, t, b, c, d) {
| |
− | if (t==0) return b;
| |
− | if (t==d) return b+c;
| |
− | if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
| |
− | return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
| |
− | },
| |
− | easeInCirc: function (x, t, b, c, d) {
| |
− | return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
| |
− | },
| |
− | easeOutCirc: function (x, t, b, c, d) {
| |
− | return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
| |
− | },
| |
− | easeInOutCirc: function (x, t, b, c, d) {
| |
− | if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
| |
− | return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
| |
− | },
| |
− | easeInElastic: function (x, t, b, c, d) {
| |
− | var s=1.70158;var p=0;var a=c;
| |
− | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
| |
− | if (a < Math.abs(c)) { a=c; var s=p/4; }
| |
− | else var s = p/(2*Math.PI) * Math.asin (c/a);
| |
− | return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
| |
− | },
| |
− | easeOutElastic: function (x, t, b, c, d) {
| |
− | var s=1.70158;var p=0;var a=c;
| |
− | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
| |
− | if (a < Math.abs(c)) { a=c; var s=p/4; }
| |
− | else var s = p/(2*Math.PI) * Math.asin (c/a);
| |
− | return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
| |
− | },
| |
− | easeInOutElastic: function (x, t, b, c, d) {
| |
− | var s=1.70158;var p=0;var a=c;
| |
− | if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
| |
− | if (a < Math.abs(c)) { a=c; var s=p/4; }
| |
− | else var s = p/(2*Math.PI) * Math.asin (c/a);
| |
− | if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
| |
− | return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
| |
− | },
| |
− | easeInBack: function (x, t, b, c, d, s) {
| |
− | if (s == undefined) s = 1.70158;
| |
− | return c*(t/=d)*t*((s+1)*t - s) + b;
| |
− | },
| |
− | easeOutBack: function (x, t, b, c, d, s) {
| |
− | if (s == undefined) s = 1.70158;
| |
− | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
| |
− | },
| |
− | easeInOutBack: function (x, t, b, c, d, s) {
| |
− | if (s == undefined) s = 1.70158;
| |
− | if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
| |
− | return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
| |
− | },
| |
− | easeInBounce: function (x, t, b, c, d) {
| |
− | return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
| |
− | },
| |
− | easeOutBounce: function (x, t, b, c, d) {
| |
− | if ((t/=d) < (1/2.75)) {
| |
− | return c*(7.5625*t*t) + b;
| |
− | } else if (t < (2/2.75)) {
| |
− | return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
| |
− | } else if (t < (2.5/2.75)) {
| |
− | return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
| |
− | } else {
| |
− | return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
| |
− | }
| |
− | },
| |
− | easeInOutBounce: function (x, t, b, c, d) {
| |
− | if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
| |
− | return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
| |
− | }
| |
− | });
| |
− |
| |
− | /*
| |
− | *
| |
− | * TERMS OF USE - EASING EQUATIONS
| |
− | *
| |
− | * Open source under the BSD License.
| |
− | *
| |
− | * Copyright В© 2001 Robert Penner
| |
− | * All rights reserved.
| |
− | *
| |
− | * Redistribution and use in source and binary forms, with or without modification,
| |
− | * are permitted provided that the following conditions are met:
| |
− | *
| |
− | * Redistributions of source code must retain the above copyright notice, this list of
| |
− | * conditions and the following disclaimer.
| |
− | * Redistributions in binary form must reproduce the above copyright notice, this list
| |
− | * of conditions and the following disclaimer in the documentation and/or other materials
| |
− | * provided with the distribution.
| |
− | *
| |
− | * Neither the name of the author nor the names of contributors may be used to endorse
| |
− | * or promote products derived from this software without specific prior written permission.
| |
− | *
| |
− | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
| |
− | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
| |
− | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
| |
− | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
| |
− | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
| |
− | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
| |
− | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
| |
− | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
| |
− | * OF THE POSSIBILITY OF SUCH DAMAGE.
| |
− | *
| |
− | */;
| |
− |
| |
− | /* ../vendor/Chart.min.js */
| |
− | /*!
| |
− | * Chart.js
| |
− | * http://chartjs.org/
| |
− | * Version: 1.0.1-beta.4
| |
− | *
| |
− | * Copyright 2014 Nick Downie
| |
− | * Released under the MIT license
| |
− | * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
| |
− | */
| |
− | (function(){"use strict";var t=this,i=t.Chart,e=function(t){this.canvas=t.canvas,this.ctx=t;this.width=t.canvas.width,this.height=t.canvas.height;return this.aspectRatio=this.width/this.height,s.retinaScale(this),this};e.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",onAnimationProgress:function(){},onAnimationComplete:function(){}}},e.types={};var s=e.helpers={},n=s.each=function(t,i,e){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var n;for(n=0;n<t.length;n++)i.apply(e,[t[n],n].concat(s))}else for(var o in t)i.apply(e,[t[o],o].concat(s))},o=s.clone=function(t){var i={};return n(t,function(e,s){t.hasOwnProperty(s)&&(i[s]=e)}),i},a=s.extend=function(t){return n(Array.prototype.slice.call(arguments,1),function(i){n(i,function(e,s){i.hasOwnProperty(s)&&(t[s]=e)})}),t},h=s.merge=function(){var t=Array.prototype.slice.call(arguments,0);return t.unshift({}),a.apply(null,t)},l=s.indexOf=function(t,i){if(Array.prototype.indexOf)return t.indexOf(i);for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1},r=(s.where=function(t,i){var e=[];return s.each(t,function(t){i(t)&&e.push(t)}),e},s.findNextWhere=function(t,i,e){e||(e=-1);for(var s=e+1;s<t.length;s++){var n=t[s];if(i(n))return n}},s.findPreviousWhere=function(t,i,e){e||(e=t.length);for(var s=e-1;s>=0;s--){var n=t[s];if(i(n))return n}},s.inherits=function(t){var i=this,e=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},s=function(){this.constructor=e};return s.prototype=i.prototype,e.prototype=new s,e.extend=r,t&&a(e.prototype,t),e.__super__=i.prototype,e}),c=s.noop=function(){},u=s.uid=function(){var t=0;return function(){return"chart-"+t++}}(),d=s.warn=function(t){window.console&&"function"==typeof window.console.warn&&console.warn(t)},p=s.amd="function"==typeof t.define&&t.define.amd,f=s.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},g=s.max=function(t){return Math.max.apply(Math,t)},m=s.min=function(t){return Math.min.apply(Math,t)},v=(s.cap=function(t,i,e){if(f(i)){if(t>i)return i}else if(f(e)&&e>t)return e;return t},s.getDecimalPlaces=function(t){return t%1!==0&&f(t)?t.toString().split(".")[1].length:0}),x=s.radians=function(t){return t*(Math.PI/180)},S=(s.getAngleFromPoint=function(t,i){var e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s),o=2*Math.PI+Math.atan2(s,e);return 0>e&&0>s&&(o+=2*Math.PI),{angle:o,distance:n}},s.aliasPixel=function(t){return t%2===0?0:.5}),y=(s.splineCurve=function(t,i,e,s){var n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=s*n/(n+o),h=s*o/(n+o);return{inner:{x:i.x-a*(e.x-t.x),y:i.y-a*(e.y-t.y)},outer:{x:i.x+h*(e.x-t.x),y:i.y+h*(e.y-t.y)}}},s.calculateOrderOfMagnitude=function(t){return Math.floor(Math.log(t)/Math.LN10)}),C=(s.calculateScaleRange=function(t,i,e,s,n){var o=2,a=Math.floor(i/(1.5*e)),h=o>=a,l=g(t),r=m(t);l===r&&(l+=.5,r>=.5&&!s?r-=.5:l+=.5);for(var c=Math.abs(l-r),u=y(c),d=Math.ceil(l/(1*Math.pow(10,u)))*Math.pow(10,u),p=s?0:Math.floor(r/(1*Math.pow(10,u)))*Math.pow(10,u),f=d-p,v=Math.pow(10,u),x=Math.round(f/v);(x>a||a>2*x)&&!h;)if(x>a)v*=2,x=Math.round(f/v),x%1!==0&&(h=!0);else if(n&&u>=0){if(v/2%1!==0)break;v/=2,x=Math.round(f/v)}else v/=2,x=Math.round(f/v);return h&&(x=o,v=f/x),{steps:x,stepValue:v,min:p,max:p+x*v}},s.template=function(t,i){function e(t,i){var e=/\W/.test(t)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+t.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):s[t]=s[t];return i?e(i):e}if(t instanceof Function)return t(i);var s={};return e(t,i)}),b=(s.generateLabels=function(t,i,e,s){var o=new Array(i);return labelTemplateString&&n(o,function(i,n){o[n]=C(t,{value:e+s*(n+1)})}),o},s.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-0.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-0.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),-(s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)))},easeOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),s*Math.pow(2,-10*t)*Math.sin(2*(1*t-i)*Math.PI/e)+1)},easeInOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:2==(t/=.5)?1:(e||(e=.3*1.5),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),1>t?-.5*s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e):s*Math.pow(2,-10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)*.5+1)},easeInBack:function(t){var i=1.70158;return 1*(t/=1)*t*((i+1)*t-i)},easeOutBack:function(t){var i=1.70158;return 1*((t=t/1-1)*t*((i+1)*t+i)+1)},easeInOutBack:function(t){var i=1.70158;return(t/=.5)<1?.5*t*t*(((i*=1.525)+1)*t-i):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},easeInBounce:function(t){return 1-b.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?7.5625*t*t:2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*b.easeInBounce(2*t):.5*b.easeOutBounce(2*t-1)+.5}}),w=s.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),P=(s.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),s.animationLoop=function(t,i,e,s,n,o){var a=0,h=b[e]||b.linear,l=function(){a++;var e=a/i,r=h(e);t.call(o,r,e,a),s.call(o,r,e),i>a?o.animationFrame=w(l):n.apply(o)};w(l)},s.getRelativePosition=function(t){var i,e,s=t.originalEvent||t,n=t.currentTarget||t.srcElement,o=n.getBoundingClientRect();return s.touches?(i=s.touches[0].clientX-o.left,e=s.touches[0].clientY-o.top):(i=s.clientX-o.left,e=s.clientY-o.top),{x:i,y:e}},s.addEvent=function(t,i,e){t.addEventListener?t.addEventListener(i,e):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e}),L=s.removeEvent=function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=c},k=(s.bindEvents=function(t,i,e){t.events||(t.events={}),n(i,function(i){t.events[i]=function(){e.apply(t,arguments)},P(t.chart.canvas,i,t.events[i])})},s.unbindEvents=function(t,i){n(i,function(i,e){L(t.chart.canvas,e,i)})}),F=s.getMaximumWidth=function(t){var i=t.parentNode;return i.clientWidth},R=s.getMaximumHeight=function(t){var i=t.parentNode;return i.clientHeight},A=(s.getMaximumSize=s.getMaximumWidth,s.retinaScale=function(t){var i=t.ctx,e=t.canvas.width,s=t.canvas.height;window.devicePixelRatio&&(i.canvas.style.width=e+"px",i.canvas.style.height=s+"px",i.canvas.height=s*window.devicePixelRatio,i.canvas.width=e*window.devicePixelRatio,i.scale(window.devicePixelRatio,window.devicePixelRatio))}),T=s.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},M=s.fontString=function(t,i,e){return i+" "+t+"px "+e},W=s.longestText=function(t,i,e){t.font=i;var s=0;return n(e,function(i){var e=t.measureText(i).width;s=e>s?e:s}),s},z=s.drawRoundedRectangle=function(t,i,e,s,n,o){t.beginPath(),t.moveTo(i+o,e),t.lineTo(i+s-o,e),t.quadraticCurveTo(i+s,e,i+s,e+o),t.lineTo(i+s,e+n-o),t.quadraticCurveTo(i+s,e+n,i+s-o,e+n),t.lineTo(i+o,e+n),t.quadraticCurveTo(i,e+n,i,e+n-o),t.lineTo(i,e+o),t.quadraticCurveTo(i,e,i+o,e),t.closePath()};e.instances={},e.Type=function(t,i,s){this.options=i,this.chart=s,this.id=u(),e.instances[this.id]=this,i.responsive&&this.resize(),this.initialize.call(this,t)},a(e.Type.prototype,{initialize:function(){return this},clear:function(){return T(this.chart),this},stop:function(){return s.cancelAnimFrame.call(t,this.animationFrame),this},resize:function(t){this.stop();var i=this.chart.canvas,e=F(this.chart.canvas),s=this.options.maintainAspectRatio?e/this.chart.aspectRatio:R(this.chart.canvas);return i.width=this.chart.width=e,i.height=this.chart.height=s,A(this.chart),"function"==typeof t&&t.apply(this,Array.prototype.slice.call(arguments,1)),this},reflow:c,render:function(t){return t&&this.reflow(),this.options.animation&&!t?s.animationLoop(this.draw,this.options.animationSteps,this.options.animationEasing,this.options.onAnimationProgress,this.options.onAnimationComplete,this):(this.draw(),this.options.onAnimationComplete.call(this)),this},generateLegend:function(){return C(this.options.legendTemplate,this)},destroy:function(){this.clear(),k(this,this.events),delete e.instances[this.id]},showTooltip:function(t,i){"undefined"==typeof this.activeElements&&(this.activeElements=[]);var o=function(t){var i=!1;return t.length!==this.activeElements.length?i=!0:(n(t,function(t,e){t!==this.activeElements[e]&&(i=!0)},this),i)}.call(this,t);if(o||i){if(this.activeElements=t,this.draw(),t.length>0)if(this.datasets&&this.datasets.length>1){for(var a,h,r=this.datasets.length-1;r>=0&&(a=this.datasets[r].points||this.datasets[r].bars||this.datasets[r].segments,h=l(a,t[0]),-1===h);r--);var c=[],u=[],d=function(){var t,i,e,n,o,a=[],l=[],r=[];return s.each(this.datasets,function(i){t=i.points||i.bars||i.segments,t[h]&&t[h].hasValue()&&a.push(t[h])}),s.each(a,function(t){l.push(t.x),r.push(t.y),c.push(s.template(this.options.multiTooltipTemplate,t)),u.push({fill:t._saved.fillColor||t.fillColor,stroke:t._saved.strokeColor||t.strokeColor})},this),o=m(r),e=g(r),n=m(l),i=g(l),{x:n>this.chart.width/2?n:i,y:(o+e)/2}}.call(this,h);new e.MultiTooltip({x:d.x,y:d.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:c,legendColors:u,legendColorBackground:this.options.multiTooltipKeyBackground,title:t[0].label,chart:this.chart,ctx:this.chart.ctx}).draw()}else n(t,function(t){var i=t.tooltipPosition();new e.Tooltip({x:Math.round(i.x),y:Math.round(i.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,text:C(this.options.tooltipTemplate,t),chart:this.chart}).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}}),e.Type.extend=function(t){var i=this,s=function(){return i.apply(this,arguments)};if(s.prototype=o(i.prototype),a(s.prototype,t),s.extend=e.Type.extend,t.name||i.prototype.name){var n=t.name||i.prototype.name,l=e.defaults[i.prototype.name]?o(e.defaults[i.prototype.name]):{};e.defaults[n]=a(l,t.defaults),e.types[n]=s,e.prototype[n]=function(t,i){var o=h(e.defaults.global,e.defaults[n],i||{});return new s(t,o,this)}}else d("Name not provided for this chart, so it hasn't been registered");return i},e.Element=function(t){a(this,t),this.initialize.apply(this,arguments),this.save()},a(e.Element.prototype,{initialize:function(){},restore:function(t){return t?n(t,function(t){this[t]=this._saved[t]},this):a(this,this._saved),this},save:function(){return this._saved=o(this),delete this._saved._saved,this},update:function(t){return n(t,function(t,i){this._saved[i]=this[i],this[i]=t},this),this},transition:function(t,i){return n(t,function(t,e){this[e]=(t-this._saved[e])*i+this._saved[e]},this),this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return f(this.value)}}),e.Element.extend=r,e.Point=e.Element.extend({display:!0,inRange:function(t,i){var e=this.hitDetectionRadius+this.radius;return Math.pow(t-this.x,2)+Math.pow(i-this.y,2)<Math.pow(e,2)},draw:function(){if(this.display){var t=this.ctx;t.beginPath(),t.arc(this.x,this.y,this.radius,0,2*Math.PI),t.closePath(),t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.fillStyle=this.fillColor,t.fill(),t.stroke()}}}),e.Arc=e.Element.extend({inRange:function(t,i){var e=s.getAngleFromPoint(this,{x:t,y:i}),n=e.angle>=this.startAngle&&e.angle<=this.endAngle,o=e.distance>=this.innerRadius&&e.distance<=this.outerRadius;return n&&o},tooltipPosition:function(){var t=this.startAngle+(this.endAngle-this.startAngle)/2,i=(this.outerRadius-this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(t)*i,y:this.y+Math.sin(t)*i}},draw:function(t){var i=this.ctx;i.beginPath(),i.arc(this.x,this.y,this.outerRadius,this.startAngle,this.endAngle),i.arc(this.x,this.y,this.innerRadius,this.endAngle,this.startAngle,!0),i.closePath(),i.strokeStyle=this.strokeColor,i.lineWidth=this.strokeWidth,i.fillStyle=this.fillColor,i.fill(),i.lineJoin="bevel",this.showStroke&&i.stroke()}}),e.Rectangle=e.Element.extend({draw:function(){var t=this.ctx,i=this.width/2,e=this.x-i,s=this.x+i,n=this.base-(this.base-this.y),o=this.strokeWidth/2;this.showStroke&&(e+=o,s-=o,n+=o),t.beginPath(),t.fillStyle=this.fillColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.moveTo(e,this.base),t.lineTo(e,n),t.lineTo(s,n),t.lineTo(s,this.base),t.fill(),this.showStroke&&t.stroke()},height:function(){return this.base-this.y},inRange:function(t,i){return t>=this.x-this.width/2&&t<=this.x+this.width/2&&i>=this.y&&i<=this.base}}),e.Tooltip=e.Element.extend({draw:function(){var t=this.chart.ctx;t.font=M(this.fontSize,this.fontStyle,this.fontFamily),this.xAlign="center",this.yAlign="above";var i=2,e=t.measureText(this.text).width+2*this.xPadding,s=this.fontSize+2*this.yPadding,n=s+this.caretHeight+i;this.x+e/2>this.chart.width?this.xAlign="left":this.x-e/2<0&&(this.xAlign="right"),this.y-n<0&&(this.yAlign="below");var o=this.x-e/2,a=this.y-n;switch(t.fillStyle=this.fillColor,this.yAlign){case"above":t.beginPath(),t.moveTo(this.x,this.y-i),t.lineTo(this.x+this.caretHeight,this.y-(i+this.caretHeight)),t.lineTo(this.x-this.caretHeight,this.y-(i+this.caretHeight)),t.closePath(),t.fill();break;case"below":a=this.y+i+this.caretHeight,t.beginPath(),t.moveTo(this.x,this.y+i),t.lineTo(this.x+this.caretHeight,this.y+i+this.caretHeight),t.lineTo(this.x-this.caretHeight,this.y+i+this.caretHeight),t.closePath(),t.fill()}switch(this.xAlign){case"left":o=this.x-e+(this.cornerRadius+this.caretHeight);break;case"right":o=this.x-(this.cornerRadius+this.caretHeight)}z(t,o,a,e,s,this.cornerRadius),t.fill(),t.fillStyle=this.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,o+e/2,a+s/2)}}),e.MultiTooltip=e.Element.extend({initialize:function(){this.font=M(this.fontSize,this.fontStyle,this.fontFamily),this.titleFont=M(this.titleFontSize,this.titleFontStyle,this.titleFontFamily),this.height=this.labels.length*this.fontSize+(this.labels.length-1)*(this.fontSize/2)+2*this.yPadding+1.5*this.titleFontSize,this.ctx.font=this.titleFont;var t=this.ctx.measureText(this.title).width,i=W(this.ctx,this.font,this.labels)+this.fontSize+3,e=g([i,t]);this.width=e+2*this.xPadding;var s=this.height/2;this.y-s<0?this.y=s:this.y+s>this.chart.height&&(this.y=this.chart.height-s),this.x>this.chart.width/2?this.x-=this.xOffset+this.width:this.x+=this.xOffset},getLineHeight:function(t){var i=this.y-this.height/2+this.yPadding,e=t-1;return 0===t?i+this.titleFontSize/2:i+(1.5*this.fontSize*e+this.fontSize/2)+1.5*this.titleFontSize},draw:function(){z(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius);var t=this.ctx;t.fillStyle=this.fillColor,t.fill(),t.closePath(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=this.titleTextColor,t.font=this.titleFont,t.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0)),t.font=this.font,s.each(this.labels,function(i,e){t.fillStyle=this.textColor,t.fillText(i,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(e+1)),t.fillStyle=this.legendColorBackground,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize),t.fillStyle=this.legendColors[e].fill,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize)},this)}}),e.Scale=e.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}));this.yLabelWidth=this.display&&this.showLabels?W(this.ctx,this.font,this.yLabels):0},addXLabel:function(t){this.xLabels.push(t),this.valuesCount++,this.fit()},removeXLabel:function(){this.xLabels.shift(),this.valuesCount--,this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var t,i=this.endPoint-this.startPoint;for(this.calculateYRange(i),this.buildYLabels(),this.calculateXLabelRotation();i>this.endPoint-this.startPoint;)i=this.endPoint-this.startPoint,t=this.yLabelWidth,this.calculateYRange(i),this.buildYLabels(),t<this.yLabelWidth&&this.calculateXLabelRotation()},calculateXLabelRotation:function(){this.ctx.font=this.font;var t,i,e=this.ctx.measureText(this.xLabels[0]).width,s=this.ctx.measureText(this.xLabels[this.xLabels.length-1]).width;if(this.xScalePaddingRight=s/2+3,this.xScalePaddingLeft=e/2>this.yLabelWidth+10?e/2:this.yLabelWidth+10,this.xLabelRotation=0,this.display){var n,o=W(this.ctx,this.font,this.xLabels);this.xLabelWidth=o;for(var a=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>a&&0===this.xLabelRotation||this.xLabelWidth>a&&this.xLabelRotation<=90&&this.xLabelRotation>0;)n=Math.cos(x(this.xLabelRotation)),t=n*e,i=n*s,t+this.fontSize/2>this.yLabelWidth+8&&(this.xScalePaddingLeft=t+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=n*o;this.xLabelRotation>0&&(this.endPoint-=Math.sin(x(this.xLabelRotation))*o+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding},calculateYRange:c,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(t){var i=this.drawingArea()/(this.min-this.max);return this.endPoint-i*(t-this.min)},calculateX:function(t){var i=(this.xLabelRotation>0,this.width-(this.xScalePaddingLeft+this.xScalePaddingRight)),e=i/(this.valuesCount-(this.offsetGridLines?0:1)),s=e*t+this.xScalePaddingLeft;return this.offsetGridLines&&(s+=e/2),Math.round(s)},update:function(t){s.extend(this,t),this.fit()},draw:function(){var t=this.ctx,i=(this.endPoint-this.startPoint)/this.steps,e=Math.round(this.xScalePaddingLeft);this.display&&(t.fillStyle=this.textColor,t.font=this.font,n(this.yLabels,function(n,o){var a=this.endPoint-i*o,h=Math.round(a);t.textAlign="right",t.textBaseline="middle",this.showLabels&&t.fillText(n,e-10,a),t.beginPath(),o>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),h+=s.aliasPixel(t.lineWidth),t.moveTo(e,h),t.lineTo(this.width,h),t.stroke(),t.closePath(),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(e-5,h),t.lineTo(e,h),t.stroke(),t.closePath()},this),n(this.xLabels,function(i,e){var s=this.calculateX(e)+S(this.lineWidth),n=this.calculateX(e-(this.offsetGridLines?.5:0))+S(this.lineWidth),o=this.xLabelRotation>0;t.beginPath(),e>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),t.moveTo(n,this.endPoint),t.lineTo(n,this.startPoint-3),t.stroke(),t.closePath(),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(n,this.endPoint),t.lineTo(n,this.endPoint+5),t.stroke(),t.closePath(),t.save(),t.translate(s,o?this.endPoint+12:this.endPoint+8),t.rotate(-1*x(this.xLabelRotation)),t.font=this.font,t.textAlign=o?"right":"center",t.textBaseline=o?"middle":"top",t.fillText(i,0,0),t.restore()},this))}}),e.RadialScale=e.Element.extend({initialize:function(){this.size=m([this.height,this.width]),this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(t){var i=this.drawingArea/(this.max-this.min);return(t-this.min)*i},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize(),this.buildYLabels()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var t,i,e,s,n,o,a,h,l,r,c,u,d=m([this.height/2-this.pointLabelFontSize-5,this.width/2]),p=this.width,g=0;for(this.ctx.font=M(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),i=0;i<this.valuesCount;i++)t=this.getPointPosition(i,d),e=this.ctx.measureText(C(this.templateString,{value:this.labels[i]})).width+5,0===i||i===this.valuesCount/2?(s=e/2,t.x+s>p&&(p=t.x+s,n=i),t.x-s<g&&(g=t.x-s,a=i)):i<this.valuesCount/2?t.x+e>p&&(p=t.x+e,n=i):i>this.valuesCount/2&&t.x-e<g&&(g=t.x-e,a=i);l=g,r=Math.ceil(p-this.width),o=this.getIndexAngle(n),h=this.getIndexAngle(a),c=r/Math.sin(o+Math.PI/2),u=l/Math.sin(h+Math.PI/2),c=f(c)?c:0,u=f(u)?u:0,this.drawingArea=d-(u+c)/2,this.setCenterPoint(u,c)},setCenterPoint:function(t,i){var e=this.width-i-this.drawingArea,s=t+this.drawingArea;this.xCenter=(s+e)/2,this.yCenter=this.height/2},getIndexAngle:function(t){var i=2*Math.PI/this.valuesCount;return t*i-Math.PI/2},getPointPosition:function(t,i){var e=this.getIndexAngle(t);return{x:Math.cos(e)*i+this.xCenter,y:Math.sin(e)*i+this.yCenter}},draw:function(){if(this.display){var t=this.ctx;if(n(this.yLabels,function(i,e){if(e>0){var s,n=e*(this.drawingArea/this.steps),o=this.yCenter-n;if(this.lineWidth>0)if(t.strokeStyle=this.lineColor,t.lineWidth=this.lineWidth,this.lineArc)t.beginPath(),t.arc(this.xCenter,this.yCenter,n,0,2*Math.PI),t.closePath(),t.stroke();else{t.beginPath();for(var a=0;a<this.valuesCount;a++)s=this.getPointPosition(a,this.calculateCenterOffset(this.min+e*this.stepValue)),0===a?t.moveTo(s.x,s.y):t.lineTo(s.x,s.y);t.closePath(),t.stroke()}if(this.showLabels){if(t.font=M(this.fontSize,this.fontStyle,this.fontFamily),this.showLabelBackdrop){var h=t.measureText(i).width;t.fillStyle=this.backdropColor,t.fillRect(this.xCenter-h/2-this.backdropPaddingX,o-this.fontSize/2-this.backdropPaddingY,h+2*this.backdropPaddingX,this.fontSize+2*this.backdropPaddingY)}t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.fontColor,t.fillText(i,this.xCenter,o)}}},this),!this.lineArc){t.lineWidth=this.angleLineWidth,t.strokeStyle=this.angleLineColor;for(var i=this.valuesCount-1;i>=0;i--){if(this.angleLineWidth>0){var e=this.getPointPosition(i,this.calculateCenterOffset(this.max));t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(e.x,e.y),t.stroke(),t.closePath()}var s=this.getPointPosition(i,this.calculateCenterOffset(this.max)+5);t.font=M(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),t.fillStyle=this.pointLabelFontColor;var o=this.labels.length,a=this.labels.length/2,h=a/2,l=h>i||i>o-h,r=i===h||i===o-h;t.textAlign=0===i?"center":i===a?"center":a>i?"left":"right",t.textBaseline=r?"middle":l?"bottom":"top",t.fillText(this.labels[i],s.x,s.y)}}}}}),s.addEvent(window,"resize",function(){var t;return function(){clearTimeout(t),t=setTimeout(function(){n(e.instances,function(t){t.options.responsive&&t.resize(t.render,!0)})},50)}}()),p?define(function(){return e}):"object"==typeof module&&module.exports&&(module.exports=e),t.Chart=e,e.noConflict=function(){return t.Chart=i,e}}).call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Bar",defaults:s,initialize:function(t){var s=this.options;this.ScaleClass=i.Scale.extend({offsetGridLines:!0,calculateBarX:function(t,i,e){var n=this.calculateBaseWidth(),o=this.calculateX(e)-n/2,a=this.calculateBarWidth(t);return o+a*i+i*s.barDatasetSpacing+a/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*s.barValueSpacing},calculateBarWidth:function(t){var i=this.calculateBaseWidth()-(t-1)*s.barDatasetSpacing;return i/t}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getBarsAtEvent(t):[];this.eachBars(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),this.BarClass=i.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,bars:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.bars.push(new this.BarClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.strokeColor,fillColor:i.fillColor,highlightFill:i.highlightFill||i.fillColor,highlightStroke:i.highlightStroke||i.strokeColor}))},this)},this),this.buildScale(t.labels),this.BarClass.prototype.base=this.scale.endPoint,this.eachBars(function(t,i,s){e.extend(t,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,s,i),y:this.scale.endPoint}),t.save()},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachBars(function(t){t.save()}),this.render()},eachBars:function(t){e.each(this.datasets,function(i,s){e.each(i.bars,t,this,s)},this)},getBarsAtEvent:function(t){for(var i,s=[],n=e.getRelativePosition(t),o=function(t){s.push(t.bars[i])},a=0;a<this.datasets.length;a++)for(i=0;i<this.datasets[a].bars.length;i++)if(this.datasets[a].bars[i].inRange(n.x,n.y))return e.each(this.datasets,o),s;return s},buildScale:function(t){var i=this,s=function(){var t=[];return i.eachBars(function(i){t.push(i.value)}),t},n={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(s(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(n,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new this.ScaleClass(n)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].bars.push(new this.BarClass({value:t,label:i,x:this.scale.calculateBarX(this.datasets.length,e,this.scale.valuesCount+1),y:this.scale.endPoint,width:this.scale.calculateBarWidth(this.datasets.length),base:this.scale.endPoint,strokeColor:this.datasets[e].strokeColor,fillColor:this.datasets[e].fillColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.bars.shift()},this),this.update()},reflow:function(){e.extend(this.BarClass.prototype,{y:this.scale.endPoint,base:this.scale.endPoint});var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();this.chart.ctx;this.scale.draw(i),e.each(this.datasets,function(t,s){e.each(t.bars,function(t,e){t.hasValue()&&(t.base=this.scale.endPoint,t.transition({x:this.scale.calculateBarX(this.datasets.length,s,e),y:this.scale.calculateY(t.value),width:this.scale.calculateBarWidth(this.datasets.length)},i).draw())},this)},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};
| |
− | i.Type.extend({name:"Doughnut",defaults:s,initialize:function(t){this.segments=[],this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=i.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.calculateTotal(t),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({value:t.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:t.color,highlightColor:t.highlight||t.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(t.value),label:t.label})),e||(this.reflow(),this.update())},calculateCircumference:function(t){return 2*Math.PI*(t/this.total)},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this)},update:function(){this.calculateTotal(this.segments),e.each(this.activeElements,function(t){t.restore(["fillColor"])}),e.each(this.segments,function(t){t.save()}),this.render()},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,e.each(this.segments,function(t){t.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(t){var i=t?t:1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.calculateCircumference(t.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},i),t.endAngle=t.startAngle+t.circumference,t.draw(),0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle)},this)}}),i.types.Doughnut.extend({name:"Pie",defaults:e.merge(s,{percentageInnerCutout:0})})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,bezierCurve:!0,bezierCurveTension:.4,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Line",defaults:s,initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(t){return Math.pow(t-this.x,2)<Math.pow(this.radius+this.hitDetectionRadius,2)}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this),this.buildScale(t.labels),this.eachPoints(function(t,i){e.extend(t,{x:this.scale.calculateX(i),y:this.scale.endPoint}),t.save()},this)},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachPoints(function(t){t.save()}),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.datasets,function(t){e.each(t.points,function(t){t.inRange(s.x,s.y)&&i.push(t)})},this),i},buildScale:function(t){var s=this,n=function(){var t=[];return s.eachPoints(function(i){t.push(i.value)}),t},o={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(n(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.pointDotRadius+this.options.pointDotStrokeWidth,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(o,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new i.Scale(o)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:this.scale.calculateX(this.scale.valuesCount+1),y:this.scale.endPoint,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.points.shift()},this),this.update()},reflow:function(){var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();var s=this.chart.ctx,n=function(t){return null!==t.value},o=function(t,i,s){return e.findNextWhere(i,n,s)||t},a=function(t,i,s){return e.findPreviousWhere(i,n,s)||t};this.scale.draw(i),e.each(this.datasets,function(t){var h=e.where(t.points,n);e.each(t.points,function(t,e){t.hasValue()&&t.transition({y:this.scale.calculateY(t.value),x:this.scale.calculateX(e)},i)},this),this.options.bezierCurve&&e.each(h,function(t,i){var s=i>0&&i<h.length-1?this.options.bezierCurveTension:0;t.controlPoints=e.splineCurve(a(t,h,i),t,o(t,h,i),s),t.controlPoints.outer.y>this.scale.endPoint?t.controlPoints.outer.y=this.scale.endPoint:t.controlPoints.outer.y<this.scale.startPoint&&(t.controlPoints.outer.y=this.scale.startPoint),t.controlPoints.inner.y>this.scale.endPoint?t.controlPoints.inner.y=this.scale.endPoint:t.controlPoints.inner.y<this.scale.startPoint&&(t.controlPoints.inner.y=this.scale.startPoint)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(h,function(t,i){if(0===i)s.moveTo(t.x,t.y);else if(this.options.bezierCurve){var e=a(t,h,i);s.bezierCurveTo(e.controlPoints.outer.x,e.controlPoints.outer.y,t.controlPoints.inner.x,t.controlPoints.inner.y,t.x,t.y)}else s.lineTo(t.x,t.y)},this),s.stroke(),this.options.datasetFill&&h.length>0&&(s.lineTo(h[h.length-1].x,this.scale.endPoint),s.lineTo(h[0].x,this.scale.endPoint),s.fillStyle=t.fillColor,s.closePath(),s.fill()),e.each(h,function(t){t.draw()})},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"PolarArea",defaults:s,initialize:function(t){this.segments=[],this.SegmentArc=i.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:t.length}),this.updateScaleRange(t),this.scale.update(),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({fillColor:t.color,highlightColor:t.highlight||t.color,label:t.label,value:t.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(t.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),e||(this.reflow(),this.update())},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(t){var i=[];e.each(t,function(t){i.push(t.value)});var s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s,{size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),e.each(this.segments,function(t){t.save()}),this.render()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),e.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),e.each(this.segments,function(t){t.update({outerRadius:this.scale.calculateCenterOffset(t.value)})},this)},draw:function(t){var i=t||1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(t.value)},i),t.endAngle=t.startAngle+t.circumference,0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle),t.draw()},this),this.scale.draw()}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers;i.Type.extend({name:"Radar",defaults:{scaleShowLine:!0,angleShowLineOut:!0,scaleShowLabels:!1,scaleBeginAtZero:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:10,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(t),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){var o;this.scale.animation||(o=this.scale.getPointPosition(n,this.scale.calculateCenterOffset(e))),s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,x:this.options.animation?this.scale.xCenter:o.x,y:this.options.animation?this.scale.yCenter:o.y,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=e.getRelativePosition(t),s=e.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),n=2*Math.PI/this.scale.valuesCount,o=Math.round((s.angle-1.5*Math.PI)/n),a=[];return(o>=this.scale.valuesCount||0>o)&&(o=0),s.distance<=this.scale.drawingArea&&e.each(this.datasets,function(t){a.push(t.points[o])}),a},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i=function(){var i=[];return e.each(t,function(t){t.data?i=i.concat(t.data):e.each(t.points,function(t){i.push(t.value)})}),i}(),s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s)},addData:function(t,i){this.scale.valuesCount++,e.each(t,function(t,e){var s=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:s.x,y:s.y,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.labels.push(i),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),e.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var i=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),e.each(this.datasets,function(t){e.each(t.points,function(t,e){t.hasValue()&&t.transition(this.scale.getPointPosition(e,this.scale.calculateCenterOffset(t.value)),i)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,s.fill(),e.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this);;
| |
− |
| |
− | /* ../vendor/SpriteAnimation.js */
| |
− | function SpriteAnimation(pSelector, pOptions)
| |
− | {
| |
− | var that = this;
| |
− | var $sprite = $(pSelector);
| |
− |
| |
− | var options = $.extend({
| |
− | width : $sprite.width(),
| |
− | height : $sprite.height(),
| |
− | columns : pOptions.frames
| |
− | }, pOptions);
| |
− |
| |
− | var currentFrame = 0;
| |
− | var interval = null;
| |
− | var callback = false;
| |
− |
| |
− | function setPosition(pCurrentFrame){
| |
− | currentFrame = pCurrentFrame || currentFrame;
| |
− | var x, y;
| |
− |
| |
− | x = options.width*(((currentFrame)%options.columns))*-1;
| |
− | //x = options.width*(((currentFrame+1)%options.columns)-1)*-1;
| |
− | y = options.height*(Math.ceil((currentFrame+1)/options.columns)-1)*-1;
| |
− |
| |
− | $sprite.stop().css({
| |
− | backgroundPosition: x+'px '+y+'px'
| |
− | });
| |
− | }
| |
− |
| |
− | this.play = function(initialize){
| |
− | initialize = initialize || false;
| |
− | if(currentFrame >= options.frames-1 || initialize)
| |
− | {
| |
− | currentFrame = 0;
| |
− | }
| |
− | that.stop();
| |
− | interval = window.setInterval(function(){
| |
− | currentFrame++;
| |
− |
| |
− | setPosition();
| |
− |
| |
− | if(currentFrame >= options.frames-1)
| |
− | {
| |
− | that.stop();
| |
− |
| |
− | if(callback !== false) callback();
| |
− | }
| |
− |
| |
− | }, 1000 / options.fps);
| |
− | };
| |
− |
| |
− | this.stop = function(){
| |
− | window.clearInterval(interval);
| |
− | };
| |
− |
| |
− | this.reward = function(){
| |
− | that.stop();
| |
− | interval = window.setInterval(function(){
| |
− | currentFrame--;
| |
− |
| |
− | setPosition();
| |
− |
| |
− | if(currentFrame <= 0)
| |
− | {
| |
− | that.stop();
| |
− | }
| |
− |
| |
− | }, 1000 / options.fps);
| |
− | };
| |
− |
| |
− | this.setCallback = function(pCallback){
| |
− | callback = pCallback;
| |
− | };
| |
− | };
| |
− |
| |
− | /* ../vendor/html5shiv.js */
| |
− | /*
| |
− | HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
| |
− | */
| |
− | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
| |
− | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
| |
− | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
| |
− | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
| |
− | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);;
| |
− |
| |
− | /* ../vendor/iscroll-probe.js */
| |
− | /*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
| |
− | (function (window, document, Math) {
| |
− | var rAF = window.requestAnimationFrame ||
| |
− | window.webkitRequestAnimationFrame ||
| |
− | window.mozRequestAnimationFrame ||
| |
− | window.oRequestAnimationFrame ||
| |
− | window.msRequestAnimationFrame ||
| |
− | function (callback) { window.setTimeout(callback, 1000 / 60); };
| |
− |
| |
− | var utils = (function () {
| |
− | var me = {};
| |
− |
| |
− | var _elementStyle = document.createElement('div').style;
| |
− | var _vendor = (function () {
| |
− | var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'],
| |
− | transform,
| |
− | i = 0,
| |
− | l = vendors.length;
| |
− |
| |
− | for ( ; i < l; i++ ) {
| |
− | transform = vendors[i] + 'ransform';
| |
− | if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1);
| |
− | }
| |
− |
| |
− | return false;
| |
− | })();
| |
− |
| |
− | function _prefixStyle (style) {
| |
− | if ( _vendor === false ) return false;
| |
− | if ( _vendor === '' ) return style;
| |
− | return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
| |
− | }
| |
− |
| |
− | me.getTime = Date.now || function getTime () { return new Date().getTime(); };
| |
− |
| |
− | me.extend = function (target, obj) {
| |
− | for ( var i in obj ) {
| |
− | target[i] = obj[i];
| |
− | }
| |
− | };
| |
− |
| |
− | me.addEvent = function (el, type, fn, capture) {
| |
− | if('addEventListener' in el)
| |
− | {
| |
− | el.addEventListener(type, fn, !!capture);
| |
− | }
| |
− | else if(type == 'wheel')
| |
− | {
| |
− | $(el).css({
| |
− | overflowY:'scroll'
| |
− | });
| |
− | }
| |
− | };
| |
− |
| |
− | me.removeEvent = function (el, type, fn, capture) {
| |
− | el.removeEventListener(type, fn, !!capture);
| |
− | };
| |
− |
| |
− | me.prefixPointerEvent = function (pointerEvent) {
| |
− | return window.MSPointerEvent ?
| |
− | 'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10):
| |
− | pointerEvent;
| |
− | };
| |
− |
| |
− | me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
| |
− | var distance = current - start,
| |
− | speed = Math.abs(distance) / time,
| |
− | destination,
| |
− | duration;
| |
− |
| |
− | deceleration = deceleration === undefined ? 0.0006 : deceleration;
| |
− |
| |
− | destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
| |
− | duration = speed / deceleration;
| |
− |
| |
− | if ( destination < lowerMargin ) {
| |
− | destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin;
| |
− | distance = Math.abs(destination - current);
| |
− | duration = distance / speed;
| |
− | } else if ( destination > 0 ) {
| |
− | destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0;
| |
− | distance = Math.abs(current) + destination;
| |
− | duration = distance / speed;
| |
− | }
| |
− |
| |
− | return {
| |
− | destination: Math.round(destination),
| |
− | duration: duration
| |
− | };
| |
− | };
| |
− |
| |
− | var _transform = _prefixStyle('transform');
| |
− |
| |
− | me.extend(me, {
| |
− | hasTransform: _transform !== false,
| |
− | hasPerspective: _prefixStyle('perspective') in _elementStyle,
| |
− | hasTouch: 'ontouchstart' in window,
| |
− | hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
| |
− | hasTransition: _prefixStyle('transition') in _elementStyle
| |
− | });
| |
− |
| |
− | // This should find all Android browsers lower than build 535.19 (both stock browser and webview)
| |
− | me.isBadAndroid = /Android /.test(window.navigator.appVersion) && !(/Chrome\/\d/.test(window.navigator.appVersion));
| |
− |
| |
− | me.extend(me.style = {}, {
| |
− | transform: _transform,
| |
− | transitionTimingFunction: _prefixStyle('transitionTimingFunction'),
| |
− | transitionDuration: _prefixStyle('transitionDuration'),
| |
− | transitionDelay: _prefixStyle('transitionDelay'),
| |
− | transformOrigin: _prefixStyle('transformOrigin')
| |
− | });
| |
− |
| |
− | me.hasClass = function (e, c) {
| |
− | var re = new RegExp("(^|\\s)" + c + "(\\s|$)");
| |
− | return re.test(e.className);
| |
− | };
| |
− |
| |
− | me.addClass = function (e, c) {
| |
− | if ( me.hasClass(e, c) ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | var newclass = e.className.split(' ');
| |
− | newclass.push(c);
| |
− | e.className = newclass.join(' ');
| |
− | };
| |
− |
| |
− | me.removeClass = function (e, c) {
| |
− | if ( !me.hasClass(e, c) ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g');
| |
− | e.className = e.className.replace(re, ' ');
| |
− | };
| |
− |
| |
− | me.offset = function (el) {
| |
− | var left = -el.offsetLeft,
| |
− | top = -el.offsetTop;
| |
− |
| |
− | // jshint -W084
| |
− | while (el = el.offsetParent) {
| |
− | left -= el.offsetLeft;
| |
− | top -= el.offsetTop;
| |
− | }
| |
− | // jshint +W084
| |
− |
| |
− | return {
| |
− | left: left,
| |
− | top: top
| |
− | };
| |
− | };
| |
− |
| |
− | me.preventDefaultException = function (el, exceptions) {
| |
− | for ( var i in exceptions ) {
| |
− | if ( exceptions[i].test(el[i]) ) {
| |
− | return true;
| |
− | }
| |
− | }
| |
− |
| |
− | return false;
| |
− | };
| |
− |
| |
− | me.extend(me.eventType = {}, {
| |
− | touchstart: 1,
| |
− | touchmove: 1,
| |
− | touchend: 1,
| |
− |
| |
− | mousedown: 2,
| |
− | mousemove: 2,
| |
− | mouseup: 2,
| |
− |
| |
− | pointerdown: 3,
| |
− | pointermove: 3,
| |
− | pointerup: 3,
| |
− |
| |
− | MSPointerDown: 3,
| |
− | MSPointerMove: 3,
| |
− | MSPointerUp: 3
| |
− | });
| |
− |
| |
− | me.extend(me.ease = {}, {
| |
− | quadratic: {
| |
− | style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
| |
− | fn: function (k) {
| |
− | return k * ( 2 - k );
| |
− | }
| |
− | },
| |
− | circular: {
| |
− | style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
| |
− | fn: function (k) {
| |
− | return Math.sqrt( 1 - ( --k * k ) );
| |
− | }
| |
− | },
| |
− | back: {
| |
− | style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
| |
− | fn: function (k) {
| |
− | var b = 4;
| |
− | return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1;
| |
− | }
| |
− | },
| |
− | bounce: {
| |
− | style: '',
| |
− | fn: function (k) {
| |
− | if ( ( k /= 1 ) < ( 1 / 2.75 ) ) {
| |
− | return 7.5625 * k * k;
| |
− | } else if ( k < ( 2 / 2.75 ) ) {
| |
− | return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
| |
− | } else if ( k < ( 2.5 / 2.75 ) ) {
| |
− | return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
| |
− | } else {
| |
− | return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
| |
− | }
| |
− | }
| |
− | },
| |
− | elastic: {
| |
− | style: '',
| |
− | fn: function (k) {
| |
− | var f = 0.22,
| |
− | e = 0.4;
| |
− |
| |
− | if ( k === 0 ) { return 0; }
| |
− | if ( k == 1 ) { return 1; }
| |
− |
| |
− | return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 );
| |
− | }
| |
− | }
| |
− | });
| |
− |
| |
− | me.tap = function (e, eventName) {
| |
− | var ev = document.createEvent('Event');
| |
− | ev.initEvent(eventName, true, true);
| |
− | ev.pageX = e.pageX;
| |
− | ev.pageY = e.pageY;
| |
− | e.target.dispatchEvent(ev);
| |
− | };
| |
− |
| |
− | me.click = function (e) {
| |
− | var target = e.target,
| |
− | ev;
| |
− |
| |
− | if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
| |
− | ev = document.createEvent('MouseEvents');
| |
− | ev.initMouseEvent('click', true, true, e.view, 1,
| |
− | target.screenX, target.screenY, target.clientX, target.clientY,
| |
− | e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
| |
− | 0, null);
| |
− |
| |
− | ev._constructed = true;
| |
− | target.dispatchEvent(ev);
| |
− | }
| |
− | };
| |
− |
| |
− | return me;
| |
− | })();
| |
− |
| |
− | function IScroll (el, options) {
| |
− | this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
| |
− | this.scroller = this.wrapper.children[0];
| |
− | this.scrollerStyle = this.scroller.style; // cache style for better performance
| |
− |
| |
− | this.options = {
| |
− |
| |
− | resizeScrollbars: true,
| |
− |
| |
− | mouseWheelSpeed: 20,
| |
− |
| |
− | snapThreshold: 0.334,
| |
− |
| |
− | // INSERT POINT: OPTIONS
| |
− |
| |
− | startX: 0,
| |
− | startY: 0,
| |
− | scrollY: true,
| |
− | directionLockThreshold: 5,
| |
− | momentum: true,
| |
− |
| |
− | bounce: true,
| |
− | bounceTime: 600,
| |
− | bounceEasing: '',
| |
− |
| |
− | preventDefault: true,
| |
− | preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ },
| |
− |
| |
− | HWCompositing: true,
| |
− | useTransition: true,
| |
− | useTransform: true
| |
− | };
| |
− |
| |
− | for ( var i in options ) {
| |
− | this.options[i] = options[i];
| |
− | }
| |
− |
| |
− | // Normalize options
| |
− | this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : '';
| |
− |
| |
− | this.options.useTransition = utils.hasTransition && this.options.useTransition;
| |
− | this.options.useTransform = utils.hasTransform && this.options.useTransform;
| |
− |
| |
− | this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough;
| |
− | this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault;
| |
− |
| |
− | // If you want eventPassthrough I have to lock one of the axes
| |
− | this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY;
| |
− | this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX;
| |
− |
| |
− | // With eventPassthrough we also need lockDirection mechanism
| |
− | this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
| |
− | this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
| |
− |
| |
− | this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing;
| |
− |
| |
− | this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling;
| |
− |
| |
− | if ( this.options.tap === true ) {
| |
− | this.options.tap = 'tap';
| |
− | }
| |
− |
| |
− | if ( this.options.shrinkScrollbars == 'scale' ) {
| |
− | this.options.useTransition = false;
| |
− | }
| |
− |
| |
− | this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1;
| |
− |
| |
− | if ( this.options.probeType == 3 ) {
| |
− | this.options.useTransition = false; }
| |
− |
| |
− | // INSERT POINT: NORMALIZATION
| |
− |
| |
− | // Some defaults
| |
− | this.x = 0;
| |
− | this.y = 0;
| |
− | this.directionX = 0;
| |
− | this.directionY = 0;
| |
− | this._events = {};
| |
− |
| |
− | // INSERT POINT: DEFAULTS
| |
− |
| |
− | this._init();
| |
− | this.refresh();
| |
− |
| |
− | this.scrollTo(this.options.startX, this.options.startY);
| |
− | this.enable();
| |
− | }
| |
− |
| |
− | IScroll.prototype = {
| |
− | version: '5.1.3',
| |
− |
| |
− | _init: function () {
| |
− | this._initEvents();
| |
− |
| |
− | if ( this.options.scrollbars || this.options.indicators ) {
| |
− | this._initIndicators();
| |
− | }
| |
− |
| |
− | if ( this.options.mouseWheel ) {
| |
− | this._initWheel();
| |
− | }
| |
− |
| |
− | if ( this.options.snap ) {
| |
− | this._initSnap();
| |
− | }
| |
− |
| |
− | if ( this.options.keyBindings ) {
| |
− | this._initKeys();
| |
− | }
| |
− |
| |
− | // INSERT POINT: _init
| |
− |
| |
− | },
| |
− |
| |
− | destroy: function () {
| |
− | this._initEvents(true);
| |
− |
| |
− | this._execEvent('destroy');
| |
− | },
| |
− |
| |
− | _transitionEnd: function (e) {
| |
− | if ( e.target != this.scroller || !this.isInTransition ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | this._transitionTime();
| |
− | if ( !this.resetPosition(this.options.bounceTime) ) {
| |
− | this.isInTransition = false;
| |
− | this._execEvent('scrollEnd');
| |
− | }
| |
− | },
| |
− |
| |
− | _start: function (e) {
| |
− | // React to left mouse button only
| |
− | if ( utils.eventType[e.type] != 1 ) {
| |
− | if ( e.button !== 0 ) {
| |
− | return;
| |
− | }
| |
− | }
| |
− |
| |
− | if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
| |
− | e.preventDefault();
| |
− | }
| |
− |
| |
− | var point = e.touches ? e.touches[0] : e,
| |
− | pos;
| |
− |
| |
− | this.initiated = utils.eventType[e.type];
| |
− | this.moved = false;
| |
− | this.distX = 0;
| |
− | this.distY = 0;
| |
− | this.directionX = 0;
| |
− | this.directionY = 0;
| |
− | this.directionLocked = 0;
| |
− |
| |
− | this._transitionTime();
| |
− |
| |
− | this.startTime = utils.getTime();
| |
− |
| |
− | if ( this.options.useTransition && this.isInTransition ) {
| |
− | this.isInTransition = false;
| |
− | pos = this.getComputedPosition();
| |
− | this._translate(Math.round(pos.x), Math.round(pos.y));
| |
− | this._execEvent('scrollEnd');
| |
− | } else if ( !this.options.useTransition && this.isAnimating ) {
| |
− | this.isAnimating = false;
| |
− | this._execEvent('scrollEnd');
| |
− | }
| |
− |
| |
− | this.startX = this.x;
| |
− | this.startY = this.y;
| |
− | this.absStartX = this.x;
| |
− | this.absStartY = this.y;
| |
− | this.pointX = point.pageX;
| |
− | this.pointY = point.pageY;
| |
− |
| |
− | this._execEvent('beforeScrollStart');
| |
− | },
| |
− |
| |
− | _move: function (e) {
| |
− | if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | if ( this.options.preventDefault ) { // increases performance on Android? TODO: check!
| |
− | e.preventDefault();
| |
− | }
| |
− |
| |
− | var point = e.touches ? e.touches[0] : e,
| |
− | deltaX = point.pageX - this.pointX,
| |
− | deltaY = point.pageY - this.pointY,
| |
− | timestamp = utils.getTime(),
| |
− | newX, newY,
| |
− | absDistX, absDistY;
| |
− |
| |
− | this.pointX = point.pageX;
| |
− | this.pointY = point.pageY;
| |
− |
| |
− | this.distX += deltaX;
| |
− | this.distY += deltaY;
| |
− | absDistX = Math.abs(this.distX);
| |
− | absDistY = Math.abs(this.distY);
| |
− |
| |
− | // We need to move at least 10 pixels for the scrolling to initiate
| |
− | if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | // If you are scrolling in one direction lock the other
| |
− | if ( !this.directionLocked && !this.options.freeScroll ) {
| |
− | if ( absDistX > absDistY + this.options.directionLockThreshold ) {
| |
− | this.directionLocked = 'h'; // lock horizontally
| |
− | } else if ( absDistY >= absDistX + this.options.directionLockThreshold ) {
| |
− | this.directionLocked = 'v'; // lock vertically
| |
− | } else {
| |
− | this.directionLocked = 'n'; // no lock
| |
− | }
| |
− | }
| |
− |
| |
− | if ( this.directionLocked == 'h' ) {
| |
− | if ( this.options.eventPassthrough == 'vertical' ) {
| |
− | e.preventDefault();
| |
− | } else if ( this.options.eventPassthrough == 'horizontal' ) {
| |
− | this.initiated = false;
| |
− | return;
| |
− | }
| |
− |
| |
− | deltaY = 0;
| |
− | } else if ( this.directionLocked == 'v' ) {
| |
− | if ( this.options.eventPassthrough == 'horizontal' ) {
| |
− | e.preventDefault();
| |
− | } else if ( this.options.eventPassthrough == 'vertical' ) {
| |
− | this.initiated = false;
| |
− | return;
| |
− | }
| |
− |
| |
− | deltaX = 0;
| |
− | }
| |
− |
| |
− | deltaX = this.hasHorizontalScroll ? deltaX : 0;
| |
− | deltaY = this.hasVerticalScroll ? deltaY : 0;
| |
− |
| |
− | newX = this.x + deltaX;
| |
− | newY = this.y + deltaY;
| |
− |
| |
− | // Slow down if outside of the boundaries
| |
− | if ( newX > 0 || newX < this.maxScrollX ) {
| |
− | newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX;
| |
− | }
| |
− | if ( newY > 0 || newY < this.maxScrollY ) {
| |
− | newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY;
| |
− | }
| |
− |
| |
− | this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
| |
− | this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
| |
− |
| |
− | if ( !this.moved ) {
| |
− | this._execEvent('scrollStart');
| |
− | }
| |
− |
| |
− | this.moved = true;
| |
− |
| |
− | this._translate(newX, newY);
| |
− |
| |
− | /* REPLACE START: _move */
| |
− | if ( timestamp - this.startTime > 300 ) {
| |
− | this.startTime = timestamp;
| |
− | this.startX = this.x;
| |
− | this.startY = this.y;
| |
− |
| |
− | if ( this.options.probeType == 1 ) {
| |
− | this._execEvent('scroll');
| |
− | }
| |
− | }
| |
− |
| |
− | if ( this.options.probeType > 1 ) {
| |
− | this._execEvent('scroll');
| |
− | }
| |
− | /* REPLACE END: _move */
| |
− |
| |
− | },
| |
− |
| |
− | _end: function (e) {
| |
− | if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
| |
− | e.preventDefault();
| |
− | }
| |
− |
| |
− | var point = e.changedTouches ? e.changedTouches[0] : e,
| |
− | momentumX,
| |
− | momentumY,
| |
− | duration = utils.getTime() - this.startTime,
| |
− | newX = Math.round(this.x),
| |
− | newY = Math.round(this.y),
| |
− | distanceX = Math.abs(newX - this.startX),
| |
− | distanceY = Math.abs(newY - this.startY),
| |
− | time = 0,
| |
− | easing = '';
| |
− |
| |
− | this.isInTransition = 0;
| |
− | this.initiated = 0;
| |
− | this.endTime = utils.getTime();
| |
− |
| |
− | // reset if we are outside of the boundaries
| |
− | if ( this.resetPosition(this.options.bounceTime) ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | this.scrollTo(newX, newY); // ensures that the last position is rounded
| |
− |
| |
− | // we scrolled less than 10 pixels
| |
− | if ( !this.moved ) {
| |
− | if ( this.options.tap ) {
| |
− | utils.tap(e, this.options.tap);
| |
− | }
| |
− |
| |
− | if ( this.options.click ) {
| |
− | utils.click(e);
| |
− | }
| |
− |
| |
− | this._execEvent('scrollCancel');
| |
− | return;
| |
− | }
| |
− |
| |
− | if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) {
| |
− | this._execEvent('flick');
| |
− | return;
| |
− | }
| |
− |
| |
− | // start momentum animation if needed
| |
− | if ( this.options.momentum && duration < 300 ) {
| |
− | momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
| |
− | momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
| |
− | newX = momentumX.destination;
| |
− | newY = momentumY.destination;
| |
− | time = Math.max(momentumX.duration, momentumY.duration);
| |
− | this.isInTransition = 1;
| |
− | }
| |
− |
| |
− |
| |
− | if ( this.options.snap ) {
| |
− | var snap = this._nearestSnap(newX, newY);
| |
− | this.currentPage = snap;
| |
− | time = this.options.snapSpeed || Math.max(
| |
− | Math.max(
| |
− | Math.min(Math.abs(newX - snap.x), 1000),
| |
− | Math.min(Math.abs(newY - snap.y), 1000)
| |
− | ), 300);
| |
− | newX = snap.x;
| |
− | newY = snap.y;
| |
− |
| |
− | this.directionX = 0;
| |
− | this.directionY = 0;
| |
− | easing = this.options.bounceEasing;
| |
− | }
| |
− |
| |
− | // INSERT POINT: _end
| |
− |
| |
− | if ( newX != this.x || newY != this.y ) {
| |
− | // change easing function when scroller goes out of the boundaries
| |
− | if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) {
| |
− | easing = utils.ease.quadratic;
| |
− | }
| |
− |
| |
− | this.scrollTo(newX, newY, time, easing);
| |
− | return;
| |
− | }
| |
− |
| |
− | this._execEvent('scrollEnd');
| |
− | },
| |
− |
| |
− | _resize: function () {
| |
− | var that = this;
| |
− |
| |
− | clearTimeout(this.resizeTimeout);
| |
− |
| |
− | this.resizeTimeout = setTimeout(function () {
| |
− | that.refresh();
| |
− | }, this.options.resizePolling);
| |
− | },
| |
− |
| |
− | resetPosition: function (time) {
| |
− | var x = this.x,
| |
− | y = this.y;
| |
− |
| |
− | time = time || 0;
| |
− |
| |
− | if ( !this.hasHorizontalScroll || this.x > 0 ) {
| |
− | x = 0;
| |
− | } else if ( this.x < this.maxScrollX ) {
| |
− | x = this.maxScrollX;
| |
− | }
| |
− |
| |
− | if ( !this.hasVerticalScroll || this.y > 0 ) {
| |
− | y = 0;
| |
− | } else if ( this.y < this.maxScrollY ) {
| |
− | y = this.maxScrollY;
| |
− | }
| |
− |
| |
− | if ( x == this.x && y == this.y ) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | this.scrollTo(x, y, time, this.options.bounceEasing);
| |
− |
| |
− | return true;
| |
− | },
| |
− |
| |
− | disable: function () {
| |
− | this.enabled = false;
| |
− | },
| |
− |
| |
− | enable: function () {
| |
− | this.enabled = true;
| |
− | },
| |
− |
| |
− | refresh: function () {
| |
− | var rf = this.wrapper.offsetHeight; // Force reflow
| |
− |
| |
− | this.wrapperWidth = this.wrapper.clientWidth;
| |
− | this.wrapperHeight = this.wrapper.clientHeight;
| |
− |
| |
− | /* REPLACE START: refresh */
| |
− |
| |
− | this.scrollerWidth = this.scroller.offsetWidth;
| |
− | this.scrollerHeight = this.scroller.offsetHeight;
| |
− |
| |
− | this.maxScrollX = this.wrapperWidth - this.scrollerWidth;
| |
− | this.maxScrollY = this.wrapperHeight - this.scrollerHeight;
| |
− |
| |
− | /* REPLACE END: refresh */
| |
− |
| |
− | this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0;
| |
− | this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0;
| |
− |
| |
− | if ( !this.hasHorizontalScroll ) {
| |
− | this.maxScrollX = 0;
| |
− | this.scrollerWidth = this.wrapperWidth;
| |
− | }
| |
− |
| |
− | if ( !this.hasVerticalScroll ) {
| |
− | this.maxScrollY = 0;
| |
− | this.scrollerHeight = this.wrapperHeight;
| |
− | }
| |
− |
| |
− | this.endTime = 0;
| |
− | this.directionX = 0;
| |
− | this.directionY = 0;
| |
− |
| |
− | this.wrapperOffset = utils.offset(this.wrapper);
| |
− |
| |
− | this._execEvent('refresh');
| |
− |
| |
− | this.resetPosition();
| |
− |
| |
− | // INSERT POINT: _refresh
| |
− |
| |
− | },
| |
− |
| |
− | on: function (type, fn) {
| |
− | if ( !this._events[type] ) {
| |
− | this._events[type] = [];
| |
− | }
| |
− |
| |
− | this._events[type].push(fn);
| |
− | },
| |
− |
| |
− | off: function (type, fn) {
| |
− | if ( !this._events[type] ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | var index = this._events[type].indexOf(fn);
| |
− |
| |
− | if ( index > -1 ) {
| |
− | this._events[type].splice(index, 1);
| |
− | }
| |
− | },
| |
− |
| |
− | _execEvent: function (type) {
| |
− | if ( !this._events[type] ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | var i = 0,
| |
− | l = this._events[type].length;
| |
− |
| |
− | if ( !l ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | for ( ; i < l; i++ ) {
| |
− | this._events[type][i].apply(this, [].slice.call(arguments, 1));
| |
− | }
| |
− | },
| |
− |
| |
− | scrollBy: function (x, y, time, easing) {
| |
− | x = this.x + x;
| |
− | y = this.y + y;
| |
− | time = time || 0;
| |
− |
| |
− | this.scrollTo(x, y, time, easing);
| |
− | },
| |
− |
| |
− | scrollTo: function (x, y, time, easing) {
| |
− | easing = easing || utils.ease.circular;
| |
− |
| |
− | this.isInTransition = this.options.useTransition && time > 0;
| |
− |
| |
− | if ( !time || (this.options.useTransition && easing.style) ) {
| |
− | this._transitionTimingFunction(easing.style);
| |
− | this._transitionTime(time);
| |
− | this._translate(x, y);
| |
− | } else {
| |
− | this._animate(x, y, time, easing.fn);
| |
− | }
| |
− | },
| |
− |
| |
− | scrollToElement: function (el, time, offsetX, offsetY, easing) {
| |
− | el = el.nodeType ? el : this.scroller.querySelector(el);
| |
− |
| |
− | if ( !el ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | var pos = utils.offset(el);
| |
− |
| |
− | pos.left -= this.wrapperOffset.left;
| |
− | pos.top -= this.wrapperOffset.top;
| |
− |
| |
− | // if offsetX/Y are true we center the element to the screen
| |
− | if ( offsetX === true ) {
| |
− | offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2);
| |
− | }
| |
− | if ( offsetY === true ) {
| |
− | offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2);
| |
− | }
| |
− |
| |
− | pos.left -= offsetX || 0;
| |
− | pos.top -= offsetY || 0;
| |
− |
| |
− | pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
| |
− | pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top;
| |
− |
| |
− | time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time;
| |
− |
| |
− | this.scrollTo(pos.left, pos.top, time, easing);
| |
− | },
| |
− |
| |
− | _transitionTime: function (time) {
| |
− | time = time || 0;
| |
− |
| |
− | this.scrollerStyle[utils.style.transitionDuration] = time + 'ms';
| |
− |
| |
− | if ( !time && utils.isBadAndroid ) {
| |
− | this.scrollerStyle[utils.style.transitionDuration] = '0.001s';
| |
− | }
| |
− |
| |
− |
| |
− | if ( this.indicators ) {
| |
− | for ( var i = this.indicators.length; i--; ) {
| |
− | this.indicators[i].transitionTime(time);
| |
− | }
| |
− | }
| |
− |
| |
− |
| |
− | // INSERT POINT: _transitionTime
| |
− |
| |
− | },
| |
− |
| |
− | _transitionTimingFunction: function (easing) {
| |
− | this.scrollerStyle[utils.style.transitionTimingFunction] = easing;
| |
− |
| |
− |
| |
− | if ( this.indicators ) {
| |
− | for ( var i = this.indicators.length; i--; ) {
| |
− | this.indicators[i].transitionTimingFunction(easing);
| |
− | }
| |
− | }
| |
− |
| |
− |
| |
− | // INSERT POINT: _transitionTimingFunction
| |
− |
| |
− | },
| |
− |
| |
− | _translate: function (x, y) {
| |
− | if ( this.options.useTransform ) {
| |
− |
| |
− | /* REPLACE START: _translate */
| |
− |
| |
− | this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ;
| |
− |
| |
− | /* REPLACE END: _translate */
| |
− |
| |
− | } else {
| |
− | x = Math.round(x);
| |
− | y = Math.round(y);
| |
− | this.scrollerStyle.left = x + 'px';
| |
− | this.scrollerStyle.top = y + 'px';
| |
− | }
| |
− |
| |
− | this.x = x;
| |
− | this.y = y;
| |
− |
| |
− |
| |
− | if ( this.indicators ) {
| |
− | for ( var i = this.indicators.length; i--; ) {
| |
− | this.indicators[i].updatePosition();
| |
− | }
| |
− | }
| |
− |
| |
− |
| |
− | // INSERT POINT: _translate
| |
− |
| |
− | },
| |
− |
| |
− | _initEvents: function (remove) {
| |
− | var eventType = remove ? utils.removeEvent : utils.addEvent,
| |
− | target = this.options.bindToWrapper ? this.wrapper : window;
| |
− |
| |
− | eventType(window, 'orientationchange', this);
| |
− | eventType(window, 'resize', this);
| |
− |
| |
− | if ( this.options.click ) {
| |
− | eventType(this.wrapper, 'click', this, true);
| |
− | }
| |
− |
| |
− | if ( !this.options.disableMouse ) {
| |
− | eventType(this.wrapper, 'mousedown', this);
| |
− | eventType(target, 'mousemove', this);
| |
− | eventType(target, 'mousecancel', this);
| |
− | eventType(target, 'mouseup', this);
| |
− | }
| |
− |
| |
− | if ( utils.hasPointer && !this.options.disablePointer ) {
| |
− | eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this);
| |
− | eventType(target, utils.prefixPointerEvent('pointermove'), this);
| |
− | eventType(target, utils.prefixPointerEvent('pointercancel'), this);
| |
− | eventType(target, utils.prefixPointerEvent('pointerup'), this);
| |
− | }
| |
− |
| |
− | if ( utils.hasTouch && !this.options.disableTouch ) {
| |
− | eventType(this.wrapper, 'touchstart', this);
| |
− | eventType(target, 'touchmove', this);
| |
− | eventType(target, 'touchcancel', this);
| |
− | eventType(target, 'touchend', this);
| |
− | }
| |
− |
| |
− | eventType(this.scroller, 'transitionend', this);
| |
− | eventType(this.scroller, 'webkitTransitionEnd', this);
| |
− | eventType(this.scroller, 'oTransitionEnd', this);
| |
− | eventType(this.scroller, 'MSTransitionEnd', this);
| |
− | },
| |
− |
| |
− | getComputedPosition: function () {
| |
− | var matrix = window.getComputedStyle(this.scroller, null),
| |
− | x, y;
| |
− |
| |
− | if ( this.options.useTransform ) {
| |
− | matrix = matrix[utils.style.transform].split(')')[0].split(', ');
| |
− | x = +(matrix[12] || matrix[4]);
| |
− | y = +(matrix[13] || matrix[5]);
| |
− | } else {
| |
− | x = +matrix.left.replace(/[^-\d.]/g, '');
| |
− | y = +matrix.top.replace(/[^-\d.]/g, '');
| |
− | }
| |
− |
| |
− | return { x: x, y: y };
| |
− | },
| |
− |
| |
− | _initIndicators: function () {
| |
− | var interactive = this.options.interactiveScrollbars,
| |
− | customStyle = typeof this.options.scrollbars != 'string',
| |
− | indicators = [],
| |
− | indicator;
| |
− |
| |
− | var that = this;
| |
− |
| |
− | this.indicators = [];
| |
− |
| |
− | if ( this.options.scrollbars ) {
| |
− | // Vertical scrollbar
| |
− | if ( this.options.scrollY ) {
| |
− | indicator = {
| |
− | el: createDefaultScrollbar('v', interactive, this.options.scrollbars),
| |
− | interactive: interactive,
| |
− | defaultScrollbars: true,
| |
− | customStyle: customStyle,
| |
− | resize: this.options.resizeScrollbars,
| |
− | shrink: this.options.shrinkScrollbars,
| |
− | fade: this.options.fadeScrollbars,
| |
− | listenX: false
| |
− | };
| |
− |
| |
− | this.wrapper.appendChild(indicator.el);
| |
− | indicators.push(indicator);
| |
− | }
| |
− |
| |
− | // Horizontal scrollbar
| |
− | if ( this.options.scrollX ) {
| |
− | indicator = {
| |
− | el: createDefaultScrollbar('h', interactive, this.options.scrollbars),
| |
− | interactive: interactive,
| |
− | defaultScrollbars: true,
| |
− | customStyle: customStyle,
| |
− | resize: this.options.resizeScrollbars,
| |
− | shrink: this.options.shrinkScrollbars,
| |
− | fade: this.options.fadeScrollbars,
| |
− | listenY: false
| |
− | };
| |
− |
| |
− | this.wrapper.appendChild(indicator.el);
| |
− | indicators.push(indicator);
| |
− | }
| |
− | }
| |
− |
| |
− | if ( this.options.indicators ) {
| |
− | // TODO: check concat compatibility
| |
− | indicators = indicators.concat(this.options.indicators);
| |
− | }
| |
− |
| |
− | for ( var i = indicators.length; i--; ) {
| |
− | this.indicators.push( new Indicator(this, indicators[i]) );
| |
− | }
| |
− |
| |
− | // TODO: check if we can use array.map (wide compatibility and performance issues)
| |
− | function _indicatorsMap (fn) {
| |
− | for ( var i = that.indicators.length; i--; ) {
| |
− | fn.call(that.indicators[i]);
| |
− | }
| |
− | }
| |
− |
| |
− | if ( this.options.fadeScrollbars ) {
| |
− | this.on('scrollEnd', function () {
| |
− | _indicatorsMap(function () {
| |
− | this.fade();
| |
− | });
| |
− | });
| |
− |
| |
− | this.on('scrollCancel', function () {
| |
− | _indicatorsMap(function () {
| |
− | this.fade();
| |
− | });
| |
− | });
| |
− |
| |
− | this.on('scrollStart', function () {
| |
− | _indicatorsMap(function () {
| |
− | this.fade(1);
| |
− | });
| |
− | });
| |
− |
| |
− | this.on('beforeScrollStart', function () {
| |
− | _indicatorsMap(function () {
| |
− | this.fade(1, true);
| |
− | });
| |
− | });
| |
− | }
| |
− |
| |
− |
| |
− | this.on('refresh', function () {
| |
− | _indicatorsMap(function () {
| |
− | this.refresh();
| |
− | });
| |
− | });
| |
− |
| |
− | this.on('destroy', function () {
| |
− | _indicatorsMap(function () {
| |
− | this.destroy();
| |
− | });
| |
− |
| |
− | delete this.indicators;
| |
− | });
| |
− | },
| |
− |
| |
− | _initWheel: function () {
| |
− | utils.addEvent(this.wrapper, 'wheel', this);
| |
− | utils.addEvent(this.wrapper, 'mousewheel', this);
| |
− | utils.addEvent(this.wrapper, 'DOMMouseScroll', this);
| |
− |
| |
− | this.on('destroy', function () {
| |
− | utils.removeEvent(this.wrapper, 'wheel', this);
| |
− | utils.removeEvent(this.wrapper, 'mousewheel', this);
| |
− | utils.removeEvent(this.wrapper, 'DOMMouseScroll', this);
| |
− | });
| |
− | },
| |
− |
| |
− | _wheel: function (e) {
| |
− | if ( !this.enabled ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | e.preventDefault();
| |
− | e.stopPropagation();
| |
− |
| |
− | var wheelDeltaX, wheelDeltaY,
| |
− | newX, newY,
| |
− | that = this;
| |
− |
| |
− | if ( this.wheelTimeout === undefined ) {
| |
− | that._execEvent('scrollStart');
| |
− | }
| |
− |
| |
− | // Execute the scrollEnd event after 400ms the wheel stopped scrolling
| |
− | clearTimeout(this.wheelTimeout);
| |
− | this.wheelTimeout = setTimeout(function () {
| |
− | that._execEvent('scrollEnd');
| |
− | that.wheelTimeout = undefined;
| |
− | }, 400);
| |
− |
| |
− | if ( 'deltaX' in e ) {
| |
− | if (e.deltaMode === 1) {
| |
− | wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed;
| |
− | wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed;
| |
− | } else {
| |
− | wheelDeltaX = -e.deltaX;
| |
− | wheelDeltaY = -e.deltaY;
| |
− | }
| |
− | } else if ( 'wheelDeltaX' in e ) {
| |
− | wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed;
| |
− | wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed;
| |
− | } else if ( 'wheelDelta' in e ) {
| |
− | wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed;
| |
− | } else if ( 'detail' in e ) {
| |
− | wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed;
| |
− | } else {
| |
− | return;
| |
− | }
| |
− |
| |
− | wheelDeltaX *= this.options.invertWheelDirection;
| |
− | wheelDeltaY *= this.options.invertWheelDirection;
| |
− |
| |
− | if ( !this.hasVerticalScroll ) {
| |
− | wheelDeltaX = wheelDeltaY;
| |
− | wheelDeltaY = 0;
| |
− | }
| |
− |
| |
− | if ( this.options.snap ) {
| |
− | newX = this.currentPage.pageX;
| |
− | newY = this.currentPage.pageY;
| |
− |
| |
− | if ( wheelDeltaX > 0 ) {
| |
− | newX--;
| |
− | } else if ( wheelDeltaX < 0 ) {
| |
− | newX++;
| |
− | }
| |
− |
| |
− | if ( wheelDeltaY > 0 ) {
| |
− | newY--;
| |
− | } else if ( wheelDeltaY < 0 ) {
| |
− | newY++;
| |
− | }
| |
− |
| |
− | this.goToPage(newX, newY);
| |
− |
| |
− | return;
| |
− | }
| |
− |
| |
− | newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0);
| |
− | newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0);
| |
− |
| |
− | if ( newX > 0 ) {
| |
− | newX = 0;
| |
− | } else if ( newX < this.maxScrollX ) {
| |
− | newX = this.maxScrollX;
| |
− | }
| |
− |
| |
− | if ( newY > 0 ) {
| |
− | newY = 0;
| |
− | } else if ( newY < this.maxScrollY ) {
| |
− | newY = this.maxScrollY;
| |
− | }
| |
− |
| |
− | this.scrollTo(newX, newY, 0);
| |
− |
| |
− | if ( this.options.probeType > 1 ) {
| |
− | this._execEvent('scroll');
| |
− | }
| |
− |
| |
− | // INSERT POINT: _wheel
| |
− | },
| |
− |
| |
− | _initSnap: function () {
| |
− | this.currentPage = {};
| |
− |
| |
− | if ( typeof this.options.snap == 'string' ) {
| |
− | this.options.snap = this.scroller.querySelectorAll(this.options.snap);
| |
− | }
| |
− |
| |
− | this.on('refresh', function () {
| |
− | var i = 0, l,
| |
− | m = 0, n,
| |
− | cx, cy,
| |
− | x = 0, y,
| |
− | stepX = this.options.snapStepX || this.wrapperWidth,
| |
− | stepY = this.options.snapStepY || this.wrapperHeight,
| |
− | el;
| |
− |
| |
− | this.pages = [];
| |
− |
| |
− | if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | if ( this.options.snap === true ) {
| |
− | cx = Math.round( stepX / 2 );
| |
− | cy = Math.round( stepY / 2 );
| |
− |
| |
− | while ( x > -this.scrollerWidth ) {
| |
− | this.pages[i] = [];
| |
− | l = 0;
| |
− | y = 0;
| |
− |
| |
− | while ( y > -this.scrollerHeight ) {
| |
− | this.pages[i][l] = {
| |
− | x: Math.max(x, this.maxScrollX),
| |
− | y: Math.max(y, this.maxScrollY),
| |
− | width: stepX,
| |
− | height: stepY,
| |
− | cx: x - cx,
| |
− | cy: y - cy
| |
− | };
| |
− |
| |
− | y -= stepY;
| |
− | l++;
| |
− | }
| |
− |
| |
− | x -= stepX;
| |
− | i++;
| |
− | }
| |
− | } else {
| |
− | el = this.options.snap;
| |
− | l = el.length;
| |
− | n = -1;
| |
− |
| |
− | for ( ; i < l; i++ ) {
| |
− | if ( i === 0 || el[i].offsetLeft <= el[i-1].offsetLeft ) {
| |
− | m = 0;
| |
− | n++;
| |
− | }
| |
− |
| |
− | if ( !this.pages[m] ) {
| |
− | this.pages[m] = [];
| |
− | }
| |
− |
| |
− | x = Math.max(-el[i].offsetLeft, this.maxScrollX);
| |
− | y = Math.max(-el[i].offsetTop, this.maxScrollY);
| |
− | cx = x - Math.round(el[i].offsetWidth / 2);
| |
− | cy = y - Math.round(el[i].offsetHeight / 2);
| |
− |
| |
− | this.pages[m][n] = {
| |
− | x: x,
| |
− | y: y,
| |
− | width: el[i].offsetWidth,
| |
− | height: el[i].offsetHeight,
| |
− | cx: cx,
| |
− | cy: cy
| |
− | };
| |
− |
| |
− | if ( x > this.maxScrollX ) {
| |
− | m++;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0);
| |
− |
| |
− | // Update snap threshold if needed
| |
− | if ( this.options.snapThreshold % 1 === 0 ) {
| |
− | this.snapThresholdX = this.options.snapThreshold;
| |
− | this.snapThresholdY = this.options.snapThreshold;
| |
− | } else {
| |
− | this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold);
| |
− | this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold);
| |
− | }
| |
− | });
| |
− |
| |
− | this.on('flick', function () {
| |
− | var time = this.options.snapSpeed || Math.max(
| |
− | Math.max(
| |
− | Math.min(Math.abs(this.x - this.startX), 1000),
| |
− | Math.min(Math.abs(this.y - this.startY), 1000)
| |
− | ), 300);
| |
− |
| |
− | this.goToPage(
| |
− | this.currentPage.pageX + this.directionX,
| |
− | this.currentPage.pageY + this.directionY,
| |
− | time
| |
− | );
| |
− | });
| |
− | },
| |
− |
| |
− | _nearestSnap: function (x, y) {
| |
− | if ( !this.pages.length ) {
| |
− | return { x: 0, y: 0, pageX: 0, pageY: 0 };
| |
− | }
| |
− |
| |
− | var i = 0,
| |
− | l = this.pages.length,
| |
− | m = 0;
| |
− |
| |
− | // Check if we exceeded the snap threshold
| |
− | if ( Math.abs(x - this.absStartX) < this.snapThresholdX &&
| |
− | Math.abs(y - this.absStartY) < this.snapThresholdY ) {
| |
− | return this.currentPage;
| |
− | }
| |
− |
| |
− | if ( x > 0 ) {
| |
− | x = 0;
| |
− | } else if ( x < this.maxScrollX ) {
| |
− | x = this.maxScrollX;
| |
− | }
| |
− |
| |
− | if ( y > 0 ) {
| |
− | y = 0;
| |
− | } else if ( y < this.maxScrollY ) {
| |
− | y = this.maxScrollY;
| |
− | }
| |
− |
| |
− | for ( ; i < l; i++ ) {
| |
− | if ( x >= this.pages[i][0].cx ) {
| |
− | x = this.pages[i][0].x;
| |
− | break;
| |
− | }
| |
− | }
| |
− |
| |
− | l = this.pages[i].length;
| |
− |
| |
− | for ( ; m < l; m++ ) {
| |
− | if ( y >= this.pages[0][m].cy ) {
| |
− | y = this.pages[0][m].y;
| |
− | break;
| |
− | }
| |
− | }
| |
− |
| |
− | if ( i == this.currentPage.pageX ) {
| |
− | i += this.directionX;
| |
− |
| |
− | if ( i < 0 ) {
| |
− | i = 0;
| |
− | } else if ( i >= this.pages.length ) {
| |
− | i = this.pages.length - 1;
| |
− | }
| |
− |
| |
− | x = this.pages[i][0].x;
| |
− | }
| |
− |
| |
− | if ( m == this.currentPage.pageY ) {
| |
− | m += this.directionY;
| |
− |
| |
− | if ( m < 0 ) {
| |
− | m = 0;
| |
− | } else if ( m >= this.pages[0].length ) {
| |
− | m = this.pages[0].length - 1;
| |
− | }
| |
− |
| |
− | y = this.pages[0][m].y;
| |
− | }
| |
− |
| |
− | return {
| |
− | x: x,
| |
− | y: y,
| |
− | pageX: i,
| |
− | pageY: m
| |
− | };
| |
− | },
| |
− |
| |
− | goToPage: function (x, y, time, easing) {
| |
− | easing = easing || this.options.bounceEasing;
| |
− |
| |
− | if ( x >= this.pages.length ) {
| |
− | x = this.pages.length - 1;
| |
− | } else if ( x < 0 ) {
| |
− | x = 0;
| |
− | }
| |
− |
| |
− | if ( y >= this.pages[x].length ) {
| |
− | y = this.pages[x].length - 1;
| |
− | } else if ( y < 0 ) {
| |
− | y = 0;
| |
− | }
| |
− |
| |
− | var posX = this.pages[x][y].x,
| |
− | posY = this.pages[x][y].y;
| |
− |
| |
− | time = time === undefined ? this.options.snapSpeed || Math.max(
| |
− | Math.max(
| |
− | Math.min(Math.abs(posX - this.x), 1000),
| |
− | Math.min(Math.abs(posY - this.y), 1000)
| |
− | ), 300) : time;
| |
− |
| |
− | this.currentPage = {
| |
− | x: posX,
| |
− | y: posY,
| |
− | pageX: x,
| |
− | pageY: y
| |
− | };
| |
− |
| |
− | this.scrollTo(posX, posY, time, easing);
| |
− | },
| |
− |
| |
− | next: function (time, easing) {
| |
− | var x = this.currentPage.pageX,
| |
− | y = this.currentPage.pageY;
| |
− |
| |
− | x++;
| |
− |
| |
− | if ( x >= this.pages.length && this.hasVerticalScroll ) {
| |
− | x = 0;
| |
− | y++;
| |
− | }
| |
− |
| |
− | this.goToPage(x, y, time, easing);
| |
− | },
| |
− |
| |
− | prev: function (time, easing) {
| |
− | var x = this.currentPage.pageX,
| |
− | y = this.currentPage.pageY;
| |
− |
| |
− | x--;
| |
− |
| |
− | if ( x < 0 && this.hasVerticalScroll ) {
| |
− | x = 0;
| |
− | y--;
| |
− | }
| |
− |
| |
− | this.goToPage(x, y, time, easing);
| |
− | },
| |
− |
| |
− | _initKeys: function (e) {
| |
− | // default key bindings
| |
− | var keys = {
| |
− | pageUp: 33,
| |
− | pageDown: 34,
| |
− | end: 35,
| |
− | home: 36,
| |
− | left: 37,
| |
− | up: 38,
| |
− | right: 39,
| |
− | down: 40
| |
− | };
| |
− | var i;
| |
− |
| |
− | // if you give me characters I give you keycode
| |
− | if ( typeof this.options.keyBindings == 'object' ) {
| |
− | for ( i in this.options.keyBindings ) {
| |
− | if ( typeof this.options.keyBindings[i] == 'string' ) {
| |
− | this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0);
| |
− | }
| |
− | }
| |
− | } else {
| |
− | this.options.keyBindings = {};
| |
− | }
| |
− |
| |
− | for ( i in keys ) {
| |
− | this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i];
| |
− | }
| |
− |
| |
− | utils.addEvent(window, 'keydown', this);
| |
− |
| |
− | this.on('destroy', function () {
| |
− | utils.removeEvent(window, 'keydown', this);
| |
− | });
| |
− | },
| |
− |
| |
− | _key: function (e) {
| |
− | if ( !this.enabled ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | var snap = this.options.snap, // we are using this alot, better to cache it
| |
− | newX = snap ? this.currentPage.pageX : this.x,
| |
− | newY = snap ? this.currentPage.pageY : this.y,
| |
− | now = utils.getTime(),
| |
− | prevTime = this.keyTime || 0,
| |
− | acceleration = 0.250,
| |
− | pos;
| |
− |
| |
− | if ( this.options.useTransition && this.isInTransition ) {
| |
− | pos = this.getComputedPosition();
| |
− |
| |
− | this._translate(Math.round(pos.x), Math.round(pos.y));
| |
− | this.isInTransition = false;
| |
− | }
| |
− |
| |
− | this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0;
| |
− |
| |
− | switch ( e.keyCode ) {
| |
− | case this.options.keyBindings.pageUp:
| |
− | if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
| |
− | newX += snap ? 1 : this.wrapperWidth;
| |
− | } else {
| |
− | newY += snap ? 1 : this.wrapperHeight;
| |
− | }
| |
− | break;
| |
− | case this.options.keyBindings.pageDown:
| |
− | if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
| |
− | newX -= snap ? 1 : this.wrapperWidth;
| |
− | } else {
| |
− | newY -= snap ? 1 : this.wrapperHeight;
| |
− | }
| |
− | break;
| |
− | case this.options.keyBindings.end:
| |
− | newX = snap ? this.pages.length-1 : this.maxScrollX;
| |
− | newY = snap ? this.pages[0].length-1 : this.maxScrollY;
| |
− | break;
| |
− | case this.options.keyBindings.home:
| |
− | newX = 0;
| |
− | newY = 0;
| |
− | break;
| |
− | case this.options.keyBindings.left:
| |
− | newX += snap ? -1 : 5 + this.keyAcceleration>>0;
| |
− | break;
| |
− | case this.options.keyBindings.up:
| |
− | newY += snap ? 1 : 5 + this.keyAcceleration>>0;
| |
− | break;
| |
− | case this.options.keyBindings.right:
| |
− | newX -= snap ? -1 : 5 + this.keyAcceleration>>0;
| |
− | break;
| |
− | case this.options.keyBindings.down:
| |
− | newY -= snap ? 1 : 5 + this.keyAcceleration>>0;
| |
− | break;
| |
− | default:
| |
− | return;
| |
− | }
| |
− |
| |
− | if ( snap ) {
| |
− | this.goToPage(newX, newY);
| |
− | return;
| |
− | }
| |
− |
| |
− | if ( newX > 0 ) {
| |
− | newX = 0;
| |
− | this.keyAcceleration = 0;
| |
− | } else if ( newX < this.maxScrollX ) {
| |
− | newX = this.maxScrollX;
| |
− | this.keyAcceleration = 0;
| |
− | }
| |
− |
| |
− | if ( newY > 0 ) {
| |
− | newY = 0;
| |
− | this.keyAcceleration = 0;
| |
− | } else if ( newY < this.maxScrollY ) {
| |
− | newY = this.maxScrollY;
| |
− | this.keyAcceleration = 0;
| |
− | }
| |
− |
| |
− | this.scrollTo(newX, newY, 0);
| |
− |
| |
− | this.keyTime = now;
| |
− | },
| |
− |
| |
− | _animate: function (destX, destY, duration, easingFn) {
| |
− | var that = this,
| |
− | startX = this.x,
| |
− | startY = this.y,
| |
− | startTime = utils.getTime(),
| |
− | destTime = startTime + duration;
| |
− |
| |
− | function step () {
| |
− | var now = utils.getTime(),
| |
− | newX, newY,
| |
− | easing;
| |
− |
| |
− | if ( now >= destTime ) {
| |
− | that.isAnimating = false;
| |
− | that._translate(destX, destY);
| |
− |
| |
− | if ( !that.resetPosition(that.options.bounceTime) ) {
| |
− | that._execEvent('scrollEnd');
| |
− | }
| |
− |
| |
− | return;
| |
− | }
| |
− |
| |
− | now = ( now - startTime ) / duration;
| |
− | easing = easingFn(now);
| |
− | newX = ( destX - startX ) * easing + startX;
| |
− | newY = ( destY - startY ) * easing + startY;
| |
− | that._translate(newX, newY);
| |
− |
| |
− | if ( that.isAnimating ) {
| |
− | rAF(step);
| |
− | }
| |
− |
| |
− | if ( that.options.probeType == 3 ) {
| |
− | that._execEvent('scroll');
| |
− | }
| |
− | }
| |
− |
| |
− | this.isAnimating = true;
| |
− | step();
| |
− | },
| |
− |
| |
− | handleEvent: function (e) {
| |
− | switch ( e.type ) {
| |
− | case 'touchstart':
| |
− | case 'pointerdown':
| |
− | case 'MSPointerDown':
| |
− | case 'mousedown':
| |
− | this._start(e);
| |
− | break;
| |
− | case 'touchmove':
| |
− | case 'pointermove':
| |
− | case 'MSPointerMove':
| |
− | case 'mousemove':
| |
− | this._move(e);
| |
− | break;
| |
− | case 'touchend':
| |
− | case 'pointerup':
| |
− | case 'MSPointerUp':
| |
− | case 'mouseup':
| |
− | case 'touchcancel':
| |
− | case 'pointercancel':
| |
− | case 'MSPointerCancel':
| |
− | case 'mousecancel':
| |
− | this._end(e);
| |
− | break;
| |
− | case 'orientationchange':
| |
− | case 'resize':
| |
− | this._resize();
| |
− | break;
| |
− | case 'transitionend':
| |
− | case 'webkitTransitionEnd':
| |
− | case 'oTransitionEnd':
| |
− | case 'MSTransitionEnd':
| |
− | this._transitionEnd(e);
| |
− | break;
| |
− | case 'wheel':
| |
− | case 'DOMMouseScroll':
| |
− | case 'mousewheel':
| |
− | this._wheel(e);
| |
− | break;
| |
− | case 'keydown':
| |
− | this._key(e);
| |
− | break;
| |
− | case 'click':
| |
− | if ( !e._constructed ) {
| |
− | e.preventDefault();
| |
− | e.stopPropagation();
| |
− | }
| |
− | break;
| |
− | }
| |
− | }
| |
− | };
| |
− | function createDefaultScrollbar (direction, interactive, type) {
| |
− | var scrollbar = document.createElement('div'),
| |
− | indicator = document.createElement('div');
| |
− |
| |
− | if ( type === true ) {
| |
− | scrollbar.style.cssText = 'position:absolute;z-index:9999';
| |
− | indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px';
| |
− | }
| |
− |
| |
− | indicator.className = 'iScrollIndicator';
| |
− |
| |
− | if ( direction == 'h' ) {
| |
− | if ( type === true ) {
| |
− | scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0';
| |
− | indicator.style.height = '100%';
| |
− | }
| |
− | scrollbar.className = 'iScrollHorizontalScrollbar';
| |
− | } else {
| |
− | if ( type === true ) {
| |
− | scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px';
| |
− | indicator.style.width = '100%';
| |
− | }
| |
− | scrollbar.className = 'iScrollVerticalScrollbar';
| |
− | }
| |
− |
| |
− | scrollbar.style.cssText += ';overflow:hidden';
| |
− |
| |
− | if ( !interactive ) {
| |
− | scrollbar.style.pointerEvents = 'none';
| |
− | }
| |
− |
| |
− | scrollbar.appendChild(indicator);
| |
− |
| |
− | return scrollbar;
| |
− | }
| |
− |
| |
− | function Indicator (scroller, options) {
| |
− | this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el;
| |
− | this.wrapperStyle = this.wrapper.style;
| |
− | this.indicator = this.wrapper.children[0];
| |
− | this.indicatorStyle = this.indicator.style;
| |
− | this.scroller = scroller;
| |
− |
| |
− | this.options = {
| |
− | listenX: true,
| |
− | listenY: true,
| |
− | interactive: false,
| |
− | resize: true,
| |
− | defaultScrollbars: false,
| |
− | shrink: false,
| |
− | fade: false,
| |
− | speedRatioX: 0,
| |
− | speedRatioY: 0
| |
− | };
| |
− |
| |
− | for ( var i in options ) {
| |
− | this.options[i] = options[i];
| |
− | }
| |
− |
| |
− | this.sizeRatioX = 1;
| |
− | this.sizeRatioY = 1;
| |
− | this.maxPosX = 0;
| |
− | this.maxPosY = 0;
| |
− |
| |
− | if ( this.options.interactive ) {
| |
− | if ( !this.options.disableTouch ) {
| |
− | utils.addEvent(this.indicator, 'touchstart', this);
| |
− | utils.addEvent(window, 'touchend', this);
| |
− | }
| |
− | if ( !this.options.disablePointer ) {
| |
− | utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
| |
− | utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this);
| |
− | }
| |
− | if ( !this.options.disableMouse ) {
| |
− | utils.addEvent(this.indicator, 'mousedown', this);
| |
− | utils.addEvent(window, 'mouseup', this);
| |
− | }
| |
− | }
| |
− |
| |
− | if ( this.options.fade ) {
| |
− | this.wrapperStyle[utils.style.transform] = this.scroller.translateZ;
| |
− | this.wrapperStyle[utils.style.transitionDuration] = utils.isBadAndroid ? '0.001s' : '0ms';
| |
− | this.wrapperStyle.opacity = '0';
| |
− | }
| |
− | }
| |
− |
| |
− | Indicator.prototype = {
| |
− | handleEvent: function (e) {
| |
− | switch ( e.type ) {
| |
− | case 'touchstart':
| |
− | case 'pointerdown':
| |
− | case 'MSPointerDown':
| |
− | case 'mousedown':
| |
− | this._start(e);
| |
− | break;
| |
− | case 'touchmove':
| |
− | case 'pointermove':
| |
− | case 'MSPointerMove':
| |
− | case 'mousemove':
| |
− | this._move(e);
| |
− | break;
| |
− | case 'touchend':
| |
− | case 'pointerup':
| |
− | case 'MSPointerUp':
| |
− | case 'mouseup':
| |
− | case 'touchcancel':
| |
− | case 'pointercancel':
| |
− | case 'MSPointerCancel':
| |
− | case 'mousecancel':
| |
− | this._end(e);
| |
− | break;
| |
− | }
| |
− | },
| |
− |
| |
− | destroy: function () {
| |
− | if ( this.options.interactive ) {
| |
− | utils.removeEvent(this.indicator, 'touchstart', this);
| |
− | utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
| |
− | utils.removeEvent(this.indicator, 'mousedown', this);
| |
− |
| |
− | utils.removeEvent(window, 'touchmove', this);
| |
− | utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
| |
− | utils.removeEvent(window, 'mousemove', this);
| |
− |
| |
− | utils.removeEvent(window, 'touchend', this);
| |
− | utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this);
| |
− | utils.removeEvent(window, 'mouseup', this);
| |
− | }
| |
− |
| |
− | if ( this.options.defaultScrollbars ) {
| |
− | this.wrapper.parentNode.removeChild(this.wrapper);
| |
− | }
| |
− | },
| |
− |
| |
− | _start: function (e) {
| |
− | var point = e.touches ? e.touches[0] : e;
| |
− |
| |
− | e.preventDefault();
| |
− | e.stopPropagation();
| |
− |
| |
− | this.transitionTime();
| |
− |
| |
− | this.initiated = true;
| |
− | this.moved = false;
| |
− | this.lastPointX = point.pageX;
| |
− | this.lastPointY = point.pageY;
| |
− |
| |
− | this.startTime = utils.getTime();
| |
− |
| |
− | if ( !this.options.disableTouch ) {
| |
− | utils.addEvent(window, 'touchmove', this);
| |
− | }
| |
− | if ( !this.options.disablePointer ) {
| |
− | utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this);
| |
− | }
| |
− | if ( !this.options.disableMouse ) {
| |
− | utils.addEvent(window, 'mousemove', this);
| |
− | }
| |
− |
| |
− | this.scroller._execEvent('beforeScrollStart');
| |
− | },
| |
− |
| |
− | _move: function (e) {
| |
− | var point = e.touches ? e.touches[0] : e,
| |
− | deltaX, deltaY,
| |
− | newX, newY,
| |
− | timestamp = utils.getTime();
| |
− |
| |
− | if ( !this.moved ) {
| |
− | this.scroller._execEvent('scrollStart');
| |
− | }
| |
− |
| |
− | this.moved = true;
| |
− |
| |
− | deltaX = point.pageX - this.lastPointX;
| |
− | this.lastPointX = point.pageX;
| |
− |
| |
− | deltaY = point.pageY - this.lastPointY;
| |
− | this.lastPointY = point.pageY;
| |
− |
| |
− | newX = this.x + deltaX;
| |
− | newY = this.y + deltaY;
| |
− |
| |
− | this._pos(newX, newY);
| |
− |
| |
− |
| |
− | if ( this.scroller.options.probeType == 1 && timestamp - this.startTime > 300 ) {
| |
− | this.startTime = timestamp;
| |
− | this.scroller._execEvent('scroll');
| |
− | } else if ( this.scroller.options.probeType > 1 ) {
| |
− | this.scroller._execEvent('scroll');
| |
− | }
| |
− |
| |
− |
| |
− | // INSERT POINT: indicator._move
| |
− |
| |
− | e.preventDefault();
| |
− | e.stopPropagation();
| |
− | },
| |
− |
| |
− | _end: function (e) {
| |
− | if ( !this.initiated ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | this.initiated = false;
| |
− |
| |
− | e.preventDefault();
| |
− | e.stopPropagation();
| |
− |
| |
− | utils.removeEvent(window, 'touchmove', this);
| |
− | utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
| |
− | utils.removeEvent(window, 'mousemove', this);
| |
− |
| |
− | if ( this.scroller.options.snap ) {
| |
− | var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y);
| |
− |
| |
− | var time = this.options.snapSpeed || Math.max(
| |
− | Math.max(
| |
− | Math.min(Math.abs(this.scroller.x - snap.x), 1000),
| |
− | Math.min(Math.abs(this.scroller.y - snap.y), 1000)
| |
− | ), 300);
| |
− |
| |
− | if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) {
| |
− | this.scroller.directionX = 0;
| |
− | this.scroller.directionY = 0;
| |
− | this.scroller.currentPage = snap;
| |
− | this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing);
| |
− | }
| |
− | }
| |
− |
| |
− | if ( this.moved ) {
| |
− | this.scroller._execEvent('scrollEnd');
| |
− | }
| |
− | },
| |
− |
| |
− | transitionTime: function (time) {
| |
− | time = time || 0;
| |
− | this.indicatorStyle[utils.style.transitionDuration] = time + 'ms';
| |
− |
| |
− | if ( !time && utils.isBadAndroid ) {
| |
− | this.indicatorStyle[utils.style.transitionDuration] = '0.001s';
| |
− | }
| |
− | },
| |
− |
| |
− | transitionTimingFunction: function (easing) {
| |
− | this.indicatorStyle[utils.style.transitionTimingFunction] = easing;
| |
− | },
| |
− |
| |
− | refresh: function () {
| |
− | this.transitionTime();
| |
− |
| |
− | if ( this.options.listenX && !this.options.listenY ) {
| |
− | this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none';
| |
− | } else if ( this.options.listenY && !this.options.listenX ) {
| |
− | this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none';
| |
− | } else {
| |
− | this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none';
| |
− | }
| |
− |
| |
− | if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) {
| |
− | utils.addClass(this.wrapper, 'iScrollBothScrollbars');
| |
− | utils.removeClass(this.wrapper, 'iScrollLoneScrollbar');
| |
− |
| |
− | if ( this.options.defaultScrollbars && this.options.customStyle ) {
| |
− | if ( this.options.listenX ) {
| |
− | this.wrapper.style.right = '8px';
| |
− | } else {
| |
− | this.wrapper.style.bottom = '8px';
| |
− | }
| |
− | }
| |
− | } else {
| |
− | utils.removeClass(this.wrapper, 'iScrollBothScrollbars');
| |
− | utils.addClass(this.wrapper, 'iScrollLoneScrollbar');
| |
− |
| |
− | if ( this.options.defaultScrollbars && this.options.customStyle ) {
| |
− | if ( this.options.listenX ) {
| |
− | this.wrapper.style.right = '2px';
| |
− | } else {
| |
− | this.wrapper.style.bottom = '2px';
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | var r = this.wrapper.offsetHeight; // force refresh
| |
− |
| |
− | if ( this.options.listenX ) {
| |
− | this.wrapperWidth = this.wrapper.clientWidth;
| |
− | if ( this.options.resize ) {
| |
− | this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8);
| |
− | this.indicatorStyle.width = this.indicatorWidth + 'px';
| |
− | } else {
| |
− | this.indicatorWidth = this.indicator.clientWidth;
| |
− | }
| |
− |
| |
− | this.maxPosX = this.wrapperWidth - this.indicatorWidth;
| |
− |
| |
− | if ( this.options.shrink == 'clip' ) {
| |
− | this.minBoundaryX = -this.indicatorWidth + 8;
| |
− | this.maxBoundaryX = this.wrapperWidth - 8;
| |
− | } else {
| |
− | this.minBoundaryX = 0;
| |
− | this.maxBoundaryX = this.maxPosX;
| |
− | }
| |
− |
| |
− | this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX));
| |
− | }
| |
− |
| |
− | if ( this.options.listenY ) {
| |
− | this.wrapperHeight = this.wrapper.clientHeight;
| |
− | if ( this.options.resize ) {
| |
− | this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8);
| |
− | this.indicatorStyle.height = this.indicatorHeight + 'px';
| |
− | } else {
| |
− | this.indicatorHeight = this.indicator.clientHeight;
| |
− | }
| |
− |
| |
− | this.maxPosY = this.wrapperHeight - this.indicatorHeight;
| |
− |
| |
− | if ( this.options.shrink == 'clip' ) {
| |
− | this.minBoundaryY = -this.indicatorHeight + 8;
| |
− | this.maxBoundaryY = this.wrapperHeight - 8;
| |
− | } else {
| |
− | this.minBoundaryY = 0;
| |
− | this.maxBoundaryY = this.maxPosY;
| |
− | }
| |
− |
| |
− | this.maxPosY = this.wrapperHeight - this.indicatorHeight;
| |
− | this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY));
| |
− | }
| |
− |
| |
− | this.updatePosition();
| |
− | },
| |
− |
| |
− | updatePosition: function () {
| |
− | var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0,
| |
− | y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0;
| |
− |
| |
− | if ( !this.options.ignoreBoundaries ) {
| |
− | if ( x < this.minBoundaryX ) {
| |
− | if ( this.options.shrink == 'scale' ) {
| |
− | this.width = Math.max(this.indicatorWidth + x, 8);
| |
− | this.indicatorStyle.width = this.width + 'px';
| |
− | }
| |
− | x = this.minBoundaryX;
| |
− | } else if ( x > this.maxBoundaryX ) {
| |
− | if ( this.options.shrink == 'scale' ) {
| |
− | this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8);
| |
− | this.indicatorStyle.width = this.width + 'px';
| |
− | x = this.maxPosX + this.indicatorWidth - this.width;
| |
− | } else {
| |
− | x = this.maxBoundaryX;
| |
− | }
| |
− | } else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) {
| |
− | this.width = this.indicatorWidth;
| |
− | this.indicatorStyle.width = this.width + 'px';
| |
− | }
| |
− |
| |
− | if ( y < this.minBoundaryY ) {
| |
− | if ( this.options.shrink == 'scale' ) {
| |
− | this.height = Math.max(this.indicatorHeight + y * 3, 8);
| |
− | this.indicatorStyle.height = this.height + 'px';
| |
− | }
| |
− | y = this.minBoundaryY;
| |
− | } else if ( y > this.maxBoundaryY ) {
| |
− | if ( this.options.shrink == 'scale' ) {
| |
− | this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8);
| |
− | this.indicatorStyle.height = this.height + 'px';
| |
− | y = this.maxPosY + this.indicatorHeight - this.height;
| |
− | } else {
| |
− | y = this.maxBoundaryY;
| |
− | }
| |
− | } else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) {
| |
− | this.height = this.indicatorHeight;
| |
− | this.indicatorStyle.height = this.height + 'px';
| |
− | }
| |
− | }
| |
− |
| |
− | this.x = x;
| |
− | this.y = y;
| |
− |
| |
− | if ( this.scroller.options.useTransform ) {
| |
− | this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ;
| |
− | } else {
| |
− | this.indicatorStyle.left = x + 'px';
| |
− | this.indicatorStyle.top = y + 'px';
| |
− | }
| |
− | },
| |
− |
| |
− | _pos: function (x, y) {
| |
− | if ( x < 0 ) {
| |
− | x = 0;
| |
− | } else if ( x > this.maxPosX ) {
| |
− | x = this.maxPosX;
| |
− | }
| |
− |
| |
− | if ( y < 0 ) {
| |
− | y = 0;
| |
− | } else if ( y > this.maxPosY ) {
| |
− | y = this.maxPosY;
| |
− | }
| |
− |
| |
− | x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x;
| |
− | y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y;
| |
− |
| |
− | this.scroller.scrollTo(x, y);
| |
− | },
| |
− |
| |
− | fade: function (val, hold) {
| |
− | if ( hold && !this.visible ) {
| |
− | return;
| |
− | }
| |
− |
| |
− | clearTimeout(this.fadeTimeout);
| |
− | this.fadeTimeout = null;
| |
− |
| |
− | var time = val ? 250 : 500,
| |
− | delay = val ? 0 : 300;
| |
− |
| |
− | val = val ? '1' : '0';
| |
− |
| |
− | this.wrapperStyle[utils.style.transitionDuration] = time + 'ms';
| |
− |
| |
− | this.fadeTimeout = setTimeout((function (val) {
| |
− | this.wrapperStyle.opacity = val;
| |
− | this.visible = +val;
| |
− | }).bind(this, val), delay);
| |
− | }
| |
− | };
| |
− |
| |
− | IScroll.utils = utils;
| |
− |
| |
− | if ( typeof module != 'undefined' && module.exports ) {
| |
− | module.exports = IScroll;
| |
− | } else {
| |
− | window.IScroll = IScroll;
| |
− | }
| |
− |
| |
− | })(window, document, Math);;
| |
− |
| |
− | /* ../vendor/jquery.mousewheel-3.0.6.pack.js */
| |
− | /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
| |
− | * Licensed under the MIT License (LICENSE.txt).
| |
− | *
| |
− | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
| |
− | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
| |
− | * Thanks to: Seamus Leahy for adding deltaX and deltaY
| |
− | *
| |
− | * Version: 3.0.6
| |
− | *
| |
− | * Requires: 1.2.2+
| |
− | */
| |
− | (function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=
| |
− | d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);;
| |
− |
| |
− | /* ../vendor/jquery.onAbsoluteScreen.js */
| |
− |
| |
− | ;(function($) {
| |
− | $.expr[":"].onAbsoluteScreen = function(elem) {
| |
− | var $window = $(window);
| |
− | var $elem = $(elem);
| |
− | var viewportWidth = $window.width();
| |
− | var left = $elem.offset().left;
| |
− |
| |
− | return (left <= viewportWidth && left > 0);
| |
− | }
| |
− | })(jQuery);;
| |
− |
| |
− | /* ../vendor/jquery.placeholder.js */
| |
− | /*! http://mths.be/placeholder v2.0.8 by @mathias */
| |
− | ;(function(window, document, $) {
| |
− |
| |
− | // Opera Mini v7 doesn’t support placeholder although its DOM seems to indicate so
| |
− | var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]';
| |
− | var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini;
| |
− | var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini;
| |
− | var prototype = $.fn;
| |
− | var valHooks = $.valHooks;
| |
− | var propHooks = $.propHooks;
| |
− | var hooks;
| |
− | var placeholder;
| |
− |
| |
− | if (isInputSupported && isTextareaSupported) {
| |
− |
| |
− | placeholder = prototype.placeholder = function() {
| |
− | return this;
| |
− | };
| |
− |
| |
− | placeholder.input = placeholder.textarea = true;
| |
− |
| |
− | } else {
| |
− |
| |
− | placeholder = prototype.placeholder = function() {
| |
− | var $this = this;
| |
− | $this
| |
− | .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
| |
− | .not('.placeholder')
| |
− | .bind({
| |
− | 'focus.placeholder': clearPlaceholder,
| |
− | 'blur.placeholder': setPlaceholder
| |
− | })
| |
− | .data('placeholder-enabled', true)
| |
− | .trigger('blur.placeholder');
| |
− | return $this;
| |
− | };
| |
− |
| |
− | placeholder.input = isInputSupported;
| |
− | placeholder.textarea = isTextareaSupported;
| |
− |
| |
− | hooks = {
| |
− | 'get': function(element) {
| |
− | var $element = $(element);
| |
− |
| |
− | var $passwordInput = $element.data('placeholder-password');
| |
− | if ($passwordInput) {
| |
− | return $passwordInput[0].value;
| |
− | }
| |
− |
| |
− | return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
| |
− | },
| |
− | 'set': function(element, value) {
| |
− | var $element = $(element);
| |
− |
| |
− | var $passwordInput = $element.data('placeholder-password');
| |
− | if ($passwordInput) {
| |
− | return $passwordInput[0].value = value;
| |
− | }
| |
− |
| |
− | if (!$element.data('placeholder-enabled')) {
| |
− | return element.value = value;
| |
− | }
| |
− | if (value == '') {
| |
− | element.value = value;
| |
− | // Issue #56: Setting the placeholder causes problems if the element continues to have focus.
| |
− | if (element != safeActiveElement()) {
| |
− | // We can't use `triggerHandler` here because of dummy text/password inputs :(
| |
− | setPlaceholder.call(element);
| |
− | }
| |
− | } else if ($element.hasClass('placeholder')) {
| |
− | clearPlaceholder.call(element, true, value) || (element.value = value);
| |
− | } else {
| |
− | element.value = value;
| |
− | }
| |
− | // `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
| |
− | return $element;
| |
− | }
| |
− | };
| |
− |
| |
− | if (!isInputSupported) {
| |
− | valHooks.input = hooks;
| |
− | propHooks.value = hooks;
| |
− | }
| |
− | if (!isTextareaSupported) {
| |
− | valHooks.textarea = hooks;
| |
− | propHooks.value = hooks;
| |
− | }
| |
− |
| |
− | $(function() {
| |
− | // Look for forms
| |
− | $(document).delegate('form', 'submit.placeholder', function() {
| |
− | // Clear the placeholder values so they don't get submitted
| |
− | var $inputs = $('.placeholder', this).each(clearPlaceholder);
| |
− | setTimeout(function() {
| |
− | $inputs.each(setPlaceholder);
| |
− | }, 10);
| |
− | });
| |
− | });
| |
− |
| |
− | // Clear placeholder values upon page reload
| |
− | $(window).bind('beforeunload.placeholder', function() {
| |
− | $('.placeholder').each(function() {
| |
− | this.value = '';
| |
− | });
| |
− | });
| |
− |
| |
− | }
| |
− |
| |
− | function args(elem) {
| |
− | // Return an object of element attributes
| |
− | var newAttrs = {};
| |
− | var rinlinejQuery = /^jQuery\d+$/;
| |
− | $.each(elem.attributes, function(i, attr) {
| |
− | if (attr.specified && !rinlinejQuery.test(attr.name)) {
| |
− | newAttrs[attr.name] = attr.value;
| |
− | }
| |
− | });
| |
− | return newAttrs;
| |
− | }
| |
− |
| |
− | function clearPlaceholder(event, value) {
| |
− | var input = this;
| |
− | var $input = $(input);
| |
− | if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) {
| |
− | if ($input.data('placeholder-password')) {
| |
− | $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
| |
− | // If `clearPlaceholder` was called from `$.valHooks.input.set`
| |
− | if (event === true) {
| |
− | return $input[0].value = value;
| |
− | }
| |
− | $input.focus();
| |
− | } else {
| |
− | input.value = '';
| |
− | $input.removeClass('placeholder');
| |
− | input == safeActiveElement() && input.select();
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | function setPlaceholder() {
| |
− | var $replacement;
| |
− | var input = this;
| |
− | var $input = $(input);
| |
− | var id = this.id;
| |
− | if (input.value == '') {
| |
− | if (input.type == 'password') {
| |
− | if (!$input.data('placeholder-textinput')) {
| |
− | try {
| |
− | $replacement = $input.clone().attr({ 'type': 'text' });
| |
− | } catch(e) {
| |
− | $replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
| |
− | }
| |
− | $replacement
| |
− | .removeAttr('name')
| |
− | .data({
| |
− | 'placeholder-password': $input,
| |
− | 'placeholder-id': id
| |
− | })
| |
− | .bind('focus.placeholder', clearPlaceholder);
| |
− | $input
| |
− | .data({
| |
− | 'placeholder-textinput': $replacement,
| |
− | 'placeholder-id': id
| |
− | })
| |
− | .before($replacement);
| |
− | }
| |
− | $input = $input.removeAttr('id').hide().prev().attr('id', id).show();
| |
− | // Note: `$input[0] != input` now!
| |
− | }
| |
− | $input.addClass('placeholder');
| |
− | $input[0].value = $input.attr('placeholder');
| |
− | } else {
| |
− | $input.removeClass('placeholder');
| |
− | }
| |
− | }
| |
− |
| |
− | function safeActiveElement() {
| |
− | // Avoid IE9 `document.activeElement` of death
| |
− | // https://github.com/mathiasbynens/jquery-placeholder/pull/99
| |
− | try {
| |
− | return document.activeElement;
| |
− | } catch (exception) {}
| |
− | }
| |
− |
| |
− | }(this, document, jQuery));
| |
− | ;
| |
− |
| |
− | /* ../vendor/jquery.tap.js */
| |
− | /**
| |
− | * @fileOverview
| |
− | * Copyright (c) 2013 Aaron Gloege
| |
− | *
| |
− | * Permission is hereby granted, free of charge, to any person
| |
− | * obtaining a copy of this software and associated documentation
| |
− | * files (the "Software"), to deal in the Software without restriction,
| |
− | * including without limitation the rights to use, copy, modify, merge,
| |
− | * publish, distribute, sublicense, and/or sell copies of the Software,
| |
− | * and to permit persons to whom the Software is furnished to do so,
| |
− | * subject to the following conditions:
| |
− | *
| |
− | * The above copyright notice and this permission notice shall be
| |
− | * included in all copies or substantial portions of the Software.
| |
− | *
| |
− | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
| |
− | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
| |
− | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
| |
− | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
| |
− | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
| |
− | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
| |
− | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
| |
− | * OR OTHER DEALINGS IN THE SOFTWARE.
| |
− | *
| |
− | * jQuery Tap Plugin
| |
− | * Using the tap event, this plugin will properly simulate a click event
| |
− | * in touch browsers using touch events, and on non-touch browsers,
| |
− | * click will automatically be used instead.
| |
− | *
| |
− | * @author Aaron Gloege
| |
− | * @version 1.1.0
| |
− | */
| |
− | (function(document, $) {
| |
− | 'use strict';
| |
− |
| |
− | /**
| |
− | * Event namespace
| |
− | *
| |
− | * @type String
| |
− | * @final
| |
− | */
| |
− | var HELPER_NAMESPACE = '._tap';
| |
− |
| |
− | /**
| |
− | * Event namespace
| |
− | *
| |
− | * @type String
| |
− | * @final
| |
− | */
| |
− | var HELPER_ACTIVE_NAMESPACE = '._tapActive';
| |
− |
| |
− | /**
| |
− | * Event name
| |
− | *
| |
− | * @type String
| |
− | * @final
| |
− | */
| |
− | var EVENT_NAME = 'tap';
| |
− |
| |
− | /**
| |
− | * Event variables to copy to touches
| |
− | *
| |
− | * @type String[]
| |
− | * @final
| |
− | */
| |
− | var EVENT_VARIABLES = 'clientX clientY screenX screenY pageX pageY'.split(' ');
| |
− |
| |
− | /**
| |
− | * jQuery body object
| |
− | *
| |
− | * @type jQuery
| |
− | */
| |
− | var $BODY;
| |
− |
| |
− | /**
| |
− | * Last canceled tap event
| |
− | *
| |
− | * @type jQuery.Event
| |
− | * @private
| |
− | */
| |
− | var _lastTap;
| |
− |
| |
− | /**
| |
− | * Last touchstart event
| |
− | *
| |
− | * @type jQuery.Event
| |
− | * @private
| |
− | */
| |
− | var _lastTouch;
| |
− |
| |
− | /**
| |
− | * Object for tracking current touch
| |
− | *
| |
− | * @type Object
| |
− | * @static
| |
− | */
| |
− | var TOUCH_VALUES = {
| |
− |
| |
− | /**
| |
− | * Number of touches currently active on touchstart
| |
− | *
| |
− | * @property count
| |
− | * @type Number
| |
− | */
| |
− | count: 0,
| |
− |
| |
− | /**
| |
− | * touchstart/mousedown jQuery.Event object
| |
− | *
| |
− | * @property event
| |
− | * @type jQuery.Event
| |
− | */
| |
− | event: 0
| |
− |
| |
− | };
| |
− |
| |
− | /**
| |
− | * Create a new event from the original event
| |
− | * Copy over EVENT_VARIABLES from the original jQuery.Event
| |
− | *
| |
− | * @param {String} type
| |
− | * @param {jQuery.Event} e
| |
− | * @return {jQuery.Event}
| |
− | * @private
| |
− | */
| |
− | var _createEvent = function(type, e) {
| |
− | var originalEvent = e.originalEvent;
| |
− | var event = $.Event(originalEvent);
| |
− |
| |
− | event.type = type;
| |
− |
| |
− | var i = 0;
| |
− | var length = EVENT_VARIABLES.length;
| |
− |
| |
− | for (; i < length; i++) {
| |
− | event[EVENT_VARIABLES[i]] = e[EVENT_VARIABLES[i]];
| |
− | }
| |
− |
| |
− | return event;
| |
− | };
| |
− |
| |
− | /**
| |
− | * Determine if a valid tap event
| |
− | *
| |
− | * @param {jQuery.Event} e
| |
− | * @return {Boolean}
| |
− | * @private
| |
− | */
| |
− | var _isTap = function(e) {
| |
− | if (e.isTrigger) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | var startEvent = TOUCH_VALUES.event;
| |
− | var xDelta = Math.abs(e.pageX - startEvent.pageX);
| |
− | var yDelta = Math.abs(e.pageY - startEvent.pageY);
| |
− | var delta = Math.max(xDelta, yDelta);
| |
− |
| |
− | return (
| |
− | e.timeStamp - startEvent.timeStamp < $.tap.TIME_DELTA &&
| |
− | delta < $.tap.POSITION_DELTA &&
| |
− | (!startEvent.touches || TOUCH_VALUES.count === 1) &&
| |
− | Tap.isTracking
| |
− | );
| |
− | };
| |
− |
| |
− | /**
| |
− | * Determine if mousedown event was emulated from the last touchstart event
| |
− | *
| |
− | * @function
| |
− | * @param {jQuery.Event} e
| |
− | * @returns {Boolean}
| |
− | * @private
| |
− | */
| |
− | var _isEmulated = function(e) {
| |
− | if (!_lastTouch) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | var xDelta = Math.abs(e.pageX - _lastTouch.pageX);
| |
− | var yDelta = Math.abs(e.pageY - _lastTouch.pageY);
| |
− | var delta = Math.max(xDelta, yDelta);
| |
− |
| |
− | return (
| |
− | Math.abs(e.timeStamp - _lastTouch.timeStamp) < 750 &&
| |
− | delta < $.tap.POSITION_DELTA
| |
− | );
| |
− | };
| |
− |
| |
− | /**
| |
− | * Normalize touch events with data from first touch in the jQuery.Event
| |
− | *
| |
− | * This could be done using the `jQuery.fixHook` api, but to avoid conflicts
| |
− | * with other libraries that might already have applied a fix hook, this
| |
− | * approach is used instead.
| |
− | *
| |
− | * @param {jQuery.Event} event
| |
− | * @private
| |
− | */
| |
− | var _normalizeEvent = function(event) {
| |
− | if (event.type.indexOf('touch') === 0) {
| |
− | event.touches = event.originalEvent.changedTouches;
| |
− | var touch = event.touches[0];
| |
− |
| |
− | var i = 0;
| |
− | var length = EVENT_VARIABLES.length;
| |
− |
| |
− | for (; i < length; i++) {
| |
− | event[EVENT_VARIABLES[i]] = touch[EVENT_VARIABLES[i]];
| |
− | }
| |
− | }
| |
− |
| |
− | // Normalize timestamp
| |
− | event.timeStamp = Date.now ? Date.now() : +new Date();
| |
− | };
| |
− |
| |
− | /**
| |
− | * Tap object that will track touch events and
| |
− | * trigger the tap event when necessary
| |
− | *
| |
− | * @class Tap
| |
− | * @static
| |
− | */
| |
− | var Tap = {
| |
− |
| |
− | /**
| |
− | * Flag to determine if touch events are currently enabled
| |
− | *
| |
− | * @property isEnabled
| |
− | * @type Boolean
| |
− | */
| |
− | isEnabled: false,
| |
− |
| |
− | /**
| |
− | * Are we currently tracking a tap event?
| |
− | *
| |
− | * @property isTracking
| |
− | * @type Boolean
| |
− | */
| |
− | isTracking: false,
| |
− |
| |
− | /**
| |
− | * Enable touch event listeners
| |
− | *
| |
− | * @method enable
| |
− | */
| |
− | enable: function() {
| |
− | if (Tap.isEnabled) {
| |
− | return;
| |
− | }
| |
− |
| |
− | Tap.isEnabled = true;
| |
− |
| |
− | // Set body element
| |
− | $BODY = $(document.body)
| |
− | .on('touchstart' + HELPER_NAMESPACE, Tap.onStart)
| |
− | .on('mousedown' + HELPER_NAMESPACE, Tap.onStart)
| |
− | .on('click' + HELPER_NAMESPACE, Tap.onClick);
| |
− | },
| |
− |
| |
− | /**
| |
− | * Disable touch event listeners
| |
− | *
| |
− | * @method disable
| |
− | */
| |
− | disable: function() {
| |
− | if (!Tap.isEnabled) {
| |
− | return;
| |
− | }
| |
− |
| |
− | Tap.isEnabled = false;
| |
− |
| |
− | // unbind all events with namespace
| |
− | $BODY.off(HELPER_NAMESPACE);
| |
− | },
| |
− |
| |
− | /**
| |
− | * Store touch start values and target
| |
− | *
| |
− | * @method onTouchStart
| |
− | * @param {jQuery.Event} e
| |
− | */
| |
− | onStart: function(e) {
| |
− | if (e.isTrigger) {
| |
− | return;
| |
− | }
| |
− |
| |
− | _normalizeEvent(e);
| |
− |
| |
− | // Ignore non left mouse clicks
| |
− | if ($.tap.LEFT_BUTTON_ONLY && !e.touches && e.which !== 1) {
| |
− | return;
| |
− | }
| |
− |
| |
− | if (e.touches) {
| |
− | TOUCH_VALUES.count = e.touches.length;
| |
− | }
| |
− |
| |
− | if (Tap.isTracking) {
| |
− | return;
| |
− | }
| |
− |
| |
− | if (!e.touches && _isEmulated(e)) {
| |
− | return;
| |
− | }
| |
− |
| |
− | Tap.isTracking = true;
| |
− |
| |
− | TOUCH_VALUES.event = e;
| |
− |
| |
− | if (e.touches) {
| |
− | _lastTouch = e;
| |
− | $BODY
| |
− | .on('touchend' + HELPER_NAMESPACE + HELPER_ACTIVE_NAMESPACE, Tap.onEnd)
| |
− | .on('touchcancel' + HELPER_NAMESPACE + HELPER_ACTIVE_NAMESPACE, Tap.onCancel);
| |
− | } else {
| |
− | $BODY.on('mouseup' + HELPER_NAMESPACE + HELPER_ACTIVE_NAMESPACE, Tap.onEnd);
| |
− | }
| |
− | },
| |
− |
| |
− | /**
| |
− | * If touch has not been canceled, create a
| |
− | * tap event and trigger it on the target element
| |
− | *
| |
− | * @method onTouchEnd
| |
− | * @param {jQuery.Event} e
| |
− | */
| |
− | onEnd: function(e) {
| |
− | var event;
| |
− |
| |
− | if (e.isTrigger) {
| |
− | return;
| |
− | }
| |
− |
| |
− | _normalizeEvent(e);
| |
− |
| |
− | if (_isTap(e)) {
| |
− | event = _createEvent(EVENT_NAME, e);
| |
− | _lastTap = event;
| |
− | $(TOUCH_VALUES.event.target).trigger(event);
| |
− | }
| |
− |
| |
− | // Cancel active tap tracking
| |
− | Tap.onCancel(e);
| |
− | },
| |
− |
| |
− | /**
| |
− | * Cancel tap and remove event listeners for active tap tracking
| |
− | *
| |
− | * @method onTouchCancel
| |
− | * @param {jQuery.Event} e
| |
− | */
| |
− | onCancel: function(e) {
| |
− | if (e && e.type === 'touchcancel') {
| |
− | e.preventDefault();
| |
− | }
| |
− |
| |
− | Tap.isTracking = false;
| |
− |
| |
− | $BODY.off(HELPER_ACTIVE_NAMESPACE);
| |
− | },
| |
− |
| |
− | /**
| |
− | * If tap was canceled, cancel click event
| |
− | *
| |
− | * @method onClick
| |
− | * @param {jQuery.Event} e
| |
− | * @return {void|Boolean}
| |
− | */
| |
− | onClick: function(e) {
| |
− | if (
| |
− | !e.isTrigger &&
| |
− | _lastTap &&
| |
− | _lastTap.isDefaultPrevented() &&
| |
− | _lastTap.target === e.target &&
| |
− | _lastTap.pageX === e.pageX &&
| |
− | _lastTap.pageY === e.pageY &&
| |
− | e.timeStamp - _lastTap.timeStamp < 750
| |
− | ) {
| |
− | _lastTap = null;
| |
− | return false;
| |
− | }
| |
− | }
| |
− |
| |
− | };
| |
− |
| |
− | // Enable tab when document is ready
| |
− | $(document).ready(Tap.enable);
| |
− |
| |
− | // Configurable options
| |
− | $.tap = {
| |
− | POSITION_DELTA: 10, // Max distance between touchstart and touchend to be considered a tap
| |
− | TIME_DELTA: 400, // Max duration between touchstart and touchend to be considered a tap
| |
− | LEFT_BUTTON_ONLY: true // Only accept left mouse button actions
| |
− | };
| |
− |
| |
− | }(document, jQuery));
| |
− | ;
| |
− |
| |
− | /* ../vendor/jquery.touchSwipe.min.js */
| |
− | (function(a){if(typeof define==="function"&&define.amd&&define.amd.jQuery){define(["jquery"],a)}else{a(jQuery)}}(function(f){var p="left",o="right",e="up",x="down",c="in",z="out",m="none",s="auto",l="swipe",t="pinch",A="tap",j="doubletap",b="longtap",y="hold",D="horizontal",u="vertical",i="all",r=10,g="start",k="move",h="end",q="cancel",a="ontouchstart" in window,v=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled,d=window.navigator.pointerEnabled||window.navigator.msPointerEnabled,B="TouchSwipe";var n={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"label, button, input, select, textarea, a, .noSwipe"};f.fn.swipe=function(G){var F=f(this),E=F.data(B);if(E&&typeof G==="string"){if(E[G]){return E[G].apply(this,Array.prototype.slice.call(arguments,1))}else{f.error("Method "+G+" does not exist on jQuery.swipe")}}else{if(!E&&(typeof G==="object"||!G)){return w.apply(this,arguments)}}return F};f.fn.swipe.defaults=n;f.fn.swipe.phases={PHASE_START:g,PHASE_MOVE:k,PHASE_END:h,PHASE_CANCEL:q};f.fn.swipe.directions={LEFT:p,RIGHT:o,UP:e,DOWN:x,IN:c,OUT:z};f.fn.swipe.pageScroll={NONE:m,HORIZONTAL:D,VERTICAL:u,AUTO:s};f.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:i};function w(E){if(E&&(E.allowPageScroll===undefined&&(E.swipe!==undefined||E.swipeStatus!==undefined))){E.allowPageScroll=m}if(E.click!==undefined&&E.tap===undefined){E.tap=E.click}if(!E){E={}}E=f.extend({},f.fn.swipe.defaults,E);return this.each(function(){var G=f(this);var F=G.data(B);if(!F){F=new C(this,E);G.data(B,F)}})}function C(a4,av){var az=(a||d||!av.fallbackToMouseEvents),J=az?(d?(v?"MSPointerDown":"pointerdown"):"touchstart"):"mousedown",ay=az?(d?(v?"MSPointerMove":"pointermove"):"touchmove"):"mousemove",U=az?(d?(v?"MSPointerUp":"pointerup"):"touchend"):"mouseup",S=az?null:"mouseleave",aD=(d?(v?"MSPointerCancel":"pointercancel"):"touchcancel");var ag=0,aP=null,ab=0,a1=0,aZ=0,G=1,aq=0,aJ=0,M=null;var aR=f(a4);var Z="start";var W=0;var aQ=null;var T=0,a2=0,a5=0,ad=0,N=0;var aW=null,af=null;try{aR.bind(J,aN);aR.bind(aD,a9)}catch(ak){f.error("events not supported "+J+","+aD+" on jQuery.swipe")}this.enable=function(){aR.bind(J,aN);aR.bind(aD,a9);return aR};this.disable=function(){aK();return aR};this.destroy=function(){aK();aR.data(B,null);aR=null};this.option=function(bc,bb){if(av[bc]!==undefined){if(bb===undefined){return av[bc]}else{av[bc]=bb}}else{f.error("Option "+bc+" does not exist on jQuery.swipe.options")}return null};function aN(bd){if(aB()){return}if(f(bd.target).closest(av.excludedElements,aR).length>0){return}var be=bd.originalEvent?bd.originalEvent:bd;var bc,bb=a?be.touches[0]:be;Z=g;if(a){W=be.touches.length}else{bd.preventDefault()}ag=0;aP=null;aJ=null;ab=0;a1=0;aZ=0;G=1;aq=0;aQ=aj();M=aa();R();if(!a||(W===av.fingers||av.fingers===i)||aX()){ai(0,bb);T=at();if(W==2){ai(1,be.touches[1]);a1=aZ=au(aQ[0].start,aQ[1].start)}if(av.swipeStatus||av.pinchStatus){bc=O(be,Z)}}else{bc=false}if(bc===false){Z=q;O(be,Z);return bc}else{if(av.hold){af=setTimeout(f.proxy(function(){aR.trigger("hold",[be.target]);if(av.hold){bc=av.hold.call(aR,be,be.target)}},this),av.longTapThreshold)}ao(true)}return null}function a3(be){var bh=be.originalEvent?be.originalEvent:be;if(Z===h||Z===q||am()){return}var bd,bc=a?bh.touches[0]:bh;var bf=aH(bc);a2=at();if(a){W=bh.touches.length}if(av.hold){clearTimeout(af)}Z=k;if(W==2){if(a1==0){ai(1,bh.touches[1]);a1=aZ=au(aQ[0].start,aQ[1].start)}else{aH(bh.touches[1]);aZ=au(aQ[0].end,aQ[1].end);aJ=ar(aQ[0].end,aQ[1].end)}G=a7(a1,aZ);aq=Math.abs(a1-aZ)}if((W===av.fingers||av.fingers===i)||!a||aX()){aP=aL(bf.start,bf.end);al(be,aP);ag=aS(bf.start,bf.end);ab=aM();aI(aP,ag);if(av.swipeStatus||av.pinchStatus){bd=O(bh,Z)}if(!av.triggerOnTouchEnd||av.triggerOnTouchLeave){var bb=true;if(av.triggerOnTouchLeave){var bg=aY(this);bb=E(bf.end,bg)}if(!av.triggerOnTouchEnd&&bb){Z=aC(k)}else{if(av.triggerOnTouchLeave&&!bb){Z=aC(h)}}if(Z==q||Z==h){O(bh,Z)}}}else{Z=q;O(bh,Z)}if(bd===false){Z=q;O(bh,Z)}}function L(bb){var bc=bb.originalEvent;if(a){if(bc.touches.length>0){F();return true}}if(am()){W=ad}a2=at();ab=aM();if(ba()||!an()){Z=q;O(bc,Z)}else{if(av.triggerOnTouchEnd||(av.triggerOnTouchEnd==false&&Z===k)){bb.preventDefault();Z=h;O(bc,Z)}else{if(!av.triggerOnTouchEnd&&a6()){Z=h;aF(bc,Z,A)}else{if(Z===k){Z=q;O(bc,Z)}}}}ao(false);return null}function a9(){W=0;a2=0;T=0;a1=0;aZ=0;G=1;R();ao(false)}function K(bb){var bc=bb.originalEvent;if(av.triggerOnTouchLeave){Z=aC(h);O(bc,Z)}}function aK(){aR.unbind(J,aN);aR.unbind(aD,a9);aR.unbind(ay,a3);aR.unbind(U,L);if(S){aR.unbind(S,K)}ao(false)}function aC(bf){var be=bf;var bd=aA();var bc=an();var bb=ba();if(!bd||bb){be=q}else{if(bc&&bf==k&&(!av.triggerOnTouchEnd||av.triggerOnTouchLeave)){be=h}else{if(!bc&&bf==h&&av.triggerOnTouchLeave){be=q}}}return be}function O(bd,bb){var bc=undefined;if(I()||V()){bc=aF(bd,bb,l)}else{if((P()||aX())&&bc!==false){bc=aF(bd,bb,t)}}if(aG()&&bc!==false){bc=aF(bd,bb,j)}else{if(ap()&&bc!==false){bc=aF(bd,bb,b)}else{if(ah()&&bc!==false){bc=aF(bd,bb,A)}}}if(bb===q){a9(bd)}if(bb===h){if(a){if(bd.touches.length==0){a9(bd)}}else{a9(bd)}}return bc}function aF(be,bb,bd){var bc=undefined;if(bd==l){aR.trigger("swipeStatus",[bb,aP||null,ag||0,ab||0,W,aQ]);if(av.swipeStatus){bc=av.swipeStatus.call(aR,be,bb,aP||null,ag||0,ab||0,W,aQ);if(bc===false){return false}}if(bb==h&&aV()){aR.trigger("swipe",[aP,ag,ab,W,aQ]);if(av.swipe){bc=av.swipe.call(aR,be,aP,ag,ab,W,aQ);if(bc===false){return false}}switch(aP){case p:aR.trigger("swipeLeft",[aP,ag,ab,W,aQ]);if(av.swipeLeft){bc=av.swipeLeft.call(aR,be,aP,ag,ab,W,aQ)}break;case o:aR.trigger("swipeRight",[aP,ag,ab,W,aQ]);if(av.swipeRight){bc=av.swipeRight.call(aR,be,aP,ag,ab,W,aQ)}break;case e:aR.trigger("swipeUp",[aP,ag,ab,W,aQ]);if(av.swipeUp){bc=av.swipeUp.call(aR,be,aP,ag,ab,W,aQ)}break;case x:aR.trigger("swipeDown",[aP,ag,ab,W,aQ]);if(av.swipeDown){bc=av.swipeDown.call(aR,be,aP,ag,ab,W,aQ)}break}}}if(bd==t){aR.trigger("pinchStatus",[bb,aJ||null,aq||0,ab||0,W,G,aQ]);if(av.pinchStatus){bc=av.pinchStatus.call(aR,be,bb,aJ||null,aq||0,ab||0,W,G,aQ);if(bc===false){return false}}if(bb==h&&a8()){switch(aJ){case c:aR.trigger("pinchIn",[aJ||null,aq||0,ab||0,W,G,aQ]);if(av.pinchIn){bc=av.pinchIn.call(aR,be,aJ||null,aq||0,ab||0,W,G,aQ)}break;case z:aR.trigger("pinchOut",[aJ||null,aq||0,ab||0,W,G,aQ]);if(av.pinchOut){bc=av.pinchOut.call(aR,be,aJ||null,aq||0,ab||0,W,G,aQ)}break}}}if(bd==A){if(bb===q||bb===h){clearTimeout(aW);clearTimeout(af);if(Y()&&!H()){N=at();aW=setTimeout(f.proxy(function(){N=null;aR.trigger("tap",[be.target]);if(av.tap){bc=av.tap.call(aR,be,be.target)}},this),av.doubleTapThreshold)}else{N=null;aR.trigger("tap",[be.target]);if(av.tap){bc=av.tap.call(aR,be,be.target)}}}}else{if(bd==j){if(bb===q||bb===h){clearTimeout(aW);N=null;aR.trigger("doubletap",[be.target]);if(av.doubleTap){bc=av.doubleTap.call(aR,be,be.target)}}}else{if(bd==b){if(bb===q||bb===h){clearTimeout(aW);N=null;aR.trigger("longtap",[be.target]);if(av.longTap){bc=av.longTap.call(aR,be,be.target)}}}}}return bc}function an(){var bb=true;if(av.threshold!==null){bb=ag>=av.threshold}return bb}function ba(){var bb=false;if(av.cancelThreshold!==null&&aP!==null){bb=(aT(aP)-ag)>=av.cancelThreshold}return bb}function ae(){if(av.pinchThreshold!==null){return aq>=av.pinchThreshold}return true}function aA(){var bb;if(av.maxTimeThreshold){if(ab>=av.maxTimeThreshold){bb=false}else{bb=true}}else{bb=true}return bb}function al(bb,bc){if(av.allowPageScroll===m||aX()){bb.preventDefault()}else{var bd=av.allowPageScroll===s;switch(bc){case p:if((av.swipeLeft&&bd)||(!bd&&av.allowPageScroll!=D)){bb.preventDefault()}break;case o:if((av.swipeRight&&bd)||(!bd&&av.allowPageScroll!=D)){bb.preventDefault()}break;case e:if((av.swipeUp&&bd)||(!bd&&av.allowPageScroll!=u)){bb.preventDefault()}break;case x:if((av.swipeDown&&bd)||(!bd&&av.allowPageScroll!=u)){bb.preventDefault()}break}}}function a8(){var bc=aO();var bb=X();var bd=ae();return bc&&bb&&bd}function aX(){return !!(av.pinchStatus||av.pinchIn||av.pinchOut)}function P(){return !!(a8()&&aX())}function aV(){var be=aA();var bg=an();var bd=aO();var bb=X();var bc=ba();var bf=!bc&&bb&&bd&&bg&&be;return bf}function V(){return !!(av.swipe||av.swipeStatus||av.swipeLeft||av.swipeRight||av.swipeUp||av.swipeDown)}function I(){return !!(aV()&&V())}function aO(){return((W===av.fingers||av.fingers===i)||!a)}function X(){return aQ[0].end.x!==0}function a6(){return !!(av.tap)}function Y(){return !!(av.doubleTap)}function aU(){return !!(av.longTap)}function Q(){if(N==null){return false}var bb=at();return(Y()&&((bb-N)<=av.doubleTapThreshold))}function H(){return Q()}function ax(){return((W===1||!a)&&(isNaN(ag)||ag<av.threshold))}function a0(){return((ab>av.longTapThreshold)&&(ag<r))}function ah(){return !!(ax()&&a6())}function aG(){return !!(Q()&&Y())}function ap(){return !!(a0()&&aU())}function F(){a5=at();ad=event.touches.length+1}function R(){a5=0;ad=0}function am(){var bb=false;if(a5){var bc=at()-a5;if(bc<=av.fingerReleaseThreshold){bb=true}}return bb}function aB(){return !!(aR.data(B+"_intouch")===true)}function ao(bb){if(bb===true){aR.bind(ay,a3);aR.bind(U,L);if(S){aR.bind(S,K)}}else{aR.unbind(ay,a3,false);aR.unbind(U,L,false);if(S){aR.unbind(S,K,false)}}aR.data(B+"_intouch",bb===true)}function ai(bc,bb){var bd=bb.identifier!==undefined?bb.identifier:0;aQ[bc].identifier=bd;aQ[bc].start.x=aQ[bc].end.x=bb.pageX||bb.clientX;aQ[bc].start.y=aQ[bc].end.y=bb.pageY||bb.clientY;return aQ[bc]}function aH(bb){var bd=bb.identifier!==undefined?bb.identifier:0;var bc=ac(bd);bc.end.x=bb.pageX||bb.clientX;bc.end.y=bb.pageY||bb.clientY;return bc}function ac(bc){for(var bb=0;bb<aQ.length;bb++){if(aQ[bb].identifier==bc){return aQ[bb]}}}function aj(){var bb=[];for(var bc=0;bc<=5;bc++){bb.push({start:{x:0,y:0},end:{x:0,y:0},identifier:0})}return bb}function aI(bb,bc){bc=Math.max(bc,aT(bb));M[bb].distance=bc}function aT(bb){if(M[bb]){return M[bb].distance}return undefined}function aa(){var bb={};bb[p]=aw(p);bb[o]=aw(o);bb[e]=aw(e);bb[x]=aw(x);return bb}function aw(bb){return{direction:bb,distance:0}}function aM(){return a2-T}function au(be,bd){var bc=Math.abs(be.x-bd.x);var bb=Math.abs(be.y-bd.y);return Math.round(Math.sqrt(bc*bc+bb*bb))}function a7(bb,bc){var bd=(bc/bb)*1;return bd.toFixed(2)}function ar(){if(G<1){return z}else{return c}}function aS(bc,bb){return Math.round(Math.sqrt(Math.pow(bb.x-bc.x,2)+Math.pow(bb.y-bc.y,2)))}function aE(be,bc){var bb=be.x-bc.x;var bg=bc.y-be.y;var bd=Math.atan2(bg,bb);var bf=Math.round(bd*180/Math.PI);if(bf<0){bf=360-Math.abs(bf)}return bf}function aL(bc,bb){var bd=aE(bc,bb);if((bd<=45)&&(bd>=0)){return p}else{if((bd<=360)&&(bd>=315)){return p}else{if((bd>=135)&&(bd<=225)){return o}else{if((bd>45)&&(bd<135)){return x}else{return e}}}}}function at(){var bb=new Date();return bb.getTime()}function aY(bb){bb=f(bb);var bd=bb.offset();var bc={left:bd.left,right:bd.left+bb.outerWidth(),top:bd.top,bottom:bd.top+bb.outerHeight()};return bc}function E(bb,bc){return(bb.x>bc.left&&bb.x<bc.right&&bb.y>bc.top&&bb.y<bc.bottom)}}}));;
| |
− |
| |
− | /* ../vendor/jquery.transit.js */
| |
− | /*!
| |
− | * jQuery Transit - CSS3 transitions and transformations
| |
− | * (c) 2011-2012 Rico Sta. Cruz <rico@ricostacruz.com>
| |
− | * MIT Licensed.
| |
− | *
| |
− | * http://ricostacruz.com/jquery.transit
| |
− | * http://github.com/rstacruz/jquery.transit
| |
− | */
| |
− | (function(k){k.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:true,useTransitionEnd:false};var d=document.createElement("div");var q={};function b(v){if(v in d.style){return v}var u=["Moz","Webkit","O","ms"];var r=v.charAt(0).toUpperCase()+v.substr(1);if(v in d.style){return v}for(var t=0;t<u.length;++t){var s=u[t]+r;if(s in d.style){return s}}}function e(){d.style[q.transform]="";d.style[q.transform]="rotateY(90deg)";return d.style[q.transform]!==""}var a=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;q.transition=b("transition");q.transitionDelay=b("transitionDelay");q.transform=b("transform");q.transformOrigin=b("transformOrigin");q.transform3d=e();var i={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"};var f=q.transitionEnd=i[q.transition]||null;for(var p in q){if(q.hasOwnProperty(p)&&typeof k.support[p]==="undefined"){k.support[p]=q[p]}}d=null;k.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};k.cssHooks["transit:transform"]={get:function(r){return k(r).data("transform")||new j()},set:function(s,r){var t=r;if(!(t instanceof j)){t=new j(t)}if(q.transform==="WebkitTransform"&&!a){s.style[q.transform]=t.toString(true)}else{s.style[q.transform]=t.toString()}k(s).data("transform",t)}};k.cssHooks.transform={set:k.cssHooks["transit:transform"].set};if(k.fn.jquery<"1.8"){k.cssHooks.transformOrigin={get:function(r){return r.style[q.transformOrigin]},set:function(r,s){r.style[q.transformOrigin]=s}};k.cssHooks.transition={get:function(r){return r.style[q.transition]},set:function(r,s){r.style[q.transition]=s}}}n("scale");n("translate");n("rotate");n("rotateX");n("rotateY");n("rotate3d");n("perspective");n("skewX");n("skewY");n("x",true);n("y",true);function j(r){if(typeof r==="string"){this.parse(r)}return this}j.prototype={setFromString:function(t,s){var r=(typeof s==="string")?s.split(","):(s.constructor===Array)?s:[s];r.unshift(t);j.prototype.set.apply(this,r)},set:function(s){var r=Array.prototype.slice.apply(arguments,[1]);if(this.setter[s]){this.setter[s].apply(this,r)}else{this[s]=r.join(",")}},get:function(r){if(this.getter[r]){return this.getter[r].apply(this)}else{return this[r]||0}},setter:{rotate:function(r){this.rotate=o(r,"deg")},rotateX:function(r){this.rotateX=o(r,"deg")},rotateY:function(r){this.rotateY=o(r,"deg")},scale:function(r,s){if(s===undefined){s=r}this.scale=r+","+s},skewX:function(r){this.skewX=o(r,"deg")},skewY:function(r){this.skewY=o(r,"deg")},perspective:function(r){this.perspective=o(r,"px")},x:function(r){this.set("translate",r,null)},y:function(r){this.set("translate",null,r)},translate:function(r,s){if(this._translateX===undefined){this._translateX=0}if(this._translateY===undefined){this._translateY=0}if(r!==null&&r!==undefined){this._translateX=o(r,"px")}if(s!==null&&s!==undefined){this._translateY=o(s,"px")}this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var r=(this.scale||"1,1").split(",");if(r[0]){r[0]=parseFloat(r[0])}if(r[1]){r[1]=parseFloat(r[1])}return(r[0]===r[1])?r[0]:r},rotate3d:function(){var t=(this.rotate3d||"0,0,0,0deg").split(",");for(var r=0;r<=3;++r){if(t[r]){t[r]=parseFloat(t[r])}}if(t[3]){t[3]=o(t[3],"deg")}return t}},parse:function(s){var r=this;s.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,v,u){r.setFromString(v,u)})},toString:function(t){var s=[];for(var r in this){if(this.hasOwnProperty(r)){if((!q.transform3d)&&((r==="rotateX")||(r==="rotateY")||(r==="perspective")||(r==="transformOrigin"))){continue}if(r[0]!=="_"){if(t&&(r==="scale")){s.push(r+"3d("+this[r]+",1)")}else{if(t&&(r==="translate")){s.push(r+"3d("+this[r]+",0)")}else{s.push(r+"("+this[r]+")")}}}}}return s.join(" ")}};function m(s,r,t){if(r===true){s.queue(t)}else{if(r){s.queue(r,t)}else{t()}}}function h(s){var r=[];k.each(s,function(t){t=k.camelCase(t);t=k.transit.propertyMap[t]||k.cssProps[t]||t;t=c(t);if(k.inArray(t,r)===-1){r.push(t)}});return r}function g(s,v,x,r){var t=h(s);if(k.cssEase[x]){x=k.cssEase[x]}var w=""+l(v)+" "+x;if(parseInt(r,10)>0){w+=" "+l(r)}var u=[];k.each(t,function(z,y){u.push(y+" "+w)});return u.join(", ")}k.fn.transition=k.fn.transit=function(z,s,y,C){var D=this;var u=0;var w=true;if(typeof s==="function"){C=s;s=undefined}if(typeof y==="function"){C=y;y=undefined}if(typeof z.easing!=="undefined"){y=z.easing;delete z.easing}if(typeof z.duration!=="undefined"){s=z.duration;delete z.duration}if(typeof z.complete!=="undefined"){C=z.complete;delete z.complete}if(typeof z.queue!=="undefined"){w=z.queue;delete z.queue}if(typeof z.delay!=="undefined"){u=z.delay;delete z.delay}if(typeof s==="undefined"){s=k.fx.speeds._default}if(typeof y==="undefined"){y=k.cssEase._default}s=l(s);var E=g(z,s,y,u);var B=k.transit.enabled&&q.transition;var t=B?(parseInt(s,10)+parseInt(u,10)):0;if(t===0){var A=function(F){D.css(z);if(C){C.apply(D)}if(F){F()}};m(D,w,A);return D}var x={};var r=function(H){var G=false;var F=function(){if(G){D.unbind(f,F)}if(t>0){D.each(function(){this.style[q.transition]=(x[this]||null)})}if(typeof C==="function"){C.apply(D)}if(typeof H==="function"){H()}};if((t>0)&&(f)&&(k.transit.useTransitionEnd)){G=true;D.bind(f,F)}else{window.setTimeout(F,t)}D.each(function(){if(t>0){this.style[q.transition]=E}k(this).css(z)})};var v=function(F){this.offsetWidth;r(F)};m(D,w,v);return this};function n(s,r){if(!r){k.cssNumber[s]=true}k.transit.propertyMap[s]=q.transform;k.cssHooks[s]={get:function(v){var u=k(v).css("transit:transform");return u.get(s)},set:function(v,w){var u=k(v).css("transit:transform");u.setFromString(s,w);k(v).css({"transit:transform":u})}}}function c(r){return r.replace(/([A-Z])/g,function(s){return"-"+s.toLowerCase()})}function o(s,r){if((typeof s==="string")&&(!s.match(/^[\-0-9\.]+$/))){return s}else{return""+s+r}}function l(s){var r=s;if(k.fx.speeds[r]){r=k.fx.speeds[r]}return o(r,"ms")}k.transit.getTransitionValue=g})(jQuery);;
| |
− |
| |
− | /* ../vendor/jquery.waitForImages.js */
| |
− | /*! waitForImages jQuery Plugin 2014-10-27 */
| |
− | !function(a){var b="waitForImages";a.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage","cursor"]},a.expr[":"].uncached=function(b){if(!a(b).is('img[src][src!=""]'))return!1;var c=new Image;return c.src=b.src,!c.complete},a.fn.waitForImages=function(c,d,e){var f=0,g=0;if(a.isPlainObject(arguments[0])&&(e=arguments[0].waitForAll,d=arguments[0].each,c=arguments[0].finished),c=c||a.noop,d=d||a.noop,e=!!e,!a.isFunction(c)||!a.isFunction(d))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var h=a(this),i=[],j=a.waitForImages.hasImageProperties||[],k=/url\(\s*(['"]?)(.*?)\1\s*\)/g;e?h.find("*").addBack().each(function(){var b=a(this);b.is("img:uncached")&&i.push({src:b.attr("src"),element:b[0]}),a.each(j,function(a,c){var d,e=b.css(c);if(!e)return!0;for(;d=k.exec(e);)i.push({src:d[2],element:b[0]})})}):h.find("img:uncached").each(function(){i.push({src:this.src,element:this})}),f=i.length,g=0,0===f&&c.call(h[0]),a.each(i,function(e,i){var j=new Image,k="load."+b+" error."+b;a(j).on(k,function l(b){return g++,d.call(i.element,g,f,"load"==b.type),a(this).off(k,l),g==f?(c.call(h[0]),!1):void 0}),j.src=i.src})})}}(jQuery);;
| |
− |
| |
− | /* ../vendor/owl.carousel.js */
| |
− | /*
| |
− | * jQuery OwlCarousel v1.3.3
| |
− | *
| |
− | * Copyright (c) 2013 Bartosz Wojciechowski
| |
− | * http://www.owlgraphic.com/owlcarousel/
| |
− | *
| |
− | * Licensed under MIT
| |
− | *
| |
− | */
| |
− |
| |
− | /*JS Lint helpers: */
| |
− | /*global dragMove: false, dragEnd: false, $, jQuery, alert, window, document */
| |
− | /*jslint nomen: true, continue:true */
| |
− |
| |
− | if (typeof Object.create !== "function") {
| |
− | Object.create = function (obj) {
| |
− | function F() {}
| |
− | F.prototype = obj;
| |
− | return new F();
| |
− | };
| |
− | }
| |
− | (function ($, window, document) {
| |
− |
| |
− | var Carousel = {
| |
− | init : function (options, el) {
| |
− | var base = this;
| |
− |
| |
− | base.$elem = $(el);
| |
− | base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);
| |
− |
| |
− | base.userOptions = options;
| |
− | base.loadContent();
| |
− | },
| |
− |
| |
− | loadContent : function () {
| |
− | var base = this, url;
| |
− |
| |
− | function getData(data) {
| |
− | var i, content = "";
| |
− | if (typeof base.options.jsonSuccess === "function") {
| |
− | base.options.jsonSuccess.apply(this, [data]);
| |
− | } else {
| |
− | for (i in data.owl) {
| |
− | if (data.owl.hasOwnProperty(i)) {
| |
− | content += data.owl[i].item;
| |
− | }
| |
− | }
| |
− | base.$elem.html(content);
| |
− | }
| |
− | base.logIn();
| |
− | }
| |
− |
| |
− | if (typeof base.options.beforeInit === "function") {
| |
− | base.options.beforeInit.apply(this, [base.$elem]);
| |
− | }
| |
− |
| |
− | if (typeof base.options.jsonPath === "string") {
| |
− | url = base.options.jsonPath;
| |
− | $.getJSON(url, getData);
| |
− | } else {
| |
− | base.logIn();
| |
− | }
| |
− | },
| |
− |
| |
− | logIn : function () {
| |
− | var base = this;
| |
− |
| |
− | base.$elem.data("owl-originalStyles", base.$elem.attr("style"));
| |
− | base.$elem.data("owl-originalClasses", base.$elem.attr("class"));
| |
− |
| |
− | base.$elem.css({opacity: 0});
| |
− | base.orignalItems = base.options.items;
| |
− | base.checkBrowser();
| |
− | base.wrapperWidth = 0;
| |
− | base.checkVisible = null;
| |
− | base.setVars();
| |
− | },
| |
− |
| |
− | setVars : function () {
| |
− | var base = this;
| |
− | if (base.$elem.children().length === 0) {return false; }
| |
− | base.baseClass();
| |
− | base.eventTypes();
| |
− | base.$userItems = base.$elem.children();
| |
− | base.itemsAmount = base.$userItems.length;
| |
− | base.wrapItems();
| |
− | base.$owlItems = base.$elem.find(".owl-item");
| |
− | base.$owlWrapper = base.$elem.find(".owl-wrapper");
| |
− | base.playDirection = "next";
| |
− | base.prevItem = 0;
| |
− | base.prevArr = [0];
| |
− | base.currentItem = 0;
| |
− | base.currentItemAfterMove = 0;
| |
− | base.customEvents();
| |
− | base.onStartup();
| |
− | },
| |
− |
| |
− | onStartup : function () {
| |
− | var base = this;
| |
− | base.updateItems();
| |
− | base.calculateAll();
| |
− | base.buildControls();
| |
− | base.updateControls();
| |
− | base.response();
| |
− | base.moveEvents();
| |
− | base.stopOnHover();
| |
− | base.owlStatus();
| |
− |
| |
− | if (base.options.transitionStyle !== false) {
| |
− | base.transitionTypes(base.options.transitionStyle);
| |
− | }
| |
− | if (base.options.autoPlay === true) {
| |
− | base.options.autoPlay = 5000;
| |
− | }
| |
− | base.play();
| |
− |
| |
− | base.$elem.find(".owl-wrapper").css("display", "block");
| |
− |
| |
− | if (!base.$elem.is(":visible")) {
| |
− | base.watchVisibility();
| |
− | } else {
| |
− | base.$elem.css("opacity", 1);
| |
− | }
| |
− | base.onstartup = false;
| |
− | base.eachMoveUpdate();
| |
− | if (typeof base.options.afterInit === "function") {
| |
− | base.options.afterInit.apply(this, [base.$elem]);
| |
− | }
| |
− | },
| |
− |
| |
− | eachMoveUpdate : function () {
| |
− | var base = this;
| |
− |
| |
− | if (base.options.lazyLoad === true) {
| |
− | base.lazyLoad();
| |
− | }
| |
− | if (base.options.autoHeight === true) {
| |
− | base.autoHeight();
| |
− | }
| |
− | base.onVisibleItems();
| |
− |
| |
− | if (typeof base.options.afterAction === "function") {
| |
− | base.options.afterAction.apply(this, [base.$elem]);
| |
− | }
| |
− | },
| |
− |
| |
− | updateVars : function () {
| |
− | var base = this;
| |
− | if (typeof base.options.beforeUpdate === "function") {
| |
− | base.options.beforeUpdate.apply(this, [base.$elem]);
| |
− | }
| |
− | base.watchVisibility();
| |
− | base.updateItems();
| |
− | base.calculateAll();
| |
− | base.updatePosition();
| |
− | base.updateControls();
| |
− | base.eachMoveUpdate();
| |
− | if (typeof base.options.afterUpdate === "function") {
| |
− | base.options.afterUpdate.apply(this, [base.$elem]);
| |
− | }
| |
− | },
| |
− |
| |
− | reload : function () {
| |
− | var base = this;
| |
− | window.setTimeout(function () {
| |
− | base.updateVars();
| |
− | }, 0);
| |
− | },
| |
− |
| |
− | watchVisibility : function () {
| |
− | var base = this;
| |
− |
| |
− | if (base.$elem.is(":visible") === false) {
| |
− | base.$elem.css({opacity: 0});
| |
− | window.clearInterval(base.autoPlayInterval);
| |
− | window.clearInterval(base.checkVisible);
| |
− | } else {
| |
− | return false;
| |
− | }
| |
− | base.checkVisible = window.setInterval(function () {
| |
− | if (base.$elem.is(":visible")) {
| |
− | base.reload();
| |
− | base.$elem.animate({opacity: 1}, 200);
| |
− | window.clearInterval(base.checkVisible);
| |
− | }
| |
− | }, 500);
| |
− | },
| |
− |
| |
− | wrapItems : function () {
| |
− | var base = this;
| |
− | base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");
| |
− | base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");
| |
− | base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");
| |
− | base.$elem.css("display", "block");
| |
− | },
| |
− |
| |
− | baseClass : function () {
| |
− | var base = this,
| |
− | hasBaseClass = base.$elem.hasClass(base.options.baseClass),
| |
− | hasThemeClass = base.$elem.hasClass(base.options.theme);
| |
− |
| |
− | if (!hasBaseClass) {
| |
− | base.$elem.addClass(base.options.baseClass);
| |
− | }
| |
− |
| |
− | if (!hasThemeClass) {
| |
− | base.$elem.addClass(base.options.theme);
| |
− | }
| |
− | },
| |
− |
| |
− | updateItems : function () {
| |
− | var base = this, width, i;
| |
− |
| |
− | if (base.options.responsive === false) {
| |
− | return false;
| |
− | }
| |
− | if (base.options.singleItem === true) {
| |
− | base.options.items = base.orignalItems = 1;
| |
− | base.options.itemsCustom = false;
| |
− | base.options.itemsDesktop = false;
| |
− | base.options.itemsDesktopSmall = false;
| |
− | base.options.itemsTablet = false;
| |
− | base.options.itemsTabletSmall = false;
| |
− | base.options.itemsMobile = false;
| |
− | return false;
| |
− | }
| |
− |
| |
− | width = $(base.options.responsiveBaseWidth).width();
| |
− |
| |
− | if (width > (base.options.itemsDesktop[0] || base.orignalItems)) {
| |
− | base.options.items = base.orignalItems;
| |
− | }
| |
− | if (base.options.itemsCustom !== false) {
| |
− | //Reorder array by screen size
| |
− | base.options.itemsCustom.sort(function (a, b) {return a[0] - b[0]; });
| |
− |
| |
− | for (i = 0; i < base.options.itemsCustom.length; i += 1) {
| |
− | if (base.options.itemsCustom[i][0] <= width) {
| |
− | base.options.items = base.options.itemsCustom[i][1];
| |
− | }
| |
− | }
| |
− |
| |
− | } else {
| |
− |
| |
− | if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) {
| |
− | base.options.items = base.options.itemsDesktop[1];
| |
− | }
| |
− |
| |
− | if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) {
| |
− | base.options.items = base.options.itemsDesktopSmall[1];
| |
− | }
| |
− |
| |
− | if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) {
| |
− | base.options.items = base.options.itemsTablet[1];
| |
− | }
| |
− |
| |
− | if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) {
| |
− | base.options.items = base.options.itemsTabletSmall[1];
| |
− | }
| |
− |
| |
− | if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) {
| |
− | base.options.items = base.options.itemsMobile[1];
| |
− | }
| |
− | }
| |
− |
| |
− | //if number of items is less than declared
| |
− | if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) {
| |
− | base.options.items = base.itemsAmount;
| |
− | }
| |
− | },
| |
− |
| |
− | response : function () {
| |
− | var base = this,
| |
− | smallDelay,
| |
− | lastWindowWidth;
| |
− |
| |
− | if (base.options.responsive !== true) {
| |
− | return false;
| |
− | }
| |
− | lastWindowWidth = $(window).width();
| |
− |
| |
− | base.resizer = function () {
| |
− | if ($(window).width() !== lastWindowWidth) {
| |
− | if (base.options.autoPlay !== false) {
| |
− | window.clearInterval(base.autoPlayInterval);
| |
− | }
| |
− | window.clearTimeout(smallDelay);
| |
− | smallDelay = window.setTimeout(function () {
| |
− | lastWindowWidth = $(window).width();
| |
− | base.updateVars();
| |
− | }, base.options.responsiveRefreshRate);
| |
− | }
| |
− | };
| |
− | $(window).resize(base.resizer);
| |
− | },
| |
− |
| |
− | updatePosition : function () {
| |
− | var base = this;
| |
− | base.jumpTo(base.currentItem);
| |
− | if (base.options.autoPlay !== false) {
| |
− | base.checkAp();
| |
− | }
| |
− | },
| |
− |
| |
− | appendItemsSizes : function () {
| |
− | var base = this,
| |
− | roundPages = 0,
| |
− | lastItem = base.itemsAmount - base.options.items;
| |
− |
| |
− | base.$owlItems.each(function (index) {
| |
− | var $this = $(this);
| |
− | $this
| |
− | .css({"width": base.itemWidth})
| |
− | .data("owl-item", Number(index));
| |
− |
| |
− | if (index % base.options.items === 0 || index === lastItem) {
| |
− | if (!(index > lastItem)) {
| |
− | roundPages += 1;
| |
− | }
| |
− | }
| |
− | $this.data("owl-roundPages", roundPages);
| |
− | });
| |
− | },
| |
− |
| |
− | appendWrapperSizes : function () {
| |
− | var base = this,
| |
− | width = base.$owlItems.length * base.itemWidth;
| |
− |
| |
− | base.$owlWrapper.css({
| |
− | "width": width * 2,
| |
− | "left": 0
| |
− | });
| |
− | base.appendItemsSizes();
| |
− | },
| |
− |
| |
− | calculateAll : function () {
| |
− | var base = this;
| |
− | base.calculateWidth();
| |
− | base.appendWrapperSizes();
| |
− | base.loops();
| |
− | base.max();
| |
− | },
| |
− |
| |
− | calculateWidth : function () {
| |
− | var base = this;
| |
− | base.itemWidth = Math.round(base.$elem.width() / base.options.items);
| |
− | },
| |
− |
| |
− | max : function () {
| |
− | var base = this,
| |
− | maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;
| |
− | if (base.options.items > base.itemsAmount) {
| |
− | base.maximumItem = 0;
| |
− | maximum = 0;
| |
− | base.maximumPixels = 0;
| |
− | } else {
| |
− | base.maximumItem = base.itemsAmount - base.options.items;
| |
− | base.maximumPixels = maximum;
| |
− | }
| |
− | return maximum;
| |
− | },
| |
− |
| |
− | min : function () {
| |
− | return 0;
| |
− | },
| |
− |
| |
− | loops : function () {
| |
− | var base = this,
| |
− | prev = 0,
| |
− | elWidth = 0,
| |
− | i,
| |
− | item,
| |
− | roundPageNum;
| |
− |
| |
− | base.positionsInArray = [0];
| |
− | base.pagesInArray = [];
| |
− |
| |
− | for (i = 0; i < base.itemsAmount; i += 1) {
| |
− | elWidth += base.itemWidth;
| |
− | base.positionsInArray.push(-elWidth);
| |
− |
| |
− | if (base.options.scrollPerPage === true) {
| |
− | item = $(base.$owlItems[i]);
| |
− | roundPageNum = item.data("owl-roundPages");
| |
− | if (roundPageNum !== prev) {
| |
− | base.pagesInArray[prev] = base.positionsInArray[i];
| |
− | prev = roundPageNum;
| |
− | }
| |
− | }
| |
− | }
| |
− | },
| |
− |
| |
− | buildControls : function () {
| |
− | var base = this;
| |
− | if (base.options.navigation === true || base.options.pagination === true) {
| |
− | base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);
| |
− | }
| |
− | if (base.options.pagination === true) {
| |
− | base.buildPagination();
| |
− | }
| |
− | if (base.options.navigation === true) {
| |
− | base.buildButtons();
| |
− | }
| |
− | },
| |
− |
| |
− | buildButtons : function () {
| |
− | var base = this,
| |
− | buttonsWrapper = $("<div class=\"owl-buttons\"/>");
| |
− | base.owlControls.append(buttonsWrapper);
| |
− |
| |
− | base.buttonPrev = $("<div/>", {
| |
− | "class" : "owl-prev",
| |
− | "html" : base.options.navigationText[0] || ""
| |
− | });
| |
− |
| |
− | base.buttonNext = $("<div/>", {
| |
− | "class" : "owl-next",
| |
− | "html" : base.options.navigationText[1] || ""
| |
− | });
| |
− |
| |
− | buttonsWrapper
| |
− | .append(base.buttonPrev)
| |
− | .append(base.buttonNext);
| |
− |
| |
− | buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) {
| |
− | event.preventDefault();
| |
− | });
| |
− |
| |
− | buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) {
| |
− | event.preventDefault();
| |
− | if ($(this).hasClass("owl-next")) {
| |
− | base.next();
| |
− | } else {
| |
− | base.prev();
| |
− | }
| |
− | });
| |
− | },
| |
− |
| |
− | buildPagination : function () {
| |
− | var base = this;
| |
− |
| |
− | base.paginationWrapper = $("<div class=\"owl-pagination\"/>");
| |
− | base.owlControls.append(base.paginationWrapper);
| |
− |
| |
− | base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) {
| |
− | event.preventDefault();
| |
− | if (Number($(this).data("owl-page")) !== base.currentItem) {
| |
− | base.goTo(Number($(this).data("owl-page")), true);
| |
− | }
| |
− | });
| |
− | },
| |
− |
| |
− | updatePagination : function () {
| |
− | var base = this,
| |
− | counter,
| |
− | lastPage,
| |
− | lastItem,
| |
− | i,
| |
− | paginationButton,
| |
− | paginationButtonInner;
| |
− |
| |
− | if (base.options.pagination === false) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | base.paginationWrapper.html("");
| |
− |
| |
− | counter = 0;
| |
− | lastPage = base.itemsAmount - base.itemsAmount % base.options.items;
| |
− |
| |
− | for (i = 0; i < base.itemsAmount; i += 1) {
| |
− | if (i % base.options.items === 0) {
| |
− | counter += 1;
| |
− | if (lastPage === i) {
| |
− | lastItem = base.itemsAmount - base.options.items;
| |
− | }
| |
− | paginationButton = $("<div/>", {
| |
− | "class" : "owl-page"
| |
− | });
| |
− | paginationButtonInner = $("<span></span>", {
| |
− | "text": base.options.paginationNumbers === true ? counter : "",
| |
− | "class": base.options.paginationNumbers === true ? "owl-numbers" : ""
| |
− | });
| |
− | paginationButton.append(paginationButtonInner);
| |
− |
| |
− | paginationButton.data("owl-page", lastPage === i ? lastItem : i);
| |
− | paginationButton.data("owl-roundPages", counter);
| |
− |
| |
− | base.paginationWrapper.append(paginationButton);
| |
− | }
| |
− | }
| |
− | base.checkPagination();
| |
− | },
| |
− | checkPagination : function () {
| |
− | var base = this;
| |
− | if (base.options.pagination === false) {
| |
− | return false;
| |
− | }
| |
− | base.paginationWrapper.find(".owl-page").each(function () {
| |
− | if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) {
| |
− | base.paginationWrapper
| |
− | .find(".owl-page")
| |
− | .removeClass("active");
| |
− | $(this).addClass("active");
| |
− | }
| |
− | });
| |
− | },
| |
− |
| |
− | checkNavigation : function () {
| |
− | var base = this;
| |
− |
| |
− | if (base.options.navigation === false) {
| |
− | return false;
| |
− | }
| |
− | if (base.options.rewindNav === false) {
| |
− | if (base.currentItem === 0 && base.maximumItem === 0) {
| |
− | base.buttonPrev.addClass("disabled");
| |
− | base.buttonNext.addClass("disabled");
| |
− | } else if (base.currentItem === 0 && base.maximumItem !== 0) {
| |
− | base.buttonPrev.addClass("disabled");
| |
− | base.buttonNext.removeClass("disabled");
| |
− | } else if (base.currentItem === base.maximumItem) {
| |
− | base.buttonPrev.removeClass("disabled");
| |
− | base.buttonNext.addClass("disabled");
| |
− | } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) {
| |
− | base.buttonPrev.removeClass("disabled");
| |
− | base.buttonNext.removeClass("disabled");
| |
− | }
| |
− | }
| |
− | },
| |
− |
| |
− | updateControls : function () {
| |
− | var base = this;
| |
− | base.updatePagination();
| |
− | base.checkNavigation();
| |
− | if (base.owlControls) {
| |
− | if (base.options.items >= base.itemsAmount) {
| |
− | base.owlControls.hide();
| |
− | } else {
| |
− | base.owlControls.show();
| |
− | }
| |
− | }
| |
− | },
| |
− |
| |
− | destroyControls : function () {
| |
− | var base = this;
| |
− | if (base.owlControls) {
| |
− | base.owlControls.remove();
| |
− | }
| |
− | },
| |
− |
| |
− | next : function (speed) {
| |
− | var base = this;
| |
− |
| |
− | if (base.isTransition) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1;
| |
− | if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) {
| |
− | if (base.options.rewindNav === true) {
| |
− | base.currentItem = 0;
| |
− | speed = "rewind";
| |
− | } else {
| |
− | base.currentItem = base.maximumItem;
| |
− | return false;
| |
− | }
| |
− | }
| |
− | base.goTo(base.currentItem, speed);
| |
− | },
| |
− |
| |
− | prev : function (speed) {
| |
− | var base = this;
| |
− |
| |
− | if (base.isTransition) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) {
| |
− | base.currentItem = 0;
| |
− | } else {
| |
− | base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1;
| |
− | }
| |
− | if (base.currentItem < 0) {
| |
− | if (base.options.rewindNav === true) {
| |
− | base.currentItem = base.maximumItem;
| |
− | speed = "rewind";
| |
− | } else {
| |
− | base.currentItem = 0;
| |
− | return false;
| |
− | }
| |
− | }
| |
− | base.goTo(base.currentItem, speed);
| |
− | },
| |
− |
| |
− | goTo : function (position, speed, drag) {
| |
− | var base = this,
| |
− | goToPixel;
| |
− |
| |
− | if (base.isTransition) {
| |
− | return false;
| |
− | }
| |
− | if (typeof base.options.beforeMove === "function") {
| |
− | base.options.beforeMove.apply(this, [base.$elem]);
| |
− | }
| |
− | if (position >= base.maximumItem) {
| |
− | position = base.maximumItem;
| |
− | } else if (position <= 0) {
| |
− | position = 0;
| |
− | }
| |
− | base.currentItem = base.owl.currentItem = position;
| |
− | if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) {
| |
− | base.swapSpeed(0);
| |
− | if (base.browser.support3d === true) {
| |
− | base.transition3d(base.positionsInArray[position]);
| |
− | } else {
| |
− | base.css2slide(base.positionsInArray[position], 1);
| |
− | }
| |
− | base.afterGo();
| |
− | base.singleItemTransition();
| |
− | return false;
| |
− | }
| |
− | goToPixel = base.positionsInArray[position];
| |
− |
| |
− | if (base.browser.support3d === true) {
| |
− | base.isCss3Finish = false;
| |
− |
| |
− | if (speed === true) {
| |
− | base.swapSpeed("paginationSpeed");
| |
− | window.setTimeout(function () {
| |
− | base.isCss3Finish = true;
| |
− | }, base.options.paginationSpeed);
| |
− |
| |
− | } else if (speed === "rewind") {
| |
− | base.swapSpeed(base.options.rewindSpeed);
| |
− | window.setTimeout(function () {
| |
− | base.isCss3Finish = true;
| |
− | }, base.options.rewindSpeed);
| |
− |
| |
− | } else {
| |
− | base.swapSpeed("slideSpeed");
| |
− | window.setTimeout(function () {
| |
− | base.isCss3Finish = true;
| |
− | }, base.options.slideSpeed);
| |
− | }
| |
− | base.transition3d(goToPixel);
| |
− | } else {
| |
− | if (speed === true) {
| |
− | base.css2slide(goToPixel, base.options.paginationSpeed);
| |
− | } else if (speed === "rewind") {
| |
− | base.css2slide(goToPixel, base.options.rewindSpeed);
| |
− | } else {
| |
− | base.css2slide(goToPixel, base.options.slideSpeed);
| |
− | }
| |
− | }
| |
− | base.afterGo();
| |
− | },
| |
− |
| |
− | jumpTo : function (position) {
| |
− | var base = this;
| |
− | if (typeof base.options.beforeMove === "function") {
| |
− | base.options.beforeMove.apply(this, [base.$elem]);
| |
− | }
| |
− | if (position >= base.maximumItem || position === -1) {
| |
− | position = base.maximumItem;
| |
− | } else if (position <= 0) {
| |
− | position = 0;
| |
− | }
| |
− | base.swapSpeed(0);
| |
− | if (base.browser.support3d === true) {
| |
− | base.transition3d(base.positionsInArray[position]);
| |
− | } else {
| |
− | base.css2slide(base.positionsInArray[position], 1);
| |
− | }
| |
− | base.currentItem = base.owl.currentItem = position;
| |
− | base.afterGo();
| |
− | },
| |
− |
| |
− | afterGo : function () {
| |
− | var base = this;
| |
− |
| |
− | base.prevArr.push(base.currentItem);
| |
− | base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2];
| |
− | base.prevArr.shift(0);
| |
− |
| |
− | if (base.prevItem !== base.currentItem) {
| |
− | base.checkPagination();
| |
− | base.checkNavigation();
| |
− | base.eachMoveUpdate();
| |
− |
| |
− | if (base.options.autoPlay !== false) {
| |
− | base.checkAp();
| |
− | }
| |
− | }
| |
− | if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) {
| |
− | base.options.afterMove.apply(this, [base.$elem]);
| |
− | }
| |
− | },
| |
− |
| |
− | stop : function () {
| |
− | var base = this;
| |
− | base.apStatus = "stop";
| |
− | window.clearInterval(base.autoPlayInterval);
| |
− | },
| |
− |
| |
− | checkAp : function () {
| |
− | var base = this;
| |
− | if (base.apStatus !== "stop") {
| |
− | base.play();
| |
− | }
| |
− | },
| |
− |
| |
− | play : function () {
| |
− | var base = this;
| |
− | base.apStatus = "play";
| |
− | if (base.options.autoPlay === false) {
| |
− | return false;
| |
− | }
| |
− | window.clearInterval(base.autoPlayInterval);
| |
− | base.autoPlayInterval = window.setInterval(function () {
| |
− | base.next(true);
| |
− | }, base.options.autoPlay);
| |
− | },
| |
− |
| |
− | swapSpeed : function (action) {
| |
− | var base = this;
| |
− | if (action === "slideSpeed") {
| |
− | base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));
| |
− | } else if (action === "paginationSpeed") {
| |
− | base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));
| |
− | } else if (typeof action !== "string") {
| |
− | base.$owlWrapper.css(base.addCssSpeed(action));
| |
− | }
| |
− | },
| |
− |
| |
− | addCssSpeed : function (speed) {
| |
− | return {
| |
− | "-webkit-transition": "all " + speed + "ms ease",
| |
− | "-moz-transition": "all " + speed + "ms ease",
| |
− | "-o-transition": "all " + speed + "ms ease",
| |
− | "transition": "all " + speed + "ms ease"
| |
− | };
| |
− | },
| |
− |
| |
− | removeTransition : function () {
| |
− | return {
| |
− | "-webkit-transition": "",
| |
− | "-moz-transition": "",
| |
− | "-o-transition": "",
| |
− | "transition": ""
| |
− | };
| |
− | },
| |
− |
| |
− | doTranslate : function (pixels) {
| |
− | return {
| |
− | "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)",
| |
− | "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)",
| |
− | "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)",
| |
− | "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)",
| |
− | "transform": "translate3d(" + pixels + "px, 0px,0px)"
| |
− | };
| |
− | },
| |
− |
| |
− | transition3d : function (value) {
| |
− | var base = this;
| |
− | //base.$owlWrapper.css(base.doTranslate(value));
| |
− | base.css2move(value);
| |
− | },
| |
− |
| |
− | css2move : function (value) {
| |
− | var base = this;
| |
− | var property = ($('html').hasClass('csstransforms3d')) ? 'x' : 'left';
| |
− | if(property == 'x')
| |
− | {
| |
− | base.$owlWrapper.stop(true, true).css({x : value});
| |
− | }
| |
− | else
| |
− | {
| |
− | base.$owlWrapper.stop(true, true).css({left : value});
| |
− | }
| |
− | },
| |
− |
| |
− | updatePosition : function(pValue) {
| |
− | var base = this;
| |
− | base.newPosX = pValue;
| |
− | if (base.browser.support3d === true) {
| |
− | base.transition3d(base.newPosX);
| |
− | } else {
| |
− | base.css2move(base.newPosX);
| |
− | }
| |
− | },
| |
− |
| |
− | css2slide : function (value, speed) {
| |
− | var base = this;
| |
− | var property = ($('html').hasClass('csstransforms3d')) ? 'x' : 'left';
| |
− |
| |
− | base.isCssFinish = false;
| |
− |
| |
− | var animateOptions = {
| |
− | duration : speed || base.options.slideSpeed,
| |
− | complete : function () {
| |
− | base.isCssFinish = true;
| |
− | base.currentItemAfterMove = base.currentItem;
| |
− | base.$owlItems.removeClass('dragging');
| |
− | },
| |
− | step : function(pValue){
| |
− | base.step(pValue, base.options.onMove);
| |
− | }
| |
− | };
| |
− |
| |
− | if(property == 'x')
| |
− | {
| |
− | base.$owlWrapper.stop(true, true).animate({
| |
− | x: value
| |
− | }, animateOptions);
| |
− | }
| |
− | else
| |
− | {
| |
− | base.$owlWrapper.stop(true, true).animate({
| |
− | left: value
| |
− | }, animateOptions);
| |
− | }
| |
− | },
| |
− |
| |
− | checkBrowser : function () {
| |
− | var base = this,
| |
− | translate3D = "translate3d(0px, 0px, 0px)",
| |
− | tempElem = document.createElement("div"),
| |
− | regex,
| |
− | asSupport,
| |
− | support3d,
| |
− | isTouch;
| |
− |
| |
− | tempElem.style.cssText = " -moz-transform:" + translate3D +
| |
− | "; -ms-transform:" + translate3D +
| |
− | "; -o-transform:" + translate3D +
| |
− | "; -webkit-transform:" + translate3D +
| |
− | "; transform:" + translate3D;
| |
− | regex = /translate3d\(0px, 0px, 0px\)/g;
| |
− | asSupport = tempElem.style.cssText.match(regex);
| |
− | support3d = (asSupport !== null && asSupport.length === 1);
| |
− | support3d = false;
| |
− | isTouch = "ontouchstart" in window || window.navigator.msMaxTouchPoints;
| |
− |
| |
− | base.browser = {
| |
− | "support3d" : support3d,
| |
− | "isTouch" : isTouch
| |
− | };
| |
− | },
| |
− |
| |
− | moveEvents : function () {
| |
− | var base = this;
| |
− | if (base.options.mouseDrag !== false || base.options.touchDrag !== false) {
| |
− | base.gestures();
| |
− | base.disabledEvents();
| |
− | }
| |
− | },
| |
− |
| |
− | eventTypes : function () {
| |
− | var base = this,
| |
− | types = ["s", "e", "x"];
| |
− |
| |
− | base.ev_types = {};
| |
− |
| |
− | if (base.options.mouseDrag === true && base.options.touchDrag === true) {
| |
− | types = [
| |
− | "touchstart.owl mousedown.owl",
| |
− | "touchmove.owl mousemove.owl",
| |
− | "touchend.owl touchcancel.owl mouseup.owl"
| |
− | ];
| |
− | } else if (base.options.mouseDrag === false && base.options.touchDrag === true) {
| |
− | types = [
| |
− | "touchstart.owl",
| |
− | "touchmove.owl",
| |
− | "touchend.owl touchcancel.owl"
| |
− | ];
| |
− | } else if (base.options.mouseDrag === true && base.options.touchDrag === false) {
| |
− | types = [
| |
− | "mousedown.owl",
| |
− | "mousemove.owl",
| |
− | "mouseup.owl"
| |
− | ];
| |
− | }
| |
− |
| |
− | base.ev_types.start = types[0];
| |
− | base.ev_types.move = types[1];
| |
− | base.ev_types.end = types[2];
| |
− | },
| |
− |
| |
− | disabledEvents : function () {
| |
− | var base = this;
| |
− | base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); });
| |
− | base.$elem.on("mousedown.disableTextSelect", function (e) {
| |
− | return $(e.target).is('input, textarea, select, option');
| |
− | });
| |
− | },
| |
− |
| |
− | gestures : function () {
| |
− | /*jslint unparam: true*/
| |
− | var base = this,
| |
− | locals = {
| |
− | offsetX : 0,
| |
− | offsetY : 0,
| |
− | baseElWidth : 0,
| |
− | relativePos : 0,
| |
− | position: null,
| |
− | minSwipe : null,
| |
− | maxSwipe: null,
| |
− | sliding : null,
| |
− | dargging: null,
| |
− | targetElement : null
| |
− | };
| |
− |
| |
− | base.isCssFinish = true;
| |
− |
| |
− | function getTouches(event) {
| |
− | if (event.touches !== undefined) {
| |
− | return {
| |
− | x : event.touches[0].pageX,
| |
− | y : event.touches[0].pageY
| |
− | };
| |
− | }
| |
− |
| |
− | if (event.touches === undefined) {
| |
− | if (event.pageX !== undefined) {
| |
− | return {
| |
− | x : event.pageX,
| |
− | y : event.pageY
| |
− | };
| |
− | }
| |
− | if (event.pageX === undefined) {
| |
− | return {
| |
− | x : event.clientX,
| |
− | y : event.clientY
| |
− | };
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | function swapEvents(type) {
| |
− | if (type === "on") {
| |
− | $(document).on(base.ev_types.move, dragMove);
| |
− | $(document).on(base.ev_types.end, dragEnd);
| |
− | } else if (type === "off") {
| |
− | $(document).off(base.ev_types.move);
| |
− | $(document).off(base.ev_types.end);
| |
− | }
| |
− | }
| |
− |
| |
− | function dragStart(event) {
| |
− | var ev = event.originalEvent || event || window.event,
| |
− | position;
| |
− |
| |
− | if (ev.which === 3) {
| |
− | return false;
| |
− | }
| |
− | if (base.itemsAmount <= base.options.items) {
| |
− | return;
| |
− | }
| |
− | if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) {
| |
− | return false;
| |
− | }
| |
− | if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | if (base.options.autoPlay !== false) {
| |
− | window.clearInterval(base.autoPlayInterval);
| |
− | }
| |
− |
| |
− | if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) {
| |
− | base.$owlWrapper.addClass("grabbing");
| |
− | }
| |
− |
| |
− | base.newPosX = 0;
| |
− | base.oldPosX = 0;
| |
− | base.newRelativeX = 0;
| |
− |
| |
− | $(this).css(base.removeTransition());
| |
− |
| |
− | position = $(this).position();
| |
− | locals.relativePos = position.left;
| |
− |
| |
− | locals.offsetX = getTouches(ev).x - position.left;
| |
− | locals.offsetY = getTouches(ev).y - position.top;
| |
− |
| |
− |
| |
− | swapEvents("on");
| |
− |
| |
− | locals.sliding = false;
| |
− | locals.targetElement = ev.target || ev.srcElement;
| |
− | }
| |
− |
| |
− | function dragMove(event) {
| |
− | var ev = event.originalEvent || event || window.event,
| |
− | minSwipe,
| |
− | maxSwipe;
| |
− |
| |
− | base.newPosX = getTouches(ev).x - locals.offsetX;
| |
− | base.newPosY = getTouches(ev).y - locals.offsetY;
| |
− | base.newRelativeX = base.newPosX - locals.relativePos;
| |
− | if (base.newRelativeX < 0) {
| |
− | base.dragDirection = base.owl.dragDirection = "left";
| |
− | } else {
| |
− | base.dragDirection = base.owl.dragDirection = "right";
| |
− | }
| |
− |
| |
− | if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) {
| |
− | locals.dragging = true;
| |
− | base.options.startDragging.apply(base, [base.$elem]);
| |
− | }
| |
− |
| |
− | if ((base.newRelativeX > 8 || base.newRelativeX < -8) && (base.browser.isTouch === true)) {
| |
− | if (ev.preventDefault !== undefined) {
| |
− | ev.preventDefault();
| |
− | } else {
| |
− | ev.returnValue = false;
| |
− | }
| |
− | locals.sliding = true;
| |
− | }
| |
− |
| |
− | if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) {
| |
− | $(document).off("touchmove.owl");
| |
− | }
| |
− |
| |
− | minSwipe = function () {
| |
− | return base.newRelativeX / 5;
| |
− | };
| |
− |
| |
− | maxSwipe = function () {
| |
− | return base.maximumPixels + base.newRelativeX / 5;
| |
− | };
| |
− |
| |
− | base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe());
| |
− | if (base.browser.support3d === true) {
| |
− | base.transition3d(base.newPosX);
| |
− | } else {
| |
− | base.css2move(base.newPosX);
| |
− | }
| |
− |
| |
− | base.step(base.newPosX, base.options.onMove, true);
| |
− |
| |
− | base.oldPosX = base.newPosX;
| |
− | }
| |
− |
| |
− | function dragEnd(event) {
| |
− | var ev = event.originalEvent || event || window.event,
| |
− | newPosition,
| |
− | handlers,
| |
− | owlStopEvent;
| |
− |
| |
− | ev.target = ev.target || ev.srcElement;
| |
− |
| |
− | locals.dragging = false;
| |
− |
| |
− | if (base.browser.isTouch !== true) {
| |
− | base.$owlWrapper.removeClass("grabbing");
| |
− | }
| |
− |
| |
− | if (base.newRelativeX < 0) {
| |
− | base.dragDirection = base.owl.dragDirection = "left";
| |
− | } else {
| |
− | base.dragDirection = base.owl.dragDirection = "right";
| |
− | }
| |
− |
| |
− | if (base.newRelativeX !== 0) {
| |
− | newPosition = base.getNewPosition();
| |
− | base.goTo(newPosition, false, "drag");
| |
− | if (locals.targetElement === ev.target && base.browser.isTouch !== true) {
| |
− | $(ev.target).on("click.disable", function (ev) {
| |
− | ev.stopImmediatePropagation();
| |
− | ev.stopPropagation();
| |
− | ev.preventDefault();
| |
− | $(ev.target).off("click.disable");
| |
− | });
| |
− | handlers = $._data(ev.target, "events").click;
| |
− | owlStopEvent = handlers.pop();
| |
− | handlers.splice(0, 0, owlStopEvent);
| |
− | }
| |
− | }
| |
− | swapEvents("off");
| |
− | }
| |
− | base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart);
| |
− | },
| |
− |
| |
− | getNewPosition : function () {
| |
− | var base = this,
| |
− | newPosition = base.closestItem();
| |
− |
| |
− | if (newPosition > base.maximumItem) {
| |
− | base.currentItem = base.maximumItem;
| |
− | newPosition = base.maximumItem;
| |
− | } else if (base.newPosX >= 0) {
| |
− | newPosition = 0;
| |
− | base.currentItem = 0;
| |
− | }
| |
− | return newPosition;
| |
− | },
| |
− | closestItem : function () {
| |
− | var base = this,
| |
− | array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray,
| |
− | goal = base.newPosX,
| |
− | closest = null;
| |
− |
| |
− | $.each(array, function (i, v) {
| |
− | if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") {
| |
− | closest = v;
| |
− | if (base.options.scrollPerPage === true) {
| |
− | base.currentItem = $.inArray(closest, base.positionsInArray);
| |
− | } else {
| |
− | base.currentItem = i;
| |
− | }
| |
− | } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") {
| |
− | if (base.options.scrollPerPage === true) {
| |
− | closest = array[i + 1] || array[array.length - 1];
| |
− | base.currentItem = $.inArray(closest, base.positionsInArray);
| |
− | } else {
| |
− | closest = array[i + 1];
| |
− | base.currentItem = i + 1;
| |
− | }
| |
− | }
| |
− | });
| |
− | return base.currentItem;
| |
− | },
| |
− |
| |
− | moveDirection : function () {
| |
− | var base = this,
| |
− | direction;
| |
− | if (base.newRelativeX < 0) {
| |
− | direction = "right";
| |
− | base.playDirection = "next";
| |
− | } else {
| |
− | direction = "left";
| |
− | base.playDirection = "prev";
| |
− | }
| |
− | return direction;
| |
− | },
| |
− |
| |
− | customEvents : function () {
| |
− | /*jslint unparam: true*/
| |
− | var base = this;
| |
− | base.$elem.on("owl.next", function () {
| |
− | base.next();
| |
− | });
| |
− | base.$elem.on("owl.prev", function () {
| |
− | base.prev();
| |
− | });
| |
− | base.$elem.on("owl.play", function (event, speed) {
| |
− | base.options.autoPlay = speed;
| |
− | base.play();
| |
− | base.hoverStatus = "play";
| |
− | });
| |
− | base.$elem.on("owl.stop", function () {
| |
− | base.stop();
| |
− | base.hoverStatus = "stop";
| |
− | });
| |
− | base.$elem.on("owl.goTo", function (event, item) {
| |
− | base.goTo(item);
| |
− | });
| |
− | base.$elem.on("owl.jumpTo", function (event, item) {
| |
− | base.jumpTo(item);
| |
− | });
| |
− | },
| |
− |
| |
− | stopOnHover : function () {
| |
− | var base = this;
| |
− | if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) {
| |
− | base.$elem.on("mouseover", function () {
| |
− | base.stop();
| |
− | });
| |
− | base.$elem.on("mouseout", function () {
| |
− | if (base.hoverStatus !== "stop") {
| |
− | base.play();
| |
− | }
| |
− | });
| |
− | }
| |
− | },
| |
− |
| |
− | lazyLoad : function () {
| |
− | var base = this,
| |
− | i,
| |
− | $item,
| |
− | itemNumber,
| |
− | $lazyImg,
| |
− | follow;
| |
− |
| |
− | if (base.options.lazyLoad === false) {
| |
− | return false;
| |
− | }
| |
− | for (i = 0; i < base.itemsAmount; i += 1) {
| |
− | $item = $(base.$owlItems[i]);
| |
− |
| |
− | if ($item.data("owl-loaded") === "loaded") {
| |
− | continue;
| |
− | }
| |
− |
| |
− | itemNumber = $item.data("owl-item");
| |
− | $lazyImg = $item.find(".lazyOwl");
| |
− |
| |
− | if (typeof $lazyImg.data("src") !== "string") {
| |
− | $item.data("owl-loaded", "loaded");
| |
− | continue;
| |
− | }
| |
− | if ($item.data("owl-loaded") === undefined) {
| |
− | $lazyImg.hide();
| |
− | $item.addClass("loading").data("owl-loaded", "checked");
| |
− | }
| |
− | if (base.options.lazyFollow === true) {
| |
− | follow = itemNumber >= base.currentItem;
| |
− | } else {
| |
− | follow = true;
| |
− | }
| |
− | if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) {
| |
− | base.lazyPreload($item, $lazyImg);
| |
− | }
| |
− | }
| |
− | },
| |
− |
| |
− | lazyPreload : function ($item, $lazyImg) {
| |
− | var base = this,
| |
− | iterations = 0,
| |
− | isBackgroundImg;
| |
− |
| |
− | if ($lazyImg.prop("tagName") === "DIV") {
| |
− | $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")");
| |
− | isBackgroundImg = true;
| |
− | } else {
| |
− | $lazyImg[0].src = $lazyImg.data("src");
| |
− | }
| |
− |
| |
− | function showImage() {
| |
− | $item.data("owl-loaded", "loaded").removeClass("loading");
| |
− | $lazyImg.removeAttr("data-src");
| |
− | if (base.options.lazyEffect === "fade") {
| |
− | $lazyImg.fadeIn(400);
| |
− | } else {
| |
− | $lazyImg.show();
| |
− | }
| |
− | if (typeof base.options.afterLazyLoad === "function") {
| |
− | base.options.afterLazyLoad.apply(this, [base.$elem]);
| |
− | }
| |
− | }
| |
− |
| |
− | function checkLazyImage() {
| |
− | iterations += 1;
| |
− | if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) {
| |
− | showImage();
| |
− | } else if (iterations <= 100) {//if image loads in less than 10 seconds
| |
− | window.setTimeout(checkLazyImage, 100);
| |
− | } else {
| |
− | showImage();
| |
− | }
| |
− | }
| |
− |
| |
− | checkLazyImage();
| |
− | },
| |
− |
| |
− | autoHeight : function () {
| |
− | var base = this,
| |
− | $currentimg = $(base.$owlItems[base.currentItem]).find("img"),
| |
− | iterations;
| |
− |
| |
− | function addHeight() {
| |
− | var $currentItem = $(base.$owlItems[base.currentItem]).height();
| |
− | base.wrapperOuter.css("height", $currentItem + "px");
| |
− | if (!base.wrapperOuter.hasClass("autoHeight")) {
| |
− | window.setTimeout(function () {
| |
− | base.wrapperOuter.addClass("autoHeight");
| |
− | }, 0);
| |
− | }
| |
− | }
| |
− |
| |
− | function checkImage() {
| |
− | iterations += 1;
| |
− | if (base.completeImg($currentimg.get(0))) {
| |
− | addHeight();
| |
− | } else if (iterations <= 100) { //if image loads in less than 10 seconds
| |
− | window.setTimeout(checkImage, 100);
| |
− | } else {
| |
− | base.wrapperOuter.css("height", ""); //Else remove height attribute
| |
− | }
| |
− | }
| |
− |
| |
− | if ($currentimg.get(0) !== undefined) {
| |
− | iterations = 0;
| |
− | checkImage();
| |
− | } else {
| |
− | addHeight();
| |
− | }
| |
− | },
| |
− |
| |
− | completeImg : function (img) {
| |
− | var naturalWidthType;
| |
− |
| |
− | if (!img.complete) {
| |
− | return false;
| |
− | }
| |
− | naturalWidthType = typeof img.naturalWidth;
| |
− | if (naturalWidthType !== "undefined" && img.naturalWidth === 0) {
| |
− | return false;
| |
− | }
| |
− | return true;
| |
− | },
| |
− |
| |
− | onVisibleItems : function () {
| |
− | var base = this,
| |
− | i;
| |
− |
| |
− | if (base.options.addClassActive === true) {
| |
− | base.$owlItems.removeClass("active");
| |
− | }
| |
− | base.visibleItems = [];
| |
− | for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) {
| |
− | base.visibleItems.push(i);
| |
− |
| |
− | if (base.options.addClassActive === true) {
| |
− | $(base.$owlItems[i]).addClass("active");
| |
− | }
| |
− | }
| |
− | base.owl.visibleItems = base.visibleItems;
| |
− | },
| |
− |
| |
− | transitionTypes : function (className) {
| |
− | var base = this;
| |
− | //Currently available: "fade", "backSlide", "goDown", "fadeUp"
| |
− | base.outClass = "owl-" + className + "-out";
| |
− | base.inClass = "owl-" + className + "-in";
| |
− | },
| |
− |
| |
− | singleItemTransition : function () {
| |
− | var base = this,
| |
− | outClass = base.outClass,
| |
− | inClass = base.inClass,
| |
− | $currentItem = base.$owlItems.eq(base.currentItem),
| |
− | $prevItem = base.$owlItems.eq(base.prevItem),
| |
− | prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],
| |
− | origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2,
| |
− | animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';
| |
− |
| |
− | base.isTransition = true;
| |
− |
| |
− | base.$owlWrapper
| |
− | .addClass('owl-origin')
| |
− | .css({
| |
− | "-webkit-transform-origin" : origin + "px",
| |
− | "-moz-perspective-origin" : origin + "px",
| |
− | "perspective-origin" : origin + "px"
| |
− | });
| |
− | function transStyles(prevPos) {
| |
− | return {
| |
− | "position" : "relative",
| |
− | "left" : prevPos + "px"
| |
− | };
| |
− | }
| |
− |
| |
− | $prevItem
| |
− | .css(transStyles(prevPos, 10))
| |
− | .addClass(outClass)
| |
− | .on(animEnd, function () {
| |
− | base.endPrev = true;
| |
− | $prevItem.off(animEnd);
| |
− | base.clearTransStyle($prevItem, outClass);
| |
− | });
| |
− |
| |
− | $currentItem
| |
− | .addClass(inClass)
| |
− | .on(animEnd, function () {
| |
− | base.endCurrent = true;
| |
− | $currentItem.off(animEnd);
| |
− | base.clearTransStyle($currentItem, inClass);
| |
− | });
| |
− | },
| |
− |
| |
− | clearTransStyle : function (item, classToRemove) {
| |
− | var base = this;
| |
− | item.css({
| |
− | "position" : "",
| |
− | "left" : ""
| |
− | }).removeClass(classToRemove);
| |
− |
| |
− | if (base.endPrev && base.endCurrent) {
| |
− | base.$owlWrapper.removeClass('owl-origin');
| |
− | base.endPrev = false;
| |
− | base.endCurrent = false;
| |
− | base.isTransition = false;
| |
− | }
| |
− | },
| |
− |
| |
− | owlStatus : function () {
| |
− | var base = this;
| |
− | base.owl = {
| |
− | "userOptions" : base.userOptions,
| |
− | "baseElement" : base.$elem,
| |
− | "userItems" : base.$userItems,
| |
− | "owlItems" : base.$owlItems,
| |
− | "currentItem" : base.currentItem,
| |
− | "prevItem" : base.prevItem,
| |
− | "visibleItems" : base.visibleItems,
| |
− | "isTouch" : base.browser.isTouch,
| |
− | "browser" : base.browser,
| |
− | "dragDirection" : base.dragDirection
| |
− | };
| |
− | },
| |
− |
| |
− | clearEvents : function () {
| |
− | var base = this;
| |
− | base.$elem.off(".owl owl mousedown.disableTextSelect");
| |
− | $(document).off(".owl owl");
| |
− | $(window).off("resize", base.resizer);
| |
− | },
| |
− |
| |
− | unWrap : function () {
| |
− | var base = this;
| |
− | if (base.$elem.children().length !== 0) {
| |
− | base.$owlWrapper.unwrap();
| |
− | base.$userItems.unwrap().unwrap();
| |
− | if (base.owlControls) {
| |
− | base.owlControls.remove();
| |
− | }
| |
− | }
| |
− | base.clearEvents();
| |
− | base.$elem
| |
− | .attr("style", base.$elem.data("owl-originalStyles") || "")
| |
− | .attr("class", base.$elem.data("owl-originalClasses"));
| |
− | },
| |
− |
| |
− | destroy : function () {
| |
− | var base = this;
| |
− | base.stop();
| |
− | window.clearInterval(base.checkVisible);
| |
− | base.unWrap();
| |
− | base.$elem.removeData();
| |
− | },
| |
− |
| |
− | reinit : function (newOptions) {
| |
− | var base = this,
| |
− | options = $.extend({}, base.userOptions, newOptions);
| |
− | base.unWrap();
| |
− | base.init(options, base.$elem);
| |
− | },
| |
− |
| |
− | addItem : function (htmlString, targetPosition) {
| |
− | var base = this,
| |
− | position;
| |
− |
| |
− | if (!htmlString) {return false; }
| |
− |
| |
− | if (base.$elem.children().length === 0) {
| |
− | base.$elem.append(htmlString);
| |
− | base.setVars();
| |
− | return false;
| |
− | }
| |
− | base.unWrap();
| |
− | if (targetPosition === undefined || targetPosition === -1) {
| |
− | position = -1;
| |
− | } else {
| |
− | position = targetPosition;
| |
− | }
| |
− | if (position >= base.$userItems.length || position === -1) {
| |
− | base.$userItems.eq(-1).after(htmlString);
| |
− | } else {
| |
− | base.$userItems.eq(position).before(htmlString);
| |
− | }
| |
− |
| |
− | base.setVars();
| |
− | },
| |
− |
| |
− | removeItem : function (targetPosition) {
| |
− | var base = this,
| |
− | position;
| |
− |
| |
− | if (base.$elem.children().length === 0) {
| |
− | return false;
| |
− | }
| |
− | if (targetPosition === undefined || targetPosition === -1) {
| |
− | position = -1;
| |
− | } else {
| |
− | position = targetPosition;
| |
− | }
| |
− |
| |
− | base.unWrap();
| |
− | base.$userItems.eq(position).remove();
| |
− | base.setVars();
| |
− | },
| |
− |
| |
− | step : function(pValue, onMove, pDragging){
| |
− | pDragging = pDragging || false;
| |
− | if(onMove !== false)
| |
− | {
| |
− | onMove(pValue, this, pDragging);
| |
− | }
| |
− | }
| |
− |
| |
− | };
| |
− |
| |
− | $.fn.owlCarousel = function (options) {
| |
− | return this.each(function () {
| |
− | if ($(this).data("owl-init") === true) {
| |
− | return false;
| |
− | }
| |
− | $(this).data("owl-init", true);
| |
− | var carousel = Object.create(Carousel);
| |
− | carousel.init(options, this);
| |
− | $.data(this, "owlCarousel", carousel);
| |
− | });
| |
− | };
| |
− |
| |
− | $.fn.owlCarousel.options = {
| |
− |
| |
− | items : 5,
| |
− | itemsCustom : false,
| |
− | itemsDesktop : [1199, 4],
| |
− | itemsDesktopSmall : [979, 3],
| |
− | itemsTablet : [768, 2],
| |
− | itemsTabletSmall : false,
| |
− | itemsMobile : [479, 1],
| |
− | singleItem : false,
| |
− | itemsScaleUp : false,
| |
− |
| |
− | slideSpeed : 200,
| |
− | paginationSpeed : 800,
| |
− | rewindSpeed : 1000,
| |
− |
| |
− | autoPlay : false,
| |
− | stopOnHover : false,
| |
− |
| |
− | navigation : false,
| |
− | navigationText : ["prev", "next"],
| |
− | rewindNav : true,
| |
− | scrollPerPage : false,
| |
− |
| |
− | pagination : true,
| |
− | paginationNumbers : false,
| |
− |
| |
− | responsive : true,
| |
− | responsiveRefreshRate : 200,
| |
− | responsiveBaseWidth : window,
| |
− |
| |
− | baseClass : "owl-carousel",
| |
− | theme : "owl-theme",
| |
− |
| |
− | lazyLoad : false,
| |
− | lazyFollow : true,
| |
− | lazyEffect : "fade",
| |
− |
| |
− | autoHeight : false,
| |
− |
| |
− | jsonPath : false,
| |
− | jsonSuccess : false,
| |
− |
| |
− | dragBeforeAnimFinish : true,
| |
− | mouseDrag : true,
| |
− | touchDrag : true,
| |
− |
| |
− | addClassActive : false,
| |
− | transitionStyle : false,
| |
− |
| |
− | beforeUpdate : false,
| |
− | afterUpdate : false,
| |
− | beforeInit : false,
| |
− | afterInit : false,
| |
− | beforeMove : false,
| |
− | afterMove : false,
| |
− | afterAction : false,
| |
− | startDragging : false,
| |
− | afterLazyLoad: false,
| |
− |
| |
− | onMove : false
| |
− | };
| |
− | }(jQuery, window, document));;
| |
− |
| |
− | /* ../vendor/swipe.js */
| |
− | /*
| |
− | * Swipe 2.0
| |
− | *
| |
− | * Brad Birdsall
| |
− | * Copyright 2013, MIT License
| |
− | *
| |
− | */
| |
− |
| |
− | function Swipe(container, options) {
| |
− |
| |
− | "use strict";
| |
− |
| |
− | // utilities
| |
− | var noop = function() {}; // simple no operation function
| |
− | var offloadFn = function(fn) { setTimeout(fn || noop, 0) }; // offload a functions execution
| |
− |
| |
− | // check browser capabilities
| |
− | var browser = {
| |
− | addEventListener: !!window.addEventListener,
| |
− | touch: ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
| |
− | transitions: (function(temp) {
| |
− | var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition'];
| |
− | for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true;
| |
− | return false;
| |
− | })(document.createElement('swipe'))
| |
− | };
| |
− |
| |
− | // quit if no root element
| |
− | if (!container) return;
| |
− | var element = container.children[0];
| |
− | var slides, slidePos, width, length;
| |
− | options = options || {};
| |
− | var index = parseInt(options.startSlide, 10) || 0;
| |
− | var speed = options.speed || 300;
| |
− | options.continuous = options.continuous !== undefined ? options.continuous : true;
| |
− |
| |
− | function setup() {
| |
− |
| |
− | // cache slides
| |
− | slides = element.children;
| |
− | length = slides.length;
| |
− |
| |
− | // set continuous to false if only one slide
| |
− | if (slides.length < 2) options.continuous = false;
| |
− |
| |
− | //special case if two slides
| |
− | if (browser.transitions && options.continuous && slides.length < 3) {
| |
− | element.appendChild(slides[0].cloneNode(true));
| |
− | element.appendChild(element.children[1].cloneNode(true));
| |
− | slides = element.children;
| |
− | }
| |
− |
| |
− | // create an array to store current positions of each slide
| |
− | slidePos = new Array(slides.length);
| |
− |
| |
− | // determine width of each slide
| |
− | width = container.getBoundingClientRect().width || container.offsetWidth;
| |
− |
| |
− | element.style.width = (slides.length * width) + 'px';
| |
− |
| |
− | // stack elements
| |
− | var pos = slides.length;
| |
− | while(pos--) {
| |
− |
| |
− | var slide = slides[pos];
| |
− |
| |
− | slide.style.width = width + 'px';
| |
− | slide.setAttribute('data-index', pos);
| |
− |
| |
− | if (browser.transitions) {
| |
− | slide.style.left = (pos * -width) + 'px';
| |
− | move(pos, index > pos ? -width : (index < pos ? width : 0), 0);
| |
− | }
| |
− |
| |
− | }
| |
− |
| |
− | // reposition elements before and after index
| |
− | if (options.continuous && browser.transitions) {
| |
− | move(circle(index-1), -width, 0);
| |
− | move(circle(index+1), width, 0);
| |
− | }
| |
− |
| |
− | if (!browser.transitions) element.style.left = (index * -width) + 'px';
| |
− |
| |
− | container.style.visibility = 'visible';
| |
− |
| |
− | }
| |
− |
| |
− | function prev() {
| |
− |
| |
− | if (options.continuous) slide(index-1);
| |
− | else if (index) slide(index-1);
| |
− |
| |
− | }
| |
− |
| |
− | function next() {
| |
− |
| |
− | if (options.continuous) slide(index+1);
| |
− | else if (index < slides.length - 1) slide(index+1);
| |
− |
| |
− | }
| |
− |
| |
− | function circle(index) {
| |
− |
| |
− | // a simple positive modulo using slides.length
| |
− | return (slides.length + (index % slides.length)) % slides.length;
| |
− |
| |
− | }
| |
− |
| |
− | function slide(to, slideSpeed) {
| |
− |
| |
− | // do nothing if already on requested slide
| |
− | if (index == to) return;
| |
− |
| |
− | if (browser.transitions) {
| |
− |
| |
− | var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward
| |
− |
| |
− | // get the actual position of the slide
| |
− | if (options.continuous) {
| |
− | var natural_direction = direction;
| |
− | direction = -slidePos[circle(to)] / width;
| |
− |
| |
− | // if going forward but to < index, use to = slides.length + to
| |
− | // if going backward but to > index, use to = -slides.length + to
| |
− | if (direction !== natural_direction) to = -direction * slides.length + to;
| |
− |
| |
− | }
| |
− |
| |
− | var diff = Math.abs(index-to) - 1;
| |
− |
| |
− | // move all the slides between index and to in the right direction
| |
− | while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0);
| |
− |
| |
− | to = circle(to);
| |
− |
| |
− | move(index, width * direction, slideSpeed || speed);
| |
− | move(to, 0, slideSpeed || speed);
| |
− |
| |
− | if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place
| |
− |
| |
− | } else {
| |
− |
| |
− | to = circle(to);
| |
− | animate(index * -width, to * -width, slideSpeed || speed);
| |
− | //no fallback for a circular continuous if the browser does not accept transitions
| |
− | }
| |
− |
| |
− | index = to;
| |
− | offloadFn(options.callback && options.callback(index, slides[index]));
| |
− | }
| |
− |
| |
− | function move(index, dist, speed) {
| |
− |
| |
− | translate(index, dist, speed);
| |
− | slidePos[index] = dist;
| |
− |
| |
− | }
| |
− |
| |
− | function translate(index, dist, speed) {
| |
− |
| |
− | var slide = slides[index];
| |
− | var style = slide && slide.style;
| |
− |
| |
− | if (!style) return;
| |
− |
| |
− | style.webkitTransitionDuration =
| |
− | style.MozTransitionDuration =
| |
− | style.msTransitionDuration =
| |
− | style.OTransitionDuration =
| |
− | style.transitionDuration = speed + 'ms';
| |
− |
| |
− | style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)';
| |
− | style.msTransform =
| |
− | style.MozTransform =
| |
− | style.OTransform = 'translateX(' + dist + 'px)';
| |
− |
| |
− | }
| |
− |
| |
− | function animate(from, to, speed) {
| |
− |
| |
− | // if not an animation, just reposition
| |
− | if (!speed) {
| |
− |
| |
− | element.style.left = to + 'px';
| |
− | return;
| |
− |
| |
− | }
| |
− |
| |
− | var start = +new Date;
| |
− |
| |
− | var timer = setInterval(function() {
| |
− |
| |
− | var timeElap = +new Date - start;
| |
− |
| |
− | if (timeElap > speed) {
| |
− |
| |
− | element.style.left = to + 'px';
| |
− |
| |
− | if (delay) begin();
| |
− |
| |
− | options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);
| |
− |
| |
− | clearInterval(timer);
| |
− | return;
| |
− |
| |
− | }
| |
− |
| |
− | element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px';
| |
− |
| |
− | }, 4);
| |
− |
| |
− | }
| |
− |
| |
− | // setup auto slideshow
| |
− | var delay = options.auto || 0;
| |
− | var interval;
| |
− |
| |
− | function begin() {
| |
− |
| |
− | interval = setTimeout(next, delay);
| |
− |
| |
− | }
| |
− |
| |
− | function stop() {
| |
− |
| |
− | delay = 0;
| |
− | clearTimeout(interval);
| |
− |
| |
− | }
| |
− |
| |
− |
| |
− | // setup initial vars
| |
− | var start = {};
| |
− | var delta = {};
| |
− | var isScrolling;
| |
− |
| |
− | // setup event capturing
| |
− | var events = {
| |
− |
| |
− | handleEvent: function(event) {
| |
− |
| |
− | switch (event.type) {
| |
− | case 'touchstart': this.start(event); break;
| |
− | case 'touchmove': this.move(event); break;
| |
− | case 'touchend': offloadFn(this.end(event)); break;
| |
− | case 'webkitTransitionEnd':
| |
− | case 'msTransitionEnd':
| |
− | case 'oTransitionEnd':
| |
− | case 'otransitionend':
| |
− | case 'transitionend': offloadFn(this.transitionEnd(event)); break;
| |
− | case 'resize': offloadFn(setup); break;
| |
− | }
| |
− |
| |
− | if (options.stopPropagation) event.stopPropagation();
| |
− |
| |
− | },
| |
− | start: function(event) {
| |
− |
| |
− | var touches = event.touches[0];
| |
− |
| |
− | // measure start values
| |
− | start = {
| |
− |
| |
− | // get initial touch coords
| |
− | x: touches.pageX,
| |
− | y: touches.pageY,
| |
− |
| |
− | // store time to determine touch duration
| |
− | time: +new Date
| |
− |
| |
− | };
| |
− |
| |
− | // used for testing first move event
| |
− | isScrolling = undefined;
| |
− |
| |
− | // reset delta and end measurements
| |
− | delta = {};
| |
− |
| |
− | // attach touchmove and touchend listeners
| |
− | element.addEventListener('touchmove', this, false);
| |
− | element.addEventListener('touchend', this, false);
| |
− |
| |
− | },
| |
− | move: function(event) {
| |
− |
| |
− | // ensure swiping with one touch and not pinching
| |
− | if ( event.touches.length > 1 || event.scale && event.scale !== 1) return
| |
− |
| |
− | if (options.disableScroll) event.preventDefault();
| |
− |
| |
− | var touches = event.touches[0];
| |
− |
| |
− | // measure change in x and y
| |
− | delta = {
| |
− | x: touches.pageX - start.x,
| |
− | y: touches.pageY - start.y
| |
− | }
| |
− |
| |
− | // determine if scrolling test has run - one time test
| |
− | if ( typeof isScrolling == 'undefined') {
| |
− | isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );
| |
− | }
| |
− |
| |
− | // if user is not trying to scroll vertically
| |
− | if (!isScrolling) {
| |
− |
| |
− | // prevent native scrolling
| |
− | event.preventDefault();
| |
− |
| |
− | // stop slideshow
| |
− | stop();
| |
− |
| |
− | // increase resistance if first or last slide
| |
− | if (options.continuous) { // we don't add resistance at the end
| |
− |
| |
− | translate(circle(index-1), delta.x + slidePos[circle(index-1)], 0);
| |
− | translate(index, delta.x + slidePos[index], 0);
| |
− | translate(circle(index+1), delta.x + slidePos[circle(index+1)], 0);
| |
− |
| |
− | } else {
| |
− |
| |
− | delta.x =
| |
− | delta.x /
| |
− | ( (!index && delta.x > 0 // if first slide and sliding left
| |
− | || index == slides.length - 1 // or if last slide and sliding right
| |
− | && delta.x < 0 // and if sliding at all
| |
− | ) ?
| |
− | ( Math.abs(delta.x) / width + 1 ) // determine resistance level
| |
− | : 1 ); // no resistance if false
| |
− |
| |
− | // translate 1:1
| |
− | translate(index-1, delta.x + slidePos[index-1], 0);
| |
− | translate(index, delta.x + slidePos[index], 0);
| |
− | translate(index+1, delta.x + slidePos[index+1], 0);
| |
− | }
| |
− |
| |
− | }
| |
− |
| |
− | },
| |
− | end: function(event) {
| |
− |
| |
− | // measure duration
| |
− | var duration = +new Date - start.time;
| |
− |
| |
− | // determine if slide attempt triggers next/prev slide
| |
− | var isValidSlide =
| |
− | Number(duration) < 250 // if slide duration is less than 250ms
| |
− | && Math.abs(delta.x) > 20 // and if slide amt is greater than 20px
| |
− | || Math.abs(delta.x) > width/2; // or if slide amt is greater than half the width
| |
− |
| |
− | // determine if slide attempt is past start and end
| |
− | var isPastBounds =
| |
− | !index && delta.x > 0 // if first slide and slide amt is greater than 0
| |
− | || index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0
| |
− |
| |
− | if (options.continuous) isPastBounds = false;
| |
− |
| |
− | // determine direction of swipe (true:right, false:left)
| |
− | var direction = delta.x < 0;
| |
− |
| |
− | // if not scrolling vertically
| |
− | if (!isScrolling) {
| |
− |
| |
− | if (isValidSlide && !isPastBounds) {
| |
− |
| |
− | if (direction) {
| |
− |
| |
− | if (options.continuous) { // we need to get the next in this direction in place
| |
− |
| |
− | move(circle(index-1), -width, 0);
| |
− | move(circle(index+2), width, 0);
| |
− |
| |
− | } else {
| |
− | move(index-1, -width, 0);
| |
− | }
| |
− |
| |
− | move(index, slidePos[index]-width, speed);
| |
− | move(circle(index+1), slidePos[circle(index+1)]-width, speed);
| |
− | index = circle(index+1);
| |
− |
| |
− | } else {
| |
− | if (options.continuous) { // we need to get the next in this direction in place
| |
− |
| |
− | move(circle(index+1), width, 0);
| |
− | move(circle(index-2), -width, 0);
| |
− |
| |
− | } else {
| |
− | move(index+1, width, 0);
| |
− | }
| |
− |
| |
− | move(index, slidePos[index]+width, speed);
| |
− | move(circle(index-1), slidePos[circle(index-1)]+width, speed);
| |
− | index = circle(index-1);
| |
− |
| |
− | }
| |
− |
| |
− | options.callback && options.callback(index, slides[index]);
| |
− |
| |
− | } else {
| |
− |
| |
− | if (options.continuous) {
| |
− |
| |
− | move(circle(index-1), -width, speed);
| |
− | move(index, 0, speed);
| |
− | move(circle(index+1), width, speed);
| |
− |
| |
− | } else {
| |
− |
| |
− | move(index-1, -width, speed);
| |
− | move(index, 0, speed);
| |
− | move(index+1, width, speed);
| |
− | }
| |
− |
| |
− | }
| |
− |
| |
− | }
| |
− |
| |
− | // kill touchmove and touchend event listeners until touchstart called again
| |
− | element.removeEventListener('touchmove', events, false)
| |
− | element.removeEventListener('touchend', events, false)
| |
− |
| |
− | },
| |
− | transitionEnd: function(event) {
| |
− |
| |
− | if (parseInt(event.target.getAttribute('data-index'), 10) == index) {
| |
− |
| |
− | if (delay) begin();
| |
− |
| |
− | options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);
| |
− |
| |
− | }
| |
− |
| |
− | }
| |
− |
| |
− | }
| |
− |
| |
− | // trigger setup
| |
− | setup();
| |
− |
| |
− | // start auto slideshow if applicable
| |
− | if (delay) begin();
| |
− |
| |
− |
| |
− | // add event listeners
| |
− | if (browser.addEventListener) {
| |
− |
| |
− | // set touchstart event on element
| |
− | if (browser.touch) element.addEventListener('touchstart', events, false);
| |
− |
| |
− | if (browser.transitions) {
| |
− | element.addEventListener('webkitTransitionEnd', events, false);
| |
− | element.addEventListener('msTransitionEnd', events, false);
| |
− | element.addEventListener('oTransitionEnd', events, false);
| |
− | element.addEventListener('otransitionend', events, false);
| |
− | element.addEventListener('transitionend', events, false);
| |
− | }
| |
− |
| |
− | // set resize event on window
| |
− | window.addEventListener('resize', events, false);
| |
− |
| |
− | } else {
| |
− |
| |
− | window.onresize = function () { setup() }; // to play nice with old IE
| |
− |
| |
− | }
| |
− |
| |
− | // expose the Swipe API
| |
− | return {
| |
− | setup: function() {
| |
− |
| |
− | setup();
| |
− |
| |
− | },
| |
− | slide: function(to, speed) {
| |
− |
| |
− | // cancel slideshow
| |
− | stop();
| |
− |
| |
− | slide(to, speed);
| |
− |
| |
− | },
| |
− | prev: function() {
| |
− |
| |
− | // cancel slideshow
| |
− | stop();
| |
− |
| |
− | prev();
| |
− |
| |
− | },
| |
− | next: function() {
| |
− |
| |
− | // cancel slideshow
| |
− | stop();
| |
− |
| |
− | next();
| |
− |
| |
− | },
| |
− | stop: function() {
| |
− |
| |
− | // cancel slideshow
| |
− | stop();
| |
− |
| |
− | },
| |
− | getPos: function() {
| |
− |
| |
− | // return current index position
| |
− | return index;
| |
− |
| |
− | },
| |
− | getNumSlides: function() {
| |
− |
| |
− | // return total number of slides
| |
− | return length;
| |
− | },
| |
− | kill: function() {
| |
− |
| |
− | // cancel slideshow
| |
− | stop();
| |
− |
| |
− | // reset element
| |
− | element.style.width = '';
| |
− | element.style.left = '';
| |
− |
| |
− | // reset slides
| |
− | var pos = slides.length;
| |
− | while(pos--) {
| |
− |
| |
− | var slide = slides[pos];
| |
− | slide.style.width = '';
| |
− | slide.style.left = '';
| |
− |
| |
− | if (browser.transitions) translate(pos, 0, 0);
| |
− |
| |
− | }
| |
− |
| |
− | // removed event listeners
| |
− | if (browser.addEventListener) {
| |
− |
| |
− | // remove current event listeners
| |
− | element.removeEventListener('touchstart', events, false);
| |
− | element.removeEventListener('webkitTransitionEnd', events, false);
| |
− | element.removeEventListener('msTransitionEnd', events, false);
| |
− | element.removeEventListener('oTransitionEnd', events, false);
| |
− | element.removeEventListener('otransitionend', events, false);
| |
− | element.removeEventListener('transitionend', events, false);
| |
− | window.removeEventListener('resize', events, false);
| |
− |
| |
− | }
| |
− | else {
| |
− |
| |
− | window.onresize = null;
| |
− |
| |
− | }
| |
− |
| |
− | }
| |
− | }
| |
− |
| |
− | }
| |
− |
| |
− |
| |
− | if ( window.jQuery || window.Zepto ) {
| |
− | (function($) {
| |
− | $.fn.Swipe = function(params) {
| |
− | return this.each(function() {
| |
− | $(this).data('Swipe', new Swipe($(this)[0], params));
| |
− | });
| |
− | }
| |
− | })( window.jQuery || window.Zepto )
| |
− | };
| |
− |
| |
− | /* ../frmwrk/McaBootstrap.js */
| |
− | var McaBootstrap = function(pRoutes, pOnChange)
| |
− | {
| |
− | // Router
| |
− | var that = this;
| |
− |
| |
− | // Le layout
| |
− | var layout = false;
| |
− |
| |
− | // Toutes les routes
| |
− | var routes = false;
| |
− |
| |
− | // l'URL courante
| |
− | var currentUrl = false;
| |
− |
| |
− | // Le controller courant
| |
− | var currentController = false;
| |
− |
| |
− | // l'action courante
| |
− | var currentAction = false;
| |
− |
| |
− | // le mvc courant
| |
− | var currentMVC;
| |
− |
| |
− | /**
| |
− | * public attributes
| |
− | */
| |
− |
| |
− | // on change routes
| |
− | that.onChange = false;
| |
− |
| |
− | /**
| |
− | * Constructeur
| |
− | * @param pRoutes
| |
− | * @param pOnChange
| |
− | */
| |
− | function construct(pRoutes, pLayout)
| |
− | {
| |
− | // le système de layout
| |
− | layout = pLayout;
| |
− |
| |
− | // toutes les routes
| |
− | routes = pRoutes;
| |
− |
| |
− | // Initialiser dragging
| |
− | window.dragging = false;
| |
− |
| |
− | // evenement "click" sur tous les liens
| |
− | $("body").on(CLICK_EVENT, "a:not(.link)", function(e){
| |
− | if(!dragging)
| |
− | {
| |
− | if (window.history && window.history.pushState)
| |
− | {
| |
− | e.preventDefault();
| |
− |
| |
− | if(currentUrl !== $(this).attr("href"))
| |
− | {
| |
− | that.open($(this).attr("href"));
| |
− | }
| |
− | return false;
| |
− | }
| |
− | }
| |
− | });
| |
− |
| |
− |
| |
− | if(window.history && window.history.pushState)
| |
− | {
| |
− | window.addEventListener("popstate", function(e) {
| |
− | if(currentUrl != window.location.pathname)
| |
− | {
| |
− | currentUrl = window.location.pathname;
| |
− |
| |
− | that.open(currentUrl);
| |
− | }
| |
− | });
| |
− | }
| |
− |
| |
− | // L'url courante
| |
− | currentUrl = window.location.pathname;
| |
− |
| |
− | // Trouver le controller et l'action
| |
− | var reverse = that.reverseUrl(currentUrl);
| |
− |
| |
− | // Setter controller et action
| |
− | currentController = reverse.controllerName;
| |
− | currentAction = reverse.actionName;
| |
− |
| |
− |
| |
− | // Appeler l'action demandée
| |
− | if(currentController in mvc.controllers && currentAction in mvc.controllers[currentController]) currentMVC = new mvc.controllers[currentController][currentAction](true);
| |
− | }
| |
− |
| |
− | /**
| |
− | * Ouvrir l'url
| |
− | * @param url
| |
− | */
| |
− | that.open = function(url)
| |
− | {
| |
− | if (window.history && window.history.pushState) {
| |
− | currentUrl = url;
| |
− |
| |
− | if(_gaq != undefined)
| |
− | {
| |
− | _gaq.push(['_trackPageview', currentUrl]);
| |
− | }
| |
− |
| |
− | window.history.pushState(null, "", currentUrl);
| |
− |
| |
− | // Trouver le controller et l'action
| |
− | var reverse = that.reverseUrl(currentUrl);
| |
− |
| |
− | // Appeler l'action
| |
− | that.callAction(reverse.controllerName, reverse.actionName);
| |
− | }
| |
− | else
| |
− | {
| |
− | document.location.href = url;
| |
− | }
| |
− | };
| |
− |
| |
− | /**
| |
− | * Appeler l'action
| |
− | * @param pController
| |
− | * @param pAction
| |
− | */
| |
− | that.callAction = function(pController, pAction){
| |
− | // Trouver le bon controller
| |
− | if(pController in mvc.controllers)
| |
− | {
| |
− | // Executer la fonction
| |
− | function executeNewAction()
| |
− | {
| |
− | // setter le controller & action courants
| |
− | currentController = pController;
| |
− | currentAction = pAction;
| |
− |
| |
− | // getData est défini dans le controller
| |
− | if("layout" in mvc.controllers[currentController] && "getData" in mvc.controllers[currentController].layout)
| |
− | {
| |
− | // Lancer getData
| |
− | if(mvc.controllers[currentController].layout.getData !== false) mvc.controllers[currentController].layout.getData(layout, currentUrl);
| |
− |
| |
− | // Appeler l'action demandée
| |
− | if(currentAction in mvc.controllers[currentController]) currentMVC = new mvc.controllers[currentController][currentAction](false);
| |
− | }
| |
− | else
| |
− | {
| |
− | // Executer la requete
| |
− | layout.getData(currentUrl, function(){
| |
− |
| |
− | // Appeler le onChange
| |
− | if(that.onChange != false)
| |
− | {
| |
− | that.onChange(currentUrl);
| |
− | }
| |
− |
| |
− | // Appeler l'action demandée
| |
− | if(currentAction in mvc.controllers[currentController]) currentMVC = new mvc.controllers[currentController][currentAction](false);
| |
− | }, currentController, currentAction);
| |
− | }
| |
− | }
| |
− |
| |
− | wait = false;
| |
− | // Si il y a un controller différent de l'actuel chargé
| |
− | if(currentController !== false && currentController != pController && 'stop' in mvc.controllers[currentController])
| |
− | {
| |
− | wait = mvc.controllers[currentController].stop(executeNewAction);
| |
− | }
| |
− |
| |
− | if(wait == false || wait == null)
| |
− | {
| |
− | executeNewAction();
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | /**
| |
− | * Reverse URL
| |
− | * @param url
| |
− | * @returns {boolean}
| |
− | */
| |
− | that.reverseUrl = function(url){
| |
− | var out = false;
| |
− | $(routes).each(function(){
| |
− | this[0] = this[0].replace(new RegExp('{lang}', 'g'), '[a-z]{2}');
| |
− | this[0] = this[0].replace(new RegExp('{alphanum}', 'g'), '[a-zA-Z0-9]+');
| |
− | this[0] = this[0].replace(new RegExp('{alphanum}', 'g'), '[a-zA-Z0-9]+');
| |
− | var regex = new RegExp(this[0]);
| |
− | if(regex.test(url))
| |
− | {
| |
− | out = {
| |
− | controllerName : this[1],
| |
− | actionName : this[2]
| |
− | };
| |
− | }
| |
− | });
| |
− | return out;
| |
− | };
| |
− |
| |
− | /**
| |
− | *
| |
− | */
| |
− |
| |
− | construct(pRoutes, pOnChange);
| |
− | };
| |
− |
| |
− | /* ../frmwrk/McaLayout.js */
| |
− | var McaLayout = function()
| |
− | {
| |
− | // objet McaLayout
| |
− | var that = this;
| |
− |
| |
− | // Les evenements disponibles
| |
− | var events = ['loading', 'load'];
| |
− |
| |
− | var handlers = [];
| |
− |
| |
− |
| |
− | /**
| |
− | * ecouter les evenements
| |
− | * @param pEvent
| |
− | * @param pCallback
| |
− | */
| |
− | that.on = function(pEvent, pCallback)
| |
− | {
| |
− | handlers[pEvent] = pCallback;
| |
− | }
| |
− |
| |
− | /**
| |
− | * charger le contenu
| |
− | */
| |
− | that.getData = function(pUrl, pCallback, pCurrentController, pCurrentAction){
| |
− | // Attendre
| |
− | var wait = false;
| |
− |
| |
− | var loadCounter = 2;
| |
− | var data;
| |
− |
| |
− | function loadPage()
| |
− | {
| |
− | if (--loadCounter == 0) {
| |
− | // Evenement "loading"
| |
− | if('load' in handlers) wait = handlers['load'](data);
| |
− |
| |
− | pCallback(data);
| |
− | }
| |
− | }
| |
− |
| |
− | // Continuer l'action
| |
− | function then()
| |
− | {
| |
− | window.setTimeout(loadPage, 800);
| |
− |
| |
− | // Executer la requete
| |
− | $.ajax({
| |
− | type: 'post',
| |
− | url: pUrl,
| |
− | dataType: 'json',
| |
− | data: {
| |
− | ajax: true
| |
− | },
| |
− | success: function(pData){
| |
− | data = pData;
| |
− | // Ajouter controller & action
| |
− | data.controller = pCurrentController;
| |
− | data.action = pCurrentAction;
| |
− |
| |
− | // title
| |
− | $('head title').text(data.title);
| |
− |
| |
− | $(data.html).waitForImages(function(){
| |
− | loadPage();
| |
− | });
| |
− | }
| |
− | });
| |
− | }
| |
− |
| |
− | // Evenement "loading"
| |
− | if('loading' in handlers) wait = handlers['loading'](then);
| |
− |
| |
− | if(wait !== false && wait !== null)
| |
− | {
| |
− | then();
| |
− | }
| |
− | }
| |
− | };;
| |
− |
| |
− | /* ../mca/_context/init.js */
| |
− | var mca = {
| |
− | components : {}
| |
− | };
| |
− |
| |
− | /* ../mca/components/FormValidator.js */
| |
− | /**
| |
− | * FormValidator pour le front-office
| |
− | * à passer en Solidify dans le namespace Gato !
| |
− | *
| |
− | * @param pForm : le selecteur jQuery du formulaire
| |
− | *
| |
− | * Nécessite le composant formValidator
| |
− | */
| |
− | mca.components.FormValidator = function (pForm)
| |
− | {
| |
− | /**
| |
− | * this : stocker l'objet
| |
− | */
| |
− | var that = this;
| |
− |
| |
− | /**
| |
− | * le formulaire
| |
− | */
| |
− | var form;
| |
− |
| |
− | /**
| |
− | * Le callback au submit
| |
− | */
| |
− | var submitCallback;
| |
− |
| |
− | /**
| |
− | * le callback au change
| |
− | */
| |
− | var changeCallback;
| |
− |
| |
− | /**
| |
− | * changeEvent est activé
| |
− | */
| |
− | var changeEventEnabled;
| |
− |
| |
− | /**
| |
− | * Les regles
| |
− | */
| |
− | var rules;
| |
− |
| |
− | /**
| |
− | * Les validations
| |
− | */
| |
− | var validations;
| |
− |
| |
− | /**
| |
− | * Les erreurs
| |
− | */
| |
− | var errors;
| |
− |
| |
− | /**
| |
− | * Constructeur du FormValidator
| |
− | * @param pForm : le selecteur jQuery du formulaire
| |
− | */
| |
− | function __construct(pForm)
| |
− | {
| |
− | // Stocker le formulaire
| |
− | form = pForm;
| |
− |
| |
− | // Initialiser les callbacks
| |
− | submitCallback = changeCallback = false;
| |
− |
| |
− | // par défault, changeEventEnabled est à false
| |
− | changeEventEnabled = false;
| |
− |
| |
− | // formValidatorData existe
| |
− | if('formValidatorData' in data)
| |
− | {
| |
− | // Stocker les regles
| |
− | rules = data.formValidatorData.rules;
| |
− |
| |
− | // Stocker les validations
| |
− | validations = data.formValidatorData.validations;
| |
− | }
| |
− | }
| |
− |
| |
− | /**
| |
− | * Récuperer le champs
| |
− | */
| |
− | function getItem(pField)
| |
− | {
| |
− | // La recherche par défault
| |
− | var search = '[name="'+pField+'"]';
| |
− | // On split sur le "."
| |
− | fieldSearch = pField.split('.');
| |
− |
| |
− | // S'il y a plus de 2 éléments.
| |
− | if(fieldSearch.length > 1)
| |
− | {
| |
− | var field = '';
| |
− | for(var i in fieldSearch)
| |
− | {
| |
− | if(i == 0)
| |
− | {
| |
− | field += fieldSearch[i];
| |
− | }
| |
− | else
| |
− | {
| |
− | field += '['+fieldSearch[i]+']';
| |
− | }
| |
− | }
| |
− | search = '[name="'+field+'"]';
| |
− |
| |
− | // Vérifier que le premier champs commence par une majuscule
| |
− | var regex = new RegExp('^[A-Z]');
| |
− |
| |
− | // Le premier caractère est une majuscule. Il faut donc ajouter au selecteur data[MonModele][...]
| |
− | if(regex.test(pField))
| |
− | {
| |
− | var field = 'data';
| |
− | for(var i in fieldSearch)
| |
− | {
| |
− | field += '\\['+fieldSearch[i]+'\\]';
| |
− | }
| |
− | search += ',[name="'+field+'"]';
| |
− | }
| |
− | }
| |
− | var item = form.find(search);
| |
− | return item;
| |
− | }
| |
− |
| |
− | /**
| |
− | * Vérifier les données
| |
− | */
| |
− | function validate(pField)
| |
− | {
| |
− | // field par défault à false
| |
− | pField = pField || false;
| |
− |
| |
− | // boolean de sortie
| |
− | var out = true;
| |
− |
| |
− | // Initialiser le tableau d'erreurs
| |
− | errors = new Array();
| |
− |
| |
− | // La validation en cours
| |
− | var validation;
| |
− |
| |
− | // Parcourir toutes les validations
| |
− | for(var i in validations)
| |
− | {
| |
− | // Stocker la validation en cours
| |
− | validation = validations[i];
| |
− |
| |
− | if(pField === false || pField == validation.field)
| |
− | {
| |
− | // Vérifier le champs
| |
− | if(!checkValidation(validation))
| |
− | {
| |
− | // Parcourir le tableau des errors et vérifier qu'il n'existe pas d'erreurs
| |
− | var alreadyExist = false;
| |
− | for(var j in errors)
| |
− | {
| |
− | if(errors[j].field == validation.field) alreadyExist = true;
| |
− | }
| |
− |
| |
− | // l'erreur n'existe pas
| |
− | if(!alreadyExist)
| |
− | {
| |
− | errors.push({
| |
− | message : validation.errorMessage,
| |
− | field : validation.field,
| |
− | item : getItem(validation.field)
| |
− | });
| |
− | }
| |
− | out = false;
| |
− | }
| |
− | }
| |
− | }
| |
− | // Retourner le boolean
| |
− | return out;
| |
− | }
| |
− |
| |
− | /**
| |
− | * Vérifier une validation
| |
− | * @returns
| |
− | */
| |
− | function checkValidation(pValidation)
| |
− | {
| |
− | // Créer la regex avec la regle
| |
− | var regex = new RegExp(rules[pValidation.rule][0], rules[pValidation.rule][1]);
| |
− |
| |
− |
| |
− | // Récuperer le contenu du champs
| |
− | var content = getItem(pValidation.field).val();
| |
− |
| |
− | // Tester la regex et retourner le résultat
| |
− | return regex.test(content);
| |
− | }
| |
− |
| |
− | function enableChangeEvent()
| |
− | {
| |
− | // la validation en cours
| |
− | var currentValidation;
| |
− |
| |
− | // Parcourir toutes les validations
| |
− | for(var i in validations)
| |
− | {
| |
− | // Stocker la validation en cours
| |
− | currentValidation = validations[i];
| |
− |
| |
− | // L'item
| |
− | var item = getItem(currentValidation.field);
| |
− |
| |
− | var tagName = false;
| |
− |
| |
− | // tag name
| |
− | if(item.length > 0)
| |
− | {
| |
− | tagName = item.get(0).tagName;
| |
− | }
| |
− |
| |
− | var eventMethod = function(e){
| |
− | // Vérifier la validation du champs en cours
| |
− | var isValid = validate();
| |
− |
| |
− | // Appeler le callback avec les erreurs
| |
− | changeCallback(errors);
| |
− | };
| |
− |
| |
− | // evenement au change
| |
− | item.bind('change', eventMethod);
| |
− |
| |
− |
| |
− | // evenement keypress si c'est un input text/pass ou un textarea
| |
− | if(tagName == 'TEXTAREA' || (tagName == 'INPUT' && (item.attr('type') == 'text' || item.attr('type') == 'password')))
| |
− | {
| |
− | // Ajouter l'evenement keypress
| |
− | item.bind('keyup', eventMethod);
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | /**
| |
− | * evenement à la validation du formulaire
| |
− | * @param pCallback : fonction de retour avec les erreurs en paramètre
| |
− | * @param pForce : booléen qui force le passage dans le callback. Dans ce cas, la méthode doit retourner true ou false.
| |
− | */
| |
− | this.submit = function(pCallback, pForce){
| |
− | // Enregistrer le callback
| |
− | submitCallback = pCallback;
| |
− |
| |
− | // Boolean de sortie
| |
− | var out = true;
| |
− |
| |
− | // pForce par défault à false
| |
− | var force = pForce || false;
| |
− |
| |
− | // Ajouter l'évènement sur le formulaire
| |
− | form.submit(function(){
| |
− | // Vérifier la validation de tous les champs
| |
− | var isValid = validate();
| |
− |
| |
− | // Appeler le callback avec les erreurs
| |
− | boolCallback = submitCallback(errors);
| |
− |
| |
− | // S'il n'y a pas de boolean retourné dans le callback, mettre false par default
| |
− | boolCallback = boolCallback || false;
| |
− |
| |
− | // le boolean de sortie est retourné par la fonction
| |
− | out = boolCallback;
| |
− |
| |
− | // Activer le changeEvent la premiere fois que l'utilisateur clique sur le submit
| |
− | if(changeCallback !== false && changeEventEnabled === false)
| |
− | {
| |
− | // Le changeEvent peut être activé
| |
− | enableChangeEvent();
| |
− |
| |
− | // passer le boolean changeEventEnabled à true
| |
− | changeEventEnabled = true;
| |
− | }
| |
− |
| |
− | // Si il y a des erreurs ou si le passage est forcé via le 2e paramètre
| |
− | if(!isValid || force)
| |
− | {
| |
− | /*
| |
− | // S'il n'y a pas de boolean retourné dans le callback, mettre false par default
| |
− | boolCallback = boolCallback || false;
| |
− |
| |
− | // le boolean de sortie est retourné par la fonction
| |
− | out = boolCallback;
| |
− | // si c'est en mode force
| |
− | if(force)
| |
− | {
| |
− | // le boolean de sortie est retourné par la fonction
| |
− | out = boolCallback;
| |
− | }
| |
− | else
| |
− | {
| |
− | // Le boolean est false
| |
− | out = false;
| |
− | }*/
| |
− | }
| |
− | return out;
| |
− | });
| |
− |
| |
− | return that;
| |
− | };
| |
− |
| |
− | /**
| |
− | * evenement au change sur les input select, etc...
| |
− | */
| |
− | this.change = function(pCallback)
| |
− | {
| |
− | // Par défault le callback du submit()
| |
− | changeCallback = pCallback || submitCallback;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Appeler le constructeur si les données sont présentes dans data
| |
− | */
| |
− | __construct(pForm);
| |
− | };;
| |
− |
| |
− | /* ../mca/components/Gmap.js */
| |
− | var Gmap = function (pId, pCenter)
| |
− | {
| |
− | // that
| |
− | var that = this;
| |
− |
| |
− | // map and geocoder
| |
− | this.map;
| |
− | this.geocoder;
| |
− |
| |
− | // params and options
| |
− | this.defaultParams;
| |
− |
| |
− | // public vars
| |
− | this.infowindow;
| |
− | this.markerCluster;
| |
− | this.markerClusterImage = '';
| |
− | this.markers = [];
| |
− | this.onClickHandler = false;
| |
− |
| |
− | // closest vars
| |
− | this.closest = {};
| |
− |
| |
− |
| |
− | /**
| |
− | * INITIALISATION
| |
− | */
| |
− |
| |
− | // initialisation de map et geocoder
| |
− | this.map = new google.maps.Map(document.getElementById(pId), {
| |
− | 'mapTypeId': google.maps.MapTypeId.ROADMAP,
| |
− | disableDefaultUI: true
| |
− | });
| |
− | this.geocoder = new google.maps.Geocoder();
| |
− |
| |
− | // centrer la map
| |
− | var center = {};
| |
− | if(pCenter != undefined)
| |
− | {
| |
− | if(pCenter.geocode != undefined)
| |
− | {
| |
− | this.geocode(pCenter.geocode, pCenter.zoom);
| |
− | }
| |
− | else
| |
− | {
| |
− | center = pCenter;
| |
− | }
| |
− | }
| |
− | else
| |
− | {
| |
− | //this.geocode('FRANCE', 4);
| |
− | }
| |
− | this.setCenter(center.latLng, center.zoom);
| |
− |
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * set default parameters
| |
− | * @param pDefault
| |
− | */
| |
− | Gmap.prototype.setParams = function(pDefault) {
| |
− | this.defaultParams = pDefault;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * set center
| |
− | * @param pDefault
| |
− | */
| |
− | Gmap.prototype.setCenter = function(pLatLng, pZoom) {
| |
− | this.map.setCenter(pLatLng);
| |
− | this.map.setZoom(pZoom);
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * search value of a field in the data
| |
− | * @param pField
| |
− | * @param pData
| |
− | * @returns value
| |
− | */
| |
− | Gmap.prototype._getFieldValue = function(pField, pData) {
| |
− | var splitted = this.defaultParams[pField].split('.');
| |
− | for(i in splitted)
| |
− | {
| |
− | pData = pData[splitted[i]];
| |
− | }
| |
− | return pData;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * set image for marker cluster
| |
− | * @param pImage
| |
− | */
| |
− | Gmap.prototype.setMarkerClusterImage = function(pImage) {
| |
− | this.markerClusterImage = pImage;
| |
− | };
| |
− |
| |
− | /**
| |
− | * set image for marker cluster
| |
− | * @param pImage
| |
− | */
| |
− | Gmap.prototype.onClick = function(pFunction){
| |
− | this.onClickHandler = pFunction;
| |
− | };
| |
− |
| |
− | /**
| |
− | * bounds
| |
− | * @param pData
| |
− | */
| |
− | Gmap.prototype.bounds = function() {
| |
− | var _this = this;
| |
− | var map = this.map;
| |
− |
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * add markers
| |
− | * @param pData
| |
− | */
| |
− | Gmap.prototype.addMarkers = function(pData, pCallback, pNoCluster) {
| |
− | var _this = this;
| |
− | var map = this.map;
| |
− |
| |
− | var bounds = new google.maps.LatLngBounds();
| |
− |
| |
− | for (var i = 0; i < pData.length; i++) {
| |
− | var formattedData = pCallback(pData[i]);
| |
− |
| |
− | // lat lng
| |
− | var latLng = new google.maps.LatLng(this._getFieldValue('lat', pData[i]), this._getFieldValue('lng', pData[i]));
| |
− | bounds.extend(latLng);
| |
− |
| |
− | // marker options
| |
− | var markerOptions = {
| |
− | position : latLng,
| |
− | title : pData[i].name
| |
− | };
| |
− |
| |
− | // icon
| |
− | if(formattedData.icon != undefined && formattedData.icon != '') markerOptions.icon = formattedData.icon;
| |
− |
| |
− | // if one marker, add to map
| |
− | if(pData.length == 1 || (pNoCluster != undefined && pNoCluster) ) markerOptions.map = this.map;
| |
− | // new marker
| |
− | var marker = new google.maps.Marker(markerOptions);
| |
− |
| |
− | // Passe l'id et l'index au marker
| |
− | marker.contentIndex = i;
| |
− | marker.contentId = this._getFieldValue('id', pData[i]);
| |
− | if(formattedData.infowindow != undefined)
| |
− | {
| |
− | marker.contentInfowindow = formattedData.infowindow;
| |
− | }
| |
− | else
| |
− | {
| |
− | marker.contentInfowindow = '';
| |
− | }
| |
− | marker.data = pData[i];
| |
− |
| |
− | // push to markers
| |
− | this.markers.push(marker);
| |
− |
| |
− | map.fitBounds(bounds);
| |
− |
| |
− | // création de l'infowindow
| |
− | this.infowindow = new google.maps.InfoWindow();
| |
− | // infoWindow
| |
− | google.maps.event.addListener(marker, 'click', function() {
| |
− | if(marker.contentInfowindow != '')
| |
− | {
| |
− | _this.infowindow.close();
| |
− | _this.infowindow.setContent(this.contentInfowindow);
| |
− | _this.infowindow.open(map, this);
| |
− | }
| |
− |
| |
− | if(_this.onClickHandler != false) _this.onClickHandler(marker);
| |
− | });
| |
− | }
| |
− |
| |
− | var markerClusterOptions = {};
| |
− | if(this.markerClusterImage != '')
| |
− | {
| |
− | var imageStyle;
| |
− | if(typeof(this.markerClusterImage)=='string')
| |
− | {
| |
− | imageStyle = {
| |
− | url: this.markerClusterImage,
| |
− | height: 47,
| |
− | width: 47,
| |
− | anchor: [17, -4],
| |
− | textColor: '#ffffff',
| |
− | textSize: 12
| |
− | };
| |
− | }
| |
− | else
| |
− | {
| |
− | imageStyle = this.markerClusterImage;
| |
− | }
| |
− | markerClusterOptions.styles = [imageStyle];
| |
− | }
| |
− | markerClusterOptions.gridSize = 40;
| |
− |
| |
− | // Est ce qu'on fait des clusters ?
| |
− | if(pData.length > 1 && (pNoCluster == false || pNoCluster == undefined) ){
| |
− | this.markerCluster = new MarkerClusterer(this.map, this.markers, markerClusterOptions);
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * open infowindow of one marker
| |
− | * @param pValue
| |
− | * @param pType
| |
− | */
| |
− | Gmap.prototype.openMarker = function(pValue, pSearchId) {
| |
− | var _this = this;
| |
− | var openIndex = false;
| |
− | if(pSearchId != undefined && pSearchId === true)
| |
− | {
| |
− | for (var i = 0; i < this.markers.length; i++) {
| |
− | if(this.markers[i].contentId == pValue)
| |
− | {
| |
− | openIndex = i;
| |
− | }
| |
− | }
| |
− | }
| |
− | else
| |
− | {
| |
− | openIndex = pValue;
| |
− | }
| |
− | if(openIndex !== false)
| |
− | {
| |
− | this.infowindow.close();
| |
− | this.infowindow.setContent(this.markers[openIndex].contentInfowindow);
| |
− | this.infowindow.open(this.map, this.markers[openIndex]);
| |
− |
| |
− | _this.map.setCenter(_this.markers[openIndex].getPosition());
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * geocoder
| |
− | * @param pText
| |
− | */
| |
− | Gmap.prototype.geocode = function(pText, pZoom) {
| |
− | var _this = this;
| |
− | _this.geocoder.geocode( { 'address': pText }, function(results, status) {
| |
− | if (status == google.maps.GeocoderStatus.OK) {
| |
− | _this.map.setCenter(results[0].geometry.location);
| |
− |
| |
− | // le zoom est défini
| |
− | if(pZoom != undefined)
| |
− | {
| |
− | _this.map.setZoom(pZoom);
| |
− | }
| |
− | else
| |
− | {
| |
− | _this.map.fitBounds(results[0].geometry.bounds);
| |
− | }
| |
− | } else {
| |
− | alert("Geocode was not successful for the following reason: " + status);
| |
− | }
| |
− | });
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * filtrer chaque item
| |
− | * @param pCallback
| |
− | */
| |
− | Gmap.prototype.filter = function(pCallback) {
| |
− | var bounds = new google.maps.LatLngBounds();
| |
− | var oneVisible = false;
| |
− | for (var i = 0; i < this.markers.length; i++) {
| |
− | if(pCallback(this.markers[i]))
| |
− | {
| |
− | this.markers[i].setVisible(true);
| |
− | oneVisible = true;
| |
− | bounds.extend( this.markers[i].getPosition() );
| |
− | }
| |
− | else
| |
− | {
| |
− | this.markers[i].setVisible(false);
| |
− | }
| |
− | }
| |
− | this.markerCluster.repaint();
| |
− | if(oneVisible) this.map.fitBounds(bounds);
| |
− | };
| |
− |
| |
− | Gmap.prototype.getAllClosest = function(pLimit, pCallback) {
| |
− | var pi = Math.PI;
| |
− | var R = 63710000; //equatorial radius
| |
− | var distances = [];
| |
− | var closest = -1;
| |
− |
| |
− | for( i=0;i<pLimit-1; i++ ) {
| |
− | var lat2 = markers[i].position.lat();
| |
− | var lon2 = markers[i].position.lng();
| |
− |
| |
− | var chLat = lat2-lat1;
| |
− | var chLon = lon2-lon1;
| |
− |
| |
− | var dLat = chLat*(pi/180);
| |
− | var dLon = chLon*(pi/180);
| |
− |
| |
− | var rLat1 = lat1*(pi/180);
| |
− | var rLat2 = lat2*(pi/180);
| |
− |
| |
− | var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
| |
− | Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(rLat1) * Math.cos(rLat2);
| |
− | var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
| |
− | var d = R * c;
| |
− |
| |
− | distances[i] = d;
| |
− | if ( closest == -1 || d < distances[closest] ) {
| |
− | closest = i;
| |
− | }
| |
− | }
| |
− |
| |
− | // (debug) The closest marker is:
| |
− | };
| |
− |
| |
− | /**
| |
− | * activer la recherche des plus proches
| |
− | * @param pLimit
| |
− | * @param pCallback
| |
− | */
| |
− | Gmap.prototype.getClosest = function(pLimit, pCallback, usePacks) {
| |
− | var _this = this;
| |
− | // initialisation des variables
| |
− | window.closest = {};
| |
− | window.closest.limit = pLimit;
| |
− | window.closest.usePacks = usePacks || false;
| |
− | window.closest.callback = pCallback;
| |
− | window.closest.timer;
| |
− | window.closest.stopCalculating = false;
| |
− | window.closest.markersPack = {};
| |
− |
| |
− | // création des packs
| |
− | var currentXPack, currentYPack;
| |
− | for(var i = 0; i < this.markers.length; i++)
| |
− | {
| |
− | currentXPack = Math.floor(this.markers[i].getPosition().lng() / 4);
| |
− | currentYPack = Math.floor(this.markers[i].getPosition().lat() / 4);
| |
− |
| |
− | if(!window.closest.usePacks)
| |
− | {
| |
− | currentXPack = 0;
| |
− | currentYPack = 0;
| |
− | }
| |
− |
| |
− | if(window.closest.markersPack[currentXPack] == undefined){
| |
− | window.closest.markersPack[currentXPack] = {};
| |
− | }
| |
− | if(window.closest.markersPack[currentXPack][currentYPack] == undefined){
| |
− | window.closest.markersPack[currentXPack][currentYPack] = [];
| |
− | }
| |
− |
| |
− | window.closest.markersPack[currentXPack][currentYPack].push(this.markers[i].data);
| |
− | }
| |
− |
| |
− |
| |
− | // event idle
| |
− | google.maps.event.addListener(this.map, 'idle', function(){
| |
− |
| |
− | window.closest.stopCalculating = true;
| |
− | window.clearTimeout(window.closest.timer);
| |
− | window.closest.timer = setTimeout(function(){
| |
− | _this._showClosestItems(_this.map.getCenter());
| |
− | }, 500);
| |
− | });
| |
− | };
| |
− |
| |
− | // get closest with the center
| |
− | Gmap.prototype._showClosestItems = function(latLng){
| |
− | // Calcul des distances
| |
− | window.closest.items = {};
| |
− |
| |
− | var currentXPack = Math.floor(latLng.lng() / 4);
| |
− | var currentYPack = Math.floor(latLng.lat() / 4);
| |
− | if(!window.closest.usePacks)
| |
− | {
| |
− | currentXPack = 0;
| |
− | currentYPack = 0;
| |
− | }
| |
− |
| |
− | window.closest.items.nearDealers = [];
| |
− | if(window.closest.markersPack[currentXPack] != undefined && window.closest.markersPack[currentXPack][currentYPack] != undefined)
| |
− | {
| |
− | window.closest.items.nearDealers = window.closest.markersPack[currentXPack][currentYPack];
| |
− | }
| |
− | window.closest.items.distances = [];
| |
− | window.closest.items.lng = latLng.lng();
| |
− | window.closest.items.lat = latLng.lat();
| |
− | window.closest.items.step = 10;
| |
− | window.closest.items.latLng = latLng;
| |
− | window.closest.items.length = window.closest.items.nearDealers.length;
| |
− | this._closestDistanceCalculate(0, window.closest.items.step);
| |
− | };
| |
− |
| |
− | // calcule la distance par paquet
| |
− | Gmap.prototype._closestDistanceCalculate = function(from, to){
| |
− | var _this = this;
| |
− | window.closest.stopCalculating = false;
| |
− | //window.isCalculatingNearPoints
| |
− | var distance;
| |
− | var item;
| |
− |
| |
− | to = Math.min(window.closest.items.length, to);
| |
− |
| |
− | // Boucle
| |
− | for(var i = from; i < to; i ++)
| |
− | {
| |
− | if(window.closest.stopCalculating == true) return;
| |
− | item = window.closest.items.nearDealers[i];
| |
− |
| |
− | distance = google.maps.geometry.spherical.computeDistanceBetween(
| |
− | window.closest.items.latLng,
| |
− | new google.maps.LatLng(this._getFieldValue('lat', item),this._getFieldValue('lng', item))
| |
− | );
| |
− | //if(distance < 100000) window.closest.items.distances.push({d: distance, item: item });
| |
− | window.closest.items.distances.push({d: distance, item: item });
| |
− | }
| |
− |
| |
− | if(window.closest.stopCalculating == true) return;
| |
− | if(to < window.closest.items.length)
| |
− | {
| |
− | window.setTimeout(function(){
| |
− | _this._closestDistanceCalculate(to, to + window.closest.items.step);
| |
− | }, 1);
| |
− | } else {
| |
− | // Tri par distance
| |
− | window.closest.items.distances.sort(function(a,b){return a.d - b.d; });
| |
− |
| |
− | // Coupe à 6
| |
− | var selectedItems = window.closest.items.distances.slice(0,window.closest.limit);
| |
− |
| |
− | window.closest.callback(selectedItems);
| |
− | }
| |
− | };;
| |
− |
| |
− | /* ../mca/components/GmapMarkerClusterer.js */
| |
− | // ==ClosureCompiler==
| |
− | // @compilation_level ADVANCED_OPTIMIZATIONS
| |
− | // @externs_url http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/maps/google_maps_api_v3_3.js
| |
− | // ==/ClosureCompiler==
| |
− |
| |
− | /**
| |
− | * @name MarkerClusterer for Google Maps v3
| |
− | * @version version 1.0
| |
− | * @author Luke Mahe
| |
− | * @fileoverview
| |
− | * The library creates and manages per-zoom-level clusters for large amounts of
| |
− | * markers.
| |
− | * <br/>
| |
− | * This is a v3 implementation of the
| |
− | * <a href="http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/"
| |
− | * >v2 MarkerClusterer</a>.
| |
− | */
| |
− |
| |
− | /**
| |
− | * Licensed under the Apache License, Version 2.0 (the "License");
| |
− | * you may not use this file except in compliance with the License.
| |
− | * You may obtain a copy of the License at
| |
− | *
| |
− | * http://www.apache.org/licenses/LICENSE-2.0
| |
− | *
| |
− | * Unless required by applicable law or agreed to in writing, software
| |
− | * distributed under the License is distributed on an "AS IS" BASIS,
| |
− | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| |
− | * See the License for the specific language governing permissions and
| |
− | * limitations under the License.
| |
− | */
| |
− |
| |
− |
| |
− | /**
| |
− | * A Marker Clusterer that clusters markers.
| |
− | *
| |
− | * @param {google.maps.Map} map The Google map to attach to.
| |
− | * @param {Array.<google.maps.Marker>=} opt_markers Optional markers to add to
| |
− | * the cluster.
| |
− | * @param {Object=} opt_options support the following options:
| |
− | * 'gridSize': (number) The grid size of a cluster in pixels.
| |
− | * 'maxZoom': (number) The maximum zoom level that a marker can be part of a
| |
− | * cluster.
| |
− | * 'zoomOnClick': (boolean) Whether the default behaviour of clicking on a
| |
− | * cluster is to zoom into it.
| |
− | * 'averageCenter': (boolean) Wether the center of each cluster should be
| |
− | * the average of all markers in the cluster.
| |
− | * 'minimumClusterSize': (number) The minimum number of markers to be in a
| |
− | * cluster before the markers are hidden and a count
| |
− | * is shown.
| |
− | * 'styles': (object) An object that has style properties:
| |
− | * 'url': (string) The image url.
| |
− | * 'height': (number) The image height.
| |
− | * 'width': (number) The image width.
| |
− | * 'anchor': (Array) The anchor position of the label text.
| |
− | * 'textColor': (string) The text color.
| |
− | * 'textSize': (number) The text size.
| |
− | * 'backgroundPosition': (string) The position of the backgound x, y.
| |
− | * @constructor
| |
− | * @extends google.maps.OverlayView
| |
− | */
| |
− | function MarkerClusterer(map, opt_markers, opt_options) {
| |
− | // MarkerClusterer implements google.maps.OverlayView interface. We use the
| |
− | // extend function to extend MarkerClusterer with google.maps.OverlayView
| |
− | // because it might not always be available when the code is defined so we
| |
− | // look for it at the last possible moment. If it doesn't exist now then
| |
− | // there is no point going ahead :)
| |
− | this.extend(MarkerClusterer, google.maps.OverlayView);
| |
− | this.map_ = map;
| |
− |
| |
− | /**
| |
− | * @type {Array.<google.maps.Marker>}
| |
− | * @private
| |
− | */
| |
− | this.markers_ = [];
| |
− |
| |
− | /**
| |
− | * @type {Array.<Cluster>}
| |
− | */
| |
− | this.clusters_ = [];
| |
− |
| |
− | this.sizes = [53, 56, 66, 78, 90];
| |
− |
| |
− | /**
| |
− | * @private
| |
− | */
| |
− | this.styles_ = [];
| |
− |
| |
− | /**
| |
− | * @type {boolean}
| |
− | * @private
| |
− | */
| |
− | this.ready_ = false;
| |
− |
| |
− | var options = opt_options || {};
| |
− |
| |
− | /**
| |
− | * @type {number}
| |
− | * @private
| |
− | */
| |
− | this.gridSize_ = options['gridSize'] || 60;
| |
− |
| |
− | /**
| |
− | * @private
| |
− | */
| |
− | this.minClusterSize_ = options['minimumClusterSize'] || 2;
| |
− |
| |
− |
| |
− | /**
| |
− | * @type {?number}
| |
− | * @private
| |
− | */
| |
− | this.maxZoom_ = options['maxZoom'] || null;
| |
− |
| |
− | this.styles_ = options['styles'] || [];
| |
− |
| |
− | /**
| |
− | * @type {string}
| |
− | * @private
| |
− | */
| |
− | this.imagePath_ = options['imagePath'] ||
| |
− | this.MARKER_CLUSTER_IMAGE_PATH_;
| |
− |
| |
− | /**
| |
− | * @type {string}
| |
− | * @private
| |
− | */
| |
− | this.imageExtension_ = options['imageExtension'] ||
| |
− | this.MARKER_CLUSTER_IMAGE_EXTENSION_;
| |
− |
| |
− | /**
| |
− | * @type {boolean}
| |
− | * @private
| |
− | */
| |
− | this.zoomOnClick_ = true;
| |
− |
| |
− | if (options['zoomOnClick'] != undefined) {
| |
− | this.zoomOnClick_ = options['zoomOnClick'];
| |
− | }
| |
− |
| |
− | /**
| |
− | * @type {boolean}
| |
− | * @private
| |
− | */
| |
− | this.averageCenter_ = false;
| |
− |
| |
− | if (options['averageCenter'] != undefined) {
| |
− | this.averageCenter_ = options['averageCenter'];
| |
− | }
| |
− |
| |
− | this.setupStyles_();
| |
− |
| |
− | this.setMap(map);
| |
− |
| |
− | /**
| |
− | * @type {number}
| |
− | * @private
| |
− | */
| |
− | this.prevZoom_ = this.map_.getZoom();
| |
− |
| |
− | // Add the map event listeners
| |
− | var that = this;
| |
− | google.maps.event.addListener(this.map_, 'zoom_changed', function() {
| |
− | var zoom = that.map_.getZoom();
| |
− |
| |
− | if (that.prevZoom_ != zoom) {
| |
− | that.prevZoom_ = zoom;
| |
− | that.resetViewport();
| |
− | }
| |
− | });
| |
− |
| |
− | google.maps.event.addListener(this.map_, 'idle', function() {
| |
− | that.redraw();
| |
− | });
| |
− |
| |
− | // Finally, add the markers
| |
− | if (opt_markers && opt_markers.length) {
| |
− | this.addMarkers(opt_markers, false);
| |
− | }
| |
− | }
| |
− |
| |
− |
| |
− | /**
| |
− | * The marker cluster image path.
| |
− | *
| |
− | * @type {string}
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ =
| |
− | 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/' +
| |
− | 'images/m';
| |
− |
| |
− |
| |
− | /**
| |
− | * The marker cluster image path.
| |
− | *
| |
− | * @type {string}
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = 'png';
| |
− |
| |
− |
| |
− | /**
| |
− | * Extends a objects prototype by anothers.
| |
− | *
| |
− | * @param {Object} obj1 The object to be extended.
| |
− | * @param {Object} obj2 The object to extend with.
| |
− | * @return {Object} The new extended object.
| |
− | * @ignore
| |
− | */
| |
− | MarkerClusterer.prototype.extend = function(obj1, obj2) {
| |
− | return (function(object) {
| |
− | for (var property in object.prototype) {
| |
− | this.prototype[property] = object.prototype[property];
| |
− | }
| |
− | return this;
| |
− | }).apply(obj1, [obj2]);
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Implementaion of the interface method.
| |
− | * @ignore
| |
− | */
| |
− | MarkerClusterer.prototype.onAdd = function() {
| |
− | this.setReady_(true);
| |
− | };
| |
− |
| |
− | /**
| |
− | * Implementaion of the interface method.
| |
− | * @ignore
| |
− | */
| |
− | MarkerClusterer.prototype.draw = function() {};
| |
− |
| |
− | /**
| |
− | * Sets up the styles object.
| |
− | *
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.setupStyles_ = function() {
| |
− | if (this.styles_.length) {
| |
− | return;
| |
− | }
| |
− |
| |
− | for (var i = 0, size; size = this.sizes[i]; i++) {
| |
− | this.styles_.push({
| |
− | url: this.imagePath_ + (i + 1) + '.' + this.imageExtension_,
| |
− | height: size,
| |
− | width: size
| |
− | });
| |
− | }
| |
− | };
| |
− |
| |
− | /**
| |
− | * Fit the map to the bounds of the markers in the clusterer.
| |
− | */
| |
− | MarkerClusterer.prototype.fitMapToMarkers = function() {
| |
− | var markers = this.getMarkers();
| |
− | var bounds = new google.maps.LatLngBounds();
| |
− | for (var i = 0, marker; marker = markers[i]; i++) {
| |
− | bounds.extend(marker.getPosition());
| |
− | }
| |
− |
| |
− | this.map_.fitBounds(bounds);
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Sets the styles.
| |
− | *
| |
− | * @param {Object} styles The style to set.
| |
− | */
| |
− | MarkerClusterer.prototype.setStyles = function(styles) {
| |
− | this.styles_ = styles;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Gets the styles.
| |
− | *
| |
− | * @return {Object} The styles object.
| |
− | */
| |
− | MarkerClusterer.prototype.getStyles = function() {
| |
− | return this.styles_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Whether zoom on click is set.
| |
− | *
| |
− | * @return {boolean} True if zoomOnClick_ is set.
| |
− | */
| |
− | MarkerClusterer.prototype.isZoomOnClick = function() {
| |
− | return this.zoomOnClick_;
| |
− | };
| |
− |
| |
− | /**
| |
− | * Whether average center is set.
| |
− | *
| |
− | * @return {boolean} True if averageCenter_ is set.
| |
− | */
| |
− | MarkerClusterer.prototype.isAverageCenter = function() {
| |
− | return this.averageCenter_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the array of markers in the clusterer.
| |
− | *
| |
− | * @return {Array.<google.maps.Marker>} The markers.
| |
− | */
| |
− | MarkerClusterer.prototype.getMarkers = function() {
| |
− | return this.markers_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the number of markers in the clusterer
| |
− | *
| |
− | * @return {Number} The number of markers.
| |
− | */
| |
− | MarkerClusterer.prototype.getTotalMarkers = function() {
| |
− | return this.markers_.length;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Sets the max zoom for the clusterer.
| |
− | *
| |
− | * @param {number} maxZoom The max zoom level.
| |
− | */
| |
− | MarkerClusterer.prototype.setMaxZoom = function(maxZoom) {
| |
− | this.maxZoom_ = maxZoom;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Gets the max zoom for the clusterer.
| |
− | *
| |
− | * @return {number} The max zoom level.
| |
− | */
| |
− | MarkerClusterer.prototype.getMaxZoom = function() {
| |
− | return this.maxZoom_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * The function for calculating the cluster icon image.
| |
− | *
| |
− | * @param {Array.<google.maps.Marker>} markers The markers in the clusterer.
| |
− | * @param {number} numStyles The number of styles available.
| |
− | * @return {Object} A object properties: 'text' (string) and 'index' (number).
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.calculator_ = function(markers, numStyles) {
| |
− | var index = 0;
| |
− | var count = markers.length;
| |
− | var dv = count;
| |
− | while (dv !== 0) {
| |
− | dv = parseInt(dv / 10, 10);
| |
− | index++;
| |
− | }
| |
− |
| |
− | index = Math.min(index, numStyles);
| |
− | return {
| |
− | text: count,
| |
− | index: index
| |
− | };
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Set the calculator function.
| |
− | *
| |
− | * @param {function(Array, number)} calculator The function to set as the
| |
− | * calculator. The function should return a object properties:
| |
− | * 'text' (string) and 'index' (number).
| |
− | *
| |
− | */
| |
− | MarkerClusterer.prototype.setCalculator = function(calculator) {
| |
− | this.calculator_ = calculator;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Get the calculator function.
| |
− | *
| |
− | * @return {function(Array, number)} the calculator function.
| |
− | */
| |
− | MarkerClusterer.prototype.getCalculator = function() {
| |
− | return this.calculator_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Add an array of markers to the clusterer.
| |
− | *
| |
− | * @param {Array.<google.maps.Marker>} markers The markers to add.
| |
− | * @param {boolean=} opt_nodraw Whether to redraw the clusters.
| |
− | */
| |
− | MarkerClusterer.prototype.addMarkers = function(markers, opt_nodraw) {
| |
− | for (var i = 0, marker; marker = markers[i]; i++) {
| |
− | this.pushMarkerTo_(marker);
| |
− | }
| |
− | if (!opt_nodraw) {
| |
− | this.redraw();
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Pushes a marker to the clusterer.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to add.
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.pushMarkerTo_ = function(marker) {
| |
− | marker.isAdded = false;
| |
− | if (marker['draggable']) {
| |
− | // If the marker is draggable add a listener so we update the clusters on
| |
− | // the drag end.
| |
− | var that = this;
| |
− | google.maps.event.addListener(marker, 'dragend', function() {
| |
− | marker.isAdded = false;
| |
− | that.repaint();
| |
− | });
| |
− | }
| |
− | this.markers_.push(marker);
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Adds a marker to the clusterer and redraws if needed.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to add.
| |
− | * @param {boolean=} opt_nodraw Whether to redraw the clusters.
| |
− | */
| |
− | MarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) {
| |
− | this.pushMarkerTo_(marker);
| |
− | if (!opt_nodraw) {
| |
− | this.redraw();
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Removes a marker and returns true if removed, false if not
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to remove
| |
− | * @return {boolean} Whether the marker was removed or not
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.removeMarker_ = function(marker) {
| |
− | var index = -1;
| |
− | if (this.markers_.indexOf) {
| |
− | index = this.markers_.indexOf(marker);
| |
− | } else {
| |
− | for (var i = 0, m; m = this.markers_[i]; i++) {
| |
− | if (m == marker) {
| |
− | index = i;
| |
− | break;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | if (index == -1) {
| |
− | // Marker is not in our list of markers.
| |
− | return false;
| |
− | }
| |
− |
| |
− | marker.setMap(null);
| |
− |
| |
− | this.markers_.splice(index, 1);
| |
− |
| |
− | return true;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Remove a marker from the cluster.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to remove.
| |
− | * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
| |
− | * @return {boolean} True if the marker was removed.
| |
− | */
| |
− | MarkerClusterer.prototype.removeMarker = function(marker, opt_nodraw) {
| |
− | var removed = this.removeMarker_(marker);
| |
− |
| |
− | if (!opt_nodraw && removed) {
| |
− | this.resetViewport();
| |
− | this.redraw();
| |
− | return true;
| |
− | } else {
| |
− | return false;
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Removes an array of markers from the cluster.
| |
− | *
| |
− | * @param {Array.<google.maps.Marker>} markers The markers to remove.
| |
− | * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
| |
− | */
| |
− | MarkerClusterer.prototype.removeMarkers = function(markers, opt_nodraw) {
| |
− | var removed = false;
| |
− |
| |
− | for (var i = 0, marker; marker = markers[i]; i++) {
| |
− | var r = this.removeMarker_(marker);
| |
− | removed = removed || r;
| |
− | }
| |
− |
| |
− | if (!opt_nodraw && removed) {
| |
− | this.resetViewport();
| |
− | this.redraw();
| |
− | return true;
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Sets the clusterer's ready state.
| |
− | *
| |
− | * @param {boolean} ready The state.
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.setReady_ = function(ready) {
| |
− | if (!this.ready_) {
| |
− | this.ready_ = ready;
| |
− | this.createClusters_();
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the number of clusters in the clusterer.
| |
− | *
| |
− | * @return {number} The number of clusters.
| |
− | */
| |
− | MarkerClusterer.prototype.getTotalClusters = function() {
| |
− | return this.clusters_.length;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the google map that the clusterer is associated with.
| |
− | *
| |
− | * @return {google.maps.Map} The map.
| |
− | */
| |
− | MarkerClusterer.prototype.getMap = function() {
| |
− | return this.map_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Sets the google map that the clusterer is associated with.
| |
− | *
| |
− | * @param {google.maps.Map} map The map.
| |
− | */
| |
− | MarkerClusterer.prototype.setMap = function(map) {
| |
− | this.map_ = map;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the size of the grid.
| |
− | *
| |
− | * @return {number} The grid size.
| |
− | */
| |
− | MarkerClusterer.prototype.getGridSize = function() {
| |
− | return this.gridSize_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Sets the size of the grid.
| |
− | *
| |
− | * @param {number} size The grid size.
| |
− | */
| |
− | MarkerClusterer.prototype.setGridSize = function(size) {
| |
− | this.gridSize_ = size;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the min cluster size.
| |
− | *
| |
− | * @return {number} The grid size.
| |
− | */
| |
− | MarkerClusterer.prototype.getMinClusterSize = function() {
| |
− | return this.minClusterSize_;
| |
− | };
| |
− |
| |
− | /**
| |
− | * Sets the min cluster size.
| |
− | *
| |
− | * @param {number} size The grid size.
| |
− | */
| |
− | MarkerClusterer.prototype.setMinClusterSize = function(size) {
| |
− | this.minClusterSize_ = size;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Extends a bounds object by the grid size.
| |
− | *
| |
− | * @param {google.maps.LatLngBounds} bounds The bounds to extend.
| |
− | * @return {google.maps.LatLngBounds} The extended bounds.
| |
− | */
| |
− | MarkerClusterer.prototype.getExtendedBounds = function(bounds) {
| |
− | var projection = this.getProjection();
| |
− |
| |
− | // Turn the bounds into latlng.
| |
− | var tr = new google.maps.LatLng(bounds.getNorthEast().lat(),
| |
− | bounds.getNorthEast().lng());
| |
− | var bl = new google.maps.LatLng(bounds.getSouthWest().lat(),
| |
− | bounds.getSouthWest().lng());
| |
− |
| |
− | // Convert the points to pixels and the extend out by the grid size.
| |
− | var trPix = projection.fromLatLngToDivPixel(tr);
| |
− | trPix.x += this.gridSize_;
| |
− | trPix.y -= this.gridSize_;
| |
− |
| |
− | var blPix = projection.fromLatLngToDivPixel(bl);
| |
− | blPix.x -= this.gridSize_;
| |
− | blPix.y += this.gridSize_;
| |
− |
| |
− | // Convert the pixel points back to LatLng
| |
− | var ne = projection.fromDivPixelToLatLng(trPix);
| |
− | var sw = projection.fromDivPixelToLatLng(blPix);
| |
− |
| |
− | // Extend the bounds to contain the new bounds.
| |
− | bounds.extend(ne);
| |
− | bounds.extend(sw);
| |
− |
| |
− | return bounds;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Determins if a marker is contained in a bounds.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to check.
| |
− | * @param {google.maps.LatLngBounds} bounds The bounds to check against.
| |
− | * @return {boolean} True if the marker is in the bounds.
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.isMarkerInBounds_ = function(marker, bounds) {
| |
− | return bounds.contains(marker.getPosition());
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Clears all clusters and markers from the clusterer.
| |
− | */
| |
− | MarkerClusterer.prototype.clearMarkers = function() {
| |
− | this.resetViewport(true);
| |
− |
| |
− | // Set the markers a empty array.
| |
− | this.markers_ = [];
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Clears all existing clusters and recreates them.
| |
− | * @param {boolean} opt_hide To also hide the marker.
| |
− | */
| |
− | MarkerClusterer.prototype.resetViewport = function(opt_hide) {
| |
− | // Remove all the clusters
| |
− | for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
| |
− | cluster.remove();
| |
− | }
| |
− |
| |
− | // Reset the markers to not be added and to be invisible.
| |
− | for (var i = 0, marker; marker = this.markers_[i]; i++) {
| |
− | marker.isAdded = false;
| |
− | if (opt_hide) {
| |
− | marker.setMap(null);
| |
− | }
| |
− | }
| |
− |
| |
− | this.clusters_ = [];
| |
− | };
| |
− |
| |
− | /**
| |
− | *
| |
− | */
| |
− | MarkerClusterer.prototype.repaint = function() {
| |
− | var oldClusters = this.clusters_.slice();
| |
− | this.clusters_.length = 0;
| |
− | this.resetViewport();
| |
− | this.redraw();
| |
− |
| |
− | // Remove the old clusters.
| |
− | // Do it in a timeout so the other clusters have been drawn first.
| |
− | window.setTimeout(function() {
| |
− | for (var i = 0, cluster; cluster = oldClusters[i]; i++) {
| |
− | cluster.remove();
| |
− | }
| |
− | }, 0);
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Redraws the clusters.
| |
− | */
| |
− | MarkerClusterer.prototype.redraw = function() {
| |
− | this.createClusters_();
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Calculates the distance between two latlng locations in km.
| |
− | * @see http://www.movable-type.co.uk/scripts/latlong.html
| |
− | *
| |
− | * @param {google.maps.LatLng} p1 The first lat lng point.
| |
− | * @param {google.maps.LatLng} p2 The second lat lng point.
| |
− | * @return {number} The distance between the two points in km.
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.distanceBetweenPoints_ = function(p1, p2) {
| |
− | if (!p1 || !p2) {
| |
− | return 0;
| |
− | }
| |
− |
| |
− | var R = 6371; // Radius of the Earth in km
| |
− | var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
| |
− | var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
| |
− | var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
| |
− | Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *
| |
− | Math.sin(dLon / 2) * Math.sin(dLon / 2);
| |
− | var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
| |
− | var d = R * c;
| |
− | return d;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Add a marker to a cluster, or creates a new cluster.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to add.
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.addToClosestCluster_ = function(marker) {
| |
− | var distance = 40000; // Some large number
| |
− | var clusterToAddTo = null;
| |
− | var pos = marker.getPosition();
| |
− | for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
| |
− | var center = cluster.getCenter();
| |
− | if (center) {
| |
− | var d = this.distanceBetweenPoints_(center, marker.getPosition());
| |
− | if (d < distance) {
| |
− | distance = d;
| |
− | clusterToAddTo = cluster;
| |
− | }
| |
− | }
| |
− | }
| |
− |
| |
− | if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {
| |
− | clusterToAddTo.addMarker(marker);
| |
− | } else {
| |
− | var cluster = new Cluster(this);
| |
− | cluster.addMarker(marker);
| |
− | this.clusters_.push(cluster);
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Creates the clusters.
| |
− | *
| |
− | * @private
| |
− | */
| |
− | MarkerClusterer.prototype.createClusters_ = function() {
| |
− | if (!this.ready_) {
| |
− | return;
| |
− | }
| |
− |
| |
− | // Get our current map view bounds.
| |
− | // Create a new bounds object so we don't affect the map.
| |
− | var mapBounds = new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),
| |
− | this.map_.getBounds().getNorthEast());
| |
− | var bounds = this.getExtendedBounds(mapBounds);
| |
− |
| |
− | for (var i = 0, marker; marker = this.markers_[i]; i++) {
| |
− | if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds) && marker.getVisible()) {
| |
− | this.addToClosestCluster_(marker);
| |
− | }
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * A cluster that contains markers.
| |
− | *
| |
− | * @param {MarkerClusterer} markerClusterer The markerclusterer that this
| |
− | * cluster is associated with.
| |
− | * @constructor
| |
− | * @ignore
| |
− | */
| |
− | function Cluster(markerClusterer) {
| |
− | this.markerClusterer_ = markerClusterer;
| |
− | this.map_ = markerClusterer.getMap();
| |
− | this.gridSize_ = markerClusterer.getGridSize();
| |
− | this.minClusterSize_ = markerClusterer.getMinClusterSize();
| |
− | this.averageCenter_ = markerClusterer.isAverageCenter();
| |
− | this.center_ = null;
| |
− | this.markers_ = [];
| |
− | this.bounds_ = null;
| |
− | this.clusterIcon_ = new ClusterIcon(this, markerClusterer.getStyles(),
| |
− | markerClusterer.getGridSize());
| |
− | }
| |
− |
| |
− | /**
| |
− | * Determins if a marker is already added to the cluster.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to check.
| |
− | * @return {boolean} True if the marker is already added.
| |
− | */
| |
− | Cluster.prototype.isMarkerAlreadyAdded = function(marker) {
| |
− | if (this.markers_.indexOf) {
| |
− | return this.markers_.indexOf(marker) != -1;
| |
− | } else {
| |
− | for (var i = 0, m; m = this.markers_[i]; i++) {
| |
− | if (m == marker) {
| |
− | return true;
| |
− | }
| |
− | }
| |
− | }
| |
− | return false;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Add a marker the cluster.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to add.
| |
− | * @return {boolean} True if the marker was added.
| |
− | */
| |
− | Cluster.prototype.addMarker = function(marker) {
| |
− | if (this.isMarkerAlreadyAdded(marker)) {
| |
− | return false;
| |
− | }
| |
− |
| |
− | if (!this.center_) {
| |
− | this.center_ = marker.getPosition();
| |
− | this.calculateBounds_();
| |
− | } else {
| |
− | if (this.averageCenter_) {
| |
− | var l = this.markers_.length + 1;
| |
− | var lat = (this.center_.lat() * (l-1) + marker.getPosition().lat()) / l;
| |
− | var lng = (this.center_.lng() * (l-1) + marker.getPosition().lng()) / l;
| |
− | this.center_ = new google.maps.LatLng(lat, lng);
| |
− | this.calculateBounds_();
| |
− | }
| |
− | }
| |
− |
| |
− | marker.isAdded = true;
| |
− | this.markers_.push(marker);
| |
− |
| |
− | var len = this.markers_.length;
| |
− | if (len < this.minClusterSize_ && marker.getMap() != this.map_) {
| |
− | // Min cluster size not reached so show the marker.
| |
− | marker.setMap(this.map_);
| |
− | }
| |
− |
| |
− | if (len == this.minClusterSize_) {
| |
− | // Hide the markers that were showing.
| |
− | for (var i = 0; i < len; i++) {
| |
− | this.markers_[i].setMap(null);
| |
− | }
| |
− | }
| |
− |
| |
− | if (len >= this.minClusterSize_) {
| |
− | marker.setMap(null);
| |
− | }
| |
− |
| |
− | this.updateIcon();
| |
− | return true;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the marker clusterer that the cluster is associated with.
| |
− | *
| |
− | * @return {MarkerClusterer} The associated marker clusterer.
| |
− | */
| |
− | Cluster.prototype.getMarkerClusterer = function() {
| |
− | return this.markerClusterer_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the bounds of the cluster.
| |
− | *
| |
− | * @return {google.maps.LatLngBounds} the cluster bounds.
| |
− | */
| |
− | Cluster.prototype.getBounds = function() {
| |
− | var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
| |
− | var markers = this.getMarkers();
| |
− | for (var i = 0, marker; marker = markers[i]; i++) {
| |
− | bounds.extend(marker.getPosition());
| |
− | }
| |
− | return bounds;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Removes the cluster
| |
− | */
| |
− | Cluster.prototype.remove = function() {
| |
− | this.clusterIcon_.remove();
| |
− | this.markers_.length = 0;
| |
− | delete this.markers_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the center of the cluster.
| |
− | *
| |
− | * @return {number} The cluster center.
| |
− | */
| |
− | Cluster.prototype.getSize = function() {
| |
− | return this.markers_.length;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the center of the cluster.
| |
− | *
| |
− | * @return {Array.<google.maps.Marker>} The cluster center.
| |
− | */
| |
− | Cluster.prototype.getMarkers = function() {
| |
− | return this.markers_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the center of the cluster.
| |
− | *
| |
− | * @return {google.maps.LatLng} The cluster center.
| |
− | */
| |
− | Cluster.prototype.getCenter = function() {
| |
− | return this.center_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Calculated the extended bounds of the cluster with the grid.
| |
− | *
| |
− | * @private
| |
− | */
| |
− | Cluster.prototype.calculateBounds_ = function() {
| |
− | var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
| |
− | this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Determines if a marker lies in the clusters bounds.
| |
− | *
| |
− | * @param {google.maps.Marker} marker The marker to check.
| |
− | * @return {boolean} True if the marker lies in the bounds.
| |
− | */
| |
− | Cluster.prototype.isMarkerInClusterBounds = function(marker) {
| |
− | return this.bounds_.contains(marker.getPosition());
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the map that the cluster is associated with.
| |
− | *
| |
− | * @return {google.maps.Map} The map.
| |
− | */
| |
− | Cluster.prototype.getMap = function() {
| |
− | return this.map_;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Updates the cluster icon
| |
− | */
| |
− | Cluster.prototype.updateIcon = function() {
| |
− | var zoom = this.map_.getZoom();
| |
− | var mz = this.markerClusterer_.getMaxZoom();
| |
− |
| |
− | if (mz && zoom > mz) {
| |
− | // The zoom is greater than our max zoom so show all the markers in cluster.
| |
− | for (var i = 0, marker; marker = this.markers_[i]; i++) {
| |
− | marker.setMap(this.map_);
| |
− | }
| |
− | return;
| |
− | }
| |
− |
| |
− | if (this.markers_.length < this.minClusterSize_) {
| |
− | // Min cluster size not yet reached.
| |
− | this.clusterIcon_.hide();
| |
− | return;
| |
− | }
| |
− |
| |
− | var numStyles = this.markerClusterer_.getStyles().length;
| |
− | var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);
| |
− | this.clusterIcon_.setCenter(this.center_);
| |
− | this.clusterIcon_.setSums(sums);
| |
− | this.clusterIcon_.show();
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * A cluster icon
| |
− | *
| |
− | * @param {Cluster} cluster The cluster to be associated with.
| |
− | * @param {Object} styles An object that has style properties:
| |
− | * 'url': (string) The image url.
| |
− | * 'height': (number) The image height.
| |
− | * 'width': (number) The image width.
| |
− | * 'anchor': (Array) The anchor position of the label text.
| |
− | * 'textColor': (string) The text color.
| |
− | * 'textSize': (number) The text size.
| |
− | * 'backgroundPosition: (string) The background postition x, y.
| |
− | * @param {number=} opt_padding Optional padding to apply to the cluster icon.
| |
− | * @constructor
| |
− | * @extends google.maps.OverlayView
| |
− | * @ignore
| |
− | */
| |
− | function ClusterIcon(cluster, styles, opt_padding) {
| |
− | cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
| |
− |
| |
− | this.styles_ = styles;
| |
− | this.padding_ = opt_padding || 0;
| |
− | this.cluster_ = cluster;
| |
− | this.center_ = null;
| |
− | this.map_ = cluster.getMap();
| |
− | this.div_ = null;
| |
− | this.sums_ = null;
| |
− | this.visible_ = false;
| |
− |
| |
− | this.setMap(this.map_);
| |
− | }
| |
− |
| |
− |
| |
− | /**
| |
− | * Triggers the clusterclick event and zoom's if the option is set.
| |
− | */
| |
− | ClusterIcon.prototype.triggerClusterClick = function() {
| |
− | var markerClusterer = this.cluster_.getMarkerClusterer();
| |
− |
| |
− | // Trigger the clusterclick event.
| |
− | google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_);
| |
− |
| |
− | if (markerClusterer.isZoomOnClick()) {
| |
− | // Zoom into the cluster.
| |
− | this.map_.fitBounds(this.cluster_.getBounds());
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Adding the cluster icon to the dom.
| |
− | * @ignore
| |
− | */
| |
− | ClusterIcon.prototype.onAdd = function() {
| |
− | this.div_ = document.createElement('DIV');
| |
− | if (this.visible_) {
| |
− | var pos = this.getPosFromLatLng_(this.center_);
| |
− | this.div_.style.cssText = this.createCss(pos);
| |
− | this.div_.innerHTML = this.sums_.text;
| |
− | }
| |
− |
| |
− | var panes = this.getPanes();
| |
− | panes.overlayMouseTarget.appendChild(this.div_);
| |
− |
| |
− | var that = this;
| |
− | google.maps.event.addDomListener(this.div_, 'click', function() {
| |
− | that.triggerClusterClick();
| |
− | });
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Returns the position to place the div dending on the latlng.
| |
− | *
| |
− | * @param {google.maps.LatLng} latlng The position in latlng.
| |
− | * @return {google.maps.Point} The position in pixels.
| |
− | * @private
| |
− | */
| |
− | ClusterIcon.prototype.getPosFromLatLng_ = function(latlng) {
| |
− | var pos = this.getProjection().fromLatLngToDivPixel(latlng);
| |
− | pos.x -= parseInt(this.width_ / 2, 10);
| |
− | pos.y -= parseInt(this.height_ / 2, 10);
| |
− | return pos;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Draw the icon.
| |
− | * @ignore
| |
− | */
| |
− | ClusterIcon.prototype.draw = function() {
| |
− | if (this.visible_) {
| |
− | var pos = this.getPosFromLatLng_(this.center_);
| |
− | this.div_.style.top = pos.y + 'px';
| |
− | this.div_.style.left = pos.x + 'px';
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Hide the icon.
| |
− | */
| |
− | ClusterIcon.prototype.hide = function() {
| |
− | if (this.div_) {
| |
− | this.div_.style.display = 'none';
| |
− | }
| |
− | this.visible_ = false;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Position and show the icon.
| |
− | */
| |
− | ClusterIcon.prototype.show = function() {
| |
− | if (this.div_) {
| |
− | var pos = this.getPosFromLatLng_(this.center_);
| |
− | this.div_.style.cssText = this.createCss(pos);
| |
− | this.div_.style.display = '';
| |
− | }
| |
− | this.visible_ = true;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Remove the icon from the map
| |
− | */
| |
− | ClusterIcon.prototype.remove = function() {
| |
− | this.setMap(null);
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Implementation of the onRemove interface.
| |
− | * @ignore
| |
− | */
| |
− | ClusterIcon.prototype.onRemove = function() {
| |
− | if (this.div_ && this.div_.parentNode) {
| |
− | this.hide();
| |
− | this.div_.parentNode.removeChild(this.div_);
| |
− | this.div_ = null;
| |
− | }
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Set the sums of the icon.
| |
− | *
| |
− | * @param {Object} sums The sums containing:
| |
− | * 'text': (string) The text to display in the icon.
| |
− | * 'index': (number) The style index of the icon.
| |
− | */
| |
− | ClusterIcon.prototype.setSums = function(sums) {
| |
− | this.sums_ = sums;
| |
− | this.text_ = sums.text;
| |
− | this.index_ = sums.index;
| |
− | if (this.div_) {
| |
− | this.div_.innerHTML = sums.text;
| |
− | }
| |
− |
| |
− | this.useStyle();
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Sets the icon to the the styles.
| |
− | */
| |
− | ClusterIcon.prototype.useStyle = function() {
| |
− | var index = Math.max(0, this.sums_.index - 1);
| |
− | index = Math.min(this.styles_.length - 1, index);
| |
− | var style = this.styles_[index];
| |
− | this.url_ = style['url'];
| |
− | this.height_ = style['height'];
| |
− | this.width_ = style['width'];
| |
− | this.textColor_ = style['textColor'];
| |
− | this.anchor_ = style['anchor'];
| |
− | this.textSize_ = style['textSize'];
| |
− | this.backgroundPosition_ = style['backgroundPosition'];
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Sets the center of the icon.
| |
− | *
| |
− | * @param {google.maps.LatLng} center The latlng to set as the center.
| |
− | */
| |
− | ClusterIcon.prototype.setCenter = function(center) {
| |
− | this.center_ = center;
| |
− | };
| |
− |
| |
− |
| |
− | /**
| |
− | * Create the css text based on the position of the icon.
| |
− | *
| |
− | * @param {google.maps.Point} pos The position.
| |
− | * @return {string} The css style text.
| |
− | */
| |
− | ClusterIcon.prototype.createCss = function(pos) {
| |
− | var style = [];
| |
− | style.push('background-image:url(' + this.url_ + ');');
| |
− | var backgroundPosition = this.backgroundPosition_ ? this.backgroundPosition_ : '0 0';
| |
− | style.push('background-position:' + backgroundPosition + ';');
| |
− |
| |
− | if (typeof this.anchor_ === 'object') {
| |
− | if (typeof this.anchor_[0] === 'number' && this.anchor_[0] > 0 &&
| |
− | this.anchor_[0] < this.height_) {
| |
− | style.push('height:' + (this.height_ - this.anchor_[0]) +
| |
− | 'px; padding-top:' + this.anchor_[0] + 'px;');
| |
− | } else {
| |
− | style.push('height:' + this.height_ + 'px; line-height:' + this.height_ +
| |
− | 'px;');
| |
− | }
| |
− | if (typeof this.anchor_[1] === 'number' && this.anchor_[1] > 0 &&
| |
− | this.anchor_[1] < this.width_) {
| |
− | style.push('width:' + (this.width_ - this.anchor_[1]) +
| |
− | 'px; padding-left:' + this.anchor_[1] + 'px;');
| |
− | } else {
| |
− | style.push('width:' + this.width_ + 'px; text-align:center;');
| |
− | }
| |
− | } else {
| |
− | style.push('height:' + this.height_ + 'px; line-height:' +
| |
− | this.height_ + 'px; width:' + this.width_ + 'px; text-align:center;');
| |
− | }
| |
− |
| |
− | var txtColor = this.textColor_ ? this.textColor_ : 'black';
| |
− | var txtSize = this.textSize_ ? this.textSize_ : 11;
| |
− |
| |
− | style.push('cursor:pointer; top:' + pos.y + 'px; left:' +
| |
− | pos.x + 'px; color:' + txtColor + '; position:absolute; font-size:' +
| |
− | txtSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
| |
− | return style.join('');
| |
− | };
| |
− |
| |
− |
| |
− | // Export Symbols for Closure
| |
− | // If you are not going to compile with closure then you can remove the
| |
− | // code below.
| |
− | window['MarkerClusterer'] = MarkerClusterer;
| |
− | MarkerClusterer.prototype['addMarker'] = MarkerClusterer.prototype.addMarker;
| |
− | MarkerClusterer.prototype['addMarkers'] = MarkerClusterer.prototype.addMarkers;
| |
− | MarkerClusterer.prototype['clearMarkers'] =
| |
− | MarkerClusterer.prototype.clearMarkers;
| |
− | MarkerClusterer.prototype['fitMapToMarkers'] =
| |
− | MarkerClusterer.prototype.fitMapToMarkers;
| |
− | MarkerClusterer.prototype['getCalculator'] =
| |
− | MarkerClusterer.prototype.getCalculator;
| |
− | MarkerClusterer.prototype['getGridSize'] =
| |
− | MarkerClusterer.prototype.getGridSize;
| |
− | MarkerClusterer.prototype['getExtendedBounds'] =
| |
− | MarkerClusterer.prototype.getExtendedBounds;
| |
− | MarkerClusterer.prototype['getMap'] = MarkerClusterer.prototype.getMap;
| |
− | MarkerClusterer.prototype['getMarkers'] = MarkerClusterer.prototype.getMarkers;
| |
− | MarkerClusterer.prototype['getMaxZoom'] = MarkerClusterer.prototype.getMaxZoom;
| |
− | MarkerClusterer.prototype['getStyles'] = MarkerClusterer.prototype.getStyles;
| |
− | MarkerClusterer.prototype['getTotalClusters'] =
| |
− | MarkerClusterer.prototype.getTotalClusters;
| |
− | MarkerClusterer.prototype['getTotalMarkers'] =
| |
− | MarkerClusterer.prototype.getTotalMarkers;
| |
− | MarkerClusterer.prototype['redraw'] = MarkerClusterer.prototype.redraw;
| |
− | MarkerClusterer.prototype['removeMarker'] =
| |
− | MarkerClusterer.prototype.removeMarker;
| |
− | MarkerClusterer.prototype['removeMarkers'] =
| |
− | MarkerClusterer.prototype.removeMarkers;
| |
− | MarkerClusterer.prototype['resetViewport'] =
| |
− | MarkerClusterer.prototype.resetViewport;
| |
− | MarkerClusterer.prototype['repaint'] =
| |
− | MarkerClusterer.prototype.repaint;
| |
− | MarkerClusterer.prototype['setCalculator'] =
| |
− | MarkerClusterer.prototype.setCalculator;
| |
− | MarkerClusterer.prototype['setGridSize'] =
| |
− | MarkerClusterer.prototype.setGridSize;
| |
− | MarkerClusterer.prototype['setMaxZoom'] =
| |
− | MarkerClusterer.prototype.setMaxZoom;
| |
− | MarkerClusterer.prototype['onAdd'] = MarkerClusterer.prototype.onAdd;
| |
− | MarkerClusterer.prototype['draw'] = MarkerClusterer.prototype.draw;
| |
− |
| |
− | Cluster.prototype['getCenter'] = Cluster.prototype.getCenter;
| |
− | Cluster.prototype['getSize'] = Cluster.prototype.getSize;
| |
− | Cluster.prototype['getMarkers'] = Cluster.prototype.getMarkers;
| |
− |
| |
− | ClusterIcon.prototype['onAdd'] = ClusterIcon.prototype.onAdd;
| |
− | ClusterIcon.prototype['draw'] = ClusterIcon.prototype.draw;
| |
− | ClusterIcon.prototype['onRemove'] = ClusterIcon.prototype.onRemove;
| |
− | ;
| |