Make WordPress Core

Ticket #50564: 50564.diff

File 50564.diff, 741.1 KB (added by azaozz, 5 years ago)
  • Gruntfile.js

     
    185185                                                [ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ],
    186186                                                [ WORKING_DIR + 'wp-includes/js/twemoji.js' ]: [ './node_modules/twemoji/dist/twemoji.js' ],
    187187                                                [ WORKING_DIR + 'wp-includes/js/underscore.js' ]: [ './node_modules/underscore/underscore.js' ],
    188                                         },
    189                                         {
    190                                                 expand: true,
    191                                                 cwd: './node_modules/jquery-ui/ui/',
    192                                                 src: '*.js',
    193                                                 dest: SOURCE_DIR + 'wp-includes/js/jquery/ui/'
    194188                                        }
    195189                                ]
    196190                        },
     
    727721                                ext: '.min.js',
    728722                                src: ['wp-includes/js/wp-embed.js']
    729723                        },
    730                         jqueryui: {
     724                        'jquery-ui': {
    731725                                options: {
    732726                                        // Preserve comments that start with a bang.
    733727                                        output: {
     
    735729                                        }
    736730                                },
    737731                                expand: true,
    738                                 cwd: 'node_modules/jquery-ui/ui/',
     732                                cwd: WORKING_DIR + 'wp-includes/js/jquery/ui/',
    739733                                dest: WORKING_DIR + 'wp-includes/js/jquery/ui/',
    740734                                ext: '.min.js',
    741735                                src: ['*.js']
     
    13851379        grunt.registerTask( 'uglify:all', [
    13861380                'uglify:core',
    13871381                'uglify:embed',
    1388                 'uglify:jqueryui',
     1382                'uglify:jquery-ui',
    13891383                'uglify:imgareaselect',
    13901384                'uglify:jqueryform',
    13911385                'uglify:moment'
  • package-lock.json

     
    1590815908                        }
    1590915909                },
    1591015910                "jquery-migrate": {
    15911                         "version": "1.4.1",
    15912                         "resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
    15913                         "integrity": "sha1-hRUvPsmalWJfT30Lz2LpuGOPWnY=",
     15911                        "version": "3.3.1",
     15912                        "resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.3.1.tgz",
     15913                        "integrity": "sha512-QAXfshB6xqaANDX8OPExKnnooLtX0cSDCKfRnqhdv+3CVEVD9L1v3zNAhZum/4AukKlWUWUoxM6ywJJcLMXLSA==",
    1591415914                        "dev": true
    1591515915                },
    15916                 "jquery-ui": {
    15917                         "version": "https://github.com/jquery/jquery-ui/archive/1.11.4.tar.gz",
    15918                         "integrity": "sha512-yMLXNruSte8iAAOsShJvUdcwgrHbWrxBCoKfPGqDmgFkfNLbnXoHcyxgOvI2IbgfupFF2paOm0AvOq6iERedKQ=="
    15919                 },
    1592015916                "js-base64": {
    1592115917                        "version": "2.5.2",
    1592215918                        "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz",
  • package.json

     
    6161                "grunt-webpack": "^3.1.3",
    6262                "ink-docstrap": "1.3.2",
    6363                "install-changed": "1.1.0",
    64                 "jquery-migrate": "1.4.1",
     64                "jquery-migrate": "3.3.1",
    6565                "matchdep": "~2.0.0",
    6666                "node-sass": "~4.14.1",
    6767                "prettier": "npm:wp-prettier@2.0.5",
     
    137137                "jquery-color": "https://github.com/jquery/jquery-color/archive/2.1.2.tar.gz",
    138138                "jquery-form": "4.2.1",
    139139                "jquery-hoverintent": "1.8.3",
    140                 "jquery-ui": "https://github.com/jquery/jquery-ui/archive/1.11.4.tar.gz",
    141140                "lodash": "4.17.19",
    142141                "masonry-layout": "4.2.2",
    143142                "moment": "2.27.0",
  • src/js/_enqueues/vendor/jquery/jquery.js

     
    1 /*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license | WordPress 2019-05-16 */
    2 !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=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],"__proto__"!==d&&g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;d<c;d++)if(!1===b.call(a[d],d,a[d]))break}else for(d in a)if(!1===b.call(a[d],d,a[d]))break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?c<0?Math.max(0,d+c):c:0;c<d;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(d<c)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;f<g;f++)(d=!b(a[f],f))!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;g<d;g++)null!=(e=b(a[g],g,c))&&h.push(e);else for(g in a)null!=(e=b(a[g],g,c))&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;if("string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a))return c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"!==c&&!n.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=fa(),z=fa(),A=fa(),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;c<d;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="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),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")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(xa){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 ea(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+pa(r[h]);s=r.join(","),w=_.test(a)&&na(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function fa(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ga(a){return a[u]=!0,a}function ha(a){var b=n.createElement("div");try{return!!a(b)}catch(xa){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ia(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ja(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 ka(a){return function(b){return"input"===b.nodeName.toLowerCase()&&b.type===a}}function la(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ma(a){return ga(function(b){return b=+b,ga(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 na(a){return a&&void 0!==a.getElementsByTagName&&a}c=ea.support={},f=ea.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ea.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ha(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ha(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ha(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(void 0!==b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c=void 0!==a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return void 0!==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){if(void 0!==b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ha(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' 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(".#.+[+~]")}),ha(function(a){var b=n.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=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ha(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.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=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||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,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ja(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ja(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ea.matches=function(a,b){return ea(a,null,null,b)},ea.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!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(xa){}return ea(b,n,null,[a]).length>0},ea.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ea.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},ea.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ea.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=ea.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=ea.selectors={cacheLength:50,createPseudo:ga,match:W,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(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===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]||ea.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]&&ea.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.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(ba,ca).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||void 0!==a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ea.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(P," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},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,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),!1===t)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return(t-=e)===d||t%d==0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ea.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ga(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:ga(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ga(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:ga(function(a){return function(b){return ea(a,b).length>0}}),contains:ga(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ga(function(a){return V.test(a||"")||ea.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do{if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return(c=c.toLowerCase())===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!1===a.disabled},disabled:function(a){return!0===a.disabled},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,!0===a.selected},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 Y.test(a.nodeName)},input:function(a){return X.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:ma(function(){return[0]}),last:ma(function(a,b){return[b-1]}),eq:ma(function(a,b,c){return[c<0?c+b:c]}),even:ma(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:ma(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:ma(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:ma(function(a,b,c){for(var d=c<0?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]=ka(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=la(b);function oa(){}oa.prototype=d.filters=d.pseudos,d.setFilters=new oa,g=ea.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=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[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?ea.error(a):z(a,i).slice(0)};function pa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function qa(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,k=[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(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function ra(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 sa(a,b,c){for(var d=0,e=b.length;d<e;d++)ea(a,b[d],c);return c}function ta(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function ua(a,b,c,d,e,f){return d&&!d[u]&&(d=ua(d)),e&&!e[u]&&(e=ua(e,f)),ga(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||sa(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ta(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ta(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=ta(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function va(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=qa(function(a){return a===b},h,!0),l=qa(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}];i<f;i++)if(c=d.relative[a[i].type])m=[qa(ra(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return ua(i>1&&ra(m),i>1&&pa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,i<e&&va(a.slice(i,e)),e<f&&va(a=a.slice(e)),e<f&&pa(a))}m.push(c)}return ra(m)}function wa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ta(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ea.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ga(f):f}return h=ea.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=va(b[c]),f[u]?d.push(f):e.push(f);f=A(a,wa(e,d)),f.selector=a}return f},i=ea.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(ba,ca),b)||[])[0]))return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.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(ba,ca),_.test(j[0].type)&&na(b.parentNode)||b))){if(j.splice(i,1),!(a=f.length&&pa(j)))return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&na(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ha(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ha(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ia("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ha(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ia("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ha(function(a){return null==a.getAttribute("disabled")})||ia(K,function(a,b,c){var d;if(!c)return!0===a[b]?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ea}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;b<e;b++)if(n.contains(d[b],this))return!0}));for(b=0;b<e;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/;(n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(!(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a))||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if((f=d.getElementById(e[2]))&&f.parentNode){if(f.id!==e[2])return A.find(a);this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))}).prototype=n.fn,A=n(d);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do{a=a[b]}while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.uniqueSort(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g;function G(a){var b={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)!1===f[h].apply(c[0],c[1])&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function b(c){n.each(c,function(c,d){n.isFunction(d)?a.unique&&j.has(d)||f.push(d):d&&d.length&&"string"!==n.type(d)&&b(d)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);b<d;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(!0===a?--n.readyWait:n.isReady)||(n.isReady=!0,!0!==a&&--n.readyWait>0||(H.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function I(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J)):(d.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(I(),n.ready())}n.ready.promise=function(b){if(!H)if(H=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll)a.setTimeout(n.ready);else if(d.addEventListener)d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J);else{d.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&function b(){if(!n.isReady){try{c.doScroll("left")}catch(e){return a.setTimeout(b,50)}I(),n.ready()}}()}return H.promise(b)},n.ready.promise();var K;for(K in n(l))break;l.ownFirst="0"===K,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;(c=d.getElementsByTagName("body")[0])&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),void 0!==b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var L=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return(1===c||9===c)&&(!b||!0!==b&&a.getAttribute("classid")===b)},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("string"==typeof(c=a.getAttribute(d))){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:M.test(c)?n.parseJSON(c):c)}catch(e){}n.data(a,b,c)}else c=void 0}return c}function P(a){var b
    3 ;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(L(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.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()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?null==(f=g[b])&&(f=g[n.camelCase(b)]):f=g,f}}function R(a,b,c){if(L(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return!!(a=a.nodeType?n.cache[a[n.expando]]:a[n.expando])&&!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)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),O(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?O(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.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=n._data(f[g],a+"queueHooks"))&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}}),function(){var a;l.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,e;return(c=d.getElementsByTagName("body")[0])&&c.style?(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),void 0!==b.style.zoom&&(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(d.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(e),a):void 0}}();var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do{f=f||".5",k/=f,n.style(a,b,k+j)}while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)X(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;h<i;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},Y=/^(?:checkbox|radio)$/i,Z=/<([\w:-]+)/,$=/^$|\/(?:java|ecma)script/i,_=/^\s+/,aa="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ba(a){var b=aa.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var ca={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:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]};ca.optgroup=ca.option,ca.tbody=ca.tfoot=ca.colgroup=ca.caption=ca.thead,ca.th=ca.td;function da(a,b){var c,d,e=0,f=void 0!==a.getElementsByTagName?a.getElementsByTagName(b||"*"):void 0!==a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,da(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function ea(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}var fa=/<|&#?\w+;/,ga=/<tbody/i;function ha(a){Y.test(a.type)&&(a.defaultChecked=a.checked)}function ia(a,b,c,d,e){for(var f,g,h,i,j,k,m,o=a.length,p=ba(b),q=[],r=0;r<o;r++)if((g=a[r])||0===g)if("object"===n.type(g))n.merge(q,g.nodeType?[g]:g);else if(fa.test(g)){i=i||p.appendChild(b.createElement("div")),j=(Z.exec(g)||["",""])[1].toLowerCase(),m=ca[j]||ca._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--)i=i.lastChild;if(!l.leadingWhitespace&&_.test(g)&&q.push(b.createTextNode(_.exec(g)[0])),!l.tbody){g="table"!==j||ga.test(g)?"<table>"!==m[1]||ga.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--)n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild)i.removeChild(i.firstChild);i=p.lastChild}else q.push(b.createTextNode(g));i&&p.removeChild(i),l.appendChecked||n.grep(da(q,"input"),ha),r=0;while(g=q[r++])if(d&&n.inArray(g,d)>-1)e&&e.push(g);else if(h=n.contains(g.ownerDocument,g),i=da(p.appendChild(g),"script"),h&&ea(i),c){f=0;while(g=i[f++])$.test(g.type||"")&&c.push(g)}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=!1===e.attributes[c].expando);e=null}();var ja=/^(?:input|select|textarea)$/i,ka=/^key/,la=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ma=/^(?:focusinfocus|focusoutblur)$/,na=/^([^.]*)(?:\.(.+)|)/;function oa(){return!0}function pa(){return!1}function qa(){try{return d.activeElement}catch(a){}}function ra(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ra(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),!1===e)e=pa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return void 0===n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=na.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&!1!==j.setup.call(a,d,p,k)||(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?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=na.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&!1!==l.teardown.call(a,p,r.handle)||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ma.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||!1!==l.trigger.apply(e,c))){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,ma.test(j+q)||(i=i.parentNode);i;i=i.parentNode)p.push(i),m=i;m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped())b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),(g=h&&i[h])&&g.apply&&L(i)&&(b.result=g.apply(i,c),!1===b.result&&b.preventDefault());if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||!1===l._default.apply(p.pop(),c))&&L(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||!1!==k.preDispatch.call(this,a)){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,void 0!==(d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i))&&!1===(a.result=d)&&(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&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(!0!==i.disabled||"click"!==a.type)){for(d=[],c=0;c<h;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=la.test(f)?this.mouseHooks:ka.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=g.srcElement||d),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,h.filter?h.filter(a,g):a},props:"altKey bubbles cancelable ctrlKey currentTarget detail 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,e,f,g=b.button,h=b.fromElement;return null==a.pageX&&null!=b.clientX&&(e=a.target.ownerDocument||d,f=e.documentElement,c=e.body,a.pageX=b.clientX+(f&&f.scrollLeft||c&&c.scrollLeft||0)-(f&&f.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(f&&f.scrollTop||c&&c.scrollTop||0)-(f&&f.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?b.toElement:h),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==qa()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){if(this===qa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(n.nodeName(this,"input")&&"checkbox"===this.type&&this.click)return this.click(),!1},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=d.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)}:function(a,b,c){var d="on"+b;a.detachEvent&&(void 0===a[d]&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){if(!(this instanceof n.Event))return new n.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&!1===a.returnValue?oa:pa):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),this[n.expando]=!0},n.Event.prototype={constructor:n.Event,isDefaultPrevented:pa,isPropagationStopped:pa,isImmediatePropagationStopped:pa,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=oa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=oa,a&&!this.isSimulated&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=oa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submit||(n.event.special.submit={setup:function(){if(n.nodeName(this,"form"))return!1;n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?n.prop(b,"form"):void 0;c&&!n._data(c,"submit")&&(n.event.add(c,"submit._submit",function(a){a._submitBubble=!0}),n._data(c,"submit",!0))})},postDispatch:function(a){a._submitBubble&&(delete a._submitBubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a))},teardown:function(){if(n.nodeName(this,"form"))return!1;n.event.remove(this,"._submit")}}),l.change||(n.event.special.change={setup:function(){if(ja.test(this.nodeName))return"checkbox"!==this.type&&"radio"!==this.type||(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._justChanged=!0)}),n.event.add(this,"click._change",function(a){this._justChanged&&!a.isTrigger&&(this._justChanged=!1),n.event.simulate("change",this,a)})),!1;n.event.add(this,"beforeactivate._change",function(a){var b=a.target;ja.test(b.nodeName)&&!n._data(b,"change")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a)}),n._data(b,"change",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type)return a.handleObj.handler.apply(this,arguments)},teardown:function(){return n.event.remove(this,"._change"),!ja.test(this.nodeName)}}),l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d){return ra(this,a,b,c,d)},one:function(a,b,c,d){return ra(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(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!1!==b&&"function"!=typeof b||(c=b,b=void 0),!1===c&&(c=pa),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return n.event.trigger(a,b,c,!0)}});var sa=/ jQuery\d+="(?:null|\d+)"/g,ta=new RegExp("<(?:"+aa+")[\\s/>]","i"),ua=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,va=/<script|<style|<link/i,wa=/checked\s*(?:[^=]|=\s*.checked.)/i,xa=/^true\/(.*)/,ya=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,za=ba(d),Aa=za.appendChild(d.createElement("div"));function Ba(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Ca(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function Da(a){var b=xa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ea(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Fa(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(Ca(b).text=a.text,Da(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Y.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)}}function Ga(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&wa.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),Ga(f,b,c,d)});if(o&&(k=ia(b,a[0].ownerDocument,!1,a,d),e=k.firstChild,1===k.childNodes.length&&(k=e),e||d)){for(i=n.map(da(k,"script"),Ca),h=i.length;m<o;m++)g=k,m!==p&&(g=n.clone(g,!0,!0),h&&n.merge(i,da(g,"script"))),c.call(a[m],g,m);if(h)for(j=i[i.length-1].ownerDocument,n.map(i,Da),m=0;m<h;m++)g=i[m],$.test(g.type||"")&&!n._data(g,"globalEval")&&n.contains(j,g)&&(g.src?n._evalUrl&&n._evalUrl(g.src):n.globalEval((g.text||g.textContent||g.innerHTML||"").replace(ya,"")));k=e=null}return a}function Ha(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(da(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&ea(da(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ua,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!ta.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(Aa.innerHTML=a.outerHTML,Aa.removeChild(f=Aa.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=da(f),h=da(a),g=0;null!=(e=h[g]);++g)d[g]&&Fa(e,d[g]);if(b)if(c)for(h=h||da(a),d=d||da(f),g=0;null!=(e=h[g]);g++)Ea(e,d[g]);else Ea(a,f);return d=da(f,"script"),d.length>0&&ea(d,!i&&da(a,"script")),d=h=e=null,f},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.attributes,m=n.event.special;null!=(d=a[h]);h++)if((b||L(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k||void 0===d.removeAttribute?d[i]=void 0:d.removeAttribute(i),c.push(f))}}}),n.fn.extend({domManip:Ga,detach:function(a){return Ha(this,a,!0)},remove:function(a){return Ha(this,a)},text:function(a){return X(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||d).createTextNode(a))},null,a,arguments.length)},append:function(){return Ga(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){Ba(this,a).appendChild(a)}})},prepend:function(){return Ga(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ba(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ga(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ga(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(da(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return X(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(sa,""):void 0;if("string"==typeof a&&!va.test(a)&&(l.htmlSerialize||!ta.test(a))&&(l.leadingWhitespace||!_.test(a))&&!ca[(Z.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(da(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ga(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(da(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],f=n(a),h=f.length-1;d<=h;d++)c=d===h?this:this.clone(!0),n(f[d])[b](c),g.apply(e,c.get());return this.pushStack(e)}});var Ia,Ja={HTML:"block",BODY:"block"};function Ka(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function La(a){var b=d,c=Ja[a];return c||(c=Ka(a,b),"none"!==c&&c||(Ia=(Ia||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ia[0].contentWindow||Ia[0].contentDocument).document,b.write(),b.close(),c=Ka(a,b),Ia.detach()),Ja[a]=c),c}var Ma=/^margin/,Na=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Oa=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},Pa=d.documentElement;!function(){var b,c,e,f,g,h,i=d.createElement("div"),j=d.createElement("div");function k(){var k,l,m=d.documentElement;m.appendChild(i),j.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",b=e=h=!1,c=g=!0,a.getComputedStyle&&(l=a.getComputedStyle(j),b="1%"!==(l||{}).top,h="2px"===(l||{}).marginLeft,e="4px"===(l||{width:"4px"}).width,j.style.marginRight="50%",c="4px"===(l||{marginRight:"4px"}).marginRight,k=j.appendChild(d.createElement("div")),k.style.cssText=j.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",k.style.marginRight=k.style.width="0",j.style.width="1px",g=!parseFloat((a.getComputedStyle(k)||{}).marginRight),j.removeChild(k)),j.style.display="none",f=0===j.getClientRects().length,f&&(j.style.display="",j.innerHTML="<table><tr><td></td><td>t</td></tr></table>",j.childNodes[0].style.borderCollapse="separate",k=j.getElementsByTagName("td"),k[0].style.cssText="margin:0;border:0;padding:0;display:none",(f=0===k[0].offsetHeight)&&(k[0].style.display="",k[1].style.display="none",f=0===k[0].offsetHeight)),m.removeChild(i)}j.style&&(j.style.cssText="float:left;opacity:.5",l.opacity="0.5"===j.style.opacity,l.cssFloat=!!j.style.cssFloat,j.style.backgroundClip="content-box",j.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===j.style.backgroundClip,i=d.createElement("div"),i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",j.innerHTML="",i.appendChild(j),l.boxSizing=""===j.style.boxSizing||""===j.style.MozBoxSizing||""===j.style.WebkitBoxSizing,n.extend(l,{reliableHiddenOffsets:function(){return null==b&&k(),f},boxSizingReliable:function(){return null==b&&k(),e},pixelMarginRight:function(){return null==b&&k(),c},pixelPosition:function(){return null==b&&k(),b},reliableMarginRight:function(){return null==b&&k(),g},reliableMarginLeft:function(){return null==b&&k(),h}}))}();var Qa,Ra,Sa=/^(top|right|bottom|left)$/;a.getComputedStyle?(Qa=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Ra=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Qa(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Na.test(g)&&Ma.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+""}):Pa.currentStyle&&(Qa=function(a){return a.currentStyle},Ra=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Qa(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Na.test(g)&&!Sa.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 Ta(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ua=/alpha\([^)]*\)/i,Va=/opacity\s*=\s*([^)]*)/i,Wa=/^(none|table(?!-c[ea]).+)/,Xa=new RegExp("^("+S+")(.*)$","i"),Ya={position:"absolute",visibility:"hidden",display:"block"},Za={letterSpacing:"0",fontWeight:"400"},$a=["Webkit","O","Moz","ms"],_a=d.createElement("div").style;function ab(a){if(a in _a)return a;var b=a.charAt(0).toUpperCase()+a.slice(1),c=$a.length;while(c--)if((a=$a[c]+b)in _a)return a}function bb(a,b){for(var c,d,e,f=[],g=0,h=a.length;g<h;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=n._data(d,"olddisplay",La(d.nodeName)))):(e=V(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;g<h;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function cb(a,b,c){var d=Xa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function db(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;f<4;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function eb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Qa(a),g=l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,f);if(e<=0||null==e){if(e=Ra(a,b,f),(e<0||null==e)&&(e=a.style[b]),Na.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+db(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ra(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=ab(h)||h),g=n.cssHooks[b]||n.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=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.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=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=ab(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ra(a,b,d)),"normal"===f&&b in Za&&(f=Za[b]),""===c||c?(e=parseFloat(f),!0===c||isFinite(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){if(c)return Wa.test(n.css(a,"display"))&&0===a.offsetWidth?Oa(a,Ya,function(){return eb(a,b,d)}):eb(a,b,d)},set:function(a,c,d){var e=d&&Qa(a);return cb(a,c,d?db(a,b,d,l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Va.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=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Ua,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ua.test(f)?f.replace(Ua,e):f+" "+e)}}),n.cssHooks.marginRight=Ta(l.reliableMarginRight,function(a,b){if(b)return Oa(a,{display:"inline-block"},Ra,[a,"marginRight"])}),n.cssHooks.marginLeft=Ta(l.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Ra(a,"marginLeft"))||(n.contains(a.ownerDocument,a)?a.getBoundingClientRect().left-Oa(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}):0))+"px"}),n.each({
    4 margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Ma.test(a)||(n.cssHooks[a+b].set=cb)}),n.fn.extend({css:function(a,b){return X(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Qa(a),e=b.length;g<e;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return bb(this,!0)},hide:function(){return bb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function fb(a,b,c,d,e){return new fb.prototype.init(a,b,c,d,e)}n.Tween=fb,fb.prototype={constructor:fb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=fb.propHooks[this.prop];return a&&a.get?a.get(this):fb.propHooks._default.get(this)},run:function(a){var b,c=fb.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=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):fb.propHooks._default.set(this),this}},fb.prototype.init.prototype=fb.prototype,fb.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},fb.propHooks.scrollTop=fb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=fb.prototype.init,n.fx.step={};var gb,hb,ib=/^(?:toggle|show|hide)$/,jb=/queueHooks$/;function kb(){return a.setTimeout(function(){gb=void 0}),gb=n.now()}function lb(a,b){var c,d={height:a},e=0;for(b=b?1:0;e<4;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function mb(a,b,c){for(var d,e=(pb.tweeners[b]||[]).concat(pb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function nb(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.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=n.css(a,"display"),"inline"===(k="none"===j?n._data(a,"olddisplay")||La(a.nodeName):j)&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==La(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.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],ib.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]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(o))"inline"===("none"===j?La(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=mb(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function ob(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),(g=n.cssHooks[d])&&"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 pb(a,b,c){var d,e,f=0,g=pb.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=gb||kb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:gb||kb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.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;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(ob(k,j.opts.specialEasing);f<g;f++)if(d=pb.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,mb,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.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)}n.Animation=n.extend(pb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(F);for(var c,d=0,e=a.length;d<e;d++)c=a[d],pb.tweeners[c]=pb.tweeners[c]||[],pb.tweeners[c].unshift(b)},prefilters:[nb],prefilter:function(a,b){b?pb.prefilters.unshift(a):pb.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&!0!==d.queue||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=pb(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||!1===f.queue?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&&!1!==a&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&jb.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||n.dequeue(this,a)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.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;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(lb(b,!0),a,d,e)}}),n.each({slideDown:lb("show"),slideUp:lb("hide"),slideToggle:lb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(gb=n.now();c<b.length;c++)(a=b[c])()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),gb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){hb||(hb=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(hb),hb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a,b=d.createElement("input"),c=d.createElement("div"),e=d.createElement("select"),f=e.appendChild(d.createElement("option"));c=d.createElement("div"),c.setAttribute("className","t"),c.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],b.setAttribute("type","checkbox"),c.appendChild(b),a=c.getElementsByTagName("a")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==c.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=f.selected,l.enctype=!!d.createElement("form").enctype,e.disabled=!0,l.optDisabled=!f.disabled,b=d.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value}();var qb=/\r/g,rb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),(b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()])&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return(b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()])&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(qb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(rb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||e<0,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i<h;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>-1)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){if(n.isArray(b))return a.checked=n.inArray(n(a).val(),b)>-1}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb,tb,ub=n.expr.attrHandle,vb=/^(?:checked|selected)$/i,wb=l.getSetAttribute,xb=l.input;n.fn.extend({attr:function(a,b){return X(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return void 0===a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?tb:sb)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(F);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?xb&&wb||!vb.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(wb?c:d)}}),tb={set:function(a,b,c){return!1===b?n.removeAttr(a,c):xb&&wb||!vb.test(c)?a.setAttribute(!wb&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ub[b]||n.find.attr;xb&&wb||!vb.test(b)?ub[b]=function(a,b,d){var e,f;return d||(f=ub[b],ub[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ub[b]=f),e}:ub[b]=function(a,b,c){if(!c)return a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),xb&&wb||(n.attrHooks.value={set:function(a,b,c){if(!n.nodeName(a,"input"))return sb&&sb.set(a,b,c);a.defaultValue=b}}),wb||(sb={set:function(a,b,c){var d=a.getAttributeNode(c);if(d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c))return b}},ub.id=ub.name=ub.coords=function(a,b,c){var d;if(!c)return(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);if(c&&c.specified)return c.value},set:sb.set},n.attrHooks.contenteditable={set:function(a,b,c){sb.set(a,""!==b&&b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){if(""===c)return a.setAttribute(b,"auto"),c}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var yb=/^(?:input|select|textarea|button|object)$/i,zb=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return X(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.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=n.find.attr(a,"tabindex");return b?parseInt(b,10):yb.test(a.nodeName)||zb.test(a.nodeName)&&a.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var Ab=/[\t\r\n\f]/g;function Bb(a){return n.attr(a,"class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,Bb(this)))});if("string"==typeof a&&a){b=a.match(F)||[];while(c=this[i++])if(e=Bb(c),d=1===c.nodeType&&(" "+e+" ").replace(Ab," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,Bb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(F)||[];while(c=this[i++])if(e=Bb(c),d=1===c.nodeType&&(" "+e+" ").replace(Ab," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,Bb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(F)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=Bb(this),b&&n._data(this,"__className__",b),n.attr(this,"class",b||!1===a?"":n._data(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+Bb(c)+" ").replace(Ab," ").indexOf(b)>-1)return!0;return!1}}),n.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){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Cb=a.location,Db=n.now(),Eb=/\?/,Fb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(Fb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new a.DOMParser,c=d.parseFromString(b,"text/xml")):(c=new a.ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var Gb=/#.*$/,Hb=/([?&])_=[^&]*/,Ib=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Jb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Kb=/^(?:GET|HEAD)$/,Lb=/^\/\//,Mb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Nb={},Ob={},Pb="*/".concat("*"),Qb=Cb.href,Rb=Mb.exec(Qb.toLowerCase())||[];function Sb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(F)||[];if(n.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 Tb(a,b,c,d){var e={},f=a===Ob;function g(h){var i;return e[h]=!0,n.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 Ub(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Vb(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}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Wb(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]))for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){!0===g?g=j[e]:!0!==j[e]&&(f=h[0],k.unshift(h[1]));break}if(!0!==g)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}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Qb,type:"GET",isLocal:Jb.test(Rb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Pb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ub(Ub(a,n.ajaxSettings),b):Ub(n.ajaxSettings,a)},ajaxPrefilter:Sb(Nb),ajaxTransport:Sb(Ob),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var d,e,f,g,h,i,j,k,l=n.ajaxSetup({},c),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!k){k={};while(b=Ib.exec(g))k[b[1].toLowerCase()]=b[2]}b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(u<2)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return j&&j.abort(b),x(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((b||l.url||Qb)+"").replace(Gb,"").replace(Lb,Rb[1]+"//"),l.type=c.method||c.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(F)||[""],null==l.crossDomain&&(d=Mb.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===Rb[1]&&d[2]===Rb[2]&&(d[3]||("http:"===d[1]?"80":"443"))===(Rb[3]||("http:"===Rb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Tb(Nb,l,c,w),2===u)return w;i=n.event&&l.global,i&&0==n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Kb.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(Eb.test(f)?"&":"?")+l.data,delete l.data),!1===l.cache&&(l.url=Hb.test(f)?f.replace(Hb,"$1_="+Db++):f+(Eb.test(f)?"&":"?")+"_="+Db++)),l.ifModified&&(n.lastModified[f]&&w.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&w.setRequestHeader("If-None-Match",n.etag[f])),(l.data&&l.hasContent&&!1!==l.contentType||c.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Pb+"; q=0.01":""):l.accepts["*"]);for(e in l.headers)w.setRequestHeader(e,l.headers[e]);if(l.beforeSend&&(!1===l.beforeSend.call(m,w,l)||2===u))return w.abort();v="abort";for(e in{success:1,error:1,complete:1})w[e](l[e]);if(j=Tb(Ob,l,c,w)){if(w.readyState=1,i&&o.trigger("ajaxSend",[w,l]),2===u)return w;l.async&&l.timeout>0&&(h=a.setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,j.send(s,x)}catch(y){if(!(u<2))throw y;x(-1,y)}}else x(-1,"No Transport");function x(b,c,d,e){var k,s,t,v,x,y=c;2!==u&&(u=2,h&&a.clearTimeout(h),j=void 0,g=e||"",w.readyState=b>0?4:0,k=b>=200&&b<300||304===b,d&&(v=Vb(l,w,d)),v=Wb(l,v,w,k),k?(l.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(n.lastModified[f]=x),(x=w.getResponseHeader("etag"))&&(n.etag[f]=x)),204===b||"HEAD"===l.type?y="nocontent":304===b?y="notmodified":(y=v.state,s=v.data,t=v.error,k=!t)):(t=y,!b&&y||(y="error",b<0&&(b=0))),w.status=b,w.statusText=(c||y)+"",k?p.resolveWith(m,[s,y,w]):p.rejectWith(m,[w,y,t]),w.statusCode(r),r=void 0,i&&o.trigger(k?"ajaxSuccess":"ajaxError",[w,l,k?s:t]),q.fireWith(m,[w,y]),i&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(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 n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}});function Xb(a){return a.style&&a.style.display||n.css(a,"display")}function Yb(a){if(!n.contains(a.ownerDocument||d,a))return!0;while(a&&1===a.nodeType){if("none"===Xb(a)||"hidden"===a.type)return!0;a=a.parentNode}return!1}n.expr.filters.hidden=function(a){return l.reliableHiddenOffsets()?a.offsetWidth<=0&&a.offsetHeight<=0&&!a.getClientRects().length:Yb(a)},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var Zb=/%20/g,$b=/\[\]$/,_b=/\r?\n/g,ac=/^(?:submit|button|image|reset|file)$/i,bc=/^(?:input|select|textarea|keygen)/i;function cc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||$b.test(a)?d(a,e):cc(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)cc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)cc(c,a[c],b,e);return d.join("&").replace(Zb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&bc.test(this.nodeName)&&!ac.test(a)&&(this.checked||!Y.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(_b,"\r\n")}}):{name:b.name,value:c.replace(_b,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return this.isLocal?hc():d.documentMode>8?gc():/^(get|post|head|put|delete|options)$/i.test(this.type)&&gc()||hc()}:gc;var dc=0,ec={},fc=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in ec)ec[a](void 0,!0)}),l.cors=!!fc&&"withCredentials"in fc,(fc=l.ajax=!!fc)&&n.ajaxTransport(function(b){if(!b.crossDomain||l.cors){var c;return{send:function(d,e){var f,g=b.xhr(),h=++dc;if(g.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(f in b.xhrFields)g[f]=b.xhrFields[f];b.mimeType&&g.overrideMimeType&&g.overrideMimeType(b.mimeType),b.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");for(f in d)void 0!==d[f]&&g.setRequestHeader(f,d[f]+"");g.send(b.hasContent&&b.data||null),c=function(a,d){var f,i,j;if(c&&(d||4===g.readyState))if(delete ec[h],c=void 0,g.onreadystatechange=n.noop,d)4!==g.readyState&&g.abort();else{j={},f=g.status,"string"==typeof g.responseText&&(j.text=g.responseText);try{i=g.statusText}catch(k){i=""}f||!b.isLocal||b.crossDomain?1223===f&&(f=204):f=j.text?200:404}j&&e(f,i,j,g.getAllResponseHeaders())},b.async?4===g.readyState?a.setTimeout(c):g.onreadystatechange=ec[h]=c:c()},abort:function(){c&&c(void 0,!0)}}}});function gc(){try{return new a.XMLHttpRequest}catch(b){}}function hc(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=d.head||n("head")[0]||d.documentElement;return{send:function(e,f){b=d.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||f(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var ic=[],jc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=ic.pop()||n.expando+"_"+Db++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=!1!==b.jsonp&&(jc.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&jc.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(jc,"$1"+e):!1!==b.jsonp&&(b.url+=(Eb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,ic.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ia([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var kc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&kc)return kc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h,a.length)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function lc(a){return n.isWindow(a)?a:9===a.nodeType&&(a.defaultView||a.parentWindow)}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.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,n.contains(b,e)?(void 0!==e.getBoundingClientRect&&(d=e.getBoundingClientRect()),c=lc(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"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Pa})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return X(this,function(a,d,e){var f=lc(a);if(void 0===e)return f?b in f?f[b]:f.document.documentElement[d]:a[d];f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ta(l.pixelPosition,function(a,c){if(c)return c=Ra(a,b),Na.test(c)?n(a).position()[b]+"px":c})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(!0===d||!0===e?"margin":"border")
    5 ;return X(this,function(b,c,d){var e;return n.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?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({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)}}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var mc=a.jQuery,nc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=nc),b&&a.jQuery===n&&(a.jQuery=mc),n},b||(a.jQuery=a.$=n),n});
     1/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
     2!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&j.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(D),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(D).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(D(this,e||[],!1))},not:function(e){return this.pushStack(D(this,e||[],!0))},is:function(e){return!!D(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var j,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^key/,we=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Te=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function Ee(){return!1}function Se(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function ke(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)ke(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ee;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Ae(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,Ce)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=Te.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=Te.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click",Ce),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ce:Ee,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Ee,isPropagationStopped:Ee,isImmediatePropagationStopped:Ee,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ce,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ce,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ce,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&be.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&we.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},function(e,t){S.event.special[e]={setup:function(){return Ae(this,e,Se),!1},trigger:function(){return Ae(this,e),!0},delegateType:t}}),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return ke(this,e,t,n,r)},one:function(e,t,n,r){return ke(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ee),this.each(function(){S.event.remove(this,e,n,t)})}});var Ne=/<script|<style|<link/i,De=/checked\s*(?:[^=]|=\s*.checked.)/i,je=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function Pe(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&De.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),Pe(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),Le)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,He),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(je,""),u,l))}return n}function Re(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Oe(o[r],a[r]);else Oe(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Re(this,e,!0)},remove:function(e){return Re(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Pe(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||qe(this,e).appendChild(e)})},prepend:function(){return Pe(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=qe(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return Pe(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Me=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Ie=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},We=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Fe=new RegExp(ne.join("|"),"i");function Be(e,t,n){var r,i,o,a,s=e.style;return(n=n||Ie(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Me.test(a)&&Fe.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function $e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px",t.style.height="1px",n.style.height="9px",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=3<parseInt(r.height),re.removeChild(e)),a}}))}();var _e=["Webkit","Moz","ms"],ze=E.createElement("div").style,Ue={};function Xe(e){var t=S.cssProps[e]||Ue[e];return t||(e in ze?e:Ue[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=_e.length;while(n--)if((e=_e[n]+t)in ze)return e}(e)||e)}var Ve=/^(none|table(?!-c[ea]).+)/,Ge=/^--/,Ye={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:"0",fontWeight:"400"};function Je(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ke(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Ze(e,t,n){var r=Ie(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=Be(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Me.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Ke(e,t,n||(i?"border":"content"),o,r,a)+"px"}function et(e,t,n,r,i){return new et.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Be(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Ge.test(t),l=e.style;if(u||(t=Xe(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Ge.test(t)||(t=Xe(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Be(e,t,r)),"normal"===i&&t in Qe&&(i=Qe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ve.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Ze(e,u,n):We(e,Ye,function(){return Ze(e,u,n)})},set:function(e,t,n){var r,i=Ie(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Ke(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Ke(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Je(0,t,s)}}}),S.cssHooks.marginLeft=$e(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Be(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),S.each({margin:"",padding:"",border:"Width"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Je)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Ie(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=et).prototype={constructor:et,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,n=et.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):et.propHooks._default.set(this),this}}).init.prototype=et.prototype,(et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[Xe(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=et.prototype.init,S.fx.step={};var tt,nt,rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){nt&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(st):C.setTimeout(st,S.fx.interval),S.fx.tick())}function ut(){return C.setTimeout(function(){tt=void 0}),tt=Date.now()}function lt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ct(e,t,n){for(var r,i=(ft.tweeners[t]||[]).concat(ft.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ft(o,e,t){var n,a,r=0,i=ft.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=tt||ut(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:tt||ut(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=ft.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ct,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(ft,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],ft.tweeners[n]=ft.tweeners[n]||[],ft.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,S.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ot.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])})),u=ct(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?ft.prefilters.unshift(e):ft.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=ft(this,S.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&at.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),S.each(["toggle","show","hide"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(lt(r,!0),e,t,n)}}),S.each({slideDown:lt("show"),slideUp:lt("hide"),slideToggle:lt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(tt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),tt=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){nt||(nt=!0,st())},S.fx.stop=function(){nt=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},rt=E.createElement("input"),it=E.createElement("select").appendChild(E.createElement("option")),rt.type="checkbox",y.checkOn=""!==rt.value,y.optSelected=it.selected,(rt=E.createElement("input")).value="t",rt.type="radio",y.radioValue="t"===rt.value;var pt,dt=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),function(e,t){var a=dt[t]||S.find.attr;dt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=dt[o],dt[o]=r,r=null!=a(e,t,n)?o:null,dt[o]=i),r}});var ht=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;function vt(e){return(e.match(P)||[]).join(" ")}function yt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,yt(this)))});if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,yt(this)))});if(!arguments.length)return this.attr("class","");if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,yt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=mt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=yt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+vt(yt(n))+" ").indexOf(t))return!0;return!1}});var xt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?"":e+""})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:vt(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var bt=/^(?:focusinfocus|focusoutblur)$/,wt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!bt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,bt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,wt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,wt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var Tt=C.location,Ct={guid:Date.now()},Et=/\?/;S.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+e),t};var St=/\[\]$/,kt=/\r?\n/g,At=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;function Dt(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||St.test(n)?i(n,t):Dt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)Dt(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)Dt(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&Nt.test(this.nodeName)&&!At.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(kt,"\r\n")}}):{name:t.name,value:n.replace(kt,"\r\n")}}).get()}});var jt=/%20/g,qt=/#.*$/,Lt=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ot=/^(?:GET|HEAD)$/,Pt=/^\/\//,Rt={},Mt={},It="*/".concat("*"),Wt=E.createElement("a");function Ft(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Bt(t,i,o,a){var s={},u=t===Mt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function $t(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Wt.href=Tt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?$t($t(e,S.ajaxSettings),t):$t(S.ajaxSettings,e)},ajaxPrefilter:Ft(Rt),ajaxTransport:Ft(Mt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Ht.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Wt.protocol+"//"+Wt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Bt(Rt,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ot.test(v.type),f=v.url.replace(qt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(jt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Et.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Lt,"$1"),o=(Et.test(f)?"&":"?")+"_="+Ct.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+It+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Bt(Mt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<S.inArray("script",v.dataTypes)&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},zt=S.ajaxSettings.xhr();y.cors=!!zt&&"withCredentials"in zt,y.ajax=zt=!!zt,S.ajaxTransport(function(i){var o,a;if(y.cors||zt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(_t[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),S.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=vt(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?S("<div>").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Gt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Gt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return S});var Yt=C.jQuery,Qt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Qt),e&&C.jQuery===S&&(C.jQuery=Yt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
  • src/js/_enqueues/vendor/jquery/ui/accordion.js

     
     1/*!
     2 * jQuery UI Accordion 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Accordion
     11//>>group: Widgets
     12// jscs:disable maximumLineLength
     13//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
     14// jscs:enable maximumLineLength
     15//>>docs: http://api.jqueryui.com/accordion/
     16//>>demos: http://jqueryui.com/accordion/
     17//>>css.structure: ../../themes/base/core.css
     18//>>css.structure: ../../themes/base/accordion.css
     19//>>css.theme: ../../themes/base/theme.css
     20
     21( function( factory ) {
     22        if ( typeof define === "function" && define.amd ) {
     23
     24                // AMD. Register as an anonymous module.
     25                define( [
     26                        "jquery",
     27                        "./version",
     28                        "./keycode",
     29                        "./unique-id",
     30                        "./widget"
     31                ], factory );
     32        } else {
     33
     34                // Browser globals
     35                factory( jQuery );
     36        }
     37}( function( $ ) {
     38
     39return $.widget( "ui.accordion", {
     40        version: "1.12.1",
     41        options: {
     42                active: 0,
     43                animate: {},
     44                classes: {
     45                        "ui-accordion-header": "ui-corner-top",
     46                        "ui-accordion-header-collapsed": "ui-corner-all",
     47                        "ui-accordion-content": "ui-corner-bottom"
     48                },
     49                collapsible: false,
     50                event: "click",
     51                header: "> li > :first-child, > :not(li):even",
     52                heightStyle: "auto",
     53                icons: {
     54                        activeHeader: "ui-icon-triangle-1-s",
     55                        header: "ui-icon-triangle-1-e"
     56                },
     57
     58                // Callbacks
     59                activate: null,
     60                beforeActivate: null
     61        },
     62
     63        hideProps: {
     64                borderTopWidth: "hide",
     65                borderBottomWidth: "hide",
     66                paddingTop: "hide",
     67                paddingBottom: "hide",
     68                height: "hide"
     69        },
     70
     71        showProps: {
     72                borderTopWidth: "show",
     73                borderBottomWidth: "show",
     74                paddingTop: "show",
     75                paddingBottom: "show",
     76                height: "show"
     77        },
     78
     79        _create: function() {
     80                var options = this.options;
     81
     82                this.prevShow = this.prevHide = $();
     83                this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
     84                this.element.attr( "role", "tablist" );
     85
     86                // Don't allow collapsible: false and active: false / null
     87                if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
     88                        options.active = 0;
     89                }
     90
     91                this._processPanels();
     92
     93                // handle negative values
     94                if ( options.active < 0 ) {
     95                        options.active += this.headers.length;
     96                }
     97                this._refresh();
     98        },
     99
     100        _getCreateEventData: function() {
     101                return {
     102                        header: this.active,
     103                        panel: !this.active.length ? $() : this.active.next()
     104                };
     105        },
     106
     107        _createIcons: function() {
     108                var icon, children,
     109                        icons = this.options.icons;
     110
     111                if ( icons ) {
     112                        icon = $( "<span>" );
     113                        this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
     114                        icon.prependTo( this.headers );
     115                        children = this.active.children( ".ui-accordion-header-icon" );
     116                        this._removeClass( children, icons.header )
     117                                ._addClass( children, null, icons.activeHeader )
     118                                ._addClass( this.headers, "ui-accordion-icons" );
     119                }
     120        },
     121
     122        _destroyIcons: function() {
     123                this._removeClass( this.headers, "ui-accordion-icons" );
     124                this.headers.children( ".ui-accordion-header-icon" ).remove();
     125        },
     126
     127        _destroy: function() {
     128                var contents;
     129
     130                // Clean up main element
     131                this.element.removeAttr( "role" );
     132
     133                // Clean up headers
     134                this.headers
     135                        .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
     136                        .removeUniqueId();
     137
     138                this._destroyIcons();
     139
     140                // Clean up content panels
     141                contents = this.headers.next()
     142                        .css( "display", "" )
     143                        .removeAttr( "role aria-hidden aria-labelledby" )
     144                        .removeUniqueId();
     145
     146                if ( this.options.heightStyle !== "content" ) {
     147                        contents.css( "height", "" );
     148                }
     149        },
     150
     151        _setOption: function( key, value ) {
     152                if ( key === "active" ) {
     153
     154                        // _activate() will handle invalid values and update this.options
     155                        this._activate( value );
     156                        return;
     157                }
     158
     159                if ( key === "event" ) {
     160                        if ( this.options.event ) {
     161                                this._off( this.headers, this.options.event );
     162                        }
     163                        this._setupEvents( value );
     164                }
     165
     166                this._super( key, value );
     167
     168                // Setting collapsible: false while collapsed; open first panel
     169                if ( key === "collapsible" && !value && this.options.active === false ) {
     170                        this._activate( 0 );
     171                }
     172
     173                if ( key === "icons" ) {
     174                        this._destroyIcons();
     175                        if ( value ) {
     176                                this._createIcons();
     177                        }
     178                }
     179        },
     180
     181        _setOptionDisabled: function( value ) {
     182                this._super( value );
     183
     184                this.element.attr( "aria-disabled", value );
     185
     186                // Support: IE8 Only
     187                // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
     188                // so we need to add the disabled class to the headers and panels
     189                this._toggleClass( null, "ui-state-disabled", !!value );
     190                this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
     191                        !!value );
     192        },
     193
     194        _keydown: function( event ) {
     195                if ( event.altKey || event.ctrlKey ) {
     196                        return;
     197                }
     198
     199                var keyCode = $.ui.keyCode,
     200                        length = this.headers.length,
     201                        currentIndex = this.headers.index( event.target ),
     202                        toFocus = false;
     203
     204                switch ( event.keyCode ) {
     205                case keyCode.RIGHT:
     206                case keyCode.DOWN:
     207                        toFocus = this.headers[ ( currentIndex + 1 ) % length ];
     208                        break;
     209                case keyCode.LEFT:
     210                case keyCode.UP:
     211                        toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
     212                        break;
     213                case keyCode.SPACE:
     214                case keyCode.ENTER:
     215                        this._eventHandler( event );
     216                        break;
     217                case keyCode.HOME:
     218                        toFocus = this.headers[ 0 ];
     219                        break;
     220                case keyCode.END:
     221                        toFocus = this.headers[ length - 1 ];
     222                        break;
     223                }
     224
     225                if ( toFocus ) {
     226                        $( event.target ).attr( "tabIndex", -1 );
     227                        $( toFocus ).attr( "tabIndex", 0 );
     228                        $( toFocus ).trigger( "focus" );
     229                        event.preventDefault();
     230                }
     231        },
     232
     233        _panelKeyDown: function( event ) {
     234                if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
     235                        $( event.currentTarget ).prev().trigger( "focus" );
     236                }
     237        },
     238
     239        refresh: function() {
     240                var options = this.options;
     241                this._processPanels();
     242
     243                // Was collapsed or no panel
     244                if ( ( options.active === false && options.collapsible === true ) ||
     245                                !this.headers.length ) {
     246                        options.active = false;
     247                        this.active = $();
     248
     249                // active false only when collapsible is true
     250                } else if ( options.active === false ) {
     251                        this._activate( 0 );
     252
     253                // was active, but active panel is gone
     254                } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
     255
     256                        // all remaining panel are disabled
     257                        if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
     258                                options.active = false;
     259                                this.active = $();
     260
     261                        // activate previous panel
     262                        } else {
     263                                this._activate( Math.max( 0, options.active - 1 ) );
     264                        }
     265
     266                // was active, active panel still exists
     267                } else {
     268
     269                        // make sure active index is correct
     270                        options.active = this.headers.index( this.active );
     271                }
     272
     273                this._destroyIcons();
     274
     275                this._refresh();
     276        },
     277
     278        _processPanels: function() {
     279                var prevHeaders = this.headers,
     280                        prevPanels = this.panels;
     281
     282                this.headers = this.element.find( this.options.header );
     283                this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
     284                        "ui-state-default" );
     285
     286                this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
     287                this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
     288
     289                // Avoid memory leaks (#10056)
     290                if ( prevPanels ) {
     291                        this._off( prevHeaders.not( this.headers ) );
     292                        this._off( prevPanels.not( this.panels ) );
     293                }
     294        },
     295
     296        _refresh: function() {
     297                var maxHeight,
     298                        options = this.options,
     299                        heightStyle = options.heightStyle,
     300                        parent = this.element.parent();
     301
     302                this.active = this._findActive( options.active );
     303                this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
     304                        ._removeClass( this.active, "ui-accordion-header-collapsed" );
     305                this._addClass( this.active.next(), "ui-accordion-content-active" );
     306                this.active.next().show();
     307
     308                this.headers
     309                        .attr( "role", "tab" )
     310                        .each( function() {
     311                                var header = $( this ),
     312                                        headerId = header.uniqueId().attr( "id" ),
     313                                        panel = header.next(),
     314                                        panelId = panel.uniqueId().attr( "id" );
     315                                header.attr( "aria-controls", panelId );
     316                                panel.attr( "aria-labelledby", headerId );
     317                        } )
     318                        .next()
     319                                .attr( "role", "tabpanel" );
     320
     321                this.headers
     322                        .not( this.active )
     323                                .attr( {
     324                                        "aria-selected": "false",
     325                                        "aria-expanded": "false",
     326                                        tabIndex: -1
     327                                } )
     328                                .next()
     329                                        .attr( {
     330                                                "aria-hidden": "true"
     331                                        } )
     332                                        .hide();
     333
     334                // Make sure at least one header is in the tab order
     335                if ( !this.active.length ) {
     336                        this.headers.eq( 0 ).attr( "tabIndex", 0 );
     337                } else {
     338                        this.active.attr( {
     339                                "aria-selected": "true",
     340                                "aria-expanded": "true",
     341                                tabIndex: 0
     342                        } )
     343                                .next()
     344                                        .attr( {
     345                                                "aria-hidden": "false"
     346                                        } );
     347                }
     348
     349                this._createIcons();
     350
     351                this._setupEvents( options.event );
     352
     353                if ( heightStyle === "fill" ) {
     354                        maxHeight = parent.height();
     355                        this.element.siblings( ":visible" ).each( function() {
     356                                var elem = $( this ),
     357                                        position = elem.css( "position" );
     358
     359                                if ( position === "absolute" || position === "fixed" ) {
     360                                        return;
     361                                }
     362                                maxHeight -= elem.outerHeight( true );
     363                        } );
     364
     365                        this.headers.each( function() {
     366                                maxHeight -= $( this ).outerHeight( true );
     367                        } );
     368
     369                        this.headers.next()
     370                                .each( function() {
     371                                        $( this ).height( Math.max( 0, maxHeight -
     372                                                $( this ).innerHeight() + $( this ).height() ) );
     373                                } )
     374                                .css( "overflow", "auto" );
     375                } else if ( heightStyle === "auto" ) {
     376                        maxHeight = 0;
     377                        this.headers.next()
     378                                .each( function() {
     379                                        var isVisible = $( this ).is( ":visible" );
     380                                        if ( !isVisible ) {
     381                                                $( this ).show();
     382                                        }
     383                                        maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
     384                                        if ( !isVisible ) {
     385                                                $( this ).hide();
     386                                        }
     387                                } )
     388                                .height( maxHeight );
     389                }
     390        },
     391
     392        _activate: function( index ) {
     393                var active = this._findActive( index )[ 0 ];
     394
     395                // Trying to activate the already active panel
     396                if ( active === this.active[ 0 ] ) {
     397                        return;
     398                }
     399
     400                // Trying to collapse, simulate a click on the currently active header
     401                active = active || this.active[ 0 ];
     402
     403                this._eventHandler( {
     404                        target: active,
     405                        currentTarget: active,
     406                        preventDefault: $.noop
     407                } );
     408        },
     409
     410        _findActive: function( selector ) {
     411                return typeof selector === "number" ? this.headers.eq( selector ) : $();
     412        },
     413
     414        _setupEvents: function( event ) {
     415                var events = {
     416                        keydown: "_keydown"
     417                };
     418                if ( event ) {
     419                        $.each( event.split( " " ), function( index, eventName ) {
     420                                events[ eventName ] = "_eventHandler";
     421                        } );
     422                }
     423
     424                this._off( this.headers.add( this.headers.next() ) );
     425                this._on( this.headers, events );
     426                this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
     427                this._hoverable( this.headers );
     428                this._focusable( this.headers );
     429        },
     430
     431        _eventHandler: function( event ) {
     432                var activeChildren, clickedChildren,
     433                        options = this.options,
     434                        active = this.active,
     435                        clicked = $( event.currentTarget ),
     436                        clickedIsActive = clicked[ 0 ] === active[ 0 ],
     437                        collapsing = clickedIsActive && options.collapsible,
     438                        toShow = collapsing ? $() : clicked.next(),
     439                        toHide = active.next(),
     440                        eventData = {
     441                                oldHeader: active,
     442                                oldPanel: toHide,
     443                                newHeader: collapsing ? $() : clicked,
     444                                newPanel: toShow
     445                        };
     446
     447                event.preventDefault();
     448
     449                if (
     450
     451                                // click on active header, but not collapsible
     452                                ( clickedIsActive && !options.collapsible ) ||
     453
     454                                // allow canceling activation
     455                                ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
     456                        return;
     457                }
     458
     459                options.active = collapsing ? false : this.headers.index( clicked );
     460
     461                // When the call to ._toggle() comes after the class changes
     462                // it causes a very odd bug in IE 8 (see #6720)
     463                this.active = clickedIsActive ? $() : clicked;
     464                this._toggle( eventData );
     465
     466                // Switch classes
     467                // corner classes on the previously active header stay after the animation
     468                this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
     469                if ( options.icons ) {
     470                        activeChildren = active.children( ".ui-accordion-header-icon" );
     471                        this._removeClass( activeChildren, null, options.icons.activeHeader )
     472                                ._addClass( activeChildren, null, options.icons.header );
     473                }
     474
     475                if ( !clickedIsActive ) {
     476                        this._removeClass( clicked, "ui-accordion-header-collapsed" )
     477                                ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
     478                        if ( options.icons ) {
     479                                clickedChildren = clicked.children( ".ui-accordion-header-icon" );
     480                                this._removeClass( clickedChildren, null, options.icons.header )
     481                                        ._addClass( clickedChildren, null, options.icons.activeHeader );
     482                        }
     483
     484                        this._addClass( clicked.next(), "ui-accordion-content-active" );
     485                }
     486        },
     487
     488        _toggle: function( data ) {
     489                var toShow = data.newPanel,
     490                        toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
     491
     492                // Handle activating a panel during the animation for another activation
     493                this.prevShow.add( this.prevHide ).stop( true, true );
     494                this.prevShow = toShow;
     495                this.prevHide = toHide;
     496
     497                if ( this.options.animate ) {
     498                        this._animate( toShow, toHide, data );
     499                } else {
     500                        toHide.hide();
     501                        toShow.show();
     502                        this._toggleComplete( data );
     503                }
     504
     505                toHide.attr( {
     506                        "aria-hidden": "true"
     507                } );
     508                toHide.prev().attr( {
     509                        "aria-selected": "false",
     510                        "aria-expanded": "false"
     511                } );
     512
     513                // if we're switching panels, remove the old header from the tab order
     514                // if we're opening from collapsed state, remove the previous header from the tab order
     515                // if we're collapsing, then keep the collapsing header in the tab order
     516                if ( toShow.length && toHide.length ) {
     517                        toHide.prev().attr( {
     518                                "tabIndex": -1,
     519                                "aria-expanded": "false"
     520                        } );
     521                } else if ( toShow.length ) {
     522                        this.headers.filter( function() {
     523                                return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
     524                        } )
     525                                .attr( "tabIndex", -1 );
     526                }
     527
     528                toShow
     529                        .attr( "aria-hidden", "false" )
     530                        .prev()
     531                                .attr( {
     532                                        "aria-selected": "true",
     533                                        "aria-expanded": "true",
     534                                        tabIndex: 0
     535                                } );
     536        },
     537
     538        _animate: function( toShow, toHide, data ) {
     539                var total, easing, duration,
     540                        that = this,
     541                        adjust = 0,
     542                        boxSizing = toShow.css( "box-sizing" ),
     543                        down = toShow.length &&
     544                                ( !toHide.length || ( toShow.index() < toHide.index() ) ),
     545                        animate = this.options.animate || {},
     546                        options = down && animate.down || animate,
     547                        complete = function() {
     548                                that._toggleComplete( data );
     549                        };
     550
     551                if ( typeof options === "number" ) {
     552                        duration = options;
     553                }
     554                if ( typeof options === "string" ) {
     555                        easing = options;
     556                }
     557
     558                // fall back from options to animation in case of partial down settings
     559                easing = easing || options.easing || animate.easing;
     560                duration = duration || options.duration || animate.duration;
     561
     562                if ( !toHide.length ) {
     563                        return toShow.animate( this.showProps, duration, easing, complete );
     564                }
     565                if ( !toShow.length ) {
     566                        return toHide.animate( this.hideProps, duration, easing, complete );
     567                }
     568
     569                total = toShow.show().outerHeight();
     570                toHide.animate( this.hideProps, {
     571                        duration: duration,
     572                        easing: easing,
     573                        step: function( now, fx ) {
     574                                fx.now = Math.round( now );
     575                        }
     576                } );
     577                toShow
     578                        .hide()
     579                        .animate( this.showProps, {
     580                                duration: duration,
     581                                easing: easing,
     582                                complete: complete,
     583                                step: function( now, fx ) {
     584                                        fx.now = Math.round( now );
     585                                        if ( fx.prop !== "height" ) {
     586                                                if ( boxSizing === "content-box" ) {
     587                                                        adjust += fx.now;
     588                                                }
     589                                        } else if ( that.options.heightStyle !== "content" ) {
     590                                                fx.now = Math.round( total - toHide.outerHeight() - adjust );
     591                                                adjust = 0;
     592                                        }
     593                                }
     594                        } );
     595        },
     596
     597        _toggleComplete: function( data ) {
     598                var toHide = data.oldPanel,
     599                        prev = toHide.prev();
     600
     601                this._removeClass( toHide, "ui-accordion-content-active" );
     602                this._removeClass( prev, "ui-accordion-header-active" )
     603                        ._addClass( prev, "ui-accordion-header-collapsed" );
     604
     605                // Work around for rendering bug in IE (#5421)
     606                if ( toHide.length ) {
     607                        toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
     608                }
     609                this._trigger( "activate", null, data );
     610        }
     611} );
     612
     613} ) );
  • src/js/_enqueues/vendor/jquery/ui/autocomplete.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/accordion.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Autocomplete 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Autocomplete
     11//>>group: Widgets
     12//>>description: Lists suggested words as the user is typing.
     13//>>docs: http://api.jqueryui.com/autocomplete/
     14//>>demos: http://jqueryui.com/autocomplete/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/autocomplete.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./menu",
     26                        "./keycode",
     27                        "./position",
     28                        "./safe-active-element",
     29                        "./version",
     30                        "./widget"
     31                ], factory );
     32        } else {
     33
     34                // Browser globals
     35                factory( jQuery );
     36        }
     37}( function( $ ) {
     38
     39$.widget( "ui.autocomplete", {
     40        version: "1.12.1",
     41        defaultElement: "<input>",
     42        options: {
     43                appendTo: null,
     44                autoFocus: false,
     45                delay: 300,
     46                minLength: 1,
     47                position: {
     48                        my: "left top",
     49                        at: "left bottom",
     50                        collision: "none"
     51                },
     52                source: null,
     53
     54                // Callbacks
     55                change: null,
     56                close: null,
     57                focus: null,
     58                open: null,
     59                response: null,
     60                search: null,
     61                select: null
     62        },
     63
     64        requestIndex: 0,
     65        pending: 0,
     66
     67        _create: function() {
     68
     69                // Some browsers only repeat keydown events, not keypress events,
     70                // so we use the suppressKeyPress flag to determine if we've already
     71                // handled the keydown event. #7269
     72                // Unfortunately the code for & in keypress is the same as the up arrow,
     73                // so we use the suppressKeyPressRepeat flag to avoid handling keypress
     74                // events when we know the keydown event was used to modify the
     75                // search term. #7799
     76                var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
     77                        nodeName = this.element[ 0 ].nodeName.toLowerCase(),
     78                        isTextarea = nodeName === "textarea",
     79                        isInput = nodeName === "input";
     80
     81                // Textareas are always multi-line
     82                // Inputs are always single-line, even if inside a contentEditable element
     83                // IE also treats inputs as contentEditable
     84                // All other element types are determined by whether or not they're contentEditable
     85                this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );
     86
     87                this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
     88                this.isNewMenu = true;
     89
     90                this._addClass( "ui-autocomplete-input" );
     91                this.element.attr( "autocomplete", "off" );
     92
     93                this._on( this.element, {
     94                        keydown: function( event ) {
     95                                if ( this.element.prop( "readOnly" ) ) {
     96                                        suppressKeyPress = true;
     97                                        suppressInput = true;
     98                                        suppressKeyPressRepeat = true;
     99                                        return;
     100                                }
     101
     102                                suppressKeyPress = false;
     103                                suppressInput = false;
     104                                suppressKeyPressRepeat = false;
     105                                var keyCode = $.ui.keyCode;
     106                                switch ( event.keyCode ) {
     107                                case keyCode.PAGE_UP:
     108                                        suppressKeyPress = true;
     109                                        this._move( "previousPage", event );
     110                                        break;
     111                                case keyCode.PAGE_DOWN:
     112                                        suppressKeyPress = true;
     113                                        this._move( "nextPage", event );
     114                                        break;
     115                                case keyCode.UP:
     116                                        suppressKeyPress = true;
     117                                        this._keyEvent( "previous", event );
     118                                        break;
     119                                case keyCode.DOWN:
     120                                        suppressKeyPress = true;
     121                                        this._keyEvent( "next", event );
     122                                        break;
     123                                case keyCode.ENTER:
     124
     125                                        // when menu is open and has focus
     126                                        if ( this.menu.active ) {
     127
     128                                                // #6055 - Opera still allows the keypress to occur
     129                                                // which causes forms to submit
     130                                                suppressKeyPress = true;
     131                                                event.preventDefault();
     132                                                this.menu.select( event );
     133                                        }
     134                                        break;
     135                                case keyCode.TAB:
     136                                        if ( this.menu.active ) {
     137                                                this.menu.select( event );
     138                                        }
     139                                        break;
     140                                case keyCode.ESCAPE:
     141                                        if ( this.menu.element.is( ":visible" ) ) {
     142                                                if ( !this.isMultiLine ) {
     143                                                        this._value( this.term );
     144                                                }
     145                                                this.close( event );
     146
     147                                                // Different browsers have different default behavior for escape
     148                                                // Single press can mean undo or clear
     149                                                // Double press in IE means clear the whole form
     150                                                event.preventDefault();
     151                                        }
     152                                        break;
     153                                default:
     154                                        suppressKeyPressRepeat = true;
     155
     156                                        // search timeout should be triggered before the input value is changed
     157                                        this._searchTimeout( event );
     158                                        break;
     159                                }
     160                        },
     161                        keypress: function( event ) {
     162                                if ( suppressKeyPress ) {
     163                                        suppressKeyPress = false;
     164                                        if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
     165                                                event.preventDefault();
     166                                        }
     167                                        return;
     168                                }
     169                                if ( suppressKeyPressRepeat ) {
     170                                        return;
     171                                }
     172
     173                                // Replicate some key handlers to allow them to repeat in Firefox and Opera
     174                                var keyCode = $.ui.keyCode;
     175                                switch ( event.keyCode ) {
     176                                case keyCode.PAGE_UP:
     177                                        this._move( "previousPage", event );
     178                                        break;
     179                                case keyCode.PAGE_DOWN:
     180                                        this._move( "nextPage", event );
     181                                        break;
     182                                case keyCode.UP:
     183                                        this._keyEvent( "previous", event );
     184                                        break;
     185                                case keyCode.DOWN:
     186                                        this._keyEvent( "next", event );
     187                                        break;
     188                                }
     189                        },
     190                        input: function( event ) {
     191                                if ( suppressInput ) {
     192                                        suppressInput = false;
     193                                        event.preventDefault();
     194                                        return;
     195                                }
     196                                this._searchTimeout( event );
     197                        },
     198                        focus: function() {
     199                                this.selectedItem = null;
     200                                this.previous = this._value();
     201                        },
     202                        blur: function( event ) {
     203                                if ( this.cancelBlur ) {
     204                                        delete this.cancelBlur;
     205                                        return;
     206                                }
     207
     208                                clearTimeout( this.searching );
     209                                this.close( event );
     210                                this._change( event );
     211                        }
     212                } );
     213
     214                this._initSource();
     215                this.menu = $( "<ul>" )
     216                        .appendTo( this._appendTo() )
     217                        .menu( {
     218
     219                                // disable ARIA support, the live region takes care of that
     220                                role: null
     221                        } )
     222                        .hide()
     223                        .menu( "instance" );
     224
     225                this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
     226                this._on( this.menu.element, {
     227                        mousedown: function( event ) {
     228
     229                                // prevent moving focus out of the text field
     230                                event.preventDefault();
     231
     232                                // IE doesn't prevent moving focus even with event.preventDefault()
     233                                // so we set a flag to know when we should ignore the blur event
     234                                this.cancelBlur = true;
     235                                this._delay( function() {
     236                                        delete this.cancelBlur;
     237
     238                                        // Support: IE 8 only
     239                                        // Right clicking a menu item or selecting text from the menu items will
     240                                        // result in focus moving out of the input. However, we've already received
     241                                        // and ignored the blur event because of the cancelBlur flag set above. So
     242                                        // we restore focus to ensure that the menu closes properly based on the user's
     243                                        // next actions.
     244                                        if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
     245                                                this.element.trigger( "focus" );
     246                                        }
     247                                } );
     248                        },
     249                        menufocus: function( event, ui ) {
     250                                var label, item;
     251
     252                                // support: Firefox
     253                                // Prevent accidental activation of menu items in Firefox (#7024 #9118)
     254                                if ( this.isNewMenu ) {
     255                                        this.isNewMenu = false;
     256                                        if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
     257                                                this.menu.blur();
     258
     259                                                this.document.one( "mousemove", function() {
     260                                                        $( event.target ).trigger( event.originalEvent );
     261                                                } );
     262
     263                                                return;
     264                                        }
     265                                }
     266
     267                                item = ui.item.data( "ui-autocomplete-item" );
     268                                if ( false !== this._trigger( "focus", event, { item: item } ) ) {
     269
     270                                        // use value to match what will end up in the input, if it was a key event
     271                                        if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
     272                                                this._value( item.value );
     273                                        }
     274                                }
     275
     276                                // Announce the value in the liveRegion
     277                                label = ui.item.attr( "aria-label" ) || item.value;
     278                                if ( label && $.trim( label ).length ) {
     279                                        this.liveRegion.children().hide();
     280                                        $( "<div>" ).text( label ).appendTo( this.liveRegion );
     281                                }
     282                        },
     283                        menuselect: function( event, ui ) {
     284                                var item = ui.item.data( "ui-autocomplete-item" ),
     285                                        previous = this.previous;
     286
     287                                // Only trigger when focus was lost (click on menu)
     288                                if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
     289                                        this.element.trigger( "focus" );
     290                                        this.previous = previous;
     291
     292                                        // #6109 - IE triggers two focus events and the second
     293                                        // is asynchronous, so we need to reset the previous
     294                                        // term synchronously and asynchronously :-(
     295                                        this._delay( function() {
     296                                                this.previous = previous;
     297                                                this.selectedItem = item;
     298                                        } );
     299                                }
     300
     301                                if ( false !== this._trigger( "select", event, { item: item } ) ) {
     302                                        this._value( item.value );
     303                                }
     304
     305                                // reset the term after the select event
     306                                // this allows custom select handling to work properly
     307                                this.term = this._value();
     308
     309                                this.close( event );
     310                                this.selectedItem = item;
     311                        }
     312                } );
     313
     314                this.liveRegion = $( "<div>", {
     315                        role: "status",
     316                        "aria-live": "assertive",
     317                        "aria-relevant": "additions"
     318                } )
     319                        .appendTo( this.document[ 0 ].body );
     320
     321                this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
     322
     323                // Turning off autocomplete prevents the browser from remembering the
     324                // value when navigating through history, so we re-enable autocomplete
     325                // if the page is unloaded before the widget is destroyed. #7790
     326                this._on( this.window, {
     327                        beforeunload: function() {
     328                                this.element.removeAttr( "autocomplete" );
     329                        }
     330                } );
     331        },
     332
     333        _destroy: function() {
     334                clearTimeout( this.searching );
     335                this.element.removeAttr( "autocomplete" );
     336                this.menu.element.remove();
     337                this.liveRegion.remove();
     338        },
     339
     340        _setOption: function( key, value ) {
     341                this._super( key, value );
     342                if ( key === "source" ) {
     343                        this._initSource();
     344                }
     345                if ( key === "appendTo" ) {
     346                        this.menu.element.appendTo( this._appendTo() );
     347                }
     348                if ( key === "disabled" && value && this.xhr ) {
     349                        this.xhr.abort();
     350                }
     351        },
     352
     353        _isEventTargetInWidget: function( event ) {
     354                var menuElement = this.menu.element[ 0 ];
     355
     356                return event.target === this.element[ 0 ] ||
     357                        event.target === menuElement ||
     358                        $.contains( menuElement, event.target );
     359        },
     360
     361        _closeOnClickOutside: function( event ) {
     362                if ( !this._isEventTargetInWidget( event ) ) {
     363                        this.close();
     364                }
     365        },
     366
     367        _appendTo: function() {
     368                var element = this.options.appendTo;
     369
     370                if ( element ) {
     371                        element = element.jquery || element.nodeType ?
     372                                $( element ) :
     373                                this.document.find( element ).eq( 0 );
     374                }
     375
     376                if ( !element || !element[ 0 ] ) {
     377                        element = this.element.closest( ".ui-front, dialog" );
     378                }
     379
     380                if ( !element.length ) {
     381                        element = this.document[ 0 ].body;
     382                }
     383
     384                return element;
     385        },
     386
     387        _initSource: function() {
     388                var array, url,
     389                        that = this;
     390                if ( $.isArray( this.options.source ) ) {
     391                        array = this.options.source;
     392                        this.source = function( request, response ) {
     393                                response( $.ui.autocomplete.filter( array, request.term ) );
     394                        };
     395                } else if ( typeof this.options.source === "string" ) {
     396                        url = this.options.source;
     397                        this.source = function( request, response ) {
     398                                if ( that.xhr ) {
     399                                        that.xhr.abort();
     400                                }
     401                                that.xhr = $.ajax( {
     402                                        url: url,
     403                                        data: request,
     404                                        dataType: "json",
     405                                        success: function( data ) {
     406                                                response( data );
     407                                        },
     408                                        error: function() {
     409                                                response( [] );
     410                                        }
     411                                } );
     412                        };
     413                } else {
     414                        this.source = this.options.source;
     415                }
     416        },
     417
     418        _searchTimeout: function( event ) {
     419                clearTimeout( this.searching );
     420                this.searching = this._delay( function() {
     421
     422                        // Search if the value has changed, or if the user retypes the same value (see #7434)
     423                        var equalValues = this.term === this._value(),
     424                                menuVisible = this.menu.element.is( ":visible" ),
     425                                modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
     426
     427                        if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
     428                                this.selectedItem = null;
     429                                this.search( null, event );
     430                        }
     431                }, this.options.delay );
     432        },
     433
     434        search: function( value, event ) {
     435                value = value != null ? value : this._value();
     436
     437                // Always save the actual value, not the one passed as an argument
     438                this.term = this._value();
     439
     440                if ( value.length < this.options.minLength ) {
     441                        return this.close( event );
     442                }
     443
     444                if ( this._trigger( "search", event ) === false ) {
     445                        return;
     446                }
     447
     448                return this._search( value );
     449        },
     450
     451        _search: function( value ) {
     452                this.pending++;
     453                this._addClass( "ui-autocomplete-loading" );
     454                this.cancelSearch = false;
     455
     456                this.source( { term: value }, this._response() );
     457        },
     458
     459        _response: function() {
     460                var index = ++this.requestIndex;
     461
     462                return $.proxy( function( content ) {
     463                        if ( index === this.requestIndex ) {
     464                                this.__response( content );
     465                        }
     466
     467                        this.pending--;
     468                        if ( !this.pending ) {
     469                                this._removeClass( "ui-autocomplete-loading" );
     470                        }
     471                }, this );
     472        },
     473
     474        __response: function( content ) {
     475                if ( content ) {
     476                        content = this._normalize( content );
     477                }
     478                this._trigger( "response", null, { content: content } );
     479                if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
     480                        this._suggest( content );
     481                        this._trigger( "open" );
     482                } else {
     483
     484                        // use ._close() instead of .close() so we don't cancel future searches
     485                        this._close();
     486                }
     487        },
     488
     489        close: function( event ) {
     490                this.cancelSearch = true;
     491                this._close( event );
     492        },
     493
     494        _close: function( event ) {
     495
     496                // Remove the handler that closes the menu on outside clicks
     497                this._off( this.document, "mousedown" );
     498
     499                if ( this.menu.element.is( ":visible" ) ) {
     500                        this.menu.element.hide();
     501                        this.menu.blur();
     502                        this.isNewMenu = true;
     503                        this._trigger( "close", event );
     504                }
     505        },
     506
     507        _change: function( event ) {
     508                if ( this.previous !== this._value() ) {
     509                        this._trigger( "change", event, { item: this.selectedItem } );
     510                }
     511        },
     512
     513        _normalize: function( items ) {
     514
     515                // assume all items have the right format when the first item is complete
     516                if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
     517                        return items;
     518                }
     519                return $.map( items, function( item ) {
     520                        if ( typeof item === "string" ) {
     521                                return {
     522                                        label: item,
     523                                        value: item
     524                                };
     525                        }
     526                        return $.extend( {}, item, {
     527                                label: item.label || item.value,
     528                                value: item.value || item.label
     529                        } );
     530                } );
     531        },
     532
     533        _suggest: function( items ) {
     534                var ul = this.menu.element.empty();
     535                this._renderMenu( ul, items );
     536                this.isNewMenu = true;
     537                this.menu.refresh();
     538
     539                // Size and position menu
     540                ul.show();
     541                this._resizeMenu();
     542                ul.position( $.extend( {
     543                        of: this.element
     544                }, this.options.position ) );
     545
     546                if ( this.options.autoFocus ) {
     547                        this.menu.next();
     548                }
     549
     550                // Listen for interactions outside of the widget (#6642)
     551                this._on( this.document, {
     552                        mousedown: "_closeOnClickOutside"
     553                } );
     554        },
     555
     556        _resizeMenu: function() {
     557                var ul = this.menu.element;
     558                ul.outerWidth( Math.max(
     559
     560                        // Firefox wraps long text (possibly a rounding bug)
     561                        // so we add 1px to avoid the wrapping (#7513)
     562                        ul.width( "" ).outerWidth() + 1,
     563                        this.element.outerWidth()
     564                ) );
     565        },
     566
     567        _renderMenu: function( ul, items ) {
     568                var that = this;
     569                $.each( items, function( index, item ) {
     570                        that._renderItemData( ul, item );
     571                } );
     572        },
     573
     574        _renderItemData: function( ul, item ) {
     575                return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
     576        },
     577
     578        _renderItem: function( ul, item ) {
     579                return $( "<li>" )
     580                        .append( $( "<div>" ).text( item.label ) )
     581                        .appendTo( ul );
     582        },
     583
     584        _move: function( direction, event ) {
     585                if ( !this.menu.element.is( ":visible" ) ) {
     586                        this.search( null, event );
     587                        return;
     588                }
     589                if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
     590                                this.menu.isLastItem() && /^next/.test( direction ) ) {
     591
     592                        if ( !this.isMultiLine ) {
     593                                this._value( this.term );
     594                        }
     595
     596                        this.menu.blur();
     597                        return;
     598                }
     599                this.menu[ direction ]( event );
     600        },
     601
     602        widget: function() {
     603                return this.menu.element;
     604        },
     605
     606        _value: function() {
     607                return this.valueMethod.apply( this.element, arguments );
     608        },
     609
     610        _keyEvent: function( keyEvent, event ) {
     611                if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
     612                        this._move( keyEvent, event );
     613
     614                        // Prevents moving cursor to beginning/end of the text field in some browsers
     615                        event.preventDefault();
     616                }
     617        },
     618
     619        // Support: Chrome <=50
     620        // We should be able to just use this.element.prop( "isContentEditable" )
     621        // but hidden elements always report false in Chrome.
     622        // https://code.google.com/p/chromium/issues/detail?id=313082
     623        _isContentEditable: function( element ) {
     624                if ( !element.length ) {
     625                        return false;
     626                }
     627
     628                var editable = element.prop( "contentEditable" );
     629
     630                if ( editable === "inherit" ) {
     631                  return this._isContentEditable( element.parent() );
     632                }
     633
     634                return editable === "true";
     635        }
     636} );
     637
     638$.extend( $.ui.autocomplete, {
     639        escapeRegex: function( value ) {
     640                return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
     641        },
     642        filter: function( array, term ) {
     643                var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
     644                return $.grep( array, function( value ) {
     645                        return matcher.test( value.label || value.value || value );
     646                } );
     647        }
     648} );
     649
     650// Live region extension, adding a `messages` option
     651// NOTE: This is an experimental API. We are still investigating
     652// a full solution for string manipulation and internationalization.
     653$.widget( "ui.autocomplete", $.ui.autocomplete, {
     654        options: {
     655                messages: {
     656                        noResults: "No search results.",
     657                        results: function( amount ) {
     658                                return amount + ( amount > 1 ? " results are" : " result is" ) +
     659                                        " available, use up and down arrow keys to navigate.";
     660                        }
     661                }
     662        },
     663
     664        __response: function( content ) {
     665                var message;
     666                this._superApply( arguments );
     667                if ( this.options.disabled || this.cancelSearch ) {
     668                        return;
     669                }
     670                if ( content && content.length ) {
     671                        message = this.options.messages.results( content.length );
     672                } else {
     673                        message = this.options.messages.noResults;
     674                }
     675                this.liveRegion.children().hide();
     676                $( "<div>" ).text( message ).appendTo( this.liveRegion );
     677        }
     678} );
     679
     680return $.ui.autocomplete;
     681
     682} ) );
  • src/js/_enqueues/vendor/jquery/ui/button.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/autocomplete.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Button 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Button
     11//>>group: Widgets
     12//>>description: Enhances a form with themeable buttons.
     13//>>docs: http://api.jqueryui.com/button/
     14//>>demos: http://jqueryui.com/button/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/button.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25
     26                        // These are only for backcompat
     27                        // TODO: Remove after 1.12
     28                        "./controlgroup",
     29                        "./checkboxradio",
     30
     31                        "./keycode",
     32                        "./widget"
     33                ], factory );
     34        } else {
     35
     36                // Browser globals
     37                factory( jQuery );
     38        }
     39}( function( $ ) {
     40
     41$.widget( "ui.button", {
     42        version: "1.12.1",
     43        defaultElement: "<button>",
     44        options: {
     45                classes: {
     46                        "ui-button": "ui-corner-all"
     47                },
     48                disabled: null,
     49                icon: null,
     50                iconPosition: "beginning",
     51                label: null,
     52                showLabel: true
     53        },
     54
     55        _getCreateOptions: function() {
     56                var disabled,
     57
     58                        // This is to support cases like in jQuery Mobile where the base widget does have
     59                        // an implementation of _getCreateOptions
     60                        options = this._super() || {};
     61
     62                this.isInput = this.element.is( "input" );
     63
     64                disabled = this.element[ 0 ].disabled;
     65                if ( disabled != null ) {
     66                        options.disabled = disabled;
     67                }
     68
     69                this.originalLabel = this.isInput ? this.element.val() : this.element.html();
     70                if ( this.originalLabel ) {
     71                        options.label = this.originalLabel;
     72                }
     73
     74                return options;
     75        },
     76
     77        _create: function() {
     78                if ( !this.option.showLabel & !this.options.icon ) {
     79                        this.options.showLabel = true;
     80                }
     81
     82                // We have to check the option again here even though we did in _getCreateOptions,
     83                // because null may have been passed on init which would override what was set in
     84                // _getCreateOptions
     85                if ( this.options.disabled == null ) {
     86                        this.options.disabled = this.element[ 0 ].disabled || false;
     87                }
     88
     89                this.hasTitle = !!this.element.attr( "title" );
     90
     91                // Check to see if the label needs to be set or if its already correct
     92                if ( this.options.label && this.options.label !== this.originalLabel ) {
     93                        if ( this.isInput ) {
     94                                this.element.val( this.options.label );
     95                        } else {
     96                                this.element.html( this.options.label );
     97                        }
     98                }
     99                this._addClass( "ui-button", "ui-widget" );
     100                this._setOption( "disabled", this.options.disabled );
     101                this._enhance();
     102
     103                if ( this.element.is( "a" ) ) {
     104                        this._on( {
     105                                "keyup": function( event ) {
     106                                        if ( event.keyCode === $.ui.keyCode.SPACE ) {
     107                                                event.preventDefault();
     108
     109                                                // Support: PhantomJS <= 1.9, IE 8 Only
     110                                                // If a native click is available use it so we actually cause navigation
     111                                                // otherwise just trigger a click event
     112                                                if ( this.element[ 0 ].click ) {
     113                                                        this.element[ 0 ].click();
     114                                                } else {
     115                                                        this.element.trigger( "click" );
     116                                                }
     117                                        }
     118                                }
     119                        } );
     120                }
     121        },
     122
     123        _enhance: function() {
     124                if ( !this.element.is( "button" ) ) {
     125                        this.element.attr( "role", "button" );
     126                }
     127
     128                if ( this.options.icon ) {
     129                        this._updateIcon( "icon", this.options.icon );
     130                        this._updateTooltip();
     131                }
     132        },
     133
     134        _updateTooltip: function() {
     135                this.title = this.element.attr( "title" );
     136
     137                if ( !this.options.showLabel && !this.title ) {
     138                        this.element.attr( "title", this.options.label );
     139                }
     140        },
     141
     142        _updateIcon: function( option, value ) {
     143                var icon = option !== "iconPosition",
     144                        position = icon ? this.options.iconPosition : value,
     145                        displayBlock = position === "top" || position === "bottom";
     146
     147                // Create icon
     148                if ( !this.icon ) {
     149                        this.icon = $( "<span>" );
     150
     151                        this._addClass( this.icon, "ui-button-icon", "ui-icon" );
     152
     153                        if ( !this.options.showLabel ) {
     154                                this._addClass( "ui-button-icon-only" );
     155                        }
     156                } else if ( icon ) {
     157
     158                        // If we are updating the icon remove the old icon class
     159                        this._removeClass( this.icon, null, this.options.icon );
     160                }
     161
     162                // If we are updating the icon add the new icon class
     163                if ( icon ) {
     164                        this._addClass( this.icon, null, value );
     165                }
     166
     167                this._attachIcon( position );
     168
     169                // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
     170                // the iconSpace if there is one.
     171                if ( displayBlock ) {
     172                        this._addClass( this.icon, null, "ui-widget-icon-block" );
     173                        if ( this.iconSpace ) {
     174                                this.iconSpace.remove();
     175                        }
     176                } else {
     177
     178                        // Position is beginning or end so remove the ui-widget-icon-block class and add the
     179                        // space if it does not exist
     180                        if ( !this.iconSpace ) {
     181                                this.iconSpace = $( "<span> </span>" );
     182                                this._addClass( this.iconSpace, "ui-button-icon-space" );
     183                        }
     184                        this._removeClass( this.icon, null, "ui-wiget-icon-block" );
     185                        this._attachIconSpace( position );
     186                }
     187        },
     188
     189        _destroy: function() {
     190                this.element.removeAttr( "role" );
     191
     192                if ( this.icon ) {
     193                        this.icon.remove();
     194                }
     195                if ( this.iconSpace ) {
     196                        this.iconSpace.remove();
     197                }
     198                if ( !this.hasTitle ) {
     199                        this.element.removeAttr( "title" );
     200                }
     201        },
     202
     203        _attachIconSpace: function( iconPosition ) {
     204                this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
     205        },
     206
     207        _attachIcon: function( iconPosition ) {
     208                this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
     209        },
     210
     211        _setOptions: function( options ) {
     212                var newShowLabel = options.showLabel === undefined ?
     213                                this.options.showLabel :
     214                                options.showLabel,
     215                        newIcon = options.icon === undefined ? this.options.icon : options.icon;
     216
     217                if ( !newShowLabel && !newIcon ) {
     218                        options.showLabel = true;
     219                }
     220                this._super( options );
     221        },
     222
     223        _setOption: function( key, value ) {
     224                if ( key === "icon" ) {
     225                        if ( value ) {
     226                                this._updateIcon( key, value );
     227                        } else if ( this.icon ) {
     228                                this.icon.remove();
     229                                if ( this.iconSpace ) {
     230                                        this.iconSpace.remove();
     231                                }
     232                        }
     233                }
     234
     235                if ( key === "iconPosition" ) {
     236                        this._updateIcon( key, value );
     237                }
     238
     239                // Make sure we can't end up with a button that has neither text nor icon
     240                if ( key === "showLabel" ) {
     241                                this._toggleClass( "ui-button-icon-only", null, !value );
     242                                this._updateTooltip();
     243                }
     244
     245                if ( key === "label" ) {
     246                        if ( this.isInput ) {
     247                                this.element.val( value );
     248                        } else {
     249
     250                                // If there is an icon, append it, else nothing then append the value
     251                                // this avoids removal of the icon when setting label text
     252                                this.element.html( value );
     253                                if ( this.icon ) {
     254                                        this._attachIcon( this.options.iconPosition );
     255                                        this._attachIconSpace( this.options.iconPosition );
     256                                }
     257                        }
     258                }
     259
     260                this._super( key, value );
     261
     262                if ( key === "disabled" ) {
     263                        this._toggleClass( null, "ui-state-disabled", value );
     264                        this.element[ 0 ].disabled = value;
     265                        if ( value ) {
     266                                this.element.blur();
     267                        }
     268                }
     269        },
     270
     271        refresh: function() {
     272
     273                // Make sure to only check disabled if its an element that supports this otherwise
     274                // check for the disabled class to determine state
     275                var isDisabled = this.element.is( "input, button" ) ?
     276                        this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
     277
     278                if ( isDisabled !== this.options.disabled ) {
     279                        this._setOptions( { disabled: isDisabled } );
     280                }
     281
     282                this._updateTooltip();
     283        }
     284} );
     285
     286// DEPRECATED
     287if ( $.uiBackCompat !== false ) {
     288
     289        // Text and Icons options
     290        $.widget( "ui.button", $.ui.button, {
     291                options: {
     292                        text: true,
     293                        icons: {
     294                                primary: null,
     295                                secondary: null
     296                        }
     297                },
     298
     299                _create: function() {
     300                        if ( this.options.showLabel && !this.options.text ) {
     301                                this.options.showLabel = this.options.text;
     302                        }
     303                        if ( !this.options.showLabel && this.options.text ) {
     304                                this.options.text = this.options.showLabel;
     305                        }
     306                        if ( !this.options.icon && ( this.options.icons.primary ||
     307                                        this.options.icons.secondary ) ) {
     308                                if ( this.options.icons.primary ) {
     309                                        this.options.icon = this.options.icons.primary;
     310                                } else {
     311                                        this.options.icon = this.options.icons.secondary;
     312                                        this.options.iconPosition = "end";
     313                                }
     314                        } else if ( this.options.icon ) {
     315                                this.options.icons.primary = this.options.icon;
     316                        }
     317                        this._super();
     318                },
     319
     320                _setOption: function( key, value ) {
     321                        if ( key === "text" ) {
     322                                this._super( "showLabel", value );
     323                                return;
     324                        }
     325                        if ( key === "showLabel" ) {
     326                                this.options.text = value;
     327                        }
     328                        if ( key === "icon" ) {
     329                                this.options.icons.primary = value;
     330                        }
     331                        if ( key === "icons" ) {
     332                                if ( value.primary ) {
     333                                        this._super( "icon", value.primary );
     334                                        this._super( "iconPosition", "beginning" );
     335                                } else if ( value.secondary ) {
     336                                        this._super( "icon", value.secondary );
     337                                        this._super( "iconPosition", "end" );
     338                                }
     339                        }
     340                        this._superApply( arguments );
     341                }
     342        } );
     343
     344        $.fn.button = ( function( orig ) {
     345                return function() {
     346                        if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
     347                                        ( this.length && this[ 0 ].tagName === "INPUT" && (
     348                                                this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
     349                                        ) ) ) {
     350                                return orig.apply( this, arguments );
     351                        }
     352                        if ( !$.ui.checkboxradio ) {
     353                                $.error( "Checkboxradio widget missing" );
     354                        }
     355                        if ( arguments.length === 0 ) {
     356                                return this.checkboxradio( {
     357                                        "icon": false
     358                                } );
     359                        }
     360                        return this.checkboxradio.apply( this, arguments );
     361                };
     362        } )( $.fn.button );
     363
     364        $.fn.buttonset = function() {
     365                if ( !$.ui.controlgroup ) {
     366                        $.error( "Controlgroup widget missing" );
     367                }
     368                if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
     369                        return this.controlgroup.apply( this,
     370                                [ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
     371                }
     372                if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
     373                        return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
     374                }
     375                if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
     376                        arguments[ 0 ].items = {
     377                                button: arguments[ 0 ].items
     378                        };
     379                }
     380                return this.controlgroup.apply( this, arguments );
     381        };
     382}
     383
     384return $.ui.button;
     385
     386} ) );
  • src/js/_enqueues/vendor/jquery/ui/checkboxradio.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/button.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Checkboxradio 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Checkboxradio
     11//>>group: Widgets
     12//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
     13//>>docs: http://api.jqueryui.com/checkboxradio/
     14//>>demos: http://jqueryui.com/checkboxradio/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/button.css
     17//>>css.structure: ../../themes/base/checkboxradio.css
     18//>>css.theme: ../../themes/base/theme.css
     19
     20( function( factory ) {
     21        if ( typeof define === "function" && define.amd ) {
     22
     23                // AMD. Register as an anonymous module.
     24                define( [
     25                        "jquery",
     26                        "./escape-selector",
     27                        "./form-reset-mixin",
     28                        "./labels",
     29                        "./widget"
     30                ], factory );
     31        } else {
     32
     33                // Browser globals
     34                factory( jQuery );
     35        }
     36}( function( $ ) {
     37
     38$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
     39        version: "1.12.1",
     40        options: {
     41                disabled: null,
     42                label: null,
     43                icon: true,
     44                classes: {
     45                        "ui-checkboxradio-label": "ui-corner-all",
     46                        "ui-checkboxradio-icon": "ui-corner-all"
     47                }
     48        },
     49
     50        _getCreateOptions: function() {
     51                var disabled, labels;
     52                var that = this;
     53                var options = this._super() || {};
     54
     55                // We read the type here, because it makes more sense to throw a element type error first,
     56                // rather then the error for lack of a label. Often if its the wrong type, it
     57                // won't have a label (e.g. calling on a div, btn, etc)
     58                this._readType();
     59
     60                labels = this.element.labels();
     61
     62                // If there are multiple labels, use the last one
     63                this.label = $( labels[ labels.length - 1 ] );
     64                if ( !this.label.length ) {
     65                        $.error( "No label found for checkboxradio widget" );
     66                }
     67
     68                this.originalLabel = "";
     69
     70                // We need to get the label text but this may also need to make sure it does not contain the
     71                // input itself.
     72                this.label.contents().not( this.element[ 0 ] ).each( function() {
     73
     74                        // The label contents could be text, html, or a mix. We concat each element to get a
     75                        // string representation of the label, without the input as part of it.
     76                        that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
     77                } );
     78
     79                // Set the label option if we found label text
     80                if ( this.originalLabel ) {
     81                        options.label = this.originalLabel;
     82                }
     83
     84                disabled = this.element[ 0 ].disabled;
     85                if ( disabled != null ) {
     86                        options.disabled = disabled;
     87                }
     88                return options;
     89        },
     90
     91        _create: function() {
     92                var checked = this.element[ 0 ].checked;
     93
     94                this._bindFormResetHandler();
     95
     96                if ( this.options.disabled == null ) {
     97                        this.options.disabled = this.element[ 0 ].disabled;
     98                }
     99
     100                this._setOption( "disabled", this.options.disabled );
     101                this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
     102                this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
     103
     104                if ( this.type === "radio" ) {
     105                        this._addClass( this.label, "ui-checkboxradio-radio-label" );
     106                }
     107
     108                if ( this.options.label && this.options.label !== this.originalLabel ) {
     109                        this._updateLabel();
     110                } else if ( this.originalLabel ) {
     111                        this.options.label = this.originalLabel;
     112                }
     113
     114                this._enhance();
     115
     116                if ( checked ) {
     117                        this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
     118                        if ( this.icon ) {
     119                                this._addClass( this.icon, null, "ui-state-hover" );
     120                        }
     121                }
     122
     123                this._on( {
     124                        change: "_toggleClasses",
     125                        focus: function() {
     126                                this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
     127                        },
     128                        blur: function() {
     129                                this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
     130                        }
     131                } );
     132        },
     133
     134        _readType: function() {
     135                var nodeName = this.element[ 0 ].nodeName.toLowerCase();
     136                this.type = this.element[ 0 ].type;
     137                if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
     138                        $.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
     139                                " and element.type=" + this.type );
     140                }
     141        },
     142
     143        // Support jQuery Mobile enhanced option
     144        _enhance: function() {
     145                this._updateIcon( this.element[ 0 ].checked );
     146        },
     147
     148        widget: function() {
     149                return this.label;
     150        },
     151
     152        _getRadioGroup: function() {
     153                var group;
     154                var name = this.element[ 0 ].name;
     155                var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']";
     156
     157                if ( !name ) {
     158                        return $( [] );
     159                }
     160
     161                if ( this.form.length ) {
     162                        group = $( this.form[ 0 ].elements ).filter( nameSelector );
     163                } else {
     164
     165                        // Not inside a form, check all inputs that also are not inside a form
     166                        group = $( nameSelector ).filter( function() {
     167                                return $( this ).form().length === 0;
     168                        } );
     169                }
     170
     171                return group.not( this.element );
     172        },
     173
     174        _toggleClasses: function() {
     175                var checked = this.element[ 0 ].checked;
     176                this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
     177
     178                if ( this.options.icon && this.type === "checkbox" ) {
     179                        this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
     180                                ._toggleClass( this.icon, null, "ui-icon-blank", !checked );
     181                }
     182
     183                if ( this.type === "radio" ) {
     184                        this._getRadioGroup()
     185                                .each( function() {
     186                                        var instance = $( this ).checkboxradio( "instance" );
     187
     188                                        if ( instance ) {
     189                                                instance._removeClass( instance.label,
     190                                                        "ui-checkboxradio-checked", "ui-state-active" );
     191                                        }
     192                                } );
     193                }
     194        },
     195
     196        _destroy: function() {
     197                this._unbindFormResetHandler();
     198
     199                if ( this.icon ) {
     200                        this.icon.remove();
     201                        this.iconSpace.remove();
     202                }
     203        },
     204
     205        _setOption: function( key, value ) {
     206
     207                // We don't allow the value to be set to nothing
     208                if ( key === "label" && !value ) {
     209                        return;
     210                }
     211
     212                this._super( key, value );
     213
     214                if ( key === "disabled" ) {
     215                        this._toggleClass( this.label, null, "ui-state-disabled", value );
     216                        this.element[ 0 ].disabled = value;
     217
     218                        // Don't refresh when setting disabled
     219                        return;
     220                }
     221                this.refresh();
     222        },
     223
     224        _updateIcon: function( checked ) {
     225                var toAdd = "ui-icon ui-icon-background ";
     226
     227                if ( this.options.icon ) {
     228                        if ( !this.icon ) {
     229                                this.icon = $( "<span>" );
     230                                this.iconSpace = $( "<span> </span>" );
     231                                this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
     232                        }
     233
     234                        if ( this.type === "checkbox" ) {
     235                                toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
     236                                this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
     237                        } else {
     238                                toAdd += "ui-icon-blank";
     239                        }
     240                        this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
     241                        if ( !checked ) {
     242                                this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
     243                        }
     244                        this.icon.prependTo( this.label ).after( this.iconSpace );
     245                } else if ( this.icon !== undefined ) {
     246                        this.icon.remove();
     247                        this.iconSpace.remove();
     248                        delete this.icon;
     249                }
     250        },
     251
     252        _updateLabel: function() {
     253
     254                // Remove the contents of the label ( minus the icon, icon space, and input )
     255                var contents = this.label.contents().not( this.element[ 0 ] );
     256                if ( this.icon ) {
     257                        contents = contents.not( this.icon[ 0 ] );
     258                }
     259                if ( this.iconSpace ) {
     260                        contents = contents.not( this.iconSpace[ 0 ] );
     261                }
     262                contents.remove();
     263
     264                this.label.append( this.options.label );
     265        },
     266
     267        refresh: function() {
     268                var checked = this.element[ 0 ].checked,
     269                        isDisabled = this.element[ 0 ].disabled;
     270
     271                this._updateIcon( checked );
     272                this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
     273                if ( this.options.label !== null ) {
     274                        this._updateLabel();
     275                }
     276
     277                if ( isDisabled !== this.options.disabled ) {
     278                        this._setOptions( { "disabled": isDisabled } );
     279                }
     280        }
     281
     282} ] );
     283
     284return $.ui.checkboxradio;
     285
     286} ) );
  • src/js/_enqueues/vendor/jquery/ui/controlgroup.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/checkboxradio.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Controlgroup 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Controlgroup
     11//>>group: Widgets
     12//>>description: Visually groups form control widgets
     13//>>docs: http://api.jqueryui.com/controlgroup/
     14//>>demos: http://jqueryui.com/controlgroup/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/controlgroup.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./widget"
     26                ], factory );
     27        } else {
     28
     29                // Browser globals
     30                factory( jQuery );
     31        }
     32}( function( $ ) {
     33var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
     34
     35return $.widget( "ui.controlgroup", {
     36        version: "1.12.1",
     37        defaultElement: "<div>",
     38        options: {
     39                direction: "horizontal",
     40                disabled: null,
     41                onlyVisible: true,
     42                items: {
     43                        "button": "input[type=button], input[type=submit], input[type=reset], button, a",
     44                        "controlgroupLabel": ".ui-controlgroup-label",
     45                        "checkboxradio": "input[type='checkbox'], input[type='radio']",
     46                        "selectmenu": "select",
     47                        "spinner": ".ui-spinner-input"
     48                }
     49        },
     50
     51        _create: function() {
     52                this._enhance();
     53        },
     54
     55        // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
     56        _enhance: function() {
     57                this.element.attr( "role", "toolbar" );
     58                this.refresh();
     59        },
     60
     61        _destroy: function() {
     62                this._callChildMethod( "destroy" );
     63                this.childWidgets.removeData( "ui-controlgroup-data" );
     64                this.element.removeAttr( "role" );
     65                if ( this.options.items.controlgroupLabel ) {
     66                        this.element
     67                                .find( this.options.items.controlgroupLabel )
     68                                .find( ".ui-controlgroup-label-contents" )
     69                                .contents().unwrap();
     70                }
     71        },
     72
     73        _initWidgets: function() {
     74                var that = this,
     75                        childWidgets = [];
     76
     77                // First we iterate over each of the items options
     78                $.each( this.options.items, function( widget, selector ) {
     79                        var labels;
     80                        var options = {};
     81
     82                        // Make sure the widget has a selector set
     83                        if ( !selector ) {
     84                                return;
     85                        }
     86
     87                        if ( widget === "controlgroupLabel" ) {
     88                                labels = that.element.find( selector );
     89                                labels.each( function() {
     90                                        var element = $( this );
     91
     92                                        if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
     93                                                return;
     94                                        }
     95                                        element.contents()
     96                                                .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
     97                                } );
     98                                that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
     99                                childWidgets = childWidgets.concat( labels.get() );
     100                                return;
     101                        }
     102
     103                        // Make sure the widget actually exists
     104                        if ( !$.fn[ widget ] ) {
     105                                return;
     106                        }
     107
     108                        // We assume everything is in the middle to start because we can't determine
     109                        // first / last elements until all enhancments are done.
     110                        if ( that[ "_" + widget + "Options" ] ) {
     111                                options = that[ "_" + widget + "Options" ]( "middle" );
     112                        } else {
     113                                options = { classes: {} };
     114                        }
     115
     116                        // Find instances of this widget inside controlgroup and init them
     117                        that.element
     118                                .find( selector )
     119                                .each( function() {
     120                                        var element = $( this );
     121                                        var instance = element[ widget ]( "instance" );
     122
     123                                        // We need to clone the default options for this type of widget to avoid
     124                                        // polluting the variable options which has a wider scope than a single widget.
     125                                        var instanceOptions = $.widget.extend( {}, options );
     126
     127                                        // If the button is the child of a spinner ignore it
     128                                        // TODO: Find a more generic solution
     129                                        if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
     130                                                return;
     131                                        }
     132
     133                                        // Create the widget if it doesn't exist
     134                                        if ( !instance ) {
     135                                                instance = element[ widget ]()[ widget ]( "instance" );
     136                                        }
     137                                        if ( instance ) {
     138                                                instanceOptions.classes =
     139                                                        that._resolveClassesValues( instanceOptions.classes, instance );
     140                                        }
     141                                        element[ widget ]( instanceOptions );
     142
     143                                        // Store an instance of the controlgroup to be able to reference
     144                                        // from the outermost element for changing options and refresh
     145                                        var widgetElement = element[ widget ]( "widget" );
     146                                        $.data( widgetElement[ 0 ], "ui-controlgroup-data",
     147                                                instance ? instance : element[ widget ]( "instance" ) );
     148
     149                                        childWidgets.push( widgetElement[ 0 ] );
     150                                } );
     151                } );
     152
     153                this.childWidgets = $( $.unique( childWidgets ) );
     154                this._addClass( this.childWidgets, "ui-controlgroup-item" );
     155        },
     156
     157        _callChildMethod: function( method ) {
     158                this.childWidgets.each( function() {
     159                        var element = $( this ),
     160                                data = element.data( "ui-controlgroup-data" );
     161                        if ( data && data[ method ] ) {
     162                                data[ method ]();
     163                        }
     164                } );
     165        },
     166
     167        _updateCornerClass: function( element, position ) {
     168                var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
     169                var add = this._buildSimpleOptions( position, "label" ).classes.label;
     170
     171                this._removeClass( element, null, remove );
     172                this._addClass( element, null, add );
     173        },
     174
     175        _buildSimpleOptions: function( position, key ) {
     176                var direction = this.options.direction === "vertical";
     177                var result = {
     178                        classes: {}
     179                };
     180                result.classes[ key ] = {
     181                        "middle": "",
     182                        "first": "ui-corner-" + ( direction ? "top" : "left" ),
     183                        "last": "ui-corner-" + ( direction ? "bottom" : "right" ),
     184                        "only": "ui-corner-all"
     185                }[ position ];
     186
     187                return result;
     188        },
     189
     190        _spinnerOptions: function( position ) {
     191                var options = this._buildSimpleOptions( position, "ui-spinner" );
     192
     193                options.classes[ "ui-spinner-up" ] = "";
     194                options.classes[ "ui-spinner-down" ] = "";
     195
     196                return options;
     197        },
     198
     199        _buttonOptions: function( position ) {
     200                return this._buildSimpleOptions( position, "ui-button" );
     201        },
     202
     203        _checkboxradioOptions: function( position ) {
     204                return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
     205        },
     206
     207        _selectmenuOptions: function( position ) {
     208                var direction = this.options.direction === "vertical";
     209                return {
     210                        width: direction ? "auto" : false,
     211                        classes: {
     212                                middle: {
     213                                        "ui-selectmenu-button-open": "",
     214                                        "ui-selectmenu-button-closed": ""
     215                                },
     216                                first: {
     217                                        "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
     218                                        "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
     219                                },
     220                                last: {
     221                                        "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
     222                                        "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
     223                                },
     224                                only: {
     225                                        "ui-selectmenu-button-open": "ui-corner-top",
     226                                        "ui-selectmenu-button-closed": "ui-corner-all"
     227                                }
     228
     229                        }[ position ]
     230                };
     231        },
     232
     233        _resolveClassesValues: function( classes, instance ) {
     234                var result = {};
     235                $.each( classes, function( key ) {
     236                        var current = instance.options.classes[ key ] || "";
     237                        current = $.trim( current.replace( controlgroupCornerRegex, "" ) );
     238                        result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
     239                } );
     240                return result;
     241        },
     242
     243        _setOption: function( key, value ) {
     244                if ( key === "direction" ) {
     245                        this._removeClass( "ui-controlgroup-" + this.options.direction );
     246                }
     247
     248                this._super( key, value );
     249                if ( key === "disabled" ) {
     250                        this._callChildMethod( value ? "disable" : "enable" );
     251                        return;
     252                }
     253
     254                this.refresh();
     255        },
     256
     257        refresh: function() {
     258                var children,
     259                        that = this;
     260
     261                this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
     262
     263                if ( this.options.direction === "horizontal" ) {
     264                        this._addClass( null, "ui-helper-clearfix" );
     265                }
     266                this._initWidgets();
     267
     268                children = this.childWidgets;
     269
     270                // We filter here because we need to track all childWidgets not just the visible ones
     271                if ( this.options.onlyVisible ) {
     272                        children = children.filter( ":visible" );
     273                }
     274
     275                if ( children.length ) {
     276
     277                        // We do this last because we need to make sure all enhancment is done
     278                        // before determining first and last
     279                        $.each( [ "first", "last" ], function( index, value ) {
     280                                var instance = children[ value ]().data( "ui-controlgroup-data" );
     281
     282                                if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
     283                                        var options = that[ "_" + instance.widgetName + "Options" ](
     284                                                children.length === 1 ? "only" : value
     285                                        );
     286                                        options.classes = that._resolveClassesValues( options.classes, instance );
     287                                        instance.element[ instance.widgetName ]( options );
     288                                } else {
     289                                        that._updateCornerClass( children[ value ](), value );
     290                                }
     291                        } );
     292
     293                        // Finally call the refresh method on each of the child widgets.
     294                        this._callChildMethod( "refresh" );
     295                }
     296        }
     297} );
     298} ) );
  • src/js/_enqueues/vendor/jquery/ui/core.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/controlgroup.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*! jQuery UI - v1.12.1 - 2016-09-14
     2* http://jqueryui.com
     3* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
     4* Copyright jQuery Foundation and other contributors; Licensed MIT */
     5
     6(function( factory ) {
     7        if ( typeof define === "function" && define.amd ) {
     8
     9                // AMD. Register as an anonymous module.
     10                define([ "jquery" ], factory );
     11        } else {
     12
     13                // Browser globals
     14                factory( jQuery );
     15        }
     16}(function( $ ) {
     17
     18$.ui = $.ui || {};
     19
     20var version = $.ui.version = "1.12.1";
     21
     22
     23/*!
     24 * jQuery UI Widget 1.12.1
     25 * http://jqueryui.com
     26 *
     27 * Copyright jQuery Foundation and other contributors
     28 * Released under the MIT license.
     29 * http://jquery.org/license
     30 */
     31
     32//>>label: Widget
     33//>>group: Core
     34//>>description: Provides a factory for creating stateful widgets with a common API.
     35//>>docs: http://api.jqueryui.com/jQuery.widget/
     36//>>demos: http://jqueryui.com/widget/
     37
     38
     39
     40var widgetUuid = 0;
     41var widgetSlice = Array.prototype.slice;
     42
     43$.cleanData = ( function( orig ) {
     44        return function( elems ) {
     45                var events, elem, i;
     46                for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
     47                        try {
     48
     49                                // Only trigger remove when necessary to save time
     50                                events = $._data( elem, "events" );
     51                                if ( events && events.remove ) {
     52                                        $( elem ).triggerHandler( "remove" );
     53                                }
     54
     55                        // Http://bugs.jquery.com/ticket/8235
     56                        } catch ( e ) {}
     57                }
     58                orig( elems );
     59        };
     60} )( $.cleanData );
     61
     62$.widget = function( name, base, prototype ) {
     63        var existingConstructor, constructor, basePrototype;
     64
     65        // ProxiedPrototype allows the provided prototype to remain unmodified
     66        // so that it can be used as a mixin for multiple widgets (#8876)
     67        var proxiedPrototype = {};
     68
     69        var namespace = name.split( "." )[ 0 ];
     70        name = name.split( "." )[ 1 ];
     71        var fullName = namespace + "-" + name;
     72
     73        if ( !prototype ) {
     74                prototype = base;
     75                base = $.Widget;
     76        }
     77
     78        if ( $.isArray( prototype ) ) {
     79                prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
     80        }
     81
     82        // Create selector for plugin
     83        $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
     84                return !!$.data( elem, fullName );
     85        };
     86
     87        $[ namespace ] = $[ namespace ] || {};
     88        existingConstructor = $[ namespace ][ name ];
     89        constructor = $[ namespace ][ name ] = function( options, element ) {
     90
     91                // Allow instantiation without "new" keyword
     92                if ( !this._createWidget ) {
     93                        return new constructor( options, element );
     94                }
     95
     96                // Allow instantiation without initializing for simple inheritance
     97                // must use "new" keyword (the code above always passes args)
     98                if ( arguments.length ) {
     99                        this._createWidget( options, element );
     100                }
     101        };
     102
     103        // Extend with the existing constructor to carry over any static properties
     104        $.extend( constructor, existingConstructor, {
     105                version: prototype.version,
     106
     107                // Copy the object used to create the prototype in case we need to
     108                // redefine the widget later
     109                _proto: $.extend( {}, prototype ),
     110
     111                // Track widgets that inherit from this widget in case this widget is
     112                // redefined after a widget inherits from it
     113                _childConstructors: []
     114        } );
     115
     116        basePrototype = new base();
     117
     118        // We need to make the options hash a property directly on the new instance
     119        // otherwise we'll modify the options hash on the prototype that we're
     120        // inheriting from
     121        basePrototype.options = $.widget.extend( {}, basePrototype.options );
     122        $.each( prototype, function( prop, value ) {
     123                if ( !$.isFunction( value ) ) {
     124                        proxiedPrototype[ prop ] = value;
     125                        return;
     126                }
     127                proxiedPrototype[ prop ] = ( function() {
     128                        function _super() {
     129                                return base.prototype[ prop ].apply( this, arguments );
     130                        }
     131
     132                        function _superApply( args ) {
     133                                return base.prototype[ prop ].apply( this, args );
     134                        }
     135
     136                        return function() {
     137                                var __super = this._super;
     138                                var __superApply = this._superApply;
     139                                var returnValue;
     140
     141                                this._super = _super;
     142                                this._superApply = _superApply;
     143
     144                                returnValue = value.apply( this, arguments );
     145
     146                                this._super = __super;
     147                                this._superApply = __superApply;
     148
     149                                return returnValue;
     150                        };
     151                } )();
     152        } );
     153        constructor.prototype = $.widget.extend( basePrototype, {
     154
     155                // TODO: remove support for widgetEventPrefix
     156                // always use the name + a colon as the prefix, e.g., draggable:start
     157                // don't prefix for widgets that aren't DOM-based
     158                widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
     159        }, proxiedPrototype, {
     160                constructor: constructor,
     161                namespace: namespace,
     162                widgetName: name,
     163                widgetFullName: fullName
     164        } );
     165
     166        // If this widget is being redefined then we need to find all widgets that
     167        // are inheriting from it and redefine all of them so that they inherit from
     168        // the new version of this widget. We're essentially trying to replace one
     169        // level in the prototype chain.
     170        if ( existingConstructor ) {
     171                $.each( existingConstructor._childConstructors, function( i, child ) {
     172                        var childPrototype = child.prototype;
     173
     174                        // Redefine the child widget using the same prototype that was
     175                        // originally used, but inherit from the new version of the base
     176                        $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
     177                                child._proto );
     178                } );
     179
     180                // Remove the list of existing child constructors from the old constructor
     181                // so the old child constructors can be garbage collected
     182                delete existingConstructor._childConstructors;
     183        } else {
     184                base._childConstructors.push( constructor );
     185        }
     186
     187        $.widget.bridge( name, constructor );
     188
     189        return constructor;
     190};
     191
     192$.widget.extend = function( target ) {
     193        var input = widgetSlice.call( arguments, 1 );
     194        var inputIndex = 0;
     195        var inputLength = input.length;
     196        var key;
     197        var value;
     198
     199        for ( ; inputIndex < inputLength; inputIndex++ ) {
     200                for ( key in input[ inputIndex ] ) {
     201                        value = input[ inputIndex ][ key ];
     202                        if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
     203
     204                                // Clone objects
     205                                if ( $.isPlainObject( value ) ) {
     206                                        target[ key ] = $.isPlainObject( target[ key ] ) ?
     207                                                $.widget.extend( {}, target[ key ], value ) :
     208
     209                                                // Don't extend strings, arrays, etc. with objects
     210                                                $.widget.extend( {}, value );
     211
     212                                // Copy everything else by reference
     213                                } else {
     214                                        target[ key ] = value;
     215                                }
     216                        }
     217                }
     218        }
     219        return target;
     220};
     221
     222$.widget.bridge = function( name, object ) {
     223        var fullName = object.prototype.widgetFullName || name;
     224        $.fn[ name ] = function( options ) {
     225                var isMethodCall = typeof options === "string";
     226                var args = widgetSlice.call( arguments, 1 );
     227                var returnValue = this;
     228
     229                if ( isMethodCall ) {
     230
     231                        // If this is an empty collection, we need to have the instance method
     232                        // return undefined instead of the jQuery instance
     233                        if ( !this.length && options === "instance" ) {
     234                                returnValue = undefined;
     235                        } else {
     236                                this.each( function() {
     237                                        var methodValue;
     238                                        var instance = $.data( this, fullName );
     239
     240                                        if ( options === "instance" ) {
     241                                                returnValue = instance;
     242                                                return false;
     243                                        }
     244
     245                                        if ( !instance ) {
     246                                                return $.error( "cannot call methods on " + name +
     247                                                        " prior to initialization; " +
     248                                                        "attempted to call method '" + options + "'" );
     249                                        }
     250
     251                                        if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
     252                                                return $.error( "no such method '" + options + "' for " + name +
     253                                                        " widget instance" );
     254                                        }
     255
     256                                        methodValue = instance[ options ].apply( instance, args );
     257
     258                                        if ( methodValue !== instance && methodValue !== undefined ) {
     259                                                returnValue = methodValue && methodValue.jquery ?
     260                                                        returnValue.pushStack( methodValue.get() ) :
     261                                                        methodValue;
     262                                                return false;
     263                                        }
     264                                } );
     265                        }
     266                } else {
     267
     268                        // Allow multiple hashes to be passed on init
     269                        if ( args.length ) {
     270                                options = $.widget.extend.apply( null, [ options ].concat( args ) );
     271                        }
     272
     273                        this.each( function() {
     274                                var instance = $.data( this, fullName );
     275                                if ( instance ) {
     276                                        instance.option( options || {} );
     277                                        if ( instance._init ) {
     278                                                instance._init();
     279                                        }
     280                                } else {
     281                                        $.data( this, fullName, new object( options, this ) );
     282                                }
     283                        } );
     284                }
     285
     286                return returnValue;
     287        };
     288};
     289
     290$.Widget = function( /* options, element */ ) {};
     291$.Widget._childConstructors = [];
     292
     293$.Widget.prototype = {
     294        widgetName: "widget",
     295        widgetEventPrefix: "",
     296        defaultElement: "<div>",
     297
     298        options: {
     299                classes: {},
     300                disabled: false,
     301
     302                // Callbacks
     303                create: null
     304        },
     305
     306        _createWidget: function( options, element ) {
     307                element = $( element || this.defaultElement || this )[ 0 ];
     308                this.element = $( element );
     309                this.uuid = widgetUuid++;
     310                this.eventNamespace = "." + this.widgetName + this.uuid;
     311
     312                this.bindings = $();
     313                this.hoverable = $();
     314                this.focusable = $();
     315                this.classesElementLookup = {};
     316
     317                if ( element !== this ) {
     318                        $.data( element, this.widgetFullName, this );
     319                        this._on( true, this.element, {
     320                                remove: function( event ) {
     321                                        if ( event.target === element ) {
     322                                                this.destroy();
     323                                        }
     324                                }
     325                        } );
     326                        this.document = $( element.style ?
     327
     328                                // Element within the document
     329                                element.ownerDocument :
     330
     331                                // Element is window or document
     332                                element.document || element );
     333                        this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
     334                }
     335
     336                this.options = $.widget.extend( {},
     337                        this.options,
     338                        this._getCreateOptions(),
     339                        options );
     340
     341                this._create();
     342
     343                if ( this.options.disabled ) {
     344                        this._setOptionDisabled( this.options.disabled );
     345                }
     346
     347                this._trigger( "create", null, this._getCreateEventData() );
     348                this._init();
     349        },
     350
     351        _getCreateOptions: function() {
     352                return {};
     353        },
     354
     355        _getCreateEventData: $.noop,
     356
     357        _create: $.noop,
     358
     359        _init: $.noop,
     360
     361        destroy: function() {
     362                var that = this;
     363
     364                this._destroy();
     365                $.each( this.classesElementLookup, function( key, value ) {
     366                        that._removeClass( value, key );
     367                } );
     368
     369                // We can probably remove the unbind calls in 2.0
     370                // all event bindings should go through this._on()
     371                this.element
     372                        .off( this.eventNamespace )
     373                        .removeData( this.widgetFullName );
     374                this.widget()
     375                        .off( this.eventNamespace )
     376                        .removeAttr( "aria-disabled" );
     377
     378                // Clean up events and states
     379                this.bindings.off( this.eventNamespace );
     380        },
     381
     382        _destroy: $.noop,
     383
     384        widget: function() {
     385                return this.element;
     386        },
     387
     388        option: function( key, value ) {
     389                var options = key;
     390                var parts;
     391                var curOption;
     392                var i;
     393
     394                if ( arguments.length === 0 ) {
     395
     396                        // Don't return a reference to the internal hash
     397                        return $.widget.extend( {}, this.options );
     398                }
     399
     400                if ( typeof key === "string" ) {
     401
     402                        // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
     403                        options = {};
     404                        parts = key.split( "." );
     405                        key = parts.shift();
     406                        if ( parts.length ) {
     407                                curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
     408                                for ( i = 0; i < parts.length - 1; i++ ) {
     409                                        curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
     410                                        curOption = curOption[ parts[ i ] ];
     411                                }
     412                                key = parts.pop();
     413                                if ( arguments.length === 1 ) {
     414                                        return curOption[ key ] === undefined ? null : curOption[ key ];
     415                                }
     416                                curOption[ key ] = value;
     417                        } else {
     418                                if ( arguments.length === 1 ) {
     419                                        return this.options[ key ] === undefined ? null : this.options[ key ];
     420                                }
     421                                options[ key ] = value;
     422                        }
     423                }
     424
     425                this._setOptions( options );
     426
     427                return this;
     428        },
     429
     430        _setOptions: function( options ) {
     431                var key;
     432
     433                for ( key in options ) {
     434                        this._setOption( key, options[ key ] );
     435                }
     436
     437                return this;
     438        },
     439
     440        _setOption: function( key, value ) {
     441                if ( key === "classes" ) {
     442                        this._setOptionClasses( value );
     443                }
     444
     445                this.options[ key ] = value;
     446
     447                if ( key === "disabled" ) {
     448                        this._setOptionDisabled( value );
     449                }
     450
     451                return this;
     452        },
     453
     454        _setOptionClasses: function( value ) {
     455                var classKey, elements, currentElements;
     456
     457                for ( classKey in value ) {
     458                        currentElements = this.classesElementLookup[ classKey ];
     459                        if ( value[ classKey ] === this.options.classes[ classKey ] ||
     460                                        !currentElements ||
     461                                        !currentElements.length ) {
     462                                continue;
     463                        }
     464
     465                        // We are doing this to create a new jQuery object because the _removeClass() call
     466                        // on the next line is going to destroy the reference to the current elements being
     467                        // tracked. We need to save a copy of this collection so that we can add the new classes
     468                        // below.
     469                        elements = $( currentElements.get() );
     470                        this._removeClass( currentElements, classKey );
     471
     472                        // We don't use _addClass() here, because that uses this.options.classes
     473                        // for generating the string of classes. We want to use the value passed in from
     474                        // _setOption(), this is the new value of the classes option which was passed to
     475                        // _setOption(). We pass this value directly to _classes().
     476                        elements.addClass( this._classes( {
     477                                element: elements,
     478                                keys: classKey,
     479                                classes: value,
     480                                add: true
     481                        } ) );
     482                }
     483        },
     484
     485        _setOptionDisabled: function( value ) {
     486                this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
     487
     488                // If the widget is becoming disabled, then nothing is interactive
     489                if ( value ) {
     490                        this._removeClass( this.hoverable, null, "ui-state-hover" );
     491                        this._removeClass( this.focusable, null, "ui-state-focus" );
     492                }
     493        },
     494
     495        enable: function() {
     496                return this._setOptions( { disabled: false } );
     497        },
     498
     499        disable: function() {
     500                return this._setOptions( { disabled: true } );
     501        },
     502
     503        _classes: function( options ) {
     504                var full = [];
     505                var that = this;
     506
     507                options = $.extend( {
     508                        element: this.element,
     509                        classes: this.options.classes || {}
     510                }, options );
     511
     512                function processClassString( classes, checkOption ) {
     513                        var current, i;
     514                        for ( i = 0; i < classes.length; i++ ) {
     515                                current = that.classesElementLookup[ classes[ i ] ] || $();
     516                                if ( options.add ) {
     517                                        current = $( $.unique( current.get().concat( options.element.get() ) ) );
     518                                } else {
     519                                        current = $( current.not( options.element ).get() );
     520                                }
     521                                that.classesElementLookup[ classes[ i ] ] = current;
     522                                full.push( classes[ i ] );
     523                                if ( checkOption && options.classes[ classes[ i ] ] ) {
     524                                        full.push( options.classes[ classes[ i ] ] );
     525                                }
     526                        }
     527                }
     528
     529                this._on( options.element, {
     530                        "remove": "_untrackClassesElement"
     531                } );
     532
     533                if ( options.keys ) {
     534                        processClassString( options.keys.match( /\S+/g ) || [], true );
     535                }
     536                if ( options.extra ) {
     537                        processClassString( options.extra.match( /\S+/g ) || [] );
     538                }
     539
     540                return full.join( " " );
     541        },
     542
     543        _untrackClassesElement: function( event ) {
     544                var that = this;
     545                $.each( that.classesElementLookup, function( key, value ) {
     546                        if ( $.inArray( event.target, value ) !== -1 ) {
     547                                that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
     548                        }
     549                } );
     550        },
     551
     552        _removeClass: function( element, keys, extra ) {
     553                return this._toggleClass( element, keys, extra, false );
     554        },
     555
     556        _addClass: function( element, keys, extra ) {
     557                return this._toggleClass( element, keys, extra, true );
     558        },
     559
     560        _toggleClass: function( element, keys, extra, add ) {
     561                add = ( typeof add === "boolean" ) ? add : extra;
     562                var shift = ( typeof element === "string" || element === null ),
     563                        options = {
     564                                extra: shift ? keys : extra,
     565                                keys: shift ? element : keys,
     566                                element: shift ? this.element : element,
     567                                add: add
     568                        };
     569                options.element.toggleClass( this._classes( options ), add );
     570                return this;
     571        },
     572
     573        _on: function( suppressDisabledCheck, element, handlers ) {
     574                var delegateElement;
     575                var instance = this;
     576
     577                // No suppressDisabledCheck flag, shuffle arguments
     578                if ( typeof suppressDisabledCheck !== "boolean" ) {
     579                        handlers = element;
     580                        element = suppressDisabledCheck;
     581                        suppressDisabledCheck = false;
     582                }
     583
     584                // No element argument, shuffle and use this.element
     585                if ( !handlers ) {
     586                        handlers = element;
     587                        element = this.element;
     588                        delegateElement = this.widget();
     589                } else {
     590                        element = delegateElement = $( element );
     591                        this.bindings = this.bindings.add( element );
     592                }
     593
     594                $.each( handlers, function( event, handler ) {
     595                        function handlerProxy() {
     596
     597                                // Allow widgets to customize the disabled handling
     598                                // - disabled as an array instead of boolean
     599                                // - disabled class as method for disabling individual parts
     600                                if ( !suppressDisabledCheck &&
     601                                                ( instance.options.disabled === true ||
     602                                                $( this ).hasClass( "ui-state-disabled" ) ) ) {
     603                                        return;
     604                                }
     605                                return ( typeof handler === "string" ? instance[ handler ] : handler )
     606                                        .apply( instance, arguments );
     607                        }
     608
     609                        // Copy the guid so direct unbinding works
     610                        if ( typeof handler !== "string" ) {
     611                                handlerProxy.guid = handler.guid =
     612                                        handler.guid || handlerProxy.guid || $.guid++;
     613                        }
     614
     615                        var match = event.match( /^([\w:-]*)\s*(.*)$/ );
     616                        var eventName = match[ 1 ] + instance.eventNamespace;
     617                        var selector = match[ 2 ];
     618
     619                        if ( selector ) {
     620                                delegateElement.on( eventName, selector, handlerProxy );
     621                        } else {
     622                                element.on( eventName, handlerProxy );
     623                        }
     624                } );
     625        },
     626
     627        _off: function( element, eventName ) {
     628                eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
     629                        this.eventNamespace;
     630                element.off( eventName ).off( eventName );
     631
     632                // Clear the stack to avoid memory leaks (#10056)
     633                this.bindings = $( this.bindings.not( element ).get() );
     634                this.focusable = $( this.focusable.not( element ).get() );
     635                this.hoverable = $( this.hoverable.not( element ).get() );
     636        },
     637
     638        _delay: function( handler, delay ) {
     639                function handlerProxy() {
     640                        return ( typeof handler === "string" ? instance[ handler ] : handler )
     641                                .apply( instance, arguments );
     642                }
     643                var instance = this;
     644                return setTimeout( handlerProxy, delay || 0 );
     645        },
     646
     647        _hoverable: function( element ) {
     648                this.hoverable = this.hoverable.add( element );
     649                this._on( element, {
     650                        mouseenter: function( event ) {
     651                                this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
     652                        },
     653                        mouseleave: function( event ) {
     654                                this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
     655                        }
     656                } );
     657        },
     658
     659        _focusable: function( element ) {
     660                this.focusable = this.focusable.add( element );
     661                this._on( element, {
     662                        focusin: function( event ) {
     663                                this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
     664                        },
     665                        focusout: function( event ) {
     666                                this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
     667                        }
     668                } );
     669        },
     670
     671        _trigger: function( type, event, data ) {
     672                var prop, orig;
     673                var callback = this.options[ type ];
     674
     675                data = data || {};
     676                event = $.Event( event );
     677                event.type = ( type === this.widgetEventPrefix ?
     678                        type :
     679                        this.widgetEventPrefix + type ).toLowerCase();
     680
     681                // The original event may come from any element
     682                // so we need to reset the target on the new event
     683                event.target = this.element[ 0 ];
     684
     685                // Copy original event properties over to the new event
     686                orig = event.originalEvent;
     687                if ( orig ) {
     688                        for ( prop in orig ) {
     689                                if ( !( prop in event ) ) {
     690                                        event[ prop ] = orig[ prop ];
     691                                }
     692                        }
     693                }
     694
     695                this.element.trigger( event, data );
     696                return !( $.isFunction( callback ) &&
     697                        callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
     698                        event.isDefaultPrevented() );
     699        }
     700};
     701
     702$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
     703        $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
     704                if ( typeof options === "string" ) {
     705                        options = { effect: options };
     706                }
     707
     708                var hasOptions;
     709                var effectName = !options ?
     710                        method :
     711                        options === true || typeof options === "number" ?
     712                                defaultEffect :
     713                                options.effect || defaultEffect;
     714
     715                options = options || {};
     716                if ( typeof options === "number" ) {
     717                        options = { duration: options };
     718                }
     719
     720                hasOptions = !$.isEmptyObject( options );
     721                options.complete = callback;
     722
     723                if ( options.delay ) {
     724                        element.delay( options.delay );
     725                }
     726
     727                if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
     728                        element[ method ]( options );
     729                } else if ( effectName !== method && element[ effectName ] ) {
     730                        element[ effectName ]( options.duration, options.easing, callback );
     731                } else {
     732                        element.queue( function( next ) {
     733                                $( this )[ method ]();
     734                                if ( callback ) {
     735                                        callback.call( element[ 0 ] );
     736                                }
     737                                next();
     738                        } );
     739                }
     740        };
     741} );
     742
     743var widget = $.widget;
     744
     745
     746/*!
     747 * jQuery UI Position 1.12.1
     748 * http://jqueryui.com
     749 *
     750 * Copyright jQuery Foundation and other contributors
     751 * Released under the MIT license.
     752 * http://jquery.org/license
     753 *
     754 * http://api.jqueryui.com/position/
     755 */
     756
     757//>>label: Position
     758//>>group: Core
     759//>>description: Positions elements relative to other elements.
     760//>>docs: http://api.jqueryui.com/position/
     761//>>demos: http://jqueryui.com/position/
     762
     763
     764( function() {
     765var cachedScrollbarWidth,
     766        max = Math.max,
     767        abs = Math.abs,
     768        rhorizontal = /left|center|right/,
     769        rvertical = /top|center|bottom/,
     770        roffset = /[\+\-]\d+(\.[\d]+)?%?/,
     771        rposition = /^\w+/,
     772        rpercent = /%$/,
     773        _position = $.fn.position;
     774
     775function getOffsets( offsets, width, height ) {
     776        return [
     777                parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
     778                parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
     779        ];
     780}
     781
     782function parseCss( element, property ) {
     783        return parseInt( $.css( element, property ), 10 ) || 0;
     784}
     785
     786function getDimensions( elem ) {
     787        var raw = elem[ 0 ];
     788        if ( raw.nodeType === 9 ) {
     789                return {
     790                        width: elem.width(),
     791                        height: elem.height(),
     792                        offset: { top: 0, left: 0 }
     793                };
     794        }
     795        if ( $.isWindow( raw ) ) {
     796                return {
     797                        width: elem.width(),
     798                        height: elem.height(),
     799                        offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
     800                };
     801        }
     802        if ( raw.preventDefault ) {
     803                return {
     804                        width: 0,
     805                        height: 0,
     806                        offset: { top: raw.pageY, left: raw.pageX }
     807                };
     808        }
     809        return {
     810                width: elem.outerWidth(),
     811                height: elem.outerHeight(),
     812                offset: elem.offset()
     813        };
     814}
     815
     816$.position = {
     817        scrollbarWidth: function() {
     818                if ( cachedScrollbarWidth !== undefined ) {
     819                        return cachedScrollbarWidth;
     820                }
     821                var w1, w2,
     822                        div = $( "<div " +
     823                                "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
     824                                "<div style='height:100px;width:auto;'></div></div>" ),
     825                        innerDiv = div.children()[ 0 ];
     826
     827                $( "body" ).append( div );
     828                w1 = innerDiv.offsetWidth;
     829                div.css( "overflow", "scroll" );
     830
     831                w2 = innerDiv.offsetWidth;
     832
     833                if ( w1 === w2 ) {
     834                        w2 = div[ 0 ].clientWidth;
     835                }
     836
     837                div.remove();
     838
     839                return ( cachedScrollbarWidth = w1 - w2 );
     840        },
     841        getScrollInfo: function( within ) {
     842                var overflowX = within.isWindow || within.isDocument ? "" :
     843                                within.element.css( "overflow-x" ),
     844                        overflowY = within.isWindow || within.isDocument ? "" :
     845                                within.element.css( "overflow-y" ),
     846                        hasOverflowX = overflowX === "scroll" ||
     847                                ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
     848                        hasOverflowY = overflowY === "scroll" ||
     849                                ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
     850                return {
     851                        width: hasOverflowY ? $.position.scrollbarWidth() : 0,
     852                        height: hasOverflowX ? $.position.scrollbarWidth() : 0
     853                };
     854        },
     855        getWithinInfo: function( element ) {
     856                var withinElement = $( element || window ),
     857                        isWindow = $.isWindow( withinElement[ 0 ] ),
     858                        isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
     859                        hasOffset = !isWindow && !isDocument;
     860                return {
     861                        element: withinElement,
     862                        isWindow: isWindow,
     863                        isDocument: isDocument,
     864                        offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
     865                        scrollLeft: withinElement.scrollLeft(),
     866                        scrollTop: withinElement.scrollTop(),
     867                        width: withinElement.outerWidth(),
     868                        height: withinElement.outerHeight()
     869                };
     870        }
     871};
     872
     873$.fn.position = function( options ) {
     874        if ( !options || !options.of ) {
     875                return _position.apply( this, arguments );
     876        }
     877
     878        // Make a copy, we don't want to modify arguments
     879        options = $.extend( {}, options );
     880
     881        var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
     882                target = $( options.of ),
     883                within = $.position.getWithinInfo( options.within ),
     884                scrollInfo = $.position.getScrollInfo( within ),
     885                collision = ( options.collision || "flip" ).split( " " ),
     886                offsets = {};
     887
     888        dimensions = getDimensions( target );
     889        if ( target[ 0 ].preventDefault ) {
     890
     891                // Force left top to allow flipping
     892                options.at = "left top";
     893        }
     894        targetWidth = dimensions.width;
     895        targetHeight = dimensions.height;
     896        targetOffset = dimensions.offset;
     897
     898        // Clone to reuse original targetOffset later
     899        basePosition = $.extend( {}, targetOffset );
     900
     901        // Force my and at to have valid horizontal and vertical positions
     902        // if a value is missing or invalid, it will be converted to center
     903        $.each( [ "my", "at" ], function() {
     904                var pos = ( options[ this ] || "" ).split( " " ),
     905                        horizontalOffset,
     906                        verticalOffset;
     907
     908                if ( pos.length === 1 ) {
     909                        pos = rhorizontal.test( pos[ 0 ] ) ?
     910                                pos.concat( [ "center" ] ) :
     911                                rvertical.test( pos[ 0 ] ) ?
     912                                        [ "center" ].concat( pos ) :
     913                                        [ "center", "center" ];
     914                }
     915                pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
     916                pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
     917
     918                // Calculate offsets
     919                horizontalOffset = roffset.exec( pos[ 0 ] );
     920                verticalOffset = roffset.exec( pos[ 1 ] );
     921                offsets[ this ] = [
     922                        horizontalOffset ? horizontalOffset[ 0 ] : 0,
     923                        verticalOffset ? verticalOffset[ 0 ] : 0
     924                ];
     925
     926                // Reduce to just the positions without the offsets
     927                options[ this ] = [
     928                        rposition.exec( pos[ 0 ] )[ 0 ],
     929                        rposition.exec( pos[ 1 ] )[ 0 ]
     930                ];
     931        } );
     932
     933        // Normalize collision option
     934        if ( collision.length === 1 ) {
     935                collision[ 1 ] = collision[ 0 ];
     936        }
     937
     938        if ( options.at[ 0 ] === "right" ) {
     939                basePosition.left += targetWidth;
     940        } else if ( options.at[ 0 ] === "center" ) {
     941                basePosition.left += targetWidth / 2;
     942        }
     943
     944        if ( options.at[ 1 ] === "bottom" ) {
     945                basePosition.top += targetHeight;
     946        } else if ( options.at[ 1 ] === "center" ) {
     947                basePosition.top += targetHeight / 2;
     948        }
     949
     950        atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
     951        basePosition.left += atOffset[ 0 ];
     952        basePosition.top += atOffset[ 1 ];
     953
     954        return this.each( function() {
     955                var collisionPosition, using,
     956                        elem = $( this ),
     957                        elemWidth = elem.outerWidth(),
     958                        elemHeight = elem.outerHeight(),
     959                        marginLeft = parseCss( this, "marginLeft" ),
     960                        marginTop = parseCss( this, "marginTop" ),
     961                        collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
     962                                scrollInfo.width,
     963                        collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
     964                                scrollInfo.height,
     965                        position = $.extend( {}, basePosition ),
     966                        myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
     967
     968                if ( options.my[ 0 ] === "right" ) {
     969                        position.left -= elemWidth;
     970                } else if ( options.my[ 0 ] === "center" ) {
     971                        position.left -= elemWidth / 2;
     972                }
     973
     974                if ( options.my[ 1 ] === "bottom" ) {
     975                        position.top -= elemHeight;
     976                } else if ( options.my[ 1 ] === "center" ) {
     977                        position.top -= elemHeight / 2;
     978                }
     979
     980                position.left += myOffset[ 0 ];
     981                position.top += myOffset[ 1 ];
     982
     983                collisionPosition = {
     984                        marginLeft: marginLeft,
     985                        marginTop: marginTop
     986                };
     987
     988                $.each( [ "left", "top" ], function( i, dir ) {
     989                        if ( $.ui.position[ collision[ i ] ] ) {
     990                                $.ui.position[ collision[ i ] ][ dir ]( position, {
     991                                        targetWidth: targetWidth,
     992                                        targetHeight: targetHeight,
     993                                        elemWidth: elemWidth,
     994                                        elemHeight: elemHeight,
     995                                        collisionPosition: collisionPosition,
     996                                        collisionWidth: collisionWidth,
     997                                        collisionHeight: collisionHeight,
     998                                        offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
     999                                        my: options.my,
     1000                                        at: options.at,
     1001                                        within: within,
     1002                                        elem: elem
     1003                                } );
     1004                        }
     1005                } );
     1006
     1007                if ( options.using ) {
     1008
     1009                        // Adds feedback as second argument to using callback, if present
     1010                        using = function( props ) {
     1011                                var left = targetOffset.left - position.left,
     1012                                        right = left + targetWidth - elemWidth,
     1013                                        top = targetOffset.top - position.top,
     1014                                        bottom = top + targetHeight - elemHeight,
     1015                                        feedback = {
     1016                                                target: {
     1017                                                        element: target,
     1018                                                        left: targetOffset.left,
     1019                                                        top: targetOffset.top,
     1020                                                        width: targetWidth,
     1021                                                        height: targetHeight
     1022                                                },
     1023                                                element: {
     1024                                                        element: elem,
     1025                                                        left: position.left,
     1026                                                        top: position.top,
     1027                                                        width: elemWidth,
     1028                                                        height: elemHeight
     1029                                                },
     1030                                                horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
     1031                                                vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
     1032                                        };
     1033                                if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
     1034                                        feedback.horizontal = "center";
     1035                                }
     1036                                if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
     1037                                        feedback.vertical = "middle";
     1038                                }
     1039                                if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
     1040                                        feedback.important = "horizontal";
     1041                                } else {
     1042                                        feedback.important = "vertical";
     1043                                }
     1044                                options.using.call( this, props, feedback );
     1045                        };
     1046                }
     1047
     1048                elem.offset( $.extend( position, { using: using } ) );
     1049        } );
     1050};
     1051
     1052$.ui.position = {
     1053        fit: {
     1054                left: function( position, data ) {
     1055                        var within = data.within,
     1056                                withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
     1057                                outerWidth = within.width,
     1058                                collisionPosLeft = position.left - data.collisionPosition.marginLeft,
     1059                                overLeft = withinOffset - collisionPosLeft,
     1060                                overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
     1061                                newOverRight;
     1062
     1063                        // Element is wider than within
     1064                        if ( data.collisionWidth > outerWidth ) {
     1065
     1066                                // Element is initially over the left side of within
     1067                                if ( overLeft > 0 && overRight <= 0 ) {
     1068                                        newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
     1069                                                withinOffset;
     1070                                        position.left += overLeft - newOverRight;
     1071
     1072                                // Element is initially over right side of within
     1073                                } else if ( overRight > 0 && overLeft <= 0 ) {
     1074                                        position.left = withinOffset;
     1075
     1076                                // Element is initially over both left and right sides of within
     1077                                } else {
     1078                                        if ( overLeft > overRight ) {
     1079                                                position.left = withinOffset + outerWidth - data.collisionWidth;
     1080                                        } else {
     1081                                                position.left = withinOffset;
     1082                                        }
     1083                                }
     1084
     1085                        // Too far left -> align with left edge
     1086                        } else if ( overLeft > 0 ) {
     1087                                position.left += overLeft;
     1088
     1089                        // Too far right -> align with right edge
     1090                        } else if ( overRight > 0 ) {
     1091                                position.left -= overRight;
     1092
     1093                        // Adjust based on position and margin
     1094                        } else {
     1095                                position.left = max( position.left - collisionPosLeft, position.left );
     1096                        }
     1097                },
     1098                top: function( position, data ) {
     1099                        var within = data.within,
     1100                                withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
     1101                                outerHeight = data.within.height,
     1102                                collisionPosTop = position.top - data.collisionPosition.marginTop,
     1103                                overTop = withinOffset - collisionPosTop,
     1104                                overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
     1105                                newOverBottom;
     1106
     1107                        // Element is taller than within
     1108                        if ( data.collisionHeight > outerHeight ) {
     1109
     1110                                // Element is initially over the top of within
     1111                                if ( overTop > 0 && overBottom <= 0 ) {
     1112                                        newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
     1113                                                withinOffset;
     1114                                        position.top += overTop - newOverBottom;
     1115
     1116                                // Element is initially over bottom of within
     1117                                } else if ( overBottom > 0 && overTop <= 0 ) {
     1118                                        position.top = withinOffset;
     1119
     1120                                // Element is initially over both top and bottom of within
     1121                                } else {
     1122                                        if ( overTop > overBottom ) {
     1123                                                position.top = withinOffset + outerHeight - data.collisionHeight;
     1124                                        } else {
     1125                                                position.top = withinOffset;
     1126                                        }
     1127                                }
     1128
     1129                        // Too far up -> align with top
     1130                        } else if ( overTop > 0 ) {
     1131                                position.top += overTop;
     1132
     1133                        // Too far down -> align with bottom edge
     1134                        } else if ( overBottom > 0 ) {
     1135                                position.top -= overBottom;
     1136
     1137                        // Adjust based on position and margin
     1138                        } else {
     1139                                position.top = max( position.top - collisionPosTop, position.top );
     1140                        }
     1141                }
     1142        },
     1143        flip: {
     1144                left: function( position, data ) {
     1145                        var within = data.within,
     1146                                withinOffset = within.offset.left + within.scrollLeft,
     1147                                outerWidth = within.width,
     1148                                offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
     1149                                collisionPosLeft = position.left - data.collisionPosition.marginLeft,
     1150                                overLeft = collisionPosLeft - offsetLeft,
     1151                                overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
     1152                                myOffset = data.my[ 0 ] === "left" ?
     1153                                        -data.elemWidth :
     1154                                        data.my[ 0 ] === "right" ?
     1155                                                data.elemWidth :
     1156                                                0,
     1157                                atOffset = data.at[ 0 ] === "left" ?
     1158                                        data.targetWidth :
     1159                                        data.at[ 0 ] === "right" ?
     1160                                                -data.targetWidth :
     1161                                                0,
     1162                                offset = -2 * data.offset[ 0 ],
     1163                                newOverRight,
     1164                                newOverLeft;
     1165
     1166                        if ( overLeft < 0 ) {
     1167                                newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
     1168                                        outerWidth - withinOffset;
     1169                                if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
     1170                                        position.left += myOffset + atOffset + offset;
     1171                                }
     1172                        } else if ( overRight > 0 ) {
     1173                                newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
     1174                                        atOffset + offset - offsetLeft;
     1175                                if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
     1176                                        position.left += myOffset + atOffset + offset;
     1177                                }
     1178                        }
     1179                },
     1180                top: function( position, data ) {
     1181                        var within = data.within,
     1182                                withinOffset = within.offset.top + within.scrollTop,
     1183                                outerHeight = within.height,
     1184                                offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
     1185                                collisionPosTop = position.top - data.collisionPosition.marginTop,
     1186                                overTop = collisionPosTop - offsetTop,
     1187                                overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
     1188                                top = data.my[ 1 ] === "top",
     1189                                myOffset = top ?
     1190                                        -data.elemHeight :
     1191                                        data.my[ 1 ] === "bottom" ?
     1192                                                data.elemHeight :
     1193                                                0,
     1194                                atOffset = data.at[ 1 ] === "top" ?
     1195                                        data.targetHeight :
     1196                                        data.at[ 1 ] === "bottom" ?
     1197                                                -data.targetHeight :
     1198                                                0,
     1199                                offset = -2 * data.offset[ 1 ],
     1200                                newOverTop,
     1201                                newOverBottom;
     1202                        if ( overTop < 0 ) {
     1203                                newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
     1204                                        outerHeight - withinOffset;
     1205                                if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
     1206                                        position.top += myOffset + atOffset + offset;
     1207                                }
     1208                        } else if ( overBottom > 0 ) {
     1209                                newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
     1210                                        offset - offsetTop;
     1211                                if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
     1212                                        position.top += myOffset + atOffset + offset;
     1213                                }
     1214                        }
     1215                }
     1216        },
     1217        flipfit: {
     1218                left: function() {
     1219                        $.ui.position.flip.left.apply( this, arguments );
     1220                        $.ui.position.fit.left.apply( this, arguments );
     1221                },
     1222                top: function() {
     1223                        $.ui.position.flip.top.apply( this, arguments );
     1224                        $.ui.position.fit.top.apply( this, arguments );
     1225                }
     1226        }
     1227};
     1228
     1229} )();
     1230
     1231var position = $.ui.position;
     1232
     1233
     1234/*!
     1235 * jQuery UI :data 1.12.1
     1236 * http://jqueryui.com
     1237 *
     1238 * Copyright jQuery Foundation and other contributors
     1239 * Released under the MIT license.
     1240 * http://jquery.org/license
     1241 */
     1242
     1243//>>label: :data Selector
     1244//>>group: Core
     1245//>>description: Selects elements which have data stored under the specified key.
     1246//>>docs: http://api.jqueryui.com/data-selector/
     1247
     1248
     1249var data = $.extend( $.expr[ ":" ], {
     1250        data: $.expr.createPseudo ?
     1251                $.expr.createPseudo( function( dataName ) {
     1252                        return function( elem ) {
     1253                                return !!$.data( elem, dataName );
     1254                        };
     1255                } ) :
     1256
     1257                // Support: jQuery <1.8
     1258                function( elem, i, match ) {
     1259                        return !!$.data( elem, match[ 3 ] );
     1260                }
     1261} );
     1262
     1263/*!
     1264 * jQuery UI Disable Selection 1.12.1
     1265 * http://jqueryui.com
     1266 *
     1267 * Copyright jQuery Foundation and other contributors
     1268 * Released under the MIT license.
     1269 * http://jquery.org/license
     1270 */
     1271
     1272//>>label: disableSelection
     1273//>>group: Core
     1274//>>description: Disable selection of text content within the set of matched elements.
     1275//>>docs: http://api.jqueryui.com/disableSelection/
     1276
     1277// This file is deprecated
     1278
     1279
     1280var disableSelection = $.fn.extend( {
     1281        disableSelection: ( function() {
     1282                var eventType = "onselectstart" in document.createElement( "div" ) ?
     1283                        "selectstart" :
     1284                        "mousedown";
     1285
     1286                return function() {
     1287                        return this.on( eventType + ".ui-disableSelection", function( event ) {
     1288                                event.preventDefault();
     1289                        } );
     1290                };
     1291        } )(),
     1292
     1293        enableSelection: function() {
     1294                return this.off( ".ui-disableSelection" );
     1295        }
     1296} );
     1297
     1298
     1299/*!
     1300 * jQuery UI Focusable 1.12.1
     1301 * http://jqueryui.com
     1302 *
     1303 * Copyright jQuery Foundation and other contributors
     1304 * Released under the MIT license.
     1305 * http://jquery.org/license
     1306 */
     1307
     1308//>>label: :focusable Selector
     1309//>>group: Core
     1310//>>description: Selects elements which can be focused.
     1311//>>docs: http://api.jqueryui.com/focusable-selector/
     1312
     1313
     1314
     1315// Selectors
     1316$.ui.focusable = function( element, hasTabindex ) {
     1317        var map, mapName, img, focusableIfVisible, fieldset,
     1318                nodeName = element.nodeName.toLowerCase();
     1319
     1320        if ( "area" === nodeName ) {
     1321                map = element.parentNode;
     1322                mapName = map.name;
     1323                if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
     1324                        return false;
     1325                }
     1326                img = $( "img[usemap='#" + mapName + "']" );
     1327                return img.length > 0 && img.is( ":visible" );
     1328        }
     1329
     1330        if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
     1331                focusableIfVisible = !element.disabled;
     1332
     1333                if ( focusableIfVisible ) {
     1334
     1335                        // Form controls within a disabled fieldset are disabled.
     1336                        // However, controls within the fieldset's legend do not get disabled.
     1337                        // Since controls generally aren't placed inside legends, we skip
     1338                        // this portion of the check.
     1339                        fieldset = $( element ).closest( "fieldset" )[ 0 ];
     1340                        if ( fieldset ) {
     1341                                focusableIfVisible = !fieldset.disabled;
     1342                        }
     1343                }
     1344        } else if ( "a" === nodeName ) {
     1345                focusableIfVisible = element.href || hasTabindex;
     1346        } else {
     1347                focusableIfVisible = hasTabindex;
     1348        }
     1349
     1350        return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
     1351};
     1352
     1353// Support: IE 8 only
     1354// IE 8 doesn't resolve inherit to visible/hidden for computed values
     1355function visible( element ) {
     1356        var visibility = element.css( "visibility" );
     1357        while ( visibility === "inherit" ) {
     1358                element = element.parent();
     1359                visibility = element.css( "visibility" );
     1360        }
     1361        return visibility !== "hidden";
     1362}
     1363
     1364$.extend( $.expr[ ":" ], {
     1365        focusable: function( element ) {
     1366                return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
     1367        }
     1368} );
     1369
     1370var focusable = $.ui.focusable;
     1371
     1372
     1373// Support: IE8 Only
     1374// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
     1375// with a string, so we need to find the proper form.
     1376var form = $.fn.form = function() {
     1377        return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
     1378};
     1379
     1380
     1381/*!
     1382 * jQuery UI Form Reset Mixin 1.12.1
     1383 * http://jqueryui.com
     1384 *
     1385 * Copyright jQuery Foundation and other contributors
     1386 * Released under the MIT license.
     1387 * http://jquery.org/license
     1388 */
     1389
     1390//>>label: Form Reset Mixin
     1391//>>group: Core
     1392//>>description: Refresh input widgets when their form is reset
     1393//>>docs: http://api.jqueryui.com/form-reset-mixin/
     1394
     1395
     1396
     1397var formResetMixin = $.ui.formResetMixin = {
     1398        _formResetHandler: function() {
     1399                var form = $( this );
     1400
     1401                // Wait for the form reset to actually happen before refreshing
     1402                setTimeout( function() {
     1403                        var instances = form.data( "ui-form-reset-instances" );
     1404                        $.each( instances, function() {
     1405                                this.refresh();
     1406                        } );
     1407                } );
     1408        },
     1409
     1410        _bindFormResetHandler: function() {
     1411                this.form = this.element.form();
     1412                if ( !this.form.length ) {
     1413                        return;
     1414                }
     1415
     1416                var instances = this.form.data( "ui-form-reset-instances" ) || [];
     1417                if ( !instances.length ) {
     1418
     1419                        // We don't use _on() here because we use a single event handler per form
     1420                        this.form.on( "reset.ui-form-reset", this._formResetHandler );
     1421                }
     1422                instances.push( this );
     1423                this.form.data( "ui-form-reset-instances", instances );
     1424        },
     1425
     1426        _unbindFormResetHandler: function() {
     1427                if ( !this.form.length ) {
     1428                        return;
     1429                }
     1430
     1431                var instances = this.form.data( "ui-form-reset-instances" );
     1432                instances.splice( $.inArray( this, instances ), 1 );
     1433                if ( instances.length ) {
     1434                        this.form.data( "ui-form-reset-instances", instances );
     1435                } else {
     1436                        this.form
     1437                                .removeData( "ui-form-reset-instances" )
     1438                                .off( "reset.ui-form-reset" );
     1439                }
     1440        }
     1441};
     1442
     1443
     1444/*!
     1445 * jQuery UI Support for jQuery core 1.7.x 1.12.1
     1446 * http://jqueryui.com
     1447 *
     1448 * Copyright jQuery Foundation and other contributors
     1449 * Released under the MIT license.
     1450 * http://jquery.org/license
     1451 *
     1452 */
     1453
     1454//>>label: jQuery 1.7 Support
     1455//>>group: Core
     1456//>>description: Support version 1.7.x of jQuery core
     1457
     1458
     1459
     1460// Support: jQuery 1.7 only
     1461// Not a great way to check versions, but since we only support 1.7+ and only
     1462// need to detect <1.8, this is a simple check that should suffice. Checking
     1463// for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0
     1464// and we'll never reach 1.70.0 (if we do, we certainly won't be supporting
     1465// 1.7 anymore). See #11197 for why we're not using feature detection.
     1466if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) {
     1467
     1468        // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight()
     1469        // Unlike jQuery Core 1.8+, these only support numeric values to set the
     1470        // dimensions in pixels
     1471        $.each( [ "Width", "Height" ], function( i, name ) {
     1472                var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
     1473                        type = name.toLowerCase(),
     1474                        orig = {
     1475                                innerWidth: $.fn.innerWidth,
     1476                                innerHeight: $.fn.innerHeight,
     1477                                outerWidth: $.fn.outerWidth,
     1478                                outerHeight: $.fn.outerHeight
     1479                        };
     1480
     1481                function reduce( elem, size, border, margin ) {
     1482                        $.each( side, function() {
     1483                                size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
     1484                                if ( border ) {
     1485                                        size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
     1486                                }
     1487                                if ( margin ) {
     1488                                        size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
     1489                                }
     1490                        } );
     1491                        return size;
     1492                }
     1493
     1494                $.fn[ "inner" + name ] = function( size ) {
     1495                        if ( size === undefined ) {
     1496                                return orig[ "inner" + name ].call( this );
     1497                        }
     1498
     1499                        return this.each( function() {
     1500                                $( this ).css( type, reduce( this, size ) + "px" );
     1501                        } );
     1502                };
     1503
     1504                $.fn[ "outer" + name ] = function( size, margin ) {
     1505                        if ( typeof size !== "number" ) {
     1506                                return orig[ "outer" + name ].call( this, size );
     1507                        }
     1508
     1509                        return this.each( function() {
     1510                                $( this ).css( type, reduce( this, size, true, margin ) + "px" );
     1511                        } );
     1512                };
     1513        } );
     1514
     1515        $.fn.addBack = function( selector ) {
     1516                return this.add( selector == null ?
     1517                        this.prevObject : this.prevObject.filter( selector )
     1518                );
     1519        };
     1520}
     1521
     1522;
     1523/*!
     1524 * jQuery UI Keycode 1.12.1
     1525 * http://jqueryui.com
     1526 *
     1527 * Copyright jQuery Foundation and other contributors
     1528 * Released under the MIT license.
     1529 * http://jquery.org/license
     1530 */
     1531
     1532//>>label: Keycode
     1533//>>group: Core
     1534//>>description: Provide keycodes as keynames
     1535//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
     1536
     1537
     1538var keycode = $.ui.keyCode = {
     1539        BACKSPACE: 8,
     1540        COMMA: 188,
     1541        DELETE: 46,
     1542        DOWN: 40,
     1543        END: 35,
     1544        ENTER: 13,
     1545        ESCAPE: 27,
     1546        HOME: 36,
     1547        LEFT: 37,
     1548        PAGE_DOWN: 34,
     1549        PAGE_UP: 33,
     1550        PERIOD: 190,
     1551        RIGHT: 39,
     1552        SPACE: 32,
     1553        TAB: 9,
     1554        UP: 38
     1555};
     1556
     1557
     1558// Internal use only
     1559var escapeSelector = $.ui.escapeSelector = ( function() {
     1560        var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
     1561        return function( selector ) {
     1562                return selector.replace( selectorEscape, "\\$1" );
     1563        };
     1564} )();
     1565
     1566
     1567/*!
     1568 * jQuery UI Labels 1.12.1
     1569 * http://jqueryui.com
     1570 *
     1571 * Copyright jQuery Foundation and other contributors
     1572 * Released under the MIT license.
     1573 * http://jquery.org/license
     1574 */
     1575
     1576//>>label: labels
     1577//>>group: Core
     1578//>>description: Find all the labels associated with a given input
     1579//>>docs: http://api.jqueryui.com/labels/
     1580
     1581
     1582
     1583var labels = $.fn.labels = function() {
     1584        var ancestor, selector, id, labels, ancestors;
     1585
     1586        // Check control.labels first
     1587        if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
     1588                return this.pushStack( this[ 0 ].labels );
     1589        }
     1590
     1591        // Support: IE <= 11, FF <= 37, Android <= 2.3 only
     1592        // Above browsers do not support control.labels. Everything below is to support them
     1593        // as well as document fragments. control.labels does not work on document fragments
     1594        labels = this.eq( 0 ).parents( "label" );
     1595
     1596        // Look for the label based on the id
     1597        id = this.attr( "id" );
     1598        if ( id ) {
     1599
     1600                // We don't search against the document in case the element
     1601                // is disconnected from the DOM
     1602                ancestor = this.eq( 0 ).parents().last();
     1603
     1604                // Get a full set of top level ancestors
     1605                ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
     1606
     1607                // Create a selector for the label based on the id
     1608                selector = "label[for='" + $.ui.escapeSelector( id ) + "']";
     1609
     1610                labels = labels.add( ancestors.find( selector ).addBack( selector ) );
     1611
     1612        }
     1613
     1614        // Return whatever we have found for labels
     1615        return this.pushStack( labels );
     1616};
     1617
     1618
     1619/*!
     1620 * jQuery UI Scroll Parent 1.12.1
     1621 * http://jqueryui.com
     1622 *
     1623 * Copyright jQuery Foundation and other contributors
     1624 * Released under the MIT license.
     1625 * http://jquery.org/license
     1626 */
     1627
     1628//>>label: scrollParent
     1629//>>group: Core
     1630//>>description: Get the closest ancestor element that is scrollable.
     1631//>>docs: http://api.jqueryui.com/scrollParent/
     1632
     1633
     1634
     1635var scrollParent = $.fn.scrollParent = function( includeHidden ) {
     1636        var position = this.css( "position" ),
     1637                excludeStaticParent = position === "absolute",
     1638                overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
     1639                scrollParent = this.parents().filter( function() {
     1640                        var parent = $( this );
     1641                        if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
     1642                                return false;
     1643                        }
     1644                        return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
     1645                                parent.css( "overflow-x" ) );
     1646                } ).eq( 0 );
     1647
     1648        return position === "fixed" || !scrollParent.length ?
     1649                $( this[ 0 ].ownerDocument || document ) :
     1650                scrollParent;
     1651};
     1652
     1653
     1654/*!
     1655 * jQuery UI Tabbable 1.12.1
     1656 * http://jqueryui.com
     1657 *
     1658 * Copyright jQuery Foundation and other contributors
     1659 * Released under the MIT license.
     1660 * http://jquery.org/license
     1661 */
     1662
     1663//>>label: :tabbable Selector
     1664//>>group: Core
     1665//>>description: Selects elements which can be tabbed to.
     1666//>>docs: http://api.jqueryui.com/tabbable-selector/
     1667
     1668
     1669
     1670var tabbable = $.extend( $.expr[ ":" ], {
     1671        tabbable: function( element ) {
     1672                var tabIndex = $.attr( element, "tabindex" ),
     1673                        hasTabindex = tabIndex != null;
     1674                return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
     1675        }
     1676} );
     1677
     1678
     1679/*!
     1680 * jQuery UI Unique ID 1.12.1
     1681 * http://jqueryui.com
     1682 *
     1683 * Copyright jQuery Foundation and other contributors
     1684 * Released under the MIT license.
     1685 * http://jquery.org/license
     1686 */
     1687
     1688//>>label: uniqueId
     1689//>>group: Core
     1690//>>description: Functions to generate and remove uniqueId's
     1691//>>docs: http://api.jqueryui.com/uniqueId/
     1692
     1693
     1694
     1695var uniqueId = $.fn.extend( {
     1696        uniqueId: ( function() {
     1697                var uuid = 0;
     1698
     1699                return function() {
     1700                        return this.each( function() {
     1701                                if ( !this.id ) {
     1702                                        this.id = "ui-id-" + ( ++uuid );
     1703                                }
     1704                        } );
     1705                };
     1706        } )(),
     1707
     1708        removeUniqueId: function() {
     1709                return this.each( function() {
     1710                        if ( /^ui-id-\d+$/.test( this.id ) ) {
     1711                                $( this ).removeAttr( "id" );
     1712                        }
     1713                } );
     1714        }
     1715} );
     1716
     1717}));
  • src/js/_enqueues/vendor/jquery/ui/datepicker.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/core.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1// jscs:disable maximumLineLength
     2/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
     3/*!
     4 * jQuery UI Datepicker 1.12.1
     5 * http://jqueryui.com
     6 *
     7 * Copyright jQuery Foundation and other contributors
     8 * Released under the MIT license.
     9 * http://jquery.org/license
     10 */
     11
     12//>>label: Datepicker
     13//>>group: Widgets
     14//>>description: Displays a calendar from an input or inline for selecting dates.
     15//>>docs: http://api.jqueryui.com/datepicker/
     16//>>demos: http://jqueryui.com/datepicker/
     17//>>css.structure: ../../themes/base/core.css
     18//>>css.structure: ../../themes/base/datepicker.css
     19//>>css.theme: ../../themes/base/theme.css
     20
     21( function( factory ) {
     22        if ( typeof define === "function" && define.amd ) {
     23
     24                // AMD. Register as an anonymous module.
     25                define( [
     26                        "jquery",
     27                        "./version",
     28                        "./keycode"
     29                ], factory );
     30        } else {
     31
     32                // Browser globals
     33                factory( jQuery );
     34        }
     35}( function( $ ) {
     36
     37$.extend( $.ui, { datepicker: { version: "1.12.1" } } );
     38
     39var datepicker_instActive;
     40
     41function datepicker_getZindex( elem ) {
     42        var position, value;
     43        while ( elem.length && elem[ 0 ] !== document ) {
     44
     45                // Ignore z-index if position is set to a value where z-index is ignored by the browser
     46                // This makes behavior of this function consistent across browsers
     47                // WebKit always returns auto if the element is positioned
     48                position = elem.css( "position" );
     49                if ( position === "absolute" || position === "relative" || position === "fixed" ) {
     50
     51                        // IE returns 0 when zIndex is not specified
     52                        // other browsers return a string
     53                        // we ignore the case of nested elements with an explicit value of 0
     54                        // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
     55                        value = parseInt( elem.css( "zIndex" ), 10 );
     56                        if ( !isNaN( value ) && value !== 0 ) {
     57                                return value;
     58                        }
     59                }
     60                elem = elem.parent();
     61        }
     62
     63        return 0;
     64}
     65/* Date picker manager.
     66   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
     67   Settings for (groups of) date pickers are maintained in an instance object,
     68   allowing multiple different settings on the same page. */
     69
     70function Datepicker() {
     71        this._curInst = null; // The current instance in use
     72        this._keyEvent = false; // If the last event was a key event
     73        this._disabledInputs = []; // List of date picker inputs that have been disabled
     74        this._datepickerShowing = false; // True if the popup picker is showing , false if not
     75        this._inDialog = false; // True if showing within a "dialog", false if not
     76        this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
     77        this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
     78        this._appendClass = "ui-datepicker-append"; // The name of the append marker class
     79        this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
     80        this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
     81        this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
     82        this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
     83        this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
     84        this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
     85        this.regional = []; // Available regional settings, indexed by language code
     86        this.regional[ "" ] = { // Default regional settings
     87                closeText: "Done", // Display text for close link
     88                prevText: "Prev", // Display text for previous month link
     89                nextText: "Next", // Display text for next month link
     90                currentText: "Today", // Display text for current month link
     91                monthNames: [ "January","February","March","April","May","June",
     92                        "July","August","September","October","November","December" ], // Names of months for drop-down and formatting
     93                monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
     94                dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
     95                dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
     96                dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday
     97                weekHeader: "Wk", // Column header for week of the year
     98                dateFormat: "mm/dd/yy", // See format options on parseDate
     99                firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
     100                isRTL: false, // True if right-to-left language, false if left-to-right
     101                showMonthAfterYear: false, // True if the year select precedes month, false for month then year
     102                yearSuffix: "" // Additional text to append to the year in the month headers
     103        };
     104        this._defaults = { // Global defaults for all the date picker instances
     105                showOn: "focus", // "focus" for popup on focus,
     106                        // "button" for trigger button, or "both" for either
     107                showAnim: "fadeIn", // Name of jQuery animation for popup
     108                showOptions: {}, // Options for enhanced animations
     109                defaultDate: null, // Used when field is blank: actual date,
     110                        // +/-number for offset from today, null for today
     111                appendText: "", // Display text following the input box, e.g. showing the format
     112                buttonText: "...", // Text for trigger button
     113                buttonImage: "", // URL for trigger button image
     114                buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
     115                hideIfNoPrevNext: false, // True to hide next/previous month links
     116                        // if not applicable, false to just disable them
     117                navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
     118                gotoCurrent: false, // True if today link goes back to current selection instead
     119                changeMonth: false, // True if month can be selected directly, false if only prev/next
     120                changeYear: false, // True if year can be selected directly, false if only prev/next
     121                yearRange: "c-10:c+10", // Range of years to display in drop-down,
     122                        // either relative to today's year (-nn:+nn), relative to currently displayed year
     123                        // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
     124                showOtherMonths: false, // True to show dates in other months, false to leave blank
     125                selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
     126                showWeek: false, // True to show week of the year, false to not show it
     127                calculateWeek: this.iso8601Week, // How to calculate the week of the year,
     128                        // takes a Date and returns the number of the week for it
     129                shortYearCutoff: "+10", // Short year values < this are in the current century,
     130                        // > this are in the previous century,
     131                        // string value starting with "+" for current year + value
     132                minDate: null, // The earliest selectable date, or null for no limit
     133                maxDate: null, // The latest selectable date, or null for no limit
     134                duration: "fast", // Duration of display/closure
     135                beforeShowDay: null, // Function that takes a date and returns an array with
     136                        // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
     137                        // [2] = cell title (optional), e.g. $.datepicker.noWeekends
     138                beforeShow: null, // Function that takes an input field and
     139                        // returns a set of custom settings for the date picker
     140                onSelect: null, // Define a callback function when a date is selected
     141                onChangeMonthYear: null, // Define a callback function when the month or year is changed
     142                onClose: null, // Define a callback function when the datepicker is closed
     143                numberOfMonths: 1, // Number of months to show at a time
     144                showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
     145                stepMonths: 1, // Number of months to step back/forward
     146                stepBigMonths: 12, // Number of months to step back/forward for the big links
     147                altField: "", // Selector for an alternate field to store selected dates into
     148                altFormat: "", // The date format to use for the alternate field
     149                constrainInput: true, // The input is constrained by the current date format
     150                showButtonPanel: false, // True to show button panel, false to not show it
     151                autoSize: false, // True to size the input for the date format, false to leave as is
     152                disabled: false // The initial disabled state
     153        };
     154        $.extend( this._defaults, this.regional[ "" ] );
     155        this.regional.en = $.extend( true, {}, this.regional[ "" ] );
     156        this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
     157        this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
     158}
     159
     160$.extend( Datepicker.prototype, {
     161        /* Class name added to elements to indicate already configured with a date picker. */
     162        markerClassName: "hasDatepicker",
     163
     164        //Keep track of the maximum number of rows displayed (see #7043)
     165        maxRows: 4,
     166
     167        // TODO rename to "widget" when switching to widget factory
     168        _widgetDatepicker: function() {
     169                return this.dpDiv;
     170        },
     171
     172        /* Override the default settings for all instances of the date picker.
     173         * @param  settings  object - the new settings to use as defaults (anonymous object)
     174         * @return the manager object
     175         */
     176        setDefaults: function( settings ) {
     177                datepicker_extendRemove( this._defaults, settings || {} );
     178                return this;
     179        },
     180
     181        /* Attach the date picker to a jQuery selection.
     182         * @param  target       element - the target input field or division or span
     183         * @param  settings  object - the new settings to use for this date picker instance (anonymous)
     184         */
     185        _attachDatepicker: function( target, settings ) {
     186                var nodeName, inline, inst;
     187                nodeName = target.nodeName.toLowerCase();
     188                inline = ( nodeName === "div" || nodeName === "span" );
     189                if ( !target.id ) {
     190                        this.uuid += 1;
     191                        target.id = "dp" + this.uuid;
     192                }
     193                inst = this._newInst( $( target ), inline );
     194                inst.settings = $.extend( {}, settings || {} );
     195                if ( nodeName === "input" ) {
     196                        this._connectDatepicker( target, inst );
     197                } else if ( inline ) {
     198                        this._inlineDatepicker( target, inst );
     199                }
     200        },
     201
     202        /* Create a new instance object. */
     203        _newInst: function( target, inline ) {
     204                var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
     205                return { id: id, input: target, // associated target
     206                        selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
     207                        drawMonth: 0, drawYear: 0, // month being drawn
     208                        inline: inline, // is datepicker inline or not
     209                        dpDiv: ( !inline ? this.dpDiv : // presentation div
     210                        datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
     211        },
     212
     213        /* Attach the date picker to an input field. */
     214        _connectDatepicker: function( target, inst ) {
     215                var input = $( target );
     216                inst.append = $( [] );
     217                inst.trigger = $( [] );
     218                if ( input.hasClass( this.markerClassName ) ) {
     219                        return;
     220                }
     221                this._attachments( input, inst );
     222                input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
     223                        on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
     224                this._autoSize( inst );
     225                $.data( target, "datepicker", inst );
     226
     227                //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
     228                if ( inst.settings.disabled ) {
     229                        this._disableDatepicker( target );
     230                }
     231        },
     232
     233        /* Make attachments based on settings. */
     234        _attachments: function( input, inst ) {
     235                var showOn, buttonText, buttonImage,
     236                        appendText = this._get( inst, "appendText" ),
     237                        isRTL = this._get( inst, "isRTL" );
     238
     239                if ( inst.append ) {
     240                        inst.append.remove();
     241                }
     242                if ( appendText ) {
     243                        inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" );
     244                        input[ isRTL ? "before" : "after" ]( inst.append );
     245                }
     246
     247                input.off( "focus", this._showDatepicker );
     248
     249                if ( inst.trigger ) {
     250                        inst.trigger.remove();
     251                }
     252
     253                showOn = this._get( inst, "showOn" );
     254                if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
     255                        input.on( "focus", this._showDatepicker );
     256                }
     257                if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
     258                        buttonText = this._get( inst, "buttonText" );
     259                        buttonImage = this._get( inst, "buttonImage" );
     260                        inst.trigger = $( this._get( inst, "buttonImageOnly" ) ?
     261                                $( "<img/>" ).addClass( this._triggerClass ).
     262                                        attr( { src: buttonImage, alt: buttonText, title: buttonText } ) :
     263                                $( "<button type='button'></button>" ).addClass( this._triggerClass ).
     264                                        html( !buttonImage ? buttonText : $( "<img/>" ).attr(
     265                                        { src:buttonImage, alt:buttonText, title:buttonText } ) ) );
     266                        input[ isRTL ? "before" : "after" ]( inst.trigger );
     267                        inst.trigger.on( "click", function() {
     268                                if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
     269                                        $.datepicker._hideDatepicker();
     270                                } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
     271                                        $.datepicker._hideDatepicker();
     272                                        $.datepicker._showDatepicker( input[ 0 ] );
     273                                } else {
     274                                        $.datepicker._showDatepicker( input[ 0 ] );
     275                                }
     276                                return false;
     277                        } );
     278                }
     279        },
     280
     281        /* Apply the maximum length for the date format. */
     282        _autoSize: function( inst ) {
     283                if ( this._get( inst, "autoSize" ) && !inst.inline ) {
     284                        var findMax, max, maxI, i,
     285                                date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
     286                                dateFormat = this._get( inst, "dateFormat" );
     287
     288                        if ( dateFormat.match( /[DM]/ ) ) {
     289                                findMax = function( names ) {
     290                                        max = 0;
     291                                        maxI = 0;
     292                                        for ( i = 0; i < names.length; i++ ) {
     293                                                if ( names[ i ].length > max ) {
     294                                                        max = names[ i ].length;
     295                                                        maxI = i;
     296                                                }
     297                                        }
     298                                        return maxI;
     299                                };
     300                                date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
     301                                        "monthNames" : "monthNamesShort" ) ) ) );
     302                                date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
     303                                        "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
     304                        }
     305                        inst.input.attr( "size", this._formatDate( inst, date ).length );
     306                }
     307        },
     308
     309        /* Attach an inline date picker to a div. */
     310        _inlineDatepicker: function( target, inst ) {
     311                var divSpan = $( target );
     312                if ( divSpan.hasClass( this.markerClassName ) ) {
     313                        return;
     314                }
     315                divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
     316                $.data( target, "datepicker", inst );
     317                this._setDate( inst, this._getDefaultDate( inst ), true );
     318                this._updateDatepicker( inst );
     319                this._updateAlternate( inst );
     320
     321                //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
     322                if ( inst.settings.disabled ) {
     323                        this._disableDatepicker( target );
     324                }
     325
     326                // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
     327                // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
     328                inst.dpDiv.css( "display", "block" );
     329        },
     330
     331        /* Pop-up the date picker in a "dialog" box.
     332         * @param  input element - ignored
     333         * @param  date string or Date - the initial date to display
     334         * @param  onSelect  function - the function to call when a date is selected
     335         * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
     336         * @param  pos int[2] - coordinates for the dialog's position within the screen or
     337         *                                      event - with x/y coordinates or
     338         *                                      leave empty for default (screen centre)
     339         * @return the manager object
     340         */
     341        _dialogDatepicker: function( input, date, onSelect, settings, pos ) {
     342                var id, browserWidth, browserHeight, scrollX, scrollY,
     343                        inst = this._dialogInst; // internal instance
     344
     345                if ( !inst ) {
     346                        this.uuid += 1;
     347                        id = "dp" + this.uuid;
     348                        this._dialogInput = $( "<input type='text' id='" + id +
     349                                "' style='position: absolute; top: -100px; width: 0px;'/>" );
     350                        this._dialogInput.on( "keydown", this._doKeyDown );
     351                        $( "body" ).append( this._dialogInput );
     352                        inst = this._dialogInst = this._newInst( this._dialogInput, false );
     353                        inst.settings = {};
     354                        $.data( this._dialogInput[ 0 ], "datepicker", inst );
     355                }
     356                datepicker_extendRemove( inst.settings, settings || {} );
     357                date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
     358                this._dialogInput.val( date );
     359
     360                this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
     361                if ( !this._pos ) {
     362                        browserWidth = document.documentElement.clientWidth;
     363                        browserHeight = document.documentElement.clientHeight;
     364                        scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
     365                        scrollY = document.documentElement.scrollTop || document.body.scrollTop;
     366                        this._pos = // should use actual width/height below
     367                                [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
     368                }
     369
     370                // Move input on screen for focus, but hidden behind dialog
     371                this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
     372                inst.settings.onSelect = onSelect;
     373                this._inDialog = true;
     374                this.dpDiv.addClass( this._dialogClass );
     375                this._showDatepicker( this._dialogInput[ 0 ] );
     376                if ( $.blockUI ) {
     377                        $.blockUI( this.dpDiv );
     378                }
     379                $.data( this._dialogInput[ 0 ], "datepicker", inst );
     380                return this;
     381        },
     382
     383        /* Detach a datepicker from its control.
     384         * @param  target       element - the target input field or division or span
     385         */
     386        _destroyDatepicker: function( target ) {
     387                var nodeName,
     388                        $target = $( target ),
     389                        inst = $.data( target, "datepicker" );
     390
     391                if ( !$target.hasClass( this.markerClassName ) ) {
     392                        return;
     393                }
     394
     395                nodeName = target.nodeName.toLowerCase();
     396                $.removeData( target, "datepicker" );
     397                if ( nodeName === "input" ) {
     398                        inst.append.remove();
     399                        inst.trigger.remove();
     400                        $target.removeClass( this.markerClassName ).
     401                                off( "focus", this._showDatepicker ).
     402                                off( "keydown", this._doKeyDown ).
     403                                off( "keypress", this._doKeyPress ).
     404                                off( "keyup", this._doKeyUp );
     405                } else if ( nodeName === "div" || nodeName === "span" ) {
     406                        $target.removeClass( this.markerClassName ).empty();
     407                }
     408
     409                if ( datepicker_instActive === inst ) {
     410                        datepicker_instActive = null;
     411                }
     412        },
     413
     414        /* Enable the date picker to a jQuery selection.
     415         * @param  target       element - the target input field or division or span
     416         */
     417        _enableDatepicker: function( target ) {
     418                var nodeName, inline,
     419                        $target = $( target ),
     420                        inst = $.data( target, "datepicker" );
     421
     422                if ( !$target.hasClass( this.markerClassName ) ) {
     423                        return;
     424                }
     425
     426                nodeName = target.nodeName.toLowerCase();
     427                if ( nodeName === "input" ) {
     428                        target.disabled = false;
     429                        inst.trigger.filter( "button" ).
     430                                each( function() { this.disabled = false; } ).end().
     431                                filter( "img" ).css( { opacity: "1.0", cursor: "" } );
     432                } else if ( nodeName === "div" || nodeName === "span" ) {
     433                        inline = $target.children( "." + this._inlineClass );
     434                        inline.children().removeClass( "ui-state-disabled" );
     435                        inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
     436                                prop( "disabled", false );
     437                }
     438                this._disabledInputs = $.map( this._disabledInputs,
     439                        function( value ) { return ( value === target ? null : value ); } ); // delete entry
     440        },
     441
     442        /* Disable the date picker to a jQuery selection.
     443         * @param  target       element - the target input field or division or span
     444         */
     445        _disableDatepicker: function( target ) {
     446                var nodeName, inline,
     447                        $target = $( target ),
     448                        inst = $.data( target, "datepicker" );
     449
     450                if ( !$target.hasClass( this.markerClassName ) ) {
     451                        return;
     452                }
     453
     454                nodeName = target.nodeName.toLowerCase();
     455                if ( nodeName === "input" ) {
     456                        target.disabled = true;
     457                        inst.trigger.filter( "button" ).
     458                                each( function() { this.disabled = true; } ).end().
     459                                filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
     460                } else if ( nodeName === "div" || nodeName === "span" ) {
     461                        inline = $target.children( "." + this._inlineClass );
     462                        inline.children().addClass( "ui-state-disabled" );
     463                        inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
     464                                prop( "disabled", true );
     465                }
     466                this._disabledInputs = $.map( this._disabledInputs,
     467                        function( value ) { return ( value === target ? null : value ); } ); // delete entry
     468                this._disabledInputs[ this._disabledInputs.length ] = target;
     469        },
     470
     471        /* Is the first field in a jQuery collection disabled as a datepicker?
     472         * @param  target       element - the target input field or division or span
     473         * @return boolean - true if disabled, false if enabled
     474         */
     475        _isDisabledDatepicker: function( target ) {
     476                if ( !target ) {
     477                        return false;
     478                }
     479                for ( var i = 0; i < this._disabledInputs.length; i++ ) {
     480                        if ( this._disabledInputs[ i ] === target ) {
     481                                return true;
     482                        }
     483                }
     484                return false;
     485        },
     486
     487        /* Retrieve the instance data for the target control.
     488         * @param  target  element - the target input field or division or span
     489         * @return  object - the associated instance data
     490         * @throws  error if a jQuery problem getting data
     491         */
     492        _getInst: function( target ) {
     493                try {
     494                        return $.data( target, "datepicker" );
     495                }
     496                catch ( err ) {
     497                        throw "Missing instance data for this datepicker";
     498                }
     499        },
     500
     501        /* Update or retrieve the settings for a date picker attached to an input field or division.
     502         * @param  target  element - the target input field or division or span
     503         * @param  name object - the new settings to update or
     504         *                              string - the name of the setting to change or retrieve,
     505         *                              when retrieving also "all" for all instance settings or
     506         *                              "defaults" for all global defaults
     507         * @param  value   any - the new value for the setting
     508         *                              (omit if above is an object or to retrieve a value)
     509         */
     510        _optionDatepicker: function( target, name, value ) {
     511                var settings, date, minDate, maxDate,
     512                        inst = this._getInst( target );
     513
     514                if ( arguments.length === 2 && typeof name === "string" ) {
     515                        return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
     516                                ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
     517                                this._get( inst, name ) ) : null ) );
     518                }
     519
     520                settings = name || {};
     521                if ( typeof name === "string" ) {
     522                        settings = {};
     523                        settings[ name ] = value;
     524                }
     525
     526                if ( inst ) {
     527                        if ( this._curInst === inst ) {
     528                                this._hideDatepicker();
     529                        }
     530
     531                        date = this._getDateDatepicker( target, true );
     532                        minDate = this._getMinMaxDate( inst, "min" );
     533                        maxDate = this._getMinMaxDate( inst, "max" );
     534                        datepicker_extendRemove( inst.settings, settings );
     535
     536                        // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
     537                        if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
     538                                inst.settings.minDate = this._formatDate( inst, minDate );
     539                        }
     540                        if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
     541                                inst.settings.maxDate = this._formatDate( inst, maxDate );
     542                        }
     543                        if ( "disabled" in settings ) {
     544                                if ( settings.disabled ) {
     545                                        this._disableDatepicker( target );
     546                                } else {
     547                                        this._enableDatepicker( target );
     548                                }
     549                        }
     550                        this._attachments( $( target ), inst );
     551                        this._autoSize( inst );
     552                        this._setDate( inst, date );
     553                        this._updateAlternate( inst );
     554                        this._updateDatepicker( inst );
     555                }
     556        },
     557
     558        // Change method deprecated
     559        _changeDatepicker: function( target, name, value ) {
     560                this._optionDatepicker( target, name, value );
     561        },
     562
     563        /* Redraw the date picker attached to an input field or division.
     564         * @param  target  element - the target input field or division or span
     565         */
     566        _refreshDatepicker: function( target ) {
     567                var inst = this._getInst( target );
     568                if ( inst ) {
     569                        this._updateDatepicker( inst );
     570                }
     571        },
     572
     573        /* Set the dates for a jQuery selection.
     574         * @param  target element - the target input field or division or span
     575         * @param  date Date - the new date
     576         */
     577        _setDateDatepicker: function( target, date ) {
     578                var inst = this._getInst( target );
     579                if ( inst ) {
     580                        this._setDate( inst, date );
     581                        this._updateDatepicker( inst );
     582                        this._updateAlternate( inst );
     583                }
     584        },
     585
     586        /* Get the date(s) for the first entry in a jQuery selection.
     587         * @param  target element - the target input field or division or span
     588         * @param  noDefault boolean - true if no default date is to be used
     589         * @return Date - the current date
     590         */
     591        _getDateDatepicker: function( target, noDefault ) {
     592                var inst = this._getInst( target );
     593                if ( inst && !inst.inline ) {
     594                        this._setDateFromField( inst, noDefault );
     595                }
     596                return ( inst ? this._getDate( inst ) : null );
     597        },
     598
     599        /* Handle keystrokes. */
     600        _doKeyDown: function( event ) {
     601                var onSelect, dateStr, sel,
     602                        inst = $.datepicker._getInst( event.target ),
     603                        handled = true,
     604                        isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );
     605
     606                inst._keyEvent = true;
     607                if ( $.datepicker._datepickerShowing ) {
     608                        switch ( event.keyCode ) {
     609                                case 9: $.datepicker._hideDatepicker();
     610                                                handled = false;
     611                                                break; // hide on tab out
     612                                case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
     613                                                                        $.datepicker._currentClass + ")", inst.dpDiv );
     614                                                if ( sel[ 0 ] ) {
     615                                                        $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
     616                                                }
     617
     618                                                onSelect = $.datepicker._get( inst, "onSelect" );
     619                                                if ( onSelect ) {
     620                                                        dateStr = $.datepicker._formatDate( inst );
     621
     622                                                        // Trigger custom callback
     623                                                        onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
     624                                                } else {
     625                                                        $.datepicker._hideDatepicker();
     626                                                }
     627
     628                                                return false; // don't submit the form
     629                                case 27: $.datepicker._hideDatepicker();
     630                                                break; // hide on escape
     631                                case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
     632                                                        -$.datepicker._get( inst, "stepBigMonths" ) :
     633                                                        -$.datepicker._get( inst, "stepMonths" ) ), "M" );
     634                                                break; // previous month/year on page up/+ ctrl
     635                                case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
     636                                                        +$.datepicker._get( inst, "stepBigMonths" ) :
     637                                                        +$.datepicker._get( inst, "stepMonths" ) ), "M" );
     638                                                break; // next month/year on page down/+ ctrl
     639                                case 35: if ( event.ctrlKey || event.metaKey ) {
     640                                                        $.datepicker._clearDate( event.target );
     641                                                }
     642                                                handled = event.ctrlKey || event.metaKey;
     643                                                break; // clear on ctrl or command +end
     644                                case 36: if ( event.ctrlKey || event.metaKey ) {
     645                                                        $.datepicker._gotoToday( event.target );
     646                                                }
     647                                                handled = event.ctrlKey || event.metaKey;
     648                                                break; // current on ctrl or command +home
     649                                case 37: if ( event.ctrlKey || event.metaKey ) {
     650                                                        $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
     651                                                }
     652                                                handled = event.ctrlKey || event.metaKey;
     653
     654                                                // -1 day on ctrl or command +left
     655                                                if ( event.originalEvent.altKey ) {
     656                                                        $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
     657                                                                -$.datepicker._get( inst, "stepBigMonths" ) :
     658                                                                -$.datepicker._get( inst, "stepMonths" ) ), "M" );
     659                                                }
     660
     661                                                // next month/year on alt +left on Mac
     662                                                break;
     663                                case 38: if ( event.ctrlKey || event.metaKey ) {
     664                                                        $.datepicker._adjustDate( event.target, -7, "D" );
     665                                                }
     666                                                handled = event.ctrlKey || event.metaKey;
     667                                                break; // -1 week on ctrl or command +up
     668                                case 39: if ( event.ctrlKey || event.metaKey ) {
     669                                                        $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
     670                                                }
     671                                                handled = event.ctrlKey || event.metaKey;
     672
     673                                                // +1 day on ctrl or command +right
     674                                                if ( event.originalEvent.altKey ) {
     675                                                        $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
     676                                                                +$.datepicker._get( inst, "stepBigMonths" ) :
     677                                                                +$.datepicker._get( inst, "stepMonths" ) ), "M" );
     678                                                }
     679
     680                                                // next month/year on alt +right
     681                                                break;
     682                                case 40: if ( event.ctrlKey || event.metaKey ) {
     683                                                        $.datepicker._adjustDate( event.target, +7, "D" );
     684                                                }
     685                                                handled = event.ctrlKey || event.metaKey;
     686                                                break; // +1 week on ctrl or command +down
     687                                default: handled = false;
     688                        }
     689                } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
     690                        $.datepicker._showDatepicker( this );
     691                } else {
     692                        handled = false;
     693                }
     694
     695                if ( handled ) {
     696                        event.preventDefault();
     697                        event.stopPropagation();
     698                }
     699        },
     700
     701        /* Filter entered characters - based on date format. */
     702        _doKeyPress: function( event ) {
     703                var chars, chr,
     704                        inst = $.datepicker._getInst( event.target );
     705
     706                if ( $.datepicker._get( inst, "constrainInput" ) ) {
     707                        chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
     708                        chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
     709                        return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
     710                }
     711        },
     712
     713        /* Synchronise manual entry and field/alternate field. */
     714        _doKeyUp: function( event ) {
     715                var date,
     716                        inst = $.datepicker._getInst( event.target );
     717
     718                if ( inst.input.val() !== inst.lastVal ) {
     719                        try {
     720                                date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
     721                                        ( inst.input ? inst.input.val() : null ),
     722                                        $.datepicker._getFormatConfig( inst ) );
     723
     724                                if ( date ) { // only if valid
     725                                        $.datepicker._setDateFromField( inst );
     726                                        $.datepicker._updateAlternate( inst );
     727                                        $.datepicker._updateDatepicker( inst );
     728                                }
     729                        }
     730                        catch ( err ) {
     731                        }
     732                }
     733                return true;
     734        },
     735
     736        /* Pop-up the date picker for a given input field.
     737         * If false returned from beforeShow event handler do not show.
     738         * @param  input  element - the input field attached to the date picker or
     739         *                                      event - if triggered by focus
     740         */
     741        _showDatepicker: function( input ) {
     742                input = input.target || input;
     743                if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
     744                        input = $( "input", input.parentNode )[ 0 ];
     745                }
     746
     747                if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
     748                        return;
     749                }
     750
     751                var inst, beforeShow, beforeShowSettings, isFixed,
     752                        offset, showAnim, duration;
     753
     754                inst = $.datepicker._getInst( input );
     755                if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
     756                        $.datepicker._curInst.dpDiv.stop( true, true );
     757                        if ( inst && $.datepicker._datepickerShowing ) {
     758                                $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
     759                        }
     760                }
     761
     762                beforeShow = $.datepicker._get( inst, "beforeShow" );
     763                beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
     764                if ( beforeShowSettings === false ) {
     765                        return;
     766                }
     767                datepicker_extendRemove( inst.settings, beforeShowSettings );
     768
     769                inst.lastVal = null;
     770                $.datepicker._lastInput = input;
     771                $.datepicker._setDateFromField( inst );
     772
     773                if ( $.datepicker._inDialog ) { // hide cursor
     774                        input.value = "";
     775                }
     776                if ( !$.datepicker._pos ) { // position below input
     777                        $.datepicker._pos = $.datepicker._findPos( input );
     778                        $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
     779                }
     780
     781                isFixed = false;
     782                $( input ).parents().each( function() {
     783                        isFixed |= $( this ).css( "position" ) === "fixed";
     784                        return !isFixed;
     785                } );
     786
     787                offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
     788                $.datepicker._pos = null;
     789
     790                //to avoid flashes on Firefox
     791                inst.dpDiv.empty();
     792
     793                // determine sizing offscreen
     794                inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
     795                $.datepicker._updateDatepicker( inst );
     796
     797                // fix width for dynamic number of date pickers
     798                // and adjust position before showing
     799                offset = $.datepicker._checkOffset( inst, offset, isFixed );
     800                inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
     801                        "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
     802                        left: offset.left + "px", top: offset.top + "px" } );
     803
     804                if ( !inst.inline ) {
     805                        showAnim = $.datepicker._get( inst, "showAnim" );
     806                        duration = $.datepicker._get( inst, "duration" );
     807                        inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
     808                        $.datepicker._datepickerShowing = true;
     809
     810                        if ( $.effects && $.effects.effect[ showAnim ] ) {
     811                                inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
     812                        } else {
     813                                inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
     814                        }
     815
     816                        if ( $.datepicker._shouldFocusInput( inst ) ) {
     817                                inst.input.trigger( "focus" );
     818                        }
     819
     820                        $.datepicker._curInst = inst;
     821                }
     822        },
     823
     824        /* Generate the date picker content. */
     825        _updateDatepicker: function( inst ) {
     826                this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
     827                datepicker_instActive = inst; // for delegate hover events
     828                inst.dpDiv.empty().append( this._generateHTML( inst ) );
     829                this._attachHandlers( inst );
     830
     831                var origyearshtml,
     832                        numMonths = this._getNumberOfMonths( inst ),
     833                        cols = numMonths[ 1 ],
     834                        width = 17,
     835                        activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
     836
     837                if ( activeCell.length > 0 ) {
     838                        datepicker_handleMouseover.apply( activeCell.get( 0 ) );
     839                }
     840
     841                inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
     842                if ( cols > 1 ) {
     843                        inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
     844                }
     845                inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
     846                        "Class" ]( "ui-datepicker-multi" );
     847                inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
     848                        "Class" ]( "ui-datepicker-rtl" );
     849
     850                if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
     851                        inst.input.trigger( "focus" );
     852                }
     853
     854                // Deffered render of the years select (to avoid flashes on Firefox)
     855                if ( inst.yearshtml ) {
     856                        origyearshtml = inst.yearshtml;
     857                        setTimeout( function() {
     858
     859                                //assure that inst.yearshtml didn't change.
     860                                if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
     861                                        inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml );
     862                                }
     863                                origyearshtml = inst.yearshtml = null;
     864                        }, 0 );
     865                }
     866        },
     867
     868        // #6694 - don't focus the input if it's already focused
     869        // this breaks the change event in IE
     870        // Support: IE and jQuery <1.9
     871        _shouldFocusInput: function( inst ) {
     872                return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
     873        },
     874
     875        /* Check positioning to remain on screen. */
     876        _checkOffset: function( inst, offset, isFixed ) {
     877                var dpWidth = inst.dpDiv.outerWidth(),
     878                        dpHeight = inst.dpDiv.outerHeight(),
     879                        inputWidth = inst.input ? inst.input.outerWidth() : 0,
     880                        inputHeight = inst.input ? inst.input.outerHeight() : 0,
     881                        viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
     882                        viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );
     883
     884                offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
     885                offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
     886                offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;
     887
     888                // Now check if datepicker is showing outside window viewport - move to a better place if so.
     889                offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
     890                        Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
     891                offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
     892                        Math.abs( dpHeight + inputHeight ) : 0 );
     893
     894                return offset;
     895        },
     896
     897        /* Find an object's position on the screen. */
     898        _findPos: function( obj ) {
     899                var position,
     900                        inst = this._getInst( obj ),
     901                        isRTL = this._get( inst, "isRTL" );
     902
     903                while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) {
     904                        obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
     905                }
     906
     907                position = $( obj ).offset();
     908                return [ position.left, position.top ];
     909        },
     910
     911        /* Hide the date picker from view.
     912         * @param  input  element - the input field attached to the date picker
     913         */
     914        _hideDatepicker: function( input ) {
     915                var showAnim, duration, postProcess, onClose,
     916                        inst = this._curInst;
     917
     918                if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
     919                        return;
     920                }
     921
     922                if ( this._datepickerShowing ) {
     923                        showAnim = this._get( inst, "showAnim" );
     924                        duration = this._get( inst, "duration" );
     925                        postProcess = function() {
     926                                $.datepicker._tidyDialog( inst );
     927                        };
     928
     929                        // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
     930                        if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
     931                                inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
     932                        } else {
     933                                inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
     934                                        ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
     935                        }
     936
     937                        if ( !showAnim ) {
     938                                postProcess();
     939                        }
     940                        this._datepickerShowing = false;
     941
     942                        onClose = this._get( inst, "onClose" );
     943                        if ( onClose ) {
     944                                onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
     945                        }
     946
     947                        this._lastInput = null;
     948                        if ( this._inDialog ) {
     949                                this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
     950                                if ( $.blockUI ) {
     951                                        $.unblockUI();
     952                                        $( "body" ).append( this.dpDiv );
     953                                }
     954                        }
     955                        this._inDialog = false;
     956                }
     957        },
     958
     959        /* Tidy up after a dialog display. */
     960        _tidyDialog: function( inst ) {
     961                inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
     962        },
     963
     964        /* Close date picker if clicked elsewhere. */
     965        _checkExternalClick: function( event ) {
     966                if ( !$.datepicker._curInst ) {
     967                        return;
     968                }
     969
     970                var $target = $( event.target ),
     971                        inst = $.datepicker._getInst( $target[ 0 ] );
     972
     973                if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
     974                                $target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
     975                                !$target.hasClass( $.datepicker.markerClassName ) &&
     976                                !$target.closest( "." + $.datepicker._triggerClass ).length &&
     977                                $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
     978                        ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
     979                                $.datepicker._hideDatepicker();
     980                }
     981        },
     982
     983        /* Adjust one of the date sub-fields. */
     984        _adjustDate: function( id, offset, period ) {
     985                var target = $( id ),
     986                        inst = this._getInst( target[ 0 ] );
     987
     988                if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
     989                        return;
     990                }
     991                this._adjustInstDate( inst, offset +
     992                        ( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning
     993                        period );
     994                this._updateDatepicker( inst );
     995        },
     996
     997        /* Action for current link. */
     998        _gotoToday: function( id ) {
     999                var date,
     1000                        target = $( id ),
     1001                        inst = this._getInst( target[ 0 ] );
     1002
     1003                if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
     1004                        inst.selectedDay = inst.currentDay;
     1005                        inst.drawMonth = inst.selectedMonth = inst.currentMonth;
     1006                        inst.drawYear = inst.selectedYear = inst.currentYear;
     1007                } else {
     1008                        date = new Date();
     1009                        inst.selectedDay = date.getDate();
     1010                        inst.drawMonth = inst.selectedMonth = date.getMonth();
     1011                        inst.drawYear = inst.selectedYear = date.getFullYear();
     1012                }
     1013                this._notifyChange( inst );
     1014                this._adjustDate( target );
     1015        },
     1016
     1017        /* Action for selecting a new month/year. */
     1018        _selectMonthYear: function( id, select, period ) {
     1019                var target = $( id ),
     1020                        inst = this._getInst( target[ 0 ] );
     1021
     1022                inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
     1023                inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
     1024                        parseInt( select.options[ select.selectedIndex ].value, 10 );
     1025
     1026                this._notifyChange( inst );
     1027                this._adjustDate( target );
     1028        },
     1029
     1030        /* Action for selecting a day. */
     1031        _selectDay: function( id, month, year, td ) {
     1032                var inst,
     1033                        target = $( id );
     1034
     1035                if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
     1036                        return;
     1037                }
     1038
     1039                inst = this._getInst( target[ 0 ] );
     1040                inst.selectedDay = inst.currentDay = $( "a", td ).html();
     1041                inst.selectedMonth = inst.currentMonth = month;
     1042                inst.selectedYear = inst.currentYear = year;
     1043                this._selectDate( id, this._formatDate( inst,
     1044                        inst.currentDay, inst.currentMonth, inst.currentYear ) );
     1045        },
     1046
     1047        /* Erase the input field and hide the date picker. */
     1048        _clearDate: function( id ) {
     1049                var target = $( id );
     1050                this._selectDate( target, "" );
     1051        },
     1052
     1053        /* Update the input field with the selected date. */
     1054        _selectDate: function( id, dateStr ) {
     1055                var onSelect,
     1056                        target = $( id ),
     1057                        inst = this._getInst( target[ 0 ] );
     1058
     1059                dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
     1060                if ( inst.input ) {
     1061                        inst.input.val( dateStr );
     1062                }
     1063                this._updateAlternate( inst );
     1064
     1065                onSelect = this._get( inst, "onSelect" );
     1066                if ( onSelect ) {
     1067                        onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );  // trigger custom callback
     1068                } else if ( inst.input ) {
     1069                        inst.input.trigger( "change" ); // fire the change event
     1070                }
     1071
     1072                if ( inst.inline ) {
     1073                        this._updateDatepicker( inst );
     1074                } else {
     1075                        this._hideDatepicker();
     1076                        this._lastInput = inst.input[ 0 ];
     1077                        if ( typeof( inst.input[ 0 ] ) !== "object" ) {
     1078                                inst.input.trigger( "focus" ); // restore focus
     1079                        }
     1080                        this._lastInput = null;
     1081                }
     1082        },
     1083
     1084        /* Update any alternate field to synchronise with the main field. */
     1085        _updateAlternate: function( inst ) {
     1086                var altFormat, date, dateStr,
     1087                        altField = this._get( inst, "altField" );
     1088
     1089                if ( altField ) { // update alternate field too
     1090                        altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
     1091                        date = this._getDate( inst );
     1092                        dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
     1093                        $( altField ).val( dateStr );
     1094                }
     1095        },
     1096
     1097        /* Set as beforeShowDay function to prevent selection of weekends.
     1098         * @param  date  Date - the date to customise
     1099         * @return [boolean, string] - is this date selectable?, what is its CSS class?
     1100         */
     1101        noWeekends: function( date ) {
     1102                var day = date.getDay();
     1103                return [ ( day > 0 && day < 6 ), "" ];
     1104        },
     1105
     1106        /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
     1107         * @param  date  Date - the date to get the week for
     1108         * @return  number - the number of the week within the year that contains this date
     1109         */
     1110        iso8601Week: function( date ) {
     1111                var time,
     1112                        checkDate = new Date( date.getTime() );
     1113
     1114                // Find Thursday of this week starting on Monday
     1115                checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );
     1116
     1117                time = checkDate.getTime();
     1118                checkDate.setMonth( 0 ); // Compare with Jan 1
     1119                checkDate.setDate( 1 );
     1120                return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
     1121        },
     1122
     1123        /* Parse a string value into a date object.
     1124         * See formatDate below for the possible formats.
     1125         *
     1126         * @param  format string - the expected format of the date
     1127         * @param  value string - the date in the above format
     1128         * @param  settings Object - attributes include:
     1129         *                                      shortYearCutoff  number - the cutoff year for determining the century (optional)
     1130         *                                      dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
     1131         *                                      dayNames                string[7] - names of the days from Sunday (optional)
     1132         *                                      monthNamesShort string[12] - abbreviated names of the months (optional)
     1133         *                                      monthNames              string[12] - names of the months (optional)
     1134         * @return  Date - the extracted date value or null if value is blank
     1135         */
     1136        parseDate: function( format, value, settings ) {
     1137                if ( format == null || value == null ) {
     1138                        throw "Invalid arguments";
     1139                }
     1140
     1141                value = ( typeof value === "object" ? value.toString() : value + "" );
     1142                if ( value === "" ) {
     1143                        return null;
     1144                }
     1145
     1146                var iFormat, dim, extra,
     1147                        iValue = 0,
     1148                        shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
     1149                        shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
     1150                                new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
     1151                        dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
     1152                        dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
     1153                        monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
     1154                        monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
     1155                        year = -1,
     1156                        month = -1,
     1157                        day = -1,
     1158                        doy = -1,
     1159                        literal = false,
     1160                        date,
     1161
     1162                        // Check whether a format character is doubled
     1163                        lookAhead = function( match ) {
     1164                                var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
     1165                                if ( matches ) {
     1166                                        iFormat++;
     1167                                }
     1168                                return matches;
     1169                        },
     1170
     1171                        // Extract a number from the string value
     1172                        getNumber = function( match ) {
     1173                                var isDoubled = lookAhead( match ),
     1174                                        size = ( match === "@" ? 14 : ( match === "!" ? 20 :
     1175                                        ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
     1176                                        minSize = ( match === "y" ? size : 1 ),
     1177                                        digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
     1178                                        num = value.substring( iValue ).match( digits );
     1179                                if ( !num ) {
     1180                                        throw "Missing number at position " + iValue;
     1181                                }
     1182                                iValue += num[ 0 ].length;
     1183                                return parseInt( num[ 0 ], 10 );
     1184                        },
     1185
     1186                        // Extract a name from the string value and convert to an index
     1187                        getName = function( match, shortNames, longNames ) {
     1188                                var index = -1,
     1189                                        names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
     1190                                                return [ [ k, v ] ];
     1191                                        } ).sort( function( a, b ) {
     1192                                                return -( a[ 1 ].length - b[ 1 ].length );
     1193                                        } );
     1194
     1195                                $.each( names, function( i, pair ) {
     1196                                        var name = pair[ 1 ];
     1197                                        if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
     1198                                                index = pair[ 0 ];
     1199                                                iValue += name.length;
     1200                                                return false;
     1201                                        }
     1202                                } );
     1203                                if ( index !== -1 ) {
     1204                                        return index + 1;
     1205                                } else {
     1206                                        throw "Unknown name at position " + iValue;
     1207                                }
     1208                        },
     1209
     1210                        // Confirm that a literal character matches the string value
     1211                        checkLiteral = function() {
     1212                                if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
     1213                                        throw "Unexpected literal at position " + iValue;
     1214                                }
     1215                                iValue++;
     1216                        };
     1217
     1218                for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
     1219                        if ( literal ) {
     1220                                if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
     1221                                        literal = false;
     1222                                } else {
     1223                                        checkLiteral();
     1224                                }
     1225                        } else {
     1226                                switch ( format.charAt( iFormat ) ) {
     1227                                        case "d":
     1228                                                day = getNumber( "d" );
     1229                                                break;
     1230                                        case "D":
     1231                                                getName( "D", dayNamesShort, dayNames );
     1232                                                break;
     1233                                        case "o":
     1234                                                doy = getNumber( "o" );
     1235                                                break;
     1236                                        case "m":
     1237                                                month = getNumber( "m" );
     1238                                                break;
     1239                                        case "M":
     1240                                                month = getName( "M", monthNamesShort, monthNames );
     1241                                                break;
     1242                                        case "y":
     1243                                                year = getNumber( "y" );
     1244                                                break;
     1245                                        case "@":
     1246                                                date = new Date( getNumber( "@" ) );
     1247                                                year = date.getFullYear();
     1248                                                month = date.getMonth() + 1;
     1249                                                day = date.getDate();
     1250                                                break;
     1251                                        case "!":
     1252                                                date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
     1253                                                year = date.getFullYear();
     1254                                                month = date.getMonth() + 1;
     1255                                                day = date.getDate();
     1256                                                break;
     1257                                        case "'":
     1258                                                if ( lookAhead( "'" ) ) {
     1259                                                        checkLiteral();
     1260                                                } else {
     1261                                                        literal = true;
     1262                                                }
     1263                                                break;
     1264                                        default:
     1265                                                checkLiteral();
     1266                                }
     1267                        }
     1268                }
     1269
     1270                if ( iValue < value.length ) {
     1271                        extra = value.substr( iValue );
     1272                        if ( !/^\s+/.test( extra ) ) {
     1273                                throw "Extra/unparsed characters found in date: " + extra;
     1274                        }
     1275                }
     1276
     1277                if ( year === -1 ) {
     1278                        year = new Date().getFullYear();
     1279                } else if ( year < 100 ) {
     1280                        year += new Date().getFullYear() - new Date().getFullYear() % 100 +
     1281                                ( year <= shortYearCutoff ? 0 : -100 );
     1282                }
     1283
     1284                if ( doy > -1 ) {
     1285                        month = 1;
     1286                        day = doy;
     1287                        do {
     1288                                dim = this._getDaysInMonth( year, month - 1 );
     1289                                if ( day <= dim ) {
     1290                                        break;
     1291                                }
     1292                                month++;
     1293                                day -= dim;
     1294                        } while ( true );
     1295                }
     1296
     1297                date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
     1298                if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
     1299                        throw "Invalid date"; // E.g. 31/02/00
     1300                }
     1301                return date;
     1302        },
     1303
     1304        /* Standard date formats. */
     1305        ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
     1306        COOKIE: "D, dd M yy",
     1307        ISO_8601: "yy-mm-dd",
     1308        RFC_822: "D, d M y",
     1309        RFC_850: "DD, dd-M-y",
     1310        RFC_1036: "D, d M y",
     1311        RFC_1123: "D, d M yy",
     1312        RFC_2822: "D, d M yy",
     1313        RSS: "D, d M y", // RFC 822
     1314        TICKS: "!",
     1315        TIMESTAMP: "@",
     1316        W3C: "yy-mm-dd", // ISO 8601
     1317
     1318        _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
     1319                Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),
     1320
     1321        /* Format a date object into a string value.
     1322         * The format can be combinations of the following:
     1323         * d  - day of month (no leading zero)
     1324         * dd - day of month (two digit)
     1325         * o  - day of year (no leading zeros)
     1326         * oo - day of year (three digit)
     1327         * D  - day name short
     1328         * DD - day name long
     1329         * m  - month of year (no leading zero)
     1330         * mm - month of year (two digit)
     1331         * M  - month name short
     1332         * MM - month name long
     1333         * y  - year (two digit)
     1334         * yy - year (four digit)
     1335         * @ - Unix timestamp (ms since 01/01/1970)
     1336         * ! - Windows ticks (100ns since 01/01/0001)
     1337         * "..." - literal text
     1338         * '' - single quote
     1339         *
     1340         * @param  format string - the desired format of the date
     1341         * @param  date Date - the date value to format
     1342         * @param  settings Object - attributes include:
     1343         *                                      dayNamesShort   string[7] - abbreviated names of the days from Sunday (optional)
     1344         *                                      dayNames                string[7] - names of the days from Sunday (optional)
     1345         *                                      monthNamesShort string[12] - abbreviated names of the months (optional)
     1346         *                                      monthNames              string[12] - names of the months (optional)
     1347         * @return  string - the date in the above format
     1348         */
     1349        formatDate: function( format, date, settings ) {
     1350                if ( !date ) {
     1351                        return "";
     1352                }
     1353
     1354                var iFormat,
     1355                        dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
     1356                        dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
     1357                        monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
     1358                        monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
     1359
     1360                        // Check whether a format character is doubled
     1361                        lookAhead = function( match ) {
     1362                                var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
     1363                                if ( matches ) {
     1364                                        iFormat++;
     1365                                }
     1366                                return matches;
     1367                        },
     1368
     1369                        // Format a number, with leading zero if necessary
     1370                        formatNumber = function( match, value, len ) {
     1371                                var num = "" + value;
     1372                                if ( lookAhead( match ) ) {
     1373                                        while ( num.length < len ) {
     1374                                                num = "0" + num;
     1375                                        }
     1376                                }
     1377                                return num;
     1378                        },
     1379
     1380                        // Format a name, short or long as requested
     1381                        formatName = function( match, value, shortNames, longNames ) {
     1382                                return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
     1383                        },
     1384                        output = "",
     1385                        literal = false;
     1386
     1387                if ( date ) {
     1388                        for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
     1389                                if ( literal ) {
     1390                                        if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
     1391                                                literal = false;
     1392                                        } else {
     1393                                                output += format.charAt( iFormat );
     1394                                        }
     1395                                } else {
     1396                                        switch ( format.charAt( iFormat ) ) {
     1397                                                case "d":
     1398                                                        output += formatNumber( "d", date.getDate(), 2 );
     1399                                                        break;
     1400                                                case "D":
     1401                                                        output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
     1402                                                        break;
     1403                                                case "o":
     1404                                                        output += formatNumber( "o",
     1405                                                                Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
     1406                                                        break;
     1407                                                case "m":
     1408                                                        output += formatNumber( "m", date.getMonth() + 1, 2 );
     1409                                                        break;
     1410                                                case "M":
     1411                                                        output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
     1412                                                        break;
     1413                                                case "y":
     1414                                                        output += ( lookAhead( "y" ) ? date.getFullYear() :
     1415                                                                ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
     1416                                                        break;
     1417                                                case "@":
     1418                                                        output += date.getTime();
     1419                                                        break;
     1420                                                case "!":
     1421                                                        output += date.getTime() * 10000 + this._ticksTo1970;
     1422                                                        break;
     1423                                                case "'":
     1424                                                        if ( lookAhead( "'" ) ) {
     1425                                                                output += "'";
     1426                                                        } else {
     1427                                                                literal = true;
     1428                                                        }
     1429                                                        break;
     1430                                                default:
     1431                                                        output += format.charAt( iFormat );
     1432                                        }
     1433                                }
     1434                        }
     1435                }
     1436                return output;
     1437        },
     1438
     1439        /* Extract all possible characters from the date format. */
     1440        _possibleChars: function( format ) {
     1441                var iFormat,
     1442                        chars = "",
     1443                        literal = false,
     1444
     1445                        // Check whether a format character is doubled
     1446                        lookAhead = function( match ) {
     1447                                var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
     1448                                if ( matches ) {
     1449                                        iFormat++;
     1450                                }
     1451                                return matches;
     1452                        };
     1453
     1454                for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
     1455                        if ( literal ) {
     1456                                if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
     1457                                        literal = false;
     1458                                } else {
     1459                                        chars += format.charAt( iFormat );
     1460                                }
     1461                        } else {
     1462                                switch ( format.charAt( iFormat ) ) {
     1463                                        case "d": case "m": case "y": case "@":
     1464                                                chars += "0123456789";
     1465                                                break;
     1466                                        case "D": case "M":
     1467                                                return null; // Accept anything
     1468                                        case "'":
     1469                                                if ( lookAhead( "'" ) ) {
     1470                                                        chars += "'";
     1471                                                } else {
     1472                                                        literal = true;
     1473                                                }
     1474                                                break;
     1475                                        default:
     1476                                                chars += format.charAt( iFormat );
     1477                                }
     1478                        }
     1479                }
     1480                return chars;
     1481        },
     1482
     1483        /* Get a setting value, defaulting if necessary. */
     1484        _get: function( inst, name ) {
     1485                return inst.settings[ name ] !== undefined ?
     1486                        inst.settings[ name ] : this._defaults[ name ];
     1487        },
     1488
     1489        /* Parse existing date and initialise date picker. */
     1490        _setDateFromField: function( inst, noDefault ) {
     1491                if ( inst.input.val() === inst.lastVal ) {
     1492                        return;
     1493                }
     1494
     1495                var dateFormat = this._get( inst, "dateFormat" ),
     1496                        dates = inst.lastVal = inst.input ? inst.input.val() : null,
     1497                        defaultDate = this._getDefaultDate( inst ),
     1498                        date = defaultDate,
     1499                        settings = this._getFormatConfig( inst );
     1500
     1501                try {
     1502                        date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
     1503                } catch ( event ) {
     1504                        dates = ( noDefault ? "" : dates );
     1505                }
     1506                inst.selectedDay = date.getDate();
     1507                inst.drawMonth = inst.selectedMonth = date.getMonth();
     1508                inst.drawYear = inst.selectedYear = date.getFullYear();
     1509                inst.currentDay = ( dates ? date.getDate() : 0 );
     1510                inst.currentMonth = ( dates ? date.getMonth() : 0 );
     1511                inst.currentYear = ( dates ? date.getFullYear() : 0 );
     1512                this._adjustInstDate( inst );
     1513        },
     1514
     1515        /* Retrieve the default date shown on opening. */
     1516        _getDefaultDate: function( inst ) {
     1517                return this._restrictMinMax( inst,
     1518                        this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
     1519        },
     1520
     1521        /* A date may be specified as an exact value or a relative one. */
     1522        _determineDate: function( inst, date, defaultDate ) {
     1523                var offsetNumeric = function( offset ) {
     1524                                var date = new Date();
     1525                                date.setDate( date.getDate() + offset );
     1526                                return date;
     1527                        },
     1528                        offsetString = function( offset ) {
     1529                                try {
     1530                                        return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
     1531                                                offset, $.datepicker._getFormatConfig( inst ) );
     1532                                }
     1533                                catch ( e ) {
     1534
     1535                                        // Ignore
     1536                                }
     1537
     1538                                var date = ( offset.toLowerCase().match( /^c/ ) ?
     1539                                        $.datepicker._getDate( inst ) : null ) || new Date(),
     1540                                        year = date.getFullYear(),
     1541                                        month = date.getMonth(),
     1542                                        day = date.getDate(),
     1543                                        pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
     1544                                        matches = pattern.exec( offset );
     1545
     1546                                while ( matches ) {
     1547                                        switch ( matches[ 2 ] || "d" ) {
     1548                                                case "d" : case "D" :
     1549                                                        day += parseInt( matches[ 1 ], 10 ); break;
     1550                                                case "w" : case "W" :
     1551                                                        day += parseInt( matches[ 1 ], 10 ) * 7; break;
     1552                                                case "m" : case "M" :
     1553                                                        month += parseInt( matches[ 1 ], 10 );
     1554                                                        day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
     1555                                                        break;
     1556                                                case "y": case "Y" :
     1557                                                        year += parseInt( matches[ 1 ], 10 );
     1558                                                        day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
     1559                                                        break;
     1560                                        }
     1561                                        matches = pattern.exec( offset );
     1562                                }
     1563                                return new Date( year, month, day );
     1564                        },
     1565                        newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
     1566                                ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );
     1567
     1568                newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
     1569                if ( newDate ) {
     1570                        newDate.setHours( 0 );
     1571                        newDate.setMinutes( 0 );
     1572                        newDate.setSeconds( 0 );
     1573                        newDate.setMilliseconds( 0 );
     1574                }
     1575                return this._daylightSavingAdjust( newDate );
     1576        },
     1577
     1578        /* Handle switch to/from daylight saving.
     1579         * Hours may be non-zero on daylight saving cut-over:
     1580         * > 12 when midnight changeover, but then cannot generate
     1581         * midnight datetime, so jump to 1AM, otherwise reset.
     1582         * @param  date  (Date) the date to check
     1583         * @return  (Date) the corrected date
     1584         */
     1585        _daylightSavingAdjust: function( date ) {
     1586                if ( !date ) {
     1587                        return null;
     1588                }
     1589                date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
     1590                return date;
     1591        },
     1592
     1593        /* Set the date(s) directly. */
     1594        _setDate: function( inst, date, noChange ) {
     1595                var clear = !date,
     1596                        origMonth = inst.selectedMonth,
     1597                        origYear = inst.selectedYear,
     1598                        newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );
     1599
     1600                inst.selectedDay = inst.currentDay = newDate.getDate();
     1601                inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
     1602                inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
     1603                if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
     1604                        this._notifyChange( inst );
     1605                }
     1606                this._adjustInstDate( inst );
     1607                if ( inst.input ) {
     1608                        inst.input.val( clear ? "" : this._formatDate( inst ) );
     1609                }
     1610        },
     1611
     1612        /* Retrieve the date(s) directly. */
     1613        _getDate: function( inst ) {
     1614                var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
     1615                        this._daylightSavingAdjust( new Date(
     1616                        inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
     1617                        return startDate;
     1618        },
     1619
     1620        /* Attach the onxxx handlers.  These are declared statically so
     1621         * they work with static code transformers like Caja.
     1622         */
     1623        _attachHandlers: function( inst ) {
     1624                var stepMonths = this._get( inst, "stepMonths" ),
     1625                        id = "#" + inst.id.replace( /\\\\/g, "\\" );
     1626                inst.dpDiv.find( "[data-handler]" ).map( function() {
     1627                        var handler = {
     1628                                prev: function() {
     1629                                        $.datepicker._adjustDate( id, -stepMonths, "M" );
     1630                                },
     1631                                next: function() {
     1632                                        $.datepicker._adjustDate( id, +stepMonths, "M" );
     1633                                },
     1634                                hide: function() {
     1635                                        $.datepicker._hideDatepicker();
     1636                                },
     1637                                today: function() {
     1638                                        $.datepicker._gotoToday( id );
     1639                                },
     1640                                selectDay: function() {
     1641                                        $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
     1642                                        return false;
     1643                                },
     1644                                selectMonth: function() {
     1645                                        $.datepicker._selectMonthYear( id, this, "M" );
     1646                                        return false;
     1647                                },
     1648                                selectYear: function() {
     1649                                        $.datepicker._selectMonthYear( id, this, "Y" );
     1650                                        return false;
     1651                                }
     1652                        };
     1653                        $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
     1654                } );
     1655        },
     1656
     1657        /* Generate the HTML for the current state of the date picker. */
     1658        _generateHTML: function( inst ) {
     1659                var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
     1660                        controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
     1661                        monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
     1662                        selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
     1663                        cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
     1664                        printDate, dRow, tbody, daySettings, otherMonth, unselectable,
     1665                        tempDate = new Date(),
     1666                        today = this._daylightSavingAdjust(
     1667                                new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
     1668                        isRTL = this._get( inst, "isRTL" ),
     1669                        showButtonPanel = this._get( inst, "showButtonPanel" ),
     1670                        hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
     1671                        navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
     1672                        numMonths = this._getNumberOfMonths( inst ),
     1673                        showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
     1674                        stepMonths = this._get( inst, "stepMonths" ),
     1675                        isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
     1676                        currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
     1677                                new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
     1678                        minDate = this._getMinMaxDate( inst, "min" ),
     1679                        maxDate = this._getMinMaxDate( inst, "max" ),
     1680                        drawMonth = inst.drawMonth - showCurrentAtPos,
     1681                        drawYear = inst.drawYear;
     1682
     1683                if ( drawMonth < 0 ) {
     1684                        drawMonth += 12;
     1685                        drawYear--;
     1686                }
     1687                if ( maxDate ) {
     1688                        maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
     1689                                maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
     1690                        maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
     1691                        while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
     1692                                drawMonth--;
     1693                                if ( drawMonth < 0 ) {
     1694                                        drawMonth = 11;
     1695                                        drawYear--;
     1696                                }
     1697                        }
     1698                }
     1699                inst.drawMonth = drawMonth;
     1700                inst.drawYear = drawYear;
     1701
     1702                prevText = this._get( inst, "prevText" );
     1703                prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
     1704                        this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
     1705                        this._getFormatConfig( inst ) ) );
     1706
     1707                prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ?
     1708                        "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
     1709                        " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" :
     1710                        ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) );
     1711
     1712                nextText = this._get( inst, "nextText" );
     1713                nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
     1714                        this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
     1715                        this._getFormatConfig( inst ) ) );
     1716
     1717                next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ?
     1718                        "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
     1719                        " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" :
     1720                        ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) );
     1721
     1722                currentText = this._get( inst, "currentText" );
     1723                gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
     1724                currentText = ( !navigationAsDateFormat ? currentText :
     1725                        this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
     1726
     1727                controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
     1728                        this._get( inst, "closeText" ) + "</button>" : "" );
     1729
     1730                buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) +
     1731                        ( this._isInRange( inst, gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
     1732                        ">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : "";
     1733
     1734                firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
     1735                firstDay = ( isNaN( firstDay ) ? 0 : firstDay );
     1736
     1737                showWeek = this._get( inst, "showWeek" );
     1738                dayNames = this._get( inst, "dayNames" );
     1739                dayNamesMin = this._get( inst, "dayNamesMin" );
     1740                monthNames = this._get( inst, "monthNames" );
     1741                monthNamesShort = this._get( inst, "monthNamesShort" );
     1742                beforeShowDay = this._get( inst, "beforeShowDay" );
     1743                showOtherMonths = this._get( inst, "showOtherMonths" );
     1744                selectOtherMonths = this._get( inst, "selectOtherMonths" );
     1745                defaultDate = this._getDefaultDate( inst );
     1746                html = "";
     1747
     1748                for ( row = 0; row < numMonths[ 0 ]; row++ ) {
     1749                        group = "";
     1750                        this.maxRows = 4;
     1751                        for ( col = 0; col < numMonths[ 1 ]; col++ ) {
     1752                                selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );
     1753                                cornerClass = " ui-corner-all";
     1754                                calender = "";
     1755                                if ( isMultiMonth ) {
     1756                                        calender += "<div class='ui-datepicker-group";
     1757                                        if ( numMonths[ 1 ] > 1 ) {
     1758                                                switch ( col ) {
     1759                                                        case 0: calender += " ui-datepicker-group-first";
     1760                                                                cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
     1761                                                        case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
     1762                                                                cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
     1763                                                        default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
     1764                                                }
     1765                                        }
     1766                                        calender += "'>";
     1767                                }
     1768                                calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
     1769                                        ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +
     1770                                        ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +
     1771                                        this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,
     1772                                        row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers
     1773                                        "</div><table class='ui-datepicker-calendar'><thead>" +
     1774                                        "<tr>";
     1775                                thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );
     1776                                for ( dow = 0; dow < 7; dow++ ) { // days of the week
     1777                                        day = ( dow + firstDay ) % 7;
     1778                                        thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
     1779                                                "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
     1780                                }
     1781                                calender += thead + "</tr></thead><tbody>";
     1782                                daysInMonth = this._getDaysInMonth( drawYear, drawMonth );
     1783                                if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {
     1784                                        inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );
     1785                                }
     1786                                leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;
     1787                                curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate
     1788                                numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)
     1789                                this.maxRows = numRows;
     1790                                printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );
     1791                                for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows
     1792                                        calender += "<tr>";
     1793                                        tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
     1794                                                this._get( inst, "calculateWeek" )( printDate ) + "</td>" );
     1795                                        for ( dow = 0; dow < 7; dow++ ) { // create date picker days
     1796                                                daySettings = ( beforeShowDay ?
     1797                                                        beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );
     1798                                                otherMonth = ( printDate.getMonth() !== drawMonth );
     1799                                                unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||
     1800                                                        ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );
     1801                                                tbody += "<td class='" +
     1802                                                        ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends
     1803                                                        ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months
     1804                                                        ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key
     1805                                                        ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?
     1806
     1807                                                        // or defaultDate is current printedDate and defaultDate is selectedDate
     1808                                                        " " + this._dayOverClass : "" ) + // highlight selected day
     1809                                                        ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) +  // highlight unselectable days
     1810                                                        ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates
     1811                                                        ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day
     1812                                                        ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)
     1813                                                        ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "&#39;" ) + "'" : "" ) + // cell title
     1814                                                        ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions
     1815                                                        ( otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
     1816                                                        ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
     1817                                                        ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
     1818                                                        ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
     1819                                                        ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
     1820                                                        "' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
     1821                                                printDate.setDate( printDate.getDate() + 1 );
     1822                                                printDate = this._daylightSavingAdjust( printDate );
     1823                                        }
     1824                                        calender += tbody + "</tr>";
     1825                                }
     1826                                drawMonth++;
     1827                                if ( drawMonth > 11 ) {
     1828                                        drawMonth = 0;
     1829                                        drawYear++;
     1830                                }
     1831                                calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +
     1832                                                        ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );
     1833                                group += calender;
     1834                        }
     1835                        html += group;
     1836                }
     1837                html += buttonPanel;
     1838                inst._keyEvent = false;
     1839                return html;
     1840        },
     1841
     1842        /* Generate the month and year header. */
     1843        _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,
     1844                        secondary, monthNames, monthNamesShort ) {
     1845
     1846                var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
     1847                        changeMonth = this._get( inst, "changeMonth" ),
     1848                        changeYear = this._get( inst, "changeYear" ),
     1849                        showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
     1850                        html = "<div class='ui-datepicker-title'>",
     1851                        monthHtml = "";
     1852
     1853                // Month selection
     1854                if ( secondary || !changeMonth ) {
     1855                        monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
     1856                } else {
     1857                        inMinYear = ( minDate && minDate.getFullYear() === drawYear );
     1858                        inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
     1859                        monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
     1860                        for ( month = 0; month < 12; month++ ) {
     1861                                if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
     1862                                        monthHtml += "<option value='" + month + "'" +
     1863                                                ( month === drawMonth ? " selected='selected'" : "" ) +
     1864                                                ">" + monthNamesShort[ month ] + "</option>";
     1865                                }
     1866                        }
     1867                        monthHtml += "</select>";
     1868                }
     1869
     1870                if ( !showMonthAfterYear ) {
     1871                        html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" );
     1872                }
     1873
     1874                // Year selection
     1875                if ( !inst.yearshtml ) {
     1876                        inst.yearshtml = "";
     1877                        if ( secondary || !changeYear ) {
     1878                                html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
     1879                        } else {
     1880
     1881                                // determine range of years to display
     1882                                years = this._get( inst, "yearRange" ).split( ":" );
     1883                                thisYear = new Date().getFullYear();
     1884                                determineYear = function( value ) {
     1885                                        var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :
     1886                                                ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :
     1887                                                parseInt( value, 10 ) ) );
     1888                                        return ( isNaN( year ) ? thisYear : year );
     1889                                };
     1890                                year = determineYear( years[ 0 ] );
     1891                                endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
     1892                                year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
     1893                                endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
     1894                                inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
     1895                                for ( ; year <= endYear; year++ ) {
     1896                                        inst.yearshtml += "<option value='" + year + "'" +
     1897                                                ( year === drawYear ? " selected='selected'" : "" ) +
     1898                                                ">" + year + "</option>";
     1899                                }
     1900                                inst.yearshtml += "</select>";
     1901
     1902                                html += inst.yearshtml;
     1903                                inst.yearshtml = null;
     1904                        }
     1905                }
     1906
     1907                html += this._get( inst, "yearSuffix" );
     1908                if ( showMonthAfterYear ) {
     1909                        html += ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ) + monthHtml;
     1910                }
     1911                html += "</div>"; // Close datepicker_header
     1912                return html;
     1913        },
     1914
     1915        /* Adjust one of the date sub-fields. */
     1916        _adjustInstDate: function( inst, offset, period ) {
     1917                var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),
     1918                        month = inst.selectedMonth + ( period === "M" ? offset : 0 ),
     1919                        day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),
     1920                        date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );
     1921
     1922                inst.selectedDay = date.getDate();
     1923                inst.drawMonth = inst.selectedMonth = date.getMonth();
     1924                inst.drawYear = inst.selectedYear = date.getFullYear();
     1925                if ( period === "M" || period === "Y" ) {
     1926                        this._notifyChange( inst );
     1927                }
     1928        },
     1929
     1930        /* Ensure a date is within any min/max bounds. */
     1931        _restrictMinMax: function( inst, date ) {
     1932                var minDate = this._getMinMaxDate( inst, "min" ),
     1933                        maxDate = this._getMinMaxDate( inst, "max" ),
     1934                        newDate = ( minDate && date < minDate ? minDate : date );
     1935                return ( maxDate && newDate > maxDate ? maxDate : newDate );
     1936        },
     1937
     1938        /* Notify change of month/year. */
     1939        _notifyChange: function( inst ) {
     1940                var onChange = this._get( inst, "onChangeMonthYear" );
     1941                if ( onChange ) {
     1942                        onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),
     1943                                [ inst.selectedYear, inst.selectedMonth + 1, inst ] );
     1944                }
     1945        },
     1946
     1947        /* Determine the number of months to show. */
     1948        _getNumberOfMonths: function( inst ) {
     1949                var numMonths = this._get( inst, "numberOfMonths" );
     1950                return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );
     1951        },
     1952
     1953        /* Determine the current maximum date - ensure no time components are set. */
     1954        _getMinMaxDate: function( inst, minMax ) {
     1955                return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );
     1956        },
     1957
     1958        /* Find the number of days in a given month. */
     1959        _getDaysInMonth: function( year, month ) {
     1960                return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();
     1961        },
     1962
     1963        /* Find the day of the week of the first of a month. */
     1964        _getFirstDayOfMonth: function( year, month ) {
     1965                return new Date( year, month, 1 ).getDay();
     1966        },
     1967
     1968        /* Determines if we should allow a "next/prev" month display change. */
     1969        _canAdjustMonth: function( inst, offset, curYear, curMonth ) {
     1970                var numMonths = this._getNumberOfMonths( inst ),
     1971                        date = this._daylightSavingAdjust( new Date( curYear,
     1972                        curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );
     1973
     1974                if ( offset < 0 ) {
     1975                        date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );
     1976                }
     1977                return this._isInRange( inst, date );
     1978        },
     1979
     1980        /* Is the given date in the accepted range? */
     1981        _isInRange: function( inst, date ) {
     1982                var yearSplit, currentYear,
     1983                        minDate = this._getMinMaxDate( inst, "min" ),
     1984                        maxDate = this._getMinMaxDate( inst, "max" ),
     1985                        minYear = null,
     1986                        maxYear = null,
     1987                        years = this._get( inst, "yearRange" );
     1988                        if ( years ) {
     1989                                yearSplit = years.split( ":" );
     1990                                currentYear = new Date().getFullYear();
     1991                                minYear = parseInt( yearSplit[ 0 ], 10 );
     1992                                maxYear = parseInt( yearSplit[ 1 ], 10 );
     1993                                if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {
     1994                                        minYear += currentYear;
     1995                                }
     1996                                if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {
     1997                                        maxYear += currentYear;
     1998                                }
     1999                        }
     2000
     2001                return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&
     2002                        ( !maxDate || date.getTime() <= maxDate.getTime() ) &&
     2003                        ( !minYear || date.getFullYear() >= minYear ) &&
     2004                        ( !maxYear || date.getFullYear() <= maxYear ) );
     2005        },
     2006
     2007        /* Provide the configuration settings for formatting/parsing. */
     2008        _getFormatConfig: function( inst ) {
     2009                var shortYearCutoff = this._get( inst, "shortYearCutoff" );
     2010                shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :
     2011                        new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );
     2012                return { shortYearCutoff: shortYearCutoff,
     2013                        dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),
     2014                        monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };
     2015        },
     2016
     2017        /* Format the given date for display. */
     2018        _formatDate: function( inst, day, month, year ) {
     2019                if ( !day ) {
     2020                        inst.currentDay = inst.selectedDay;
     2021                        inst.currentMonth = inst.selectedMonth;
     2022                        inst.currentYear = inst.selectedYear;
     2023                }
     2024                var date = ( day ? ( typeof day === "object" ? day :
     2025                        this._daylightSavingAdjust( new Date( year, month, day ) ) ) :
     2026                        this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
     2027                return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );
     2028        }
     2029} );
     2030
     2031/*
     2032 * Bind hover events for datepicker elements.
     2033 * Done via delegate so the binding only occurs once in the lifetime of the parent div.
     2034 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
     2035 */
     2036function datepicker_bindHover( dpDiv ) {
     2037        var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
     2038        return dpDiv.on( "mouseout", selector, function() {
     2039                        $( this ).removeClass( "ui-state-hover" );
     2040                        if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
     2041                                $( this ).removeClass( "ui-datepicker-prev-hover" );
     2042                        }
     2043                        if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
     2044                                $( this ).removeClass( "ui-datepicker-next-hover" );
     2045                        }
     2046                } )
     2047                .on( "mouseover", selector, datepicker_handleMouseover );
     2048}
     2049
     2050function datepicker_handleMouseover() {
     2051        if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {
     2052                $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );
     2053                $( this ).addClass( "ui-state-hover" );
     2054                if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
     2055                        $( this ).addClass( "ui-datepicker-prev-hover" );
     2056                }
     2057                if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
     2058                        $( this ).addClass( "ui-datepicker-next-hover" );
     2059                }
     2060        }
     2061}
     2062
     2063/* jQuery extend now ignores nulls! */
     2064function datepicker_extendRemove( target, props ) {
     2065        $.extend( target, props );
     2066        for ( var name in props ) {
     2067                if ( props[ name ] == null ) {
     2068                        target[ name ] = props[ name ];
     2069                }
     2070        }
     2071        return target;
     2072}
     2073
     2074/* Invoke the datepicker functionality.
     2075   @param  options  string - a command, optionally followed by additional parameters or
     2076                                        Object - settings for attaching new datepicker functionality
     2077   @return  jQuery object */
     2078$.fn.datepicker = function( options ) {
     2079
     2080        /* Verify an empty collection wasn't passed - Fixes #6976 */
     2081        if ( !this.length ) {
     2082                return this;
     2083        }
     2084
     2085        /* Initialise the date picker. */
     2086        if ( !$.datepicker.initialized ) {
     2087                $( document ).on( "mousedown", $.datepicker._checkExternalClick );
     2088                $.datepicker.initialized = true;
     2089        }
     2090
     2091        /* Append datepicker main container to body if not exist. */
     2092        if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {
     2093                $( "body" ).append( $.datepicker.dpDiv );
     2094        }
     2095
     2096        var otherArgs = Array.prototype.slice.call( arguments, 1 );
     2097        if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {
     2098                return $.datepicker[ "_" + options + "Datepicker" ].
     2099                        apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
     2100        }
     2101        if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {
     2102                return $.datepicker[ "_" + options + "Datepicker" ].
     2103                        apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
     2104        }
     2105        return this.each( function() {
     2106                typeof options === "string" ?
     2107                        $.datepicker[ "_" + options + "Datepicker" ].
     2108                                apply( $.datepicker, [ this ].concat( otherArgs ) ) :
     2109                        $.datepicker._attachDatepicker( this, options );
     2110        } );
     2111};
     2112
     2113$.datepicker = new Datepicker(); // singleton instance
     2114$.datepicker.initialized = false;
     2115$.datepicker.uuid = new Date().getTime();
     2116$.datepicker.version = "1.12.1";
     2117
     2118return $.datepicker;
     2119
     2120} ) );
  • src/js/_enqueues/vendor/jquery/ui/dialog.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/datepicker.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Dialog 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Dialog
     11//>>group: Widgets
     12//>>description: Displays customizable dialog windows.
     13//>>docs: http://api.jqueryui.com/dialog/
     14//>>demos: http://jqueryui.com/dialog/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/dialog.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./button",
     26                        "./draggable",
     27                        "./mouse",
     28                        "./resizable",
     29                        "./focusable",
     30                        "./keycode",
     31                        "./position",
     32                        "./safe-active-element",
     33                        "./safe-blur",
     34                        "./tabbable",
     35                        "./unique-id",
     36                        "./version",
     37                        "./widget"
     38                ], factory );
     39        } else {
     40
     41                // Browser globals
     42                factory( jQuery );
     43        }
     44}( function( $ ) {
     45
     46$.widget( "ui.dialog", {
     47        version: "1.12.1",
     48        options: {
     49                appendTo: "body",
     50                autoOpen: true,
     51                buttons: [],
     52                classes: {
     53                        "ui-dialog": "ui-corner-all",
     54                        "ui-dialog-titlebar": "ui-corner-all"
     55                },
     56                closeOnEscape: true,
     57                closeText: "Close",
     58                draggable: true,
     59                hide: null,
     60                height: "auto",
     61                maxHeight: null,
     62                maxWidth: null,
     63                minHeight: 150,
     64                minWidth: 150,
     65                modal: false,
     66                position: {
     67                        my: "center",
     68                        at: "center",
     69                        of: window,
     70                        collision: "fit",
     71
     72                        // Ensure the titlebar is always visible
     73                        using: function( pos ) {
     74                                var topOffset = $( this ).css( pos ).offset().top;
     75                                if ( topOffset < 0 ) {
     76                                        $( this ).css( "top", pos.top - topOffset );
     77                                }
     78                        }
     79                },
     80                resizable: true,
     81                show: null,
     82                title: null,
     83                width: 300,
     84
     85                // Callbacks
     86                beforeClose: null,
     87                close: null,
     88                drag: null,
     89                dragStart: null,
     90                dragStop: null,
     91                focus: null,
     92                open: null,
     93                resize: null,
     94                resizeStart: null,
     95                resizeStop: null
     96        },
     97
     98        sizeRelatedOptions: {
     99                buttons: true,
     100                height: true,
     101                maxHeight: true,
     102                maxWidth: true,
     103                minHeight: true,
     104                minWidth: true,
     105                width: true
     106        },
     107
     108        resizableRelatedOptions: {
     109                maxHeight: true,
     110                maxWidth: true,
     111                minHeight: true,
     112                minWidth: true
     113        },
     114
     115        _create: function() {
     116                this.originalCss = {
     117                        display: this.element[ 0 ].style.display,
     118                        width: this.element[ 0 ].style.width,
     119                        minHeight: this.element[ 0 ].style.minHeight,
     120                        maxHeight: this.element[ 0 ].style.maxHeight,
     121                        height: this.element[ 0 ].style.height
     122                };
     123                this.originalPosition = {
     124                        parent: this.element.parent(),
     125                        index: this.element.parent().children().index( this.element )
     126                };
     127                this.originalTitle = this.element.attr( "title" );
     128                if ( this.options.title == null && this.originalTitle != null ) {
     129                        this.options.title = this.originalTitle;
     130                }
     131
     132                // Dialogs can't be disabled
     133                if ( this.options.disabled ) {
     134                        this.options.disabled = false;
     135                }
     136
     137                this._createWrapper();
     138
     139                this.element
     140                        .show()
     141                        .removeAttr( "title" )
     142                        .appendTo( this.uiDialog );
     143
     144                this._addClass( "ui-dialog-content", "ui-widget-content" );
     145
     146                this._createTitlebar();
     147                this._createButtonPane();
     148
     149                if ( this.options.draggable && $.fn.draggable ) {
     150                        this._makeDraggable();
     151                }
     152                if ( this.options.resizable && $.fn.resizable ) {
     153                        this._makeResizable();
     154                }
     155
     156                this._isOpen = false;
     157
     158                this._trackFocus();
     159        },
     160
     161        _init: function() {
     162                if ( this.options.autoOpen ) {
     163                        this.open();
     164                }
     165        },
     166
     167        _appendTo: function() {
     168                var element = this.options.appendTo;
     169                if ( element && ( element.jquery || element.nodeType ) ) {
     170                        return $( element );
     171                }
     172                return this.document.find( element || "body" ).eq( 0 );
     173        },
     174
     175        _destroy: function() {
     176                var next,
     177                        originalPosition = this.originalPosition;
     178
     179                this._untrackInstance();
     180                this._destroyOverlay();
     181
     182                this.element
     183                        .removeUniqueId()
     184                        .css( this.originalCss )
     185
     186                        // Without detaching first, the following becomes really slow
     187                        .detach();
     188
     189                this.uiDialog.remove();
     190
     191                if ( this.originalTitle ) {
     192                        this.element.attr( "title", this.originalTitle );
     193                }
     194
     195                next = originalPosition.parent.children().eq( originalPosition.index );
     196
     197                // Don't try to place the dialog next to itself (#8613)
     198                if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
     199                        next.before( this.element );
     200                } else {
     201                        originalPosition.parent.append( this.element );
     202                }
     203        },
     204
     205        widget: function() {
     206                return this.uiDialog;
     207        },
     208
     209        disable: $.noop,
     210        enable: $.noop,
     211
     212        close: function( event ) {
     213                var that = this;
     214
     215                if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
     216                        return;
     217                }
     218
     219                this._isOpen = false;
     220                this._focusedElement = null;
     221                this._destroyOverlay();
     222                this._untrackInstance();
     223
     224                if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
     225
     226                        // Hiding a focused element doesn't trigger blur in WebKit
     227                        // so in case we have nothing to focus on, explicitly blur the active element
     228                        // https://bugs.webkit.org/show_bug.cgi?id=47182
     229                        $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
     230                }
     231
     232                this._hide( this.uiDialog, this.options.hide, function() {
     233                        that._trigger( "close", event );
     234                } );
     235        },
     236
     237        isOpen: function() {
     238                return this._isOpen;
     239        },
     240
     241        moveToTop: function() {
     242                this._moveToTop();
     243        },
     244
     245        _moveToTop: function( event, silent ) {
     246                var moved = false,
     247                        zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
     248                                return +$( this ).css( "z-index" );
     249                        } ).get(),
     250                        zIndexMax = Math.max.apply( null, zIndices );
     251
     252                if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
     253                        this.uiDialog.css( "z-index", zIndexMax + 1 );
     254                        moved = true;
     255                }
     256
     257                if ( moved && !silent ) {
     258                        this._trigger( "focus", event );
     259                }
     260                return moved;
     261        },
     262
     263        open: function() {
     264                var that = this;
     265                if ( this._isOpen ) {
     266                        if ( this._moveToTop() ) {
     267                                this._focusTabbable();
     268                        }
     269                        return;
     270                }
     271
     272                this._isOpen = true;
     273                this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
     274
     275                this._size();
     276                this._position();
     277                this._createOverlay();
     278                this._moveToTop( null, true );
     279
     280                // Ensure the overlay is moved to the top with the dialog, but only when
     281                // opening. The overlay shouldn't move after the dialog is open so that
     282                // modeless dialogs opened after the modal dialog stack properly.
     283                if ( this.overlay ) {
     284                        this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
     285                }
     286
     287                this._show( this.uiDialog, this.options.show, function() {
     288                        that._focusTabbable();
     289                        that._trigger( "focus" );
     290                } );
     291
     292                // Track the dialog immediately upon openening in case a focus event
     293                // somehow occurs outside of the dialog before an element inside the
     294                // dialog is focused (#10152)
     295                this._makeFocusTarget();
     296
     297                this._trigger( "open" );
     298        },
     299
     300        _focusTabbable: function() {
     301
     302                // Set focus to the first match:
     303                // 1. An element that was focused previously
     304                // 2. First element inside the dialog matching [autofocus]
     305                // 3. Tabbable element inside the content element
     306                // 4. Tabbable element inside the buttonpane
     307                // 5. The close button
     308                // 6. The dialog itself
     309                var hasFocus = this._focusedElement;
     310                if ( !hasFocus ) {
     311                        hasFocus = this.element.find( "[autofocus]" );
     312                }
     313                if ( !hasFocus.length ) {
     314                        hasFocus = this.element.find( ":tabbable" );
     315                }
     316                if ( !hasFocus.length ) {
     317                        hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
     318                }
     319                if ( !hasFocus.length ) {
     320                        hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
     321                }
     322                if ( !hasFocus.length ) {
     323                        hasFocus = this.uiDialog;
     324                }
     325                hasFocus.eq( 0 ).trigger( "focus" );
     326        },
     327
     328        _keepFocus: function( event ) {
     329                function checkFocus() {
     330                        var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
     331                                isActive = this.uiDialog[ 0 ] === activeElement ||
     332                                        $.contains( this.uiDialog[ 0 ], activeElement );
     333                        if ( !isActive ) {
     334                                this._focusTabbable();
     335                        }
     336                }
     337                event.preventDefault();
     338                checkFocus.call( this );
     339
     340                // support: IE
     341                // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
     342                // so we check again later
     343                this._delay( checkFocus );
     344        },
     345
     346        _createWrapper: function() {
     347                this.uiDialog = $( "<div>" )
     348                        .hide()
     349                        .attr( {
     350
     351                                // Setting tabIndex makes the div focusable
     352                                tabIndex: -1,
     353                                role: "dialog"
     354                        } )
     355                        .appendTo( this._appendTo() );
     356
     357                this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
     358                this._on( this.uiDialog, {
     359                        keydown: function( event ) {
     360                                if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
     361                                                event.keyCode === $.ui.keyCode.ESCAPE ) {
     362                                        event.preventDefault();
     363                                        this.close( event );
     364                                        return;
     365                                }
     366
     367                                // Prevent tabbing out of dialogs
     368                                if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
     369                                        return;
     370                                }
     371                                var tabbables = this.uiDialog.find( ":tabbable" ),
     372                                        first = tabbables.filter( ":first" ),
     373                                        last = tabbables.filter( ":last" );
     374
     375                                if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
     376                                                !event.shiftKey ) {
     377                                        this._delay( function() {
     378                                                first.trigger( "focus" );
     379                                        } );
     380                                        event.preventDefault();
     381                                } else if ( ( event.target === first[ 0 ] ||
     382                                                event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
     383                                        this._delay( function() {
     384                                                last.trigger( "focus" );
     385                                        } );
     386                                        event.preventDefault();
     387                                }
     388                        },
     389                        mousedown: function( event ) {
     390                                if ( this._moveToTop( event ) ) {
     391                                        this._focusTabbable();
     392                                }
     393                        }
     394                } );
     395
     396                // We assume that any existing aria-describedby attribute means
     397                // that the dialog content is marked up properly
     398                // otherwise we brute force the content as the description
     399                if ( !this.element.find( "[aria-describedby]" ).length ) {
     400                        this.uiDialog.attr( {
     401                                "aria-describedby": this.element.uniqueId().attr( "id" )
     402                        } );
     403                }
     404        },
     405
     406        _createTitlebar: function() {
     407                var uiDialogTitle;
     408
     409                this.uiDialogTitlebar = $( "<div>" );
     410                this._addClass( this.uiDialogTitlebar,
     411                        "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
     412                this._on( this.uiDialogTitlebar, {
     413                        mousedown: function( event ) {
     414
     415                                // Don't prevent click on close button (#8838)
     416                                // Focusing a dialog that is partially scrolled out of view
     417                                // causes the browser to scroll it into view, preventing the click event
     418                                if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
     419
     420                                        // Dialog isn't getting focus when dragging (#8063)
     421                                        this.uiDialog.trigger( "focus" );
     422                                }
     423                        }
     424                } );
     425
     426                // Support: IE
     427                // Use type="button" to prevent enter keypresses in textboxes from closing the
     428                // dialog in IE (#9312)
     429                this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
     430                        .button( {
     431                                label: $( "<a>" ).text( this.options.closeText ).html(),
     432                                icon: "ui-icon-closethick",
     433                                showLabel: false
     434                        } )
     435                        .appendTo( this.uiDialogTitlebar );
     436
     437                this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
     438                this._on( this.uiDialogTitlebarClose, {
     439                        click: function( event ) {
     440                                event.preventDefault();
     441                                this.close( event );
     442                        }
     443                } );
     444
     445                uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
     446                this._addClass( uiDialogTitle, "ui-dialog-title" );
     447                this._title( uiDialogTitle );
     448
     449                this.uiDialogTitlebar.prependTo( this.uiDialog );
     450
     451                this.uiDialog.attr( {
     452                        "aria-labelledby": uiDialogTitle.attr( "id" )
     453                } );
     454        },
     455
     456        _title: function( title ) {
     457                if ( this.options.title ) {
     458                        title.text( this.options.title );
     459                } else {
     460                        title.html( "&#160;" );
     461                }
     462        },
     463
     464        _createButtonPane: function() {
     465                this.uiDialogButtonPane = $( "<div>" );
     466                this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
     467                        "ui-widget-content ui-helper-clearfix" );
     468
     469                this.uiButtonSet = $( "<div>" )
     470                        .appendTo( this.uiDialogButtonPane );
     471                this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
     472
     473                this._createButtons();
     474        },
     475
     476        _createButtons: function() {
     477                var that = this,
     478                        buttons = this.options.buttons;
     479
     480                // If we already have a button pane, remove it
     481                this.uiDialogButtonPane.remove();
     482                this.uiButtonSet.empty();
     483
     484                if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
     485                        this._removeClass( this.uiDialog, "ui-dialog-buttons" );
     486                        return;
     487                }
     488
     489                $.each( buttons, function( name, props ) {
     490                        var click, buttonOptions;
     491                        props = $.isFunction( props ) ?
     492                                { click: props, text: name } :
     493                                props;
     494
     495                        // Default to a non-submitting button
     496                        props = $.extend( { type: "button" }, props );
     497
     498                        // Change the context for the click callback to be the main element
     499                        click = props.click;
     500                        buttonOptions = {
     501                                icon: props.icon,
     502                                iconPosition: props.iconPosition,
     503                                showLabel: props.showLabel,
     504
     505                                // Deprecated options
     506                                icons: props.icons,
     507                                text: props.text
     508                        };
     509
     510                        delete props.click;
     511                        delete props.icon;
     512                        delete props.iconPosition;
     513                        delete props.showLabel;
     514
     515                        // Deprecated options
     516                        delete props.icons;
     517                        if ( typeof props.text === "boolean" ) {
     518                                delete props.text;
     519                        }
     520
     521                        $( "<button></button>", props )
     522                                .button( buttonOptions )
     523                                .appendTo( that.uiButtonSet )
     524                                .on( "click", function() {
     525                                        click.apply( that.element[ 0 ], arguments );
     526                                } );
     527                } );
     528                this._addClass( this.uiDialog, "ui-dialog-buttons" );
     529                this.uiDialogButtonPane.appendTo( this.uiDialog );
     530        },
     531
     532        _makeDraggable: function() {
     533                var that = this,
     534                        options = this.options;
     535
     536                function filteredUi( ui ) {
     537                        return {
     538                                position: ui.position,
     539                                offset: ui.offset
     540                        };
     541                }
     542
     543                this.uiDialog.draggable( {
     544                        cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
     545                        handle: ".ui-dialog-titlebar",
     546                        containment: "document",
     547                        start: function( event, ui ) {
     548                                that._addClass( $( this ), "ui-dialog-dragging" );
     549                                that._blockFrames();
     550                                that._trigger( "dragStart", event, filteredUi( ui ) );
     551                        },
     552                        drag: function( event, ui ) {
     553                                that._trigger( "drag", event, filteredUi( ui ) );
     554                        },
     555                        stop: function( event, ui ) {
     556                                var left = ui.offset.left - that.document.scrollLeft(),
     557                                        top = ui.offset.top - that.document.scrollTop();
     558
     559                                options.position = {
     560                                        my: "left top",
     561                                        at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
     562                                                "top" + ( top >= 0 ? "+" : "" ) + top,
     563                                        of: that.window
     564                                };
     565                                that._removeClass( $( this ), "ui-dialog-dragging" );
     566                                that._unblockFrames();
     567                                that._trigger( "dragStop", event, filteredUi( ui ) );
     568                        }
     569                } );
     570        },
     571
     572        _makeResizable: function() {
     573                var that = this,
     574                        options = this.options,
     575                        handles = options.resizable,
     576
     577                        // .ui-resizable has position: relative defined in the stylesheet
     578                        // but dialogs have to use absolute or fixed positioning
     579                        position = this.uiDialog.css( "position" ),
     580                        resizeHandles = typeof handles === "string" ?
     581                                handles :
     582                                "n,e,s,w,se,sw,ne,nw";
     583
     584                function filteredUi( ui ) {
     585                        return {
     586                                originalPosition: ui.originalPosition,
     587                                originalSize: ui.originalSize,
     588                                position: ui.position,
     589                                size: ui.size
     590                        };
     591                }
     592
     593                this.uiDialog.resizable( {
     594                        cancel: ".ui-dialog-content",
     595                        containment: "document",
     596                        alsoResize: this.element,
     597                        maxWidth: options.maxWidth,
     598                        maxHeight: options.maxHeight,
     599                        minWidth: options.minWidth,
     600                        minHeight: this._minHeight(),
     601                        handles: resizeHandles,
     602                        start: function( event, ui ) {
     603                                that._addClass( $( this ), "ui-dialog-resizing" );
     604                                that._blockFrames();
     605                                that._trigger( "resizeStart", event, filteredUi( ui ) );
     606                        },
     607                        resize: function( event, ui ) {
     608                                that._trigger( "resize", event, filteredUi( ui ) );
     609                        },
     610                        stop: function( event, ui ) {
     611                                var offset = that.uiDialog.offset(),
     612                                        left = offset.left - that.document.scrollLeft(),
     613                                        top = offset.top - that.document.scrollTop();
     614
     615                                options.height = that.uiDialog.height();
     616                                options.width = that.uiDialog.width();
     617                                options.position = {
     618                                        my: "left top",
     619                                        at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
     620                                                "top" + ( top >= 0 ? "+" : "" ) + top,
     621                                        of: that.window
     622                                };
     623                                that._removeClass( $( this ), "ui-dialog-resizing" );
     624                                that._unblockFrames();
     625                                that._trigger( "resizeStop", event, filteredUi( ui ) );
     626                        }
     627                } )
     628                        .css( "position", position );
     629        },
     630
     631        _trackFocus: function() {
     632                this._on( this.widget(), {
     633                        focusin: function( event ) {
     634                                this._makeFocusTarget();
     635                                this._focusedElement = $( event.target );
     636                        }
     637                } );
     638        },
     639
     640        _makeFocusTarget: function() {
     641                this._untrackInstance();
     642                this._trackingInstances().unshift( this );
     643        },
     644
     645        _untrackInstance: function() {
     646                var instances = this._trackingInstances(),
     647                        exists = $.inArray( this, instances );
     648                if ( exists !== -1 ) {
     649                        instances.splice( exists, 1 );
     650                }
     651        },
     652
     653        _trackingInstances: function() {
     654                var instances = this.document.data( "ui-dialog-instances" );
     655                if ( !instances ) {
     656                        instances = [];
     657                        this.document.data( "ui-dialog-instances", instances );
     658                }
     659                return instances;
     660        },
     661
     662        _minHeight: function() {
     663                var options = this.options;
     664
     665                return options.height === "auto" ?
     666                        options.minHeight :
     667                        Math.min( options.minHeight, options.height );
     668        },
     669
     670        _position: function() {
     671
     672                // Need to show the dialog to get the actual offset in the position plugin
     673                var isVisible = this.uiDialog.is( ":visible" );
     674                if ( !isVisible ) {
     675                        this.uiDialog.show();
     676                }
     677                this.uiDialog.position( this.options.position );
     678                if ( !isVisible ) {
     679                        this.uiDialog.hide();
     680                }
     681        },
     682
     683        _setOptions: function( options ) {
     684                var that = this,
     685                        resize = false,
     686                        resizableOptions = {};
     687
     688                $.each( options, function( key, value ) {
     689                        that._setOption( key, value );
     690
     691                        if ( key in that.sizeRelatedOptions ) {
     692                                resize = true;
     693                        }
     694                        if ( key in that.resizableRelatedOptions ) {
     695                                resizableOptions[ key ] = value;
     696                        }
     697                } );
     698
     699                if ( resize ) {
     700                        this._size();
     701                        this._position();
     702                }
     703                if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
     704                        this.uiDialog.resizable( "option", resizableOptions );
     705                }
     706        },
     707
     708        _setOption: function( key, value ) {
     709                var isDraggable, isResizable,
     710                        uiDialog = this.uiDialog;
     711
     712                if ( key === "disabled" ) {
     713                        return;
     714                }
     715
     716                this._super( key, value );
     717
     718                if ( key === "appendTo" ) {
     719                        this.uiDialog.appendTo( this._appendTo() );
     720                }
     721
     722                if ( key === "buttons" ) {
     723                        this._createButtons();
     724                }
     725
     726                if ( key === "closeText" ) {
     727                        this.uiDialogTitlebarClose.button( {
     728
     729                                // Ensure that we always pass a string
     730                                label: $( "<a>" ).text( "" + this.options.closeText ).html()
     731                        } );
     732                }
     733
     734                if ( key === "draggable" ) {
     735                        isDraggable = uiDialog.is( ":data(ui-draggable)" );
     736                        if ( isDraggable && !value ) {
     737                                uiDialog.draggable( "destroy" );
     738                        }
     739
     740                        if ( !isDraggable && value ) {
     741                                this._makeDraggable();
     742                        }
     743                }
     744
     745                if ( key === "position" ) {
     746                        this._position();
     747                }
     748
     749                if ( key === "resizable" ) {
     750
     751                        // currently resizable, becoming non-resizable
     752                        isResizable = uiDialog.is( ":data(ui-resizable)" );
     753                        if ( isResizable && !value ) {
     754                                uiDialog.resizable( "destroy" );
     755                        }
     756
     757                        // Currently resizable, changing handles
     758                        if ( isResizable && typeof value === "string" ) {
     759                                uiDialog.resizable( "option", "handles", value );
     760                        }
     761
     762                        // Currently non-resizable, becoming resizable
     763                        if ( !isResizable && value !== false ) {
     764                                this._makeResizable();
     765                        }
     766                }
     767
     768                if ( key === "title" ) {
     769                        this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
     770                }
     771        },
     772
     773        _size: function() {
     774
     775                // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
     776                // divs will both have width and height set, so we need to reset them
     777                var nonContentHeight, minContentHeight, maxContentHeight,
     778                        options = this.options;
     779
     780                // Reset content sizing
     781                this.element.show().css( {
     782                        width: "auto",
     783                        minHeight: 0,
     784                        maxHeight: "none",
     785                        height: 0
     786                } );
     787
     788                if ( options.minWidth > options.width ) {
     789                        options.width = options.minWidth;
     790                }
     791
     792                // Reset wrapper sizing
     793                // determine the height of all the non-content elements
     794                nonContentHeight = this.uiDialog.css( {
     795                        height: "auto",
     796                        width: options.width
     797                } )
     798                        .outerHeight();
     799                minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
     800                maxContentHeight = typeof options.maxHeight === "number" ?
     801                        Math.max( 0, options.maxHeight - nonContentHeight ) :
     802                        "none";
     803
     804                if ( options.height === "auto" ) {
     805                        this.element.css( {
     806                                minHeight: minContentHeight,
     807                                maxHeight: maxContentHeight,
     808                                height: "auto"
     809                        } );
     810                } else {
     811                        this.element.height( Math.max( 0, options.height - nonContentHeight ) );
     812                }
     813
     814                if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
     815                        this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
     816                }
     817        },
     818
     819        _blockFrames: function() {
     820                this.iframeBlocks = this.document.find( "iframe" ).map( function() {
     821                        var iframe = $( this );
     822
     823                        return $( "<div>" )
     824                                .css( {
     825                                        position: "absolute",
     826                                        width: iframe.outerWidth(),
     827                                        height: iframe.outerHeight()
     828                                } )
     829                                .appendTo( iframe.parent() )
     830                                .offset( iframe.offset() )[ 0 ];
     831                } );
     832        },
     833
     834        _unblockFrames: function() {
     835                if ( this.iframeBlocks ) {
     836                        this.iframeBlocks.remove();
     837                        delete this.iframeBlocks;
     838                }
     839        },
     840
     841        _allowInteraction: function( event ) {
     842                if ( $( event.target ).closest( ".ui-dialog" ).length ) {
     843                        return true;
     844                }
     845
     846                // TODO: Remove hack when datepicker implements
     847                // the .ui-front logic (#8989)
     848                return !!$( event.target ).closest( ".ui-datepicker" ).length;
     849        },
     850
     851        _createOverlay: function() {
     852                if ( !this.options.modal ) {
     853                        return;
     854                }
     855
     856                // We use a delay in case the overlay is created from an
     857                // event that we're going to be cancelling (#2804)
     858                var isOpening = true;
     859                this._delay( function() {
     860                        isOpening = false;
     861                } );
     862
     863                if ( !this.document.data( "ui-dialog-overlays" ) ) {
     864
     865                        // Prevent use of anchors and inputs
     866                        // Using _on() for an event handler shared across many instances is
     867                        // safe because the dialogs stack and must be closed in reverse order
     868                        this._on( this.document, {
     869                                focusin: function( event ) {
     870                                        if ( isOpening ) {
     871                                                return;
     872                                        }
     873
     874                                        if ( !this._allowInteraction( event ) ) {
     875                                                event.preventDefault();
     876                                                this._trackingInstances()[ 0 ]._focusTabbable();
     877                                        }
     878                                }
     879                        } );
     880                }
     881
     882                this.overlay = $( "<div>" )
     883                        .appendTo( this._appendTo() );
     884
     885                this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
     886                this._on( this.overlay, {
     887                        mousedown: "_keepFocus"
     888                } );
     889                this.document.data( "ui-dialog-overlays",
     890                        ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
     891        },
     892
     893        _destroyOverlay: function() {
     894                if ( !this.options.modal ) {
     895                        return;
     896                }
     897
     898                if ( this.overlay ) {
     899                        var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
     900
     901                        if ( !overlays ) {
     902                                this._off( this.document, "focusin" );
     903                                this.document.removeData( "ui-dialog-overlays" );
     904                        } else {
     905                                this.document.data( "ui-dialog-overlays", overlays );
     906                        }
     907
     908                        this.overlay.remove();
     909                        this.overlay = null;
     910                }
     911        }
     912} );
     913
     914// DEPRECATED
     915// TODO: switch return back to widget declaration at top of file when this is removed
     916if ( $.uiBackCompat !== false ) {
     917
     918        // Backcompat for dialogClass option
     919        $.widget( "ui.dialog", $.ui.dialog, {
     920                options: {
     921                        dialogClass: ""
     922                },
     923                _createWrapper: function() {
     924                        this._super();
     925                        this.uiDialog.addClass( this.options.dialogClass );
     926                },
     927                _setOption: function( key, value ) {
     928                        if ( key === "dialogClass" ) {
     929                                this.uiDialog
     930                                        .removeClass( this.options.dialogClass )
     931                                        .addClass( value );
     932                        }
     933                        this._superApply( arguments );
     934                }
     935        } );
     936}
     937
     938return $.ui.dialog;
     939
     940} ) );
  • src/js/_enqueues/vendor/jquery/ui/draggable.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/dialog.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Draggable 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Draggable
     11//>>group: Interactions
     12//>>description: Enables dragging functionality for any element.
     13//>>docs: http://api.jqueryui.com/draggable/
     14//>>demos: http://jqueryui.com/draggable/
     15//>>css.structure: ../../themes/base/draggable.css
     16
     17( function( factory ) {
     18        if ( typeof define === "function" && define.amd ) {
     19
     20                // AMD. Register as an anonymous module.
     21                define( [
     22                        "jquery",
     23                        "./mouse",
     24                        "./data",
     25                        "./plugin",
     26                        "./safe-active-element",
     27                        "./safe-blur",
     28                        "./scroll-parent",
     29                        "./version",
     30                        "./widget"
     31                ], factory );
     32        } else {
     33
     34                // Browser globals
     35                factory( jQuery );
     36        }
     37}( function( $ ) {
     38
     39$.widget( "ui.draggable", $.ui.mouse, {
     40        version: "1.12.1",
     41        widgetEventPrefix: "drag",
     42        options: {
     43                addClasses: true,
     44                appendTo: "parent",
     45                axis: false,
     46                connectToSortable: false,
     47                containment: false,
     48                cursor: "auto",
     49                cursorAt: false,
     50                grid: false,
     51                handle: false,
     52                helper: "original",
     53                iframeFix: false,
     54                opacity: false,
     55                refreshPositions: false,
     56                revert: false,
     57                revertDuration: 500,
     58                scope: "default",
     59                scroll: true,
     60                scrollSensitivity: 20,
     61                scrollSpeed: 20,
     62                snap: false,
     63                snapMode: "both",
     64                snapTolerance: 20,
     65                stack: false,
     66                zIndex: false,
     67
     68                // Callbacks
     69                drag: null,
     70                start: null,
     71                stop: null
     72        },
     73        _create: function() {
     74
     75                if ( this.options.helper === "original" ) {
     76                        this._setPositionRelative();
     77                }
     78                if ( this.options.addClasses ) {
     79                        this._addClass( "ui-draggable" );
     80                }
     81                this._setHandleClassName();
     82
     83                this._mouseInit();
     84        },
     85
     86        _setOption: function( key, value ) {
     87                this._super( key, value );
     88                if ( key === "handle" ) {
     89                        this._removeHandleClassName();
     90                        this._setHandleClassName();
     91                }
     92        },
     93
     94        _destroy: function() {
     95                if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
     96                        this.destroyOnClear = true;
     97                        return;
     98                }
     99                this._removeHandleClassName();
     100                this._mouseDestroy();
     101        },
     102
     103        _mouseCapture: function( event ) {
     104                var o = this.options;
     105
     106                // Among others, prevent a drag on a resizable-handle
     107                if ( this.helper || o.disabled ||
     108                                $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
     109                        return false;
     110                }
     111
     112                //Quit if we're not on a valid handle
     113                this.handle = this._getHandle( event );
     114                if ( !this.handle ) {
     115                        return false;
     116                }
     117
     118                this._blurActiveElement( event );
     119
     120                this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
     121
     122                return true;
     123
     124        },
     125
     126        _blockFrames: function( selector ) {
     127                this.iframeBlocks = this.document.find( selector ).map( function() {
     128                        var iframe = $( this );
     129
     130                        return $( "<div>" )
     131                                .css( "position", "absolute" )
     132                                .appendTo( iframe.parent() )
     133                                .outerWidth( iframe.outerWidth() )
     134                                .outerHeight( iframe.outerHeight() )
     135                                .offset( iframe.offset() )[ 0 ];
     136                } );
     137        },
     138
     139        _unblockFrames: function() {
     140                if ( this.iframeBlocks ) {
     141                        this.iframeBlocks.remove();
     142                        delete this.iframeBlocks;
     143                }
     144        },
     145
     146        _blurActiveElement: function( event ) {
     147                var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
     148                        target = $( event.target );
     149
     150                // Don't blur if the event occurred on an element that is within
     151                // the currently focused element
     152                // See #10527, #12472
     153                if ( target.closest( activeElement ).length ) {
     154                        return;
     155                }
     156
     157                // Blur any element that currently has focus, see #4261
     158                $.ui.safeBlur( activeElement );
     159        },
     160
     161        _mouseStart: function( event ) {
     162
     163                var o = this.options;
     164
     165                //Create and append the visible helper
     166                this.helper = this._createHelper( event );
     167
     168                this._addClass( this.helper, "ui-draggable-dragging" );
     169
     170                //Cache the helper size
     171                this._cacheHelperProportions();
     172
     173                //If ddmanager is used for droppables, set the global draggable
     174                if ( $.ui.ddmanager ) {
     175                        $.ui.ddmanager.current = this;
     176                }
     177
     178                /*
     179                 * - Position generation -
     180                 * This block generates everything position related - it's the core of draggables.
     181                 */
     182
     183                //Cache the margins of the original element
     184                this._cacheMargins();
     185
     186                //Store the helper's css position
     187                this.cssPosition = this.helper.css( "position" );
     188                this.scrollParent = this.helper.scrollParent( true );
     189                this.offsetParent = this.helper.offsetParent();
     190                this.hasFixedAncestor = this.helper.parents().filter( function() {
     191                                return $( this ).css( "position" ) === "fixed";
     192                        } ).length > 0;
     193
     194                //The element's absolute position on the page minus margins
     195                this.positionAbs = this.element.offset();
     196                this._refreshOffsets( event );
     197
     198                //Generate the original position
     199                this.originalPosition = this.position = this._generatePosition( event, false );
     200                this.originalPageX = event.pageX;
     201                this.originalPageY = event.pageY;
     202
     203                //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
     204                ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
     205
     206                //Set a containment if given in the options
     207                this._setContainment();
     208
     209                //Trigger event + callbacks
     210                if ( this._trigger( "start", event ) === false ) {
     211                        this._clear();
     212                        return false;
     213                }
     214
     215                //Recache the helper size
     216                this._cacheHelperProportions();
     217
     218                //Prepare the droppable offsets
     219                if ( $.ui.ddmanager && !o.dropBehaviour ) {
     220                        $.ui.ddmanager.prepareOffsets( this, event );
     221                }
     222
     223                // Execute the drag once - this causes the helper not to be visible before getting its
     224                // correct position
     225                this._mouseDrag( event, true );
     226
     227                // If the ddmanager is used for droppables, inform the manager that dragging has started
     228                // (see #5003)
     229                if ( $.ui.ddmanager ) {
     230                        $.ui.ddmanager.dragStart( this, event );
     231                }
     232
     233                return true;
     234        },
     235
     236        _refreshOffsets: function( event ) {
     237                this.offset = {
     238                        top: this.positionAbs.top - this.margins.top,
     239                        left: this.positionAbs.left - this.margins.left,
     240                        scroll: false,
     241                        parent: this._getParentOffset(),
     242                        relative: this._getRelativeOffset()
     243                };
     244
     245                this.offset.click = {
     246                        left: event.pageX - this.offset.left,
     247                        top: event.pageY - this.offset.top
     248                };
     249        },
     250
     251        _mouseDrag: function( event, noPropagation ) {
     252
     253                // reset any necessary cached properties (see #5009)
     254                if ( this.hasFixedAncestor ) {
     255                        this.offset.parent = this._getParentOffset();
     256                }
     257
     258                //Compute the helpers position
     259                this.position = this._generatePosition( event, true );
     260                this.positionAbs = this._convertPositionTo( "absolute" );
     261
     262                //Call plugins and callbacks and use the resulting position if something is returned
     263                if ( !noPropagation ) {
     264                        var ui = this._uiHash();
     265                        if ( this._trigger( "drag", event, ui ) === false ) {
     266                                this._mouseUp( new $.Event( "mouseup", event ) );
     267                                return false;
     268                        }
     269                        this.position = ui.position;
     270                }
     271
     272                this.helper[ 0 ].style.left = this.position.left + "px";
     273                this.helper[ 0 ].style.top = this.position.top + "px";
     274
     275                if ( $.ui.ddmanager ) {
     276                        $.ui.ddmanager.drag( this, event );
     277                }
     278
     279                return false;
     280        },
     281
     282        _mouseStop: function( event ) {
     283
     284                //If we are using droppables, inform the manager about the drop
     285                var that = this,
     286                        dropped = false;
     287                if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
     288                        dropped = $.ui.ddmanager.drop( this, event );
     289                }
     290
     291                //if a drop comes from outside (a sortable)
     292                if ( this.dropped ) {
     293                        dropped = this.dropped;
     294                        this.dropped = false;
     295                }
     296
     297                if ( ( this.options.revert === "invalid" && !dropped ) ||
     298                                ( this.options.revert === "valid" && dropped ) ||
     299                                this.options.revert === true || ( $.isFunction( this.options.revert ) &&
     300                                this.options.revert.call( this.element, dropped ) )
     301                ) {
     302                        $( this.helper ).animate(
     303                                this.originalPosition,
     304                                parseInt( this.options.revertDuration, 10 ),
     305                                function() {
     306                                        if ( that._trigger( "stop", event ) !== false ) {
     307                                                that._clear();
     308                                        }
     309                                }
     310                        );
     311                } else {
     312                        if ( this._trigger( "stop", event ) !== false ) {
     313                                this._clear();
     314                        }
     315                }
     316
     317                return false;
     318        },
     319
     320        _mouseUp: function( event ) {
     321                this._unblockFrames();
     322
     323                // If the ddmanager is used for droppables, inform the manager that dragging has stopped
     324                // (see #5003)
     325                if ( $.ui.ddmanager ) {
     326                        $.ui.ddmanager.dragStop( this, event );
     327                }
     328
     329                // Only need to focus if the event occurred on the draggable itself, see #10527
     330                if ( this.handleElement.is( event.target ) ) {
     331
     332                        // The interaction is over; whether or not the click resulted in a drag,
     333                        // focus the element
     334                        this.element.trigger( "focus" );
     335                }
     336
     337                return $.ui.mouse.prototype._mouseUp.call( this, event );
     338        },
     339
     340        cancel: function() {
     341
     342                if ( this.helper.is( ".ui-draggable-dragging" ) ) {
     343                        this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
     344                } else {
     345                        this._clear();
     346                }
     347
     348                return this;
     349
     350        },
     351
     352        _getHandle: function( event ) {
     353                return this.options.handle ?
     354                        !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
     355                        true;
     356        },
     357
     358        _setHandleClassName: function() {
     359                this.handleElement = this.options.handle ?
     360                        this.element.find( this.options.handle ) : this.element;
     361                this._addClass( this.handleElement, "ui-draggable-handle" );
     362        },
     363
     364        _removeHandleClassName: function() {
     365                this._removeClass( this.handleElement, "ui-draggable-handle" );
     366        },
     367
     368        _createHelper: function( event ) {
     369
     370                var o = this.options,
     371                        helperIsFunction = $.isFunction( o.helper ),
     372                        helper = helperIsFunction ?
     373                                $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
     374                                ( o.helper === "clone" ?
     375                                        this.element.clone().removeAttr( "id" ) :
     376                                        this.element );
     377
     378                if ( !helper.parents( "body" ).length ) {
     379                        helper.appendTo( ( o.appendTo === "parent" ?
     380                                this.element[ 0 ].parentNode :
     381                                o.appendTo ) );
     382                }
     383
     384                // Http://bugs.jqueryui.com/ticket/9446
     385                // a helper function can return the original element
     386                // which wouldn't have been set to relative in _create
     387                if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
     388                        this._setPositionRelative();
     389                }
     390
     391                if ( helper[ 0 ] !== this.element[ 0 ] &&
     392                                !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
     393                        helper.css( "position", "absolute" );
     394                }
     395
     396                return helper;
     397
     398        },
     399
     400        _setPositionRelative: function() {
     401                if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
     402                        this.element[ 0 ].style.position = "relative";
     403                }
     404        },
     405
     406        _adjustOffsetFromHelper: function( obj ) {
     407                if ( typeof obj === "string" ) {
     408                        obj = obj.split( " " );
     409                }
     410                if ( $.isArray( obj ) ) {
     411                        obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
     412                }
     413                if ( "left" in obj ) {
     414                        this.offset.click.left = obj.left + this.margins.left;
     415                }
     416                if ( "right" in obj ) {
     417                        this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
     418                }
     419                if ( "top" in obj ) {
     420                        this.offset.click.top = obj.top + this.margins.top;
     421                }
     422                if ( "bottom" in obj ) {
     423                        this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
     424                }
     425        },
     426
     427        _isRootNode: function( element ) {
     428                return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
     429        },
     430
     431        _getParentOffset: function() {
     432
     433                //Get the offsetParent and cache its position
     434                var po = this.offsetParent.offset(),
     435                        document = this.document[ 0 ];
     436
     437                // This is a special case where we need to modify a offset calculated on start, since the
     438                // following happened:
     439                // 1. The position of the helper is absolute, so it's position is calculated based on the
     440                // next positioned parent
     441                // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
     442                // the document, which means that the scroll is included in the initial calculation of the
     443                // offset of the parent, and never recalculated upon drag
     444                if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
     445                                $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
     446                        po.left += this.scrollParent.scrollLeft();
     447                        po.top += this.scrollParent.scrollTop();
     448                }
     449
     450                if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
     451                        po = { top: 0, left: 0 };
     452                }
     453
     454                return {
     455                        top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
     456                        left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
     457                };
     458
     459        },
     460
     461        _getRelativeOffset: function() {
     462                if ( this.cssPosition !== "relative" ) {
     463                        return { top: 0, left: 0 };
     464                }
     465
     466                var p = this.element.position(),
     467                        scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
     468
     469                return {
     470                        top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
     471                                ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
     472                        left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
     473                                ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
     474                };
     475
     476        },
     477
     478        _cacheMargins: function() {
     479                this.margins = {
     480                        left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
     481                        top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
     482                        right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
     483                        bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
     484                };
     485        },
     486
     487        _cacheHelperProportions: function() {
     488                this.helperProportions = {
     489                        width: this.helper.outerWidth(),
     490                        height: this.helper.outerHeight()
     491                };
     492        },
     493
     494        _setContainment: function() {
     495
     496                var isUserScrollable, c, ce,
     497                        o = this.options,
     498                        document = this.document[ 0 ];
     499
     500                this.relativeContainer = null;
     501
     502                if ( !o.containment ) {
     503                        this.containment = null;
     504                        return;
     505                }
     506
     507                if ( o.containment === "window" ) {
     508                        this.containment = [
     509                                $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
     510                                $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
     511                                $( window ).scrollLeft() + $( window ).width() -
     512                                        this.helperProportions.width - this.margins.left,
     513                                $( window ).scrollTop() +
     514                                        ( $( window ).height() || document.body.parentNode.scrollHeight ) -
     515                                        this.helperProportions.height - this.margins.top
     516                        ];
     517                        return;
     518                }
     519
     520                if ( o.containment === "document" ) {
     521                        this.containment = [
     522                                0,
     523                                0,
     524                                $( document ).width() - this.helperProportions.width - this.margins.left,
     525                                ( $( document ).height() || document.body.parentNode.scrollHeight ) -
     526                                        this.helperProportions.height - this.margins.top
     527                        ];
     528                        return;
     529                }
     530
     531                if ( o.containment.constructor === Array ) {
     532                        this.containment = o.containment;
     533                        return;
     534                }
     535
     536                if ( o.containment === "parent" ) {
     537                        o.containment = this.helper[ 0 ].parentNode;
     538                }
     539
     540                c = $( o.containment );
     541                ce = c[ 0 ];
     542
     543                if ( !ce ) {
     544                        return;
     545                }
     546
     547                isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
     548
     549                this.containment = [
     550                        ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
     551                                ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
     552                        ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
     553                                ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
     554                        ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
     555                                ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
     556                                ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
     557                                this.helperProportions.width -
     558                                this.margins.left -
     559                                this.margins.right,
     560                        ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
     561                                ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
     562                                ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
     563                                this.helperProportions.height -
     564                                this.margins.top -
     565                                this.margins.bottom
     566                ];
     567                this.relativeContainer = c;
     568        },
     569
     570        _convertPositionTo: function( d, pos ) {
     571
     572                if ( !pos ) {
     573                        pos = this.position;
     574                }
     575
     576                var mod = d === "absolute" ? 1 : -1,
     577                        scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
     578
     579                return {
     580                        top: (
     581
     582                                // The absolute mouse position
     583                                pos.top +
     584
     585                                // Only for relative positioned nodes: Relative offset from element to offset parent
     586                                this.offset.relative.top * mod +
     587
     588                                // The offsetParent's offset without borders (offset + border)
     589                                this.offset.parent.top * mod -
     590                                ( ( this.cssPosition === "fixed" ?
     591                                        -this.offset.scroll.top :
     592                                        ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
     593                        ),
     594                        left: (
     595
     596                                // The absolute mouse position
     597                                pos.left +
     598
     599                                // Only for relative positioned nodes: Relative offset from element to offset parent
     600                                this.offset.relative.left * mod +
     601
     602                                // The offsetParent's offset without borders (offset + border)
     603                                this.offset.parent.left * mod   -
     604                                ( ( this.cssPosition === "fixed" ?
     605                                        -this.offset.scroll.left :
     606                                        ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
     607                        )
     608                };
     609
     610        },
     611
     612        _generatePosition: function( event, constrainPosition ) {
     613
     614                var containment, co, top, left,
     615                        o = this.options,
     616                        scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
     617                        pageX = event.pageX,
     618                        pageY = event.pageY;
     619
     620                // Cache the scroll
     621                if ( !scrollIsRootNode || !this.offset.scroll ) {
     622                        this.offset.scroll = {
     623                                top: this.scrollParent.scrollTop(),
     624                                left: this.scrollParent.scrollLeft()
     625                        };
     626                }
     627
     628                /*
     629                 * - Position constraining -
     630                 * Constrain the position to a mix of grid, containment.
     631                 */
     632
     633                // If we are not dragging yet, we won't check for options
     634                if ( constrainPosition ) {
     635                        if ( this.containment ) {
     636                                if ( this.relativeContainer ) {
     637                                        co = this.relativeContainer.offset();
     638                                        containment = [
     639                                                this.containment[ 0 ] + co.left,
     640                                                this.containment[ 1 ] + co.top,
     641                                                this.containment[ 2 ] + co.left,
     642                                                this.containment[ 3 ] + co.top
     643                                        ];
     644                                } else {
     645                                        containment = this.containment;
     646                                }
     647
     648                                if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
     649                                        pageX = containment[ 0 ] + this.offset.click.left;
     650                                }
     651                                if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
     652                                        pageY = containment[ 1 ] + this.offset.click.top;
     653                                }
     654                                if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
     655                                        pageX = containment[ 2 ] + this.offset.click.left;
     656                                }
     657                                if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
     658                                        pageY = containment[ 3 ] + this.offset.click.top;
     659                                }
     660                        }
     661
     662                        if ( o.grid ) {
     663
     664                                //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
     665                                // argument errors in IE (see ticket #6950)
     666                                top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
     667                                        this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
     668                                pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
     669                                        top - this.offset.click.top > containment[ 3 ] ) ?
     670                                                top :
     671                                                ( ( top - this.offset.click.top >= containment[ 1 ] ) ?
     672                                                        top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
     673
     674                                left = o.grid[ 0 ] ? this.originalPageX +
     675                                        Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
     676                                        this.originalPageX;
     677                                pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
     678                                        left - this.offset.click.left > containment[ 2 ] ) ?
     679                                                left :
     680                                                ( ( left - this.offset.click.left >= containment[ 0 ] ) ?
     681                                                        left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
     682                        }
     683
     684                        if ( o.axis === "y" ) {
     685                                pageX = this.originalPageX;
     686                        }
     687
     688                        if ( o.axis === "x" ) {
     689                                pageY = this.originalPageY;
     690                        }
     691                }
     692
     693                return {
     694                        top: (
     695
     696                                // The absolute mouse position
     697                                pageY -
     698
     699                                // Click offset (relative to the element)
     700                                this.offset.click.top -
     701
     702                                // Only for relative positioned nodes: Relative offset from element to offset parent
     703                                this.offset.relative.top -
     704
     705                                // The offsetParent's offset without borders (offset + border)
     706                                this.offset.parent.top +
     707                                ( this.cssPosition === "fixed" ?
     708                                        -this.offset.scroll.top :
     709                                        ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
     710                        ),
     711                        left: (
     712
     713                                // The absolute mouse position
     714                                pageX -
     715
     716                                // Click offset (relative to the element)
     717                                this.offset.click.left -
     718
     719                                // Only for relative positioned nodes: Relative offset from element to offset parent
     720                                this.offset.relative.left -
     721
     722                                // The offsetParent's offset without borders (offset + border)
     723                                this.offset.parent.left +
     724                                ( this.cssPosition === "fixed" ?
     725                                        -this.offset.scroll.left :
     726                                        ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
     727                        )
     728                };
     729
     730        },
     731
     732        _clear: function() {
     733                this._removeClass( this.helper, "ui-draggable-dragging" );
     734                if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
     735                        this.helper.remove();
     736                }
     737                this.helper = null;
     738                this.cancelHelperRemoval = false;
     739                if ( this.destroyOnClear ) {
     740                        this.destroy();
     741                }
     742        },
     743
     744        // From now on bulk stuff - mainly helpers
     745
     746        _trigger: function( type, event, ui ) {
     747                ui = ui || this._uiHash();
     748                $.ui.plugin.call( this, type, [ event, ui, this ], true );
     749
     750                // Absolute position and offset (see #6884 ) have to be recalculated after plugins
     751                if ( /^(drag|start|stop)/.test( type ) ) {
     752                        this.positionAbs = this._convertPositionTo( "absolute" );
     753                        ui.offset = this.positionAbs;
     754                }
     755                return $.Widget.prototype._trigger.call( this, type, event, ui );
     756        },
     757
     758        plugins: {},
     759
     760        _uiHash: function() {
     761                return {
     762                        helper: this.helper,
     763                        position: this.position,
     764                        originalPosition: this.originalPosition,
     765                        offset: this.positionAbs
     766                };
     767        }
     768
     769} );
     770
     771$.ui.plugin.add( "draggable", "connectToSortable", {
     772        start: function( event, ui, draggable ) {
     773                var uiSortable = $.extend( {}, ui, {
     774                        item: draggable.element
     775                } );
     776
     777                draggable.sortables = [];
     778                $( draggable.options.connectToSortable ).each( function() {
     779                        var sortable = $( this ).sortable( "instance" );
     780
     781                        if ( sortable && !sortable.options.disabled ) {
     782                                draggable.sortables.push( sortable );
     783
     784                                // RefreshPositions is called at drag start to refresh the containerCache
     785                                // which is used in drag. This ensures it's initialized and synchronized
     786                                // with any changes that might have happened on the page since initialization.
     787                                sortable.refreshPositions();
     788                                sortable._trigger( "activate", event, uiSortable );
     789                        }
     790                } );
     791        },
     792        stop: function( event, ui, draggable ) {
     793                var uiSortable = $.extend( {}, ui, {
     794                        item: draggable.element
     795                } );
     796
     797                draggable.cancelHelperRemoval = false;
     798
     799                $.each( draggable.sortables, function() {
     800                        var sortable = this;
     801
     802                        if ( sortable.isOver ) {
     803                                sortable.isOver = 0;
     804
     805                                // Allow this sortable to handle removing the helper
     806                                draggable.cancelHelperRemoval = true;
     807                                sortable.cancelHelperRemoval = false;
     808
     809                                // Use _storedCSS To restore properties in the sortable,
     810                                // as this also handles revert (#9675) since the draggable
     811                                // may have modified them in unexpected ways (#8809)
     812                                sortable._storedCSS = {
     813                                        position: sortable.placeholder.css( "position" ),
     814                                        top: sortable.placeholder.css( "top" ),
     815                                        left: sortable.placeholder.css( "left" )
     816                                };
     817
     818                                sortable._mouseStop( event );
     819
     820                                // Once drag has ended, the sortable should return to using
     821                                // its original helper, not the shared helper from draggable
     822                                sortable.options.helper = sortable.options._helper;
     823                        } else {
     824
     825                                // Prevent this Sortable from removing the helper.
     826                                // However, don't set the draggable to remove the helper
     827                                // either as another connected Sortable may yet handle the removal.
     828                                sortable.cancelHelperRemoval = true;
     829
     830                                sortable._trigger( "deactivate", event, uiSortable );
     831                        }
     832                } );
     833        },
     834        drag: function( event, ui, draggable ) {
     835                $.each( draggable.sortables, function() {
     836                        var innermostIntersecting = false,
     837                                sortable = this;
     838
     839                        // Copy over variables that sortable's _intersectsWith uses
     840                        sortable.positionAbs = draggable.positionAbs;
     841                        sortable.helperProportions = draggable.helperProportions;
     842                        sortable.offset.click = draggable.offset.click;
     843
     844                        if ( sortable._intersectsWith( sortable.containerCache ) ) {
     845                                innermostIntersecting = true;
     846
     847                                $.each( draggable.sortables, function() {
     848
     849                                        // Copy over variables that sortable's _intersectsWith uses
     850                                        this.positionAbs = draggable.positionAbs;
     851                                        this.helperProportions = draggable.helperProportions;
     852                                        this.offset.click = draggable.offset.click;
     853
     854                                        if ( this !== sortable &&
     855                                                        this._intersectsWith( this.containerCache ) &&
     856                                                        $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
     857                                                innermostIntersecting = false;
     858                                        }
     859
     860                                        return innermostIntersecting;
     861                                } );
     862                        }
     863
     864                        if ( innermostIntersecting ) {
     865
     866                                // If it intersects, we use a little isOver variable and set it once,
     867                                // so that the move-in stuff gets fired only once.
     868                                if ( !sortable.isOver ) {
     869                                        sortable.isOver = 1;
     870
     871                                        // Store draggable's parent in case we need to reappend to it later.
     872                                        draggable._parent = ui.helper.parent();
     873
     874                                        sortable.currentItem = ui.helper
     875                                                .appendTo( sortable.element )
     876                                                .data( "ui-sortable-item", true );
     877
     878                                        // Store helper option to later restore it
     879                                        sortable.options._helper = sortable.options.helper;
     880
     881                                        sortable.options.helper = function() {
     882                                                return ui.helper[ 0 ];
     883                                        };
     884
     885                                        // Fire the start events of the sortable with our passed browser event,
     886                                        // and our own helper (so it doesn't create a new one)
     887                                        event.target = sortable.currentItem[ 0 ];
     888                                        sortable._mouseCapture( event, true );
     889                                        sortable._mouseStart( event, true, true );
     890
     891                                        // Because the browser event is way off the new appended portlet,
     892                                        // modify necessary variables to reflect the changes
     893                                        sortable.offset.click.top = draggable.offset.click.top;
     894                                        sortable.offset.click.left = draggable.offset.click.left;
     895                                        sortable.offset.parent.left -= draggable.offset.parent.left -
     896                                                sortable.offset.parent.left;
     897                                        sortable.offset.parent.top -= draggable.offset.parent.top -
     898                                                sortable.offset.parent.top;
     899
     900                                        draggable._trigger( "toSortable", event );
     901
     902                                        // Inform draggable that the helper is in a valid drop zone,
     903                                        // used solely in the revert option to handle "valid/invalid".
     904                                        draggable.dropped = sortable.element;
     905
     906                                        // Need to refreshPositions of all sortables in the case that
     907                                        // adding to one sortable changes the location of the other sortables (#9675)
     908                                        $.each( draggable.sortables, function() {
     909                                                this.refreshPositions();
     910                                        } );
     911
     912                                        // Hack so receive/update callbacks work (mostly)
     913                                        draggable.currentItem = draggable.element;
     914                                        sortable.fromOutside = draggable;
     915                                }
     916
     917                                if ( sortable.currentItem ) {
     918                                        sortable._mouseDrag( event );
     919
     920                                        // Copy the sortable's position because the draggable's can potentially reflect
     921                                        // a relative position, while sortable is always absolute, which the dragged
     922                                        // element has now become. (#8809)
     923                                        ui.position = sortable.position;
     924                                }
     925                        } else {
     926
     927                                // If it doesn't intersect with the sortable, and it intersected before,
     928                                // we fake the drag stop of the sortable, but make sure it doesn't remove
     929                                // the helper by using cancelHelperRemoval.
     930                                if ( sortable.isOver ) {
     931
     932                                        sortable.isOver = 0;
     933                                        sortable.cancelHelperRemoval = true;
     934
     935                                        // Calling sortable's mouseStop would trigger a revert,
     936                                        // so revert must be temporarily false until after mouseStop is called.
     937                                        sortable.options._revert = sortable.options.revert;
     938                                        sortable.options.revert = false;
     939
     940                                        sortable._trigger( "out", event, sortable._uiHash( sortable ) );
     941                                        sortable._mouseStop( event, true );
     942
     943                                        // Restore sortable behaviors that were modfied
     944                                        // when the draggable entered the sortable area (#9481)
     945                                        sortable.options.revert = sortable.options._revert;
     946                                        sortable.options.helper = sortable.options._helper;
     947
     948                                        if ( sortable.placeholder ) {
     949                                                sortable.placeholder.remove();
     950                                        }
     951
     952                                        // Restore and recalculate the draggable's offset considering the sortable
     953                                        // may have modified them in unexpected ways. (#8809, #10669)
     954                                        ui.helper.appendTo( draggable._parent );
     955                                        draggable._refreshOffsets( event );
     956                                        ui.position = draggable._generatePosition( event, true );
     957
     958                                        draggable._trigger( "fromSortable", event );
     959
     960                                        // Inform draggable that the helper is no longer in a valid drop zone
     961                                        draggable.dropped = false;
     962
     963                                        // Need to refreshPositions of all sortables just in case removing
     964                                        // from one sortable changes the location of other sortables (#9675)
     965                                        $.each( draggable.sortables, function() {
     966                                                this.refreshPositions();
     967                                        } );
     968                                }
     969                        }
     970                } );
     971        }
     972} );
     973
     974$.ui.plugin.add( "draggable", "cursor", {
     975        start: function( event, ui, instance ) {
     976                var t = $( "body" ),
     977                        o = instance.options;
     978
     979                if ( t.css( "cursor" ) ) {
     980                        o._cursor = t.css( "cursor" );
     981                }
     982                t.css( "cursor", o.cursor );
     983        },
     984        stop: function( event, ui, instance ) {
     985                var o = instance.options;
     986                if ( o._cursor ) {
     987                        $( "body" ).css( "cursor", o._cursor );
     988                }
     989        }
     990} );
     991
     992$.ui.plugin.add( "draggable", "opacity", {
     993        start: function( event, ui, instance ) {
     994                var t = $( ui.helper ),
     995                        o = instance.options;
     996                if ( t.css( "opacity" ) ) {
     997                        o._opacity = t.css( "opacity" );
     998                }
     999                t.css( "opacity", o.opacity );
     1000        },
     1001        stop: function( event, ui, instance ) {
     1002                var o = instance.options;
     1003                if ( o._opacity ) {
     1004                        $( ui.helper ).css( "opacity", o._opacity );
     1005                }
     1006        }
     1007} );
     1008
     1009$.ui.plugin.add( "draggable", "scroll", {
     1010        start: function( event, ui, i ) {
     1011                if ( !i.scrollParentNotHidden ) {
     1012                        i.scrollParentNotHidden = i.helper.scrollParent( false );
     1013                }
     1014
     1015                if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
     1016                                i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
     1017                        i.overflowOffset = i.scrollParentNotHidden.offset();
     1018                }
     1019        },
     1020        drag: function( event, ui, i  ) {
     1021
     1022                var o = i.options,
     1023                        scrolled = false,
     1024                        scrollParent = i.scrollParentNotHidden[ 0 ],
     1025                        document = i.document[ 0 ];
     1026
     1027                if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
     1028                        if ( !o.axis || o.axis !== "x" ) {
     1029                                if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
     1030                                                o.scrollSensitivity ) {
     1031                                        scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
     1032                                } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
     1033                                        scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
     1034                                }
     1035                        }
     1036
     1037                        if ( !o.axis || o.axis !== "y" ) {
     1038                                if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
     1039                                                o.scrollSensitivity ) {
     1040                                        scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
     1041                                } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
     1042                                        scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
     1043                                }
     1044                        }
     1045
     1046                } else {
     1047
     1048                        if ( !o.axis || o.axis !== "x" ) {
     1049                                if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
     1050                                        scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
     1051                                } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
     1052                                                o.scrollSensitivity ) {
     1053                                        scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
     1054                                }
     1055                        }
     1056
     1057                        if ( !o.axis || o.axis !== "y" ) {
     1058                                if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
     1059                                        scrolled = $( document ).scrollLeft(
     1060                                                $( document ).scrollLeft() - o.scrollSpeed
     1061                                        );
     1062                                } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
     1063                                                o.scrollSensitivity ) {
     1064                                        scrolled = $( document ).scrollLeft(
     1065                                                $( document ).scrollLeft() + o.scrollSpeed
     1066                                        );
     1067                                }
     1068                        }
     1069
     1070                }
     1071
     1072                if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
     1073                        $.ui.ddmanager.prepareOffsets( i, event );
     1074                }
     1075
     1076        }
     1077} );
     1078
     1079$.ui.plugin.add( "draggable", "snap", {
     1080        start: function( event, ui, i ) {
     1081
     1082                var o = i.options;
     1083
     1084                i.snapElements = [];
     1085
     1086                $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
     1087                        .each( function() {
     1088                                var $t = $( this ),
     1089                                        $o = $t.offset();
     1090                                if ( this !== i.element[ 0 ] ) {
     1091                                        i.snapElements.push( {
     1092                                                item: this,
     1093                                                width: $t.outerWidth(), height: $t.outerHeight(),
     1094                                                top: $o.top, left: $o.left
     1095                                        } );
     1096                                }
     1097                        } );
     1098
     1099        },
     1100        drag: function( event, ui, inst ) {
     1101
     1102                var ts, bs, ls, rs, l, r, t, b, i, first,
     1103                        o = inst.options,
     1104                        d = o.snapTolerance,
     1105                        x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
     1106                        y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
     1107
     1108                for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
     1109
     1110                        l = inst.snapElements[ i ].left - inst.margins.left;
     1111                        r = l + inst.snapElements[ i ].width;
     1112                        t = inst.snapElements[ i ].top - inst.margins.top;
     1113                        b = t + inst.snapElements[ i ].height;
     1114
     1115                        if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
     1116                                        !$.contains( inst.snapElements[ i ].item.ownerDocument,
     1117                                        inst.snapElements[ i ].item ) ) {
     1118                                if ( inst.snapElements[ i ].snapping ) {
     1119                                        ( inst.options.snap.release &&
     1120                                                inst.options.snap.release.call(
     1121                                                        inst.element,
     1122                                                        event,
     1123                                                        $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
     1124                                                ) );
     1125                                }
     1126                                inst.snapElements[ i ].snapping = false;
     1127                                continue;
     1128                        }
     1129
     1130                        if ( o.snapMode !== "inner" ) {
     1131                                ts = Math.abs( t - y2 ) <= d;
     1132                                bs = Math.abs( b - y1 ) <= d;
     1133                                ls = Math.abs( l - x2 ) <= d;
     1134                                rs = Math.abs( r - x1 ) <= d;
     1135                                if ( ts ) {
     1136                                        ui.position.top = inst._convertPositionTo( "relative", {
     1137                                                top: t - inst.helperProportions.height,
     1138                                                left: 0
     1139                                        } ).top;
     1140                                }
     1141                                if ( bs ) {
     1142                                        ui.position.top = inst._convertPositionTo( "relative", {
     1143                                                top: b,
     1144                                                left: 0
     1145                                        } ).top;
     1146                                }
     1147                                if ( ls ) {
     1148                                        ui.position.left = inst._convertPositionTo( "relative", {
     1149                                                top: 0,
     1150                                                left: l - inst.helperProportions.width
     1151                                        } ).left;
     1152                                }
     1153                                if ( rs ) {
     1154                                        ui.position.left = inst._convertPositionTo( "relative", {
     1155                                                top: 0,
     1156                                                left: r
     1157                                        } ).left;
     1158                                }
     1159                        }
     1160
     1161                        first = ( ts || bs || ls || rs );
     1162
     1163                        if ( o.snapMode !== "outer" ) {
     1164                                ts = Math.abs( t - y1 ) <= d;
     1165                                bs = Math.abs( b - y2 ) <= d;
     1166                                ls = Math.abs( l - x1 ) <= d;
     1167                                rs = Math.abs( r - x2 ) <= d;
     1168                                if ( ts ) {
     1169                                        ui.position.top = inst._convertPositionTo( "relative", {
     1170                                                top: t,
     1171                                                left: 0
     1172                                        } ).top;
     1173                                }
     1174                                if ( bs ) {
     1175                                        ui.position.top = inst._convertPositionTo( "relative", {
     1176                                                top: b - inst.helperProportions.height,
     1177                                                left: 0
     1178                                        } ).top;
     1179                                }
     1180                                if ( ls ) {
     1181                                        ui.position.left = inst._convertPositionTo( "relative", {
     1182                                                top: 0,
     1183                                                left: l
     1184                                        } ).left;
     1185                                }
     1186                                if ( rs ) {
     1187                                        ui.position.left = inst._convertPositionTo( "relative", {
     1188                                                top: 0,
     1189                                                left: r - inst.helperProportions.width
     1190                                        } ).left;
     1191                                }
     1192                        }
     1193
     1194                        if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
     1195                                ( inst.options.snap.snap &&
     1196                                        inst.options.snap.snap.call(
     1197                                                inst.element,
     1198                                                event,
     1199                                                $.extend( inst._uiHash(), {
     1200                                                        snapItem: inst.snapElements[ i ].item
     1201                                                } ) ) );
     1202                        }
     1203                        inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
     1204
     1205                }
     1206
     1207        }
     1208} );
     1209
     1210$.ui.plugin.add( "draggable", "stack", {
     1211        start: function( event, ui, instance ) {
     1212                var min,
     1213                        o = instance.options,
     1214                        group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
     1215                                return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
     1216                                        ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
     1217                        } );
     1218
     1219                if ( !group.length ) { return; }
     1220
     1221                min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
     1222                $( group ).each( function( i ) {
     1223                        $( this ).css( "zIndex", min + i );
     1224                } );
     1225                this.css( "zIndex", ( min + group.length ) );
     1226        }
     1227} );
     1228
     1229$.ui.plugin.add( "draggable", "zIndex", {
     1230        start: function( event, ui, instance ) {
     1231                var t = $( ui.helper ),
     1232                        o = instance.options;
     1233
     1234                if ( t.css( "zIndex" ) ) {
     1235                        o._zIndex = t.css( "zIndex" );
     1236                }
     1237                t.css( "zIndex", o.zIndex );
     1238        },
     1239        stop: function( event, ui, instance ) {
     1240                var o = instance.options;
     1241
     1242                if ( o._zIndex ) {
     1243                        $( ui.helper ).css( "zIndex", o._zIndex );
     1244                }
     1245        }
     1246} );
     1247
     1248return $.ui.draggable;
     1249
     1250} ) );
  • src/js/_enqueues/vendor/jquery/ui/droppable.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/draggable.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Droppable 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Droppable
     11//>>group: Interactions
     12//>>description: Enables drop targets for draggable elements.
     13//>>docs: http://api.jqueryui.com/droppable/
     14//>>demos: http://jqueryui.com/droppable/
     15
     16( function( factory ) {
     17        if ( typeof define === "function" && define.amd ) {
     18
     19                // AMD. Register as an anonymous module.
     20                define( [
     21                        "jquery",
     22                        "./draggable",
     23                        "./mouse",
     24                        "./version",
     25                        "./widget"
     26                ], factory );
     27        } else {
     28
     29                // Browser globals
     30                factory( jQuery );
     31        }
     32}( function( $ ) {
     33
     34$.widget( "ui.droppable", {
     35        version: "1.12.1",
     36        widgetEventPrefix: "drop",
     37        options: {
     38                accept: "*",
     39                addClasses: true,
     40                greedy: false,
     41                scope: "default",
     42                tolerance: "intersect",
     43
     44                // Callbacks
     45                activate: null,
     46                deactivate: null,
     47                drop: null,
     48                out: null,
     49                over: null
     50        },
     51        _create: function() {
     52
     53                var proportions,
     54                        o = this.options,
     55                        accept = o.accept;
     56
     57                this.isover = false;
     58                this.isout = true;
     59
     60                this.accept = $.isFunction( accept ) ? accept : function( d ) {
     61                        return d.is( accept );
     62                };
     63
     64                this.proportions = function( /* valueToWrite */ ) {
     65                        if ( arguments.length ) {
     66
     67                                // Store the droppable's proportions
     68                                proportions = arguments[ 0 ];
     69                        } else {
     70
     71                                // Retrieve or derive the droppable's proportions
     72                                return proportions ?
     73                                        proportions :
     74                                        proportions = {
     75                                                width: this.element[ 0 ].offsetWidth,
     76                                                height: this.element[ 0 ].offsetHeight
     77                                        };
     78                        }
     79                };
     80
     81                this._addToManager( o.scope );
     82
     83                o.addClasses && this._addClass( "ui-droppable" );
     84
     85        },
     86
     87        _addToManager: function( scope ) {
     88
     89                // Add the reference and positions to the manager
     90                $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
     91                $.ui.ddmanager.droppables[ scope ].push( this );
     92        },
     93
     94        _splice: function( drop ) {
     95                var i = 0;
     96                for ( ; i < drop.length; i++ ) {
     97                        if ( drop[ i ] === this ) {
     98                                drop.splice( i, 1 );
     99                        }
     100                }
     101        },
     102
     103        _destroy: function() {
     104                var drop = $.ui.ddmanager.droppables[ this.options.scope ];
     105
     106                this._splice( drop );
     107        },
     108
     109        _setOption: function( key, value ) {
     110
     111                if ( key === "accept" ) {
     112                        this.accept = $.isFunction( value ) ? value : function( d ) {
     113                                return d.is( value );
     114                        };
     115                } else if ( key === "scope" ) {
     116                        var drop = $.ui.ddmanager.droppables[ this.options.scope ];
     117
     118                        this._splice( drop );
     119                        this._addToManager( value );
     120                }
     121
     122                this._super( key, value );
     123        },
     124
     125        _activate: function( event ) {
     126                var draggable = $.ui.ddmanager.current;
     127
     128                this._addActiveClass();
     129                if ( draggable ) {
     130                        this._trigger( "activate", event, this.ui( draggable ) );
     131                }
     132        },
     133
     134        _deactivate: function( event ) {
     135                var draggable = $.ui.ddmanager.current;
     136
     137                this._removeActiveClass();
     138                if ( draggable ) {
     139                        this._trigger( "deactivate", event, this.ui( draggable ) );
     140                }
     141        },
     142
     143        _over: function( event ) {
     144
     145                var draggable = $.ui.ddmanager.current;
     146
     147                // Bail if draggable and droppable are same element
     148                if ( !draggable || ( draggable.currentItem ||
     149                                draggable.element )[ 0 ] === this.element[ 0 ] ) {
     150                        return;
     151                }
     152
     153                if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
     154                                draggable.element ) ) ) {
     155                        this._addHoverClass();
     156                        this._trigger( "over", event, this.ui( draggable ) );
     157                }
     158
     159        },
     160
     161        _out: function( event ) {
     162
     163                var draggable = $.ui.ddmanager.current;
     164
     165                // Bail if draggable and droppable are same element
     166                if ( !draggable || ( draggable.currentItem ||
     167                                draggable.element )[ 0 ] === this.element[ 0 ] ) {
     168                        return;
     169                }
     170
     171                if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
     172                                draggable.element ) ) ) {
     173                        this._removeHoverClass();
     174                        this._trigger( "out", event, this.ui( draggable ) );
     175                }
     176
     177        },
     178
     179        _drop: function( event, custom ) {
     180
     181                var draggable = custom || $.ui.ddmanager.current,
     182                        childrenIntersection = false;
     183
     184                // Bail if draggable and droppable are same element
     185                if ( !draggable || ( draggable.currentItem ||
     186                                draggable.element )[ 0 ] === this.element[ 0 ] ) {
     187                        return false;
     188                }
     189
     190                this.element
     191                        .find( ":data(ui-droppable)" )
     192                        .not( ".ui-draggable-dragging" )
     193                        .each( function() {
     194                                var inst = $( this ).droppable( "instance" );
     195                                if (
     196                                        inst.options.greedy &&
     197                                        !inst.options.disabled &&
     198                                        inst.options.scope === draggable.options.scope &&
     199                                        inst.accept.call(
     200                                                inst.element[ 0 ], ( draggable.currentItem || draggable.element )
     201                                        ) &&
     202                                        intersect(
     203                                                draggable,
     204                                                $.extend( inst, { offset: inst.element.offset() } ),
     205                                                inst.options.tolerance, event
     206                                        )
     207                                ) {
     208                                        childrenIntersection = true;
     209                                        return false; }
     210                        } );
     211                if ( childrenIntersection ) {
     212                        return false;
     213                }
     214
     215                if ( this.accept.call( this.element[ 0 ],
     216                                ( draggable.currentItem || draggable.element ) ) ) {
     217                        this._removeActiveClass();
     218                        this._removeHoverClass();
     219
     220                        this._trigger( "drop", event, this.ui( draggable ) );
     221                        return this.element;
     222                }
     223
     224                return false;
     225
     226        },
     227
     228        ui: function( c ) {
     229                return {
     230                        draggable: ( c.currentItem || c.element ),
     231                        helper: c.helper,
     232                        position: c.position,
     233                        offset: c.positionAbs
     234                };
     235        },
     236
     237        // Extension points just to make backcompat sane and avoid duplicating logic
     238        // TODO: Remove in 1.13 along with call to it below
     239        _addHoverClass: function() {
     240                this._addClass( "ui-droppable-hover" );
     241        },
     242
     243        _removeHoverClass: function() {
     244                this._removeClass( "ui-droppable-hover" );
     245        },
     246
     247        _addActiveClass: function() {
     248                this._addClass( "ui-droppable-active" );
     249        },
     250
     251        _removeActiveClass: function() {
     252                this._removeClass( "ui-droppable-active" );
     253        }
     254} );
     255
     256var intersect = $.ui.intersect = ( function() {
     257        function isOverAxis( x, reference, size ) {
     258                return ( x >= reference ) && ( x < ( reference + size ) );
     259        }
     260
     261        return function( draggable, droppable, toleranceMode, event ) {
     262
     263                if ( !droppable.offset ) {
     264                        return false;
     265                }
     266
     267                var x1 = ( draggable.positionAbs ||
     268                                draggable.position.absolute ).left + draggable.margins.left,
     269                        y1 = ( draggable.positionAbs ||
     270                                draggable.position.absolute ).top + draggable.margins.top,
     271                        x2 = x1 + draggable.helperProportions.width,
     272                        y2 = y1 + draggable.helperProportions.height,
     273                        l = droppable.offset.left,
     274                        t = droppable.offset.top,
     275                        r = l + droppable.proportions().width,
     276                        b = t + droppable.proportions().height;
     277
     278                switch ( toleranceMode ) {
     279                case "fit":
     280                        return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
     281                case "intersect":
     282                        return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
     283                                x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
     284                                t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
     285                                y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
     286                case "pointer":
     287                        return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
     288                                isOverAxis( event.pageX, l, droppable.proportions().width );
     289                case "touch":
     290                        return (
     291                                ( y1 >= t && y1 <= b ) || // Top edge touching
     292                                ( y2 >= t && y2 <= b ) || // Bottom edge touching
     293                                ( y1 < t && y2 > b ) // Surrounded vertically
     294                        ) && (
     295                                ( x1 >= l && x1 <= r ) || // Left edge touching
     296                                ( x2 >= l && x2 <= r ) || // Right edge touching
     297                                ( x1 < l && x2 > r ) // Surrounded horizontally
     298                        );
     299                default:
     300                        return false;
     301                }
     302        };
     303} )();
     304
     305/*
     306        This manager tracks offsets of draggables and droppables
     307*/
     308$.ui.ddmanager = {
     309        current: null,
     310        droppables: { "default": [] },
     311        prepareOffsets: function( t, event ) {
     312
     313                var i, j,
     314                        m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
     315                        type = event ? event.type : null, // workaround for #2317
     316                        list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
     317
     318                droppablesLoop: for ( i = 0; i < m.length; i++ ) {
     319
     320                        // No disabled and non-accepted
     321                        if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
     322                                        ( t.currentItem || t.element ) ) ) ) {
     323                                continue;
     324                        }
     325
     326                        // Filter out elements in the current dragged item
     327                        for ( j = 0; j < list.length; j++ ) {
     328                                if ( list[ j ] === m[ i ].element[ 0 ] ) {
     329                                        m[ i ].proportions().height = 0;
     330                                        continue droppablesLoop;
     331                                }
     332                        }
     333
     334                        m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
     335                        if ( !m[ i ].visible ) {
     336                                continue;
     337                        }
     338
     339                        // Activate the droppable if used directly from draggables
     340                        if ( type === "mousedown" ) {
     341                                m[ i ]._activate.call( m[ i ], event );
     342                        }
     343
     344                        m[ i ].offset = m[ i ].element.offset();
     345                        m[ i ].proportions( {
     346                                width: m[ i ].element[ 0 ].offsetWidth,
     347                                height: m[ i ].element[ 0 ].offsetHeight
     348                        } );
     349
     350                }
     351
     352        },
     353        drop: function( draggable, event ) {
     354
     355                var dropped = false;
     356
     357                // Create a copy of the droppables in case the list changes during the drop (#9116)
     358                $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
     359
     360                        if ( !this.options ) {
     361                                return;
     362                        }
     363                        if ( !this.options.disabled && this.visible &&
     364                                        intersect( draggable, this, this.options.tolerance, event ) ) {
     365                                dropped = this._drop.call( this, event ) || dropped;
     366                        }
     367
     368                        if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
     369                                        ( draggable.currentItem || draggable.element ) ) ) {
     370                                this.isout = true;
     371                                this.isover = false;
     372                                this._deactivate.call( this, event );
     373                        }
     374
     375                } );
     376                return dropped;
     377
     378        },
     379        dragStart: function( draggable, event ) {
     380
     381                // Listen for scrolling so that if the dragging causes scrolling the position of the
     382                // droppables can be recalculated (see #5003)
     383                draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
     384                        if ( !draggable.options.refreshPositions ) {
     385                                $.ui.ddmanager.prepareOffsets( draggable, event );
     386                        }
     387                } );
     388        },
     389        drag: function( draggable, event ) {
     390
     391                // If you have a highly dynamic page, you might try this option. It renders positions
     392                // every time you move the mouse.
     393                if ( draggable.options.refreshPositions ) {
     394                        $.ui.ddmanager.prepareOffsets( draggable, event );
     395                }
     396
     397                // Run through all droppables and check their positions based on specific tolerance options
     398                $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
     399
     400                        if ( this.options.disabled || this.greedyChild || !this.visible ) {
     401                                return;
     402                        }
     403
     404                        var parentInstance, scope, parent,
     405                                intersects = intersect( draggable, this, this.options.tolerance, event ),
     406                                c = !intersects && this.isover ?
     407                                        "isout" :
     408                                        ( intersects && !this.isover ? "isover" : null );
     409                        if ( !c ) {
     410                                return;
     411                        }
     412
     413                        if ( this.options.greedy ) {
     414
     415                                // find droppable parents with same scope
     416                                scope = this.options.scope;
     417                                parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
     418                                        return $( this ).droppable( "instance" ).options.scope === scope;
     419                                } );
     420
     421                                if ( parent.length ) {
     422                                        parentInstance = $( parent[ 0 ] ).droppable( "instance" );
     423                                        parentInstance.greedyChild = ( c === "isover" );
     424                                }
     425                        }
     426
     427                        // We just moved into a greedy child
     428                        if ( parentInstance && c === "isover" ) {
     429                                parentInstance.isover = false;
     430                                parentInstance.isout = true;
     431                                parentInstance._out.call( parentInstance, event );
     432                        }
     433
     434                        this[ c ] = true;
     435                        this[ c === "isout" ? "isover" : "isout" ] = false;
     436                        this[ c === "isover" ? "_over" : "_out" ].call( this, event );
     437
     438                        // We just moved out of a greedy child
     439                        if ( parentInstance && c === "isout" ) {
     440                                parentInstance.isout = false;
     441                                parentInstance.isover = true;
     442                                parentInstance._over.call( parentInstance, event );
     443                        }
     444                } );
     445
     446        },
     447        dragStop: function( draggable, event ) {
     448                draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
     449
     450                // Call prepareOffsets one final time since IE does not fire return scroll events when
     451                // overflow was caused by drag (see #5003)
     452                if ( !draggable.options.refreshPositions ) {
     453                        $.ui.ddmanager.prepareOffsets( draggable, event );
     454                }
     455        }
     456};
     457
     458// DEPRECATED
     459// TODO: switch return back to widget declaration at top of file when this is removed
     460if ( $.uiBackCompat !== false ) {
     461
     462        // Backcompat for activeClass and hoverClass options
     463        $.widget( "ui.droppable", $.ui.droppable, {
     464                options: {
     465                        hoverClass: false,
     466                        activeClass: false
     467                },
     468                _addActiveClass: function() {
     469                        this._super();
     470                        if ( this.options.activeClass ) {
     471                                this.element.addClass( this.options.activeClass );
     472                        }
     473                },
     474                _removeActiveClass: function() {
     475                        this._super();
     476                        if ( this.options.activeClass ) {
     477                                this.element.removeClass( this.options.activeClass );
     478                        }
     479                },
     480                _addHoverClass: function() {
     481                        this._super();
     482                        if ( this.options.hoverClass ) {
     483                                this.element.addClass( this.options.hoverClass );
     484                        }
     485                },
     486                _removeHoverClass: function() {
     487                        this._super();
     488                        if ( this.options.hoverClass ) {
     489                                this.element.removeClass( this.options.hoverClass );
     490                        }
     491                }
     492        } );
     493}
     494
     495return $.ui.droppable;
     496
     497} ) );
  • src/js/_enqueues/vendor/jquery/ui/effects-all.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/droppable.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*! jQuery UI - v1.12.1 - 2016-09-14
     2* http://jqueryui.com
     3* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
     4* Copyright jQuery Foundation and other contributors; Licensed MIT */
     5
     6(function( factory ) {
     7        if ( typeof define === "function" && define.amd ) {
     8
     9                // AMD. Register as an anonymous module.
     10                define([ "jquery" ], factory );
     11        } else {
     12
     13                // Browser globals
     14                factory( jQuery );
     15        }
     16}(function( $ ) {
     17
     18$.ui = $.ui || {};
     19
     20/*!
     21 * jQuery UI Effects 1.12.1
     22 * http://jqueryui.com
     23 *
     24 * Copyright jQuery Foundation and other contributors
     25 * Released under the MIT license.
     26 * http://jquery.org/license
     27 */
     28
     29//>>label: Effects Core
     30//>>group: Effects
     31// jscs:disable maximumLineLength
     32//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
     33// jscs:enable maximumLineLength
     34//>>docs: http://api.jqueryui.com/category/effects-core/
     35//>>demos: http://jqueryui.com/effect/
     36
     37
     38
     39var dataSpace = "ui-effects-",
     40        dataSpaceStyle = "ui-effects-style",
     41        dataSpaceAnimated = "ui-effects-animated",
     42
     43        // Create a local jQuery because jQuery Color relies on it and the
     44        // global may not exist with AMD and a custom build (#10199)
     45        jQuery = $;
     46
     47$.effects = {
     48        effect: {}
     49};
     50
     51/*!
     52 * jQuery Color Animations v2.1.2
     53 * https://github.com/jquery/jquery-color
     54 *
     55 * Copyright 2014 jQuery Foundation and other contributors
     56 * Released under the MIT license.
     57 * http://jquery.org/license
     58 *
     59 * Date: Wed Jan 16 08:47:09 2013 -0600
     60 */
     61( function( jQuery, undefined ) {
     62
     63        var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
     64                "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
     65
     66        // Plusequals test for += 100 -= 100
     67        rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
     68
     69        // A set of RE's that can match strings and generate color tuples.
     70        stringParsers = [ {
     71                        re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
     72                        parse: function( execResult ) {
     73                                return [
     74                                        execResult[ 1 ],
     75                                        execResult[ 2 ],
     76                                        execResult[ 3 ],
     77                                        execResult[ 4 ]
     78                                ];
     79                        }
     80                }, {
     81                        re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
     82                        parse: function( execResult ) {
     83                                return [
     84                                        execResult[ 1 ] * 2.55,
     85                                        execResult[ 2 ] * 2.55,
     86                                        execResult[ 3 ] * 2.55,
     87                                        execResult[ 4 ]
     88                                ];
     89                        }
     90                }, {
     91
     92                        // This regex ignores A-F because it's compared against an already lowercased string
     93                        re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
     94                        parse: function( execResult ) {
     95                                return [
     96                                        parseInt( execResult[ 1 ], 16 ),
     97                                        parseInt( execResult[ 2 ], 16 ),
     98                                        parseInt( execResult[ 3 ], 16 )
     99                                ];
     100                        }
     101                }, {
     102
     103                        // This regex ignores A-F because it's compared against an already lowercased string
     104                        re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
     105                        parse: function( execResult ) {
     106                                return [
     107                                        parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
     108                                        parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
     109                                        parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
     110                                ];
     111                        }
     112                }, {
     113                        re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
     114                        space: "hsla",
     115                        parse: function( execResult ) {
     116                                return [
     117                                        execResult[ 1 ],
     118                                        execResult[ 2 ] / 100,
     119                                        execResult[ 3 ] / 100,
     120                                        execResult[ 4 ]
     121                                ];
     122                        }
     123                } ],
     124
     125        // JQuery.Color( )
     126        color = jQuery.Color = function( color, green, blue, alpha ) {
     127                return new jQuery.Color.fn.parse( color, green, blue, alpha );
     128        },
     129        spaces = {
     130                rgba: {
     131                        props: {
     132                                red: {
     133                                        idx: 0,
     134                                        type: "byte"
     135                                },
     136                                green: {
     137                                        idx: 1,
     138                                        type: "byte"
     139                                },
     140                                blue: {
     141                                        idx: 2,
     142                                        type: "byte"
     143                                }
     144                        }
     145                },
     146
     147                hsla: {
     148                        props: {
     149                                hue: {
     150                                        idx: 0,
     151                                        type: "degrees"
     152                                },
     153                                saturation: {
     154                                        idx: 1,
     155                                        type: "percent"
     156                                },
     157                                lightness: {
     158                                        idx: 2,
     159                                        type: "percent"
     160                                }
     161                        }
     162                }
     163        },
     164        propTypes = {
     165                "byte": {
     166                        floor: true,
     167                        max: 255
     168                },
     169                "percent": {
     170                        max: 1
     171                },
     172                "degrees": {
     173                        mod: 360,
     174                        floor: true
     175                }
     176        },
     177        support = color.support = {},
     178
     179        // Element for support tests
     180        supportElem = jQuery( "<p>" )[ 0 ],
     181
     182        // Colors = jQuery.Color.names
     183        colors,
     184
     185        // Local aliases of functions called often
     186        each = jQuery.each;
     187
     188// Determine rgba support immediately
     189supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
     190support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
     191
     192// Define cache name and alpha properties
     193// for rgba and hsla spaces
     194each( spaces, function( spaceName, space ) {
     195        space.cache = "_" + spaceName;
     196        space.props.alpha = {
     197                idx: 3,
     198                type: "percent",
     199                def: 1
     200        };
     201} );
     202
     203function clamp( value, prop, allowEmpty ) {
     204        var type = propTypes[ prop.type ] || {};
     205
     206        if ( value == null ) {
     207                return ( allowEmpty || !prop.def ) ? null : prop.def;
     208        }
     209
     210        // ~~ is an short way of doing floor for positive numbers
     211        value = type.floor ? ~~value : parseFloat( value );
     212
     213        // IE will pass in empty strings as value for alpha,
     214        // which will hit this case
     215        if ( isNaN( value ) ) {
     216                return prop.def;
     217        }
     218
     219        if ( type.mod ) {
     220
     221                // We add mod before modding to make sure that negatives values
     222                // get converted properly: -10 -> 350
     223                return ( value + type.mod ) % type.mod;
     224        }
     225
     226        // For now all property types without mod have min and max
     227        return 0 > value ? 0 : type.max < value ? type.max : value;
     228}
     229
     230function stringParse( string ) {
     231        var inst = color(),
     232                rgba = inst._rgba = [];
     233
     234        string = string.toLowerCase();
     235
     236        each( stringParsers, function( i, parser ) {
     237                var parsed,
     238                        match = parser.re.exec( string ),
     239                        values = match && parser.parse( match ),
     240                        spaceName = parser.space || "rgba";
     241
     242                if ( values ) {
     243                        parsed = inst[ spaceName ]( values );
     244
     245                        // If this was an rgba parse the assignment might happen twice
     246                        // oh well....
     247                        inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
     248                        rgba = inst._rgba = parsed._rgba;
     249
     250                        // Exit each( stringParsers ) here because we matched
     251                        return false;
     252                }
     253        } );
     254
     255        // Found a stringParser that handled it
     256        if ( rgba.length ) {
     257
     258                // If this came from a parsed string, force "transparent" when alpha is 0
     259                // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
     260                if ( rgba.join() === "0,0,0,0" ) {
     261                        jQuery.extend( rgba, colors.transparent );
     262                }
     263                return inst;
     264        }
     265
     266        // Named colors
     267        return colors[ string ];
     268}
     269
     270color.fn = jQuery.extend( color.prototype, {
     271        parse: function( red, green, blue, alpha ) {
     272                if ( red === undefined ) {
     273                        this._rgba = [ null, null, null, null ];
     274                        return this;
     275                }
     276                if ( red.jquery || red.nodeType ) {
     277                        red = jQuery( red ).css( green );
     278                        green = undefined;
     279                }
     280
     281                var inst = this,
     282                        type = jQuery.type( red ),
     283                        rgba = this._rgba = [];
     284
     285                // More than 1 argument specified - assume ( red, green, blue, alpha )
     286                if ( green !== undefined ) {
     287                        red = [ red, green, blue, alpha ];
     288                        type = "array";
     289                }
     290
     291                if ( type === "string" ) {
     292                        return this.parse( stringParse( red ) || colors._default );
     293                }
     294
     295                if ( type === "array" ) {
     296                        each( spaces.rgba.props, function( key, prop ) {
     297                                rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
     298                        } );
     299                        return this;
     300                }
     301
     302                if ( type === "object" ) {
     303                        if ( red instanceof color ) {
     304                                each( spaces, function( spaceName, space ) {
     305                                        if ( red[ space.cache ] ) {
     306                                                inst[ space.cache ] = red[ space.cache ].slice();
     307                                        }
     308                                } );
     309                        } else {
     310                                each( spaces, function( spaceName, space ) {
     311                                        var cache = space.cache;
     312                                        each( space.props, function( key, prop ) {
     313
     314                                                // If the cache doesn't exist, and we know how to convert
     315                                                if ( !inst[ cache ] && space.to ) {
     316
     317                                                        // If the value was null, we don't need to copy it
     318                                                        // if the key was alpha, we don't need to copy it either
     319                                                        if ( key === "alpha" || red[ key ] == null ) {
     320                                                                return;
     321                                                        }
     322                                                        inst[ cache ] = space.to( inst._rgba );
     323                                                }
     324
     325                                                // This is the only case where we allow nulls for ALL properties.
     326                                                // call clamp with alwaysAllowEmpty
     327                                                inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
     328                                        } );
     329
     330                                        // Everything defined but alpha?
     331                                        if ( inst[ cache ] &&
     332                                                        jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
     333
     334                                                // Use the default of 1
     335                                                inst[ cache ][ 3 ] = 1;
     336                                                if ( space.from ) {
     337                                                        inst._rgba = space.from( inst[ cache ] );
     338                                                }
     339                                        }
     340                                } );
     341                        }
     342                        return this;
     343                }
     344        },
     345        is: function( compare ) {
     346                var is = color( compare ),
     347                        same = true,
     348                        inst = this;
     349
     350                each( spaces, function( _, space ) {
     351                        var localCache,
     352                                isCache = is[ space.cache ];
     353                        if ( isCache ) {
     354                                localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
     355                                each( space.props, function( _, prop ) {
     356                                        if ( isCache[ prop.idx ] != null ) {
     357                                                same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
     358                                                return same;
     359                                        }
     360                                } );
     361                        }
     362                        return same;
     363                } );
     364                return same;
     365        },
     366        _space: function() {
     367                var used = [],
     368                        inst = this;
     369                each( spaces, function( spaceName, space ) {
     370                        if ( inst[ space.cache ] ) {
     371                                used.push( spaceName );
     372                        }
     373                } );
     374                return used.pop();
     375        },
     376        transition: function( other, distance ) {
     377                var end = color( other ),
     378                        spaceName = end._space(),
     379                        space = spaces[ spaceName ],
     380                        startColor = this.alpha() === 0 ? color( "transparent" ) : this,
     381                        start = startColor[ space.cache ] || space.to( startColor._rgba ),
     382                        result = start.slice();
     383
     384                end = end[ space.cache ];
     385                each( space.props, function( key, prop ) {
     386                        var index = prop.idx,
     387                                startValue = start[ index ],
     388                                endValue = end[ index ],
     389                                type = propTypes[ prop.type ] || {};
     390
     391                        // If null, don't override start value
     392                        if ( endValue === null ) {
     393                                return;
     394                        }
     395
     396                        // If null - use end
     397                        if ( startValue === null ) {
     398                                result[ index ] = endValue;
     399                        } else {
     400                                if ( type.mod ) {
     401                                        if ( endValue - startValue > type.mod / 2 ) {
     402                                                startValue += type.mod;
     403                                        } else if ( startValue - endValue > type.mod / 2 ) {
     404                                                startValue -= type.mod;
     405                                        }
     406                                }
     407                                result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
     408                        }
     409                } );
     410                return this[ spaceName ]( result );
     411        },
     412        blend: function( opaque ) {
     413
     414                // If we are already opaque - return ourself
     415                if ( this._rgba[ 3 ] === 1 ) {
     416                        return this;
     417                }
     418
     419                var rgb = this._rgba.slice(),
     420                        a = rgb.pop(),
     421                        blend = color( opaque )._rgba;
     422
     423                return color( jQuery.map( rgb, function( v, i ) {
     424                        return ( 1 - a ) * blend[ i ] + a * v;
     425                } ) );
     426        },
     427        toRgbaString: function() {
     428                var prefix = "rgba(",
     429                        rgba = jQuery.map( this._rgba, function( v, i ) {
     430                                return v == null ? ( i > 2 ? 1 : 0 ) : v;
     431                        } );
     432
     433                if ( rgba[ 3 ] === 1 ) {
     434                        rgba.pop();
     435                        prefix = "rgb(";
     436                }
     437
     438                return prefix + rgba.join() + ")";
     439        },
     440        toHslaString: function() {
     441                var prefix = "hsla(",
     442                        hsla = jQuery.map( this.hsla(), function( v, i ) {
     443                                if ( v == null ) {
     444                                        v = i > 2 ? 1 : 0;
     445                                }
     446
     447                                // Catch 1 and 2
     448                                if ( i && i < 3 ) {
     449                                        v = Math.round( v * 100 ) + "%";
     450                                }
     451                                return v;
     452                        } );
     453
     454                if ( hsla[ 3 ] === 1 ) {
     455                        hsla.pop();
     456                        prefix = "hsl(";
     457                }
     458                return prefix + hsla.join() + ")";
     459        },
     460        toHexString: function( includeAlpha ) {
     461                var rgba = this._rgba.slice(),
     462                        alpha = rgba.pop();
     463
     464                if ( includeAlpha ) {
     465                        rgba.push( ~~( alpha * 255 ) );
     466                }
     467
     468                return "#" + jQuery.map( rgba, function( v ) {
     469
     470                        // Default to 0 when nulls exist
     471                        v = ( v || 0 ).toString( 16 );
     472                        return v.length === 1 ? "0" + v : v;
     473                } ).join( "" );
     474        },
     475        toString: function() {
     476                return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
     477        }
     478} );
     479color.fn.parse.prototype = color.fn;
     480
     481// Hsla conversions adapted from:
     482// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
     483
     484function hue2rgb( p, q, h ) {
     485        h = ( h + 1 ) % 1;
     486        if ( h * 6 < 1 ) {
     487                return p + ( q - p ) * h * 6;
     488        }
     489        if ( h * 2 < 1 ) {
     490                return q;
     491        }
     492        if ( h * 3 < 2 ) {
     493                return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
     494        }
     495        return p;
     496}
     497
     498spaces.hsla.to = function( rgba ) {
     499        if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
     500                return [ null, null, null, rgba[ 3 ] ];
     501        }
     502        var r = rgba[ 0 ] / 255,
     503                g = rgba[ 1 ] / 255,
     504                b = rgba[ 2 ] / 255,
     505                a = rgba[ 3 ],
     506                max = Math.max( r, g, b ),
     507                min = Math.min( r, g, b ),
     508                diff = max - min,
     509                add = max + min,
     510                l = add * 0.5,
     511                h, s;
     512
     513        if ( min === max ) {
     514                h = 0;
     515        } else if ( r === max ) {
     516                h = ( 60 * ( g - b ) / diff ) + 360;
     517        } else if ( g === max ) {
     518                h = ( 60 * ( b - r ) / diff ) + 120;
     519        } else {
     520                h = ( 60 * ( r - g ) / diff ) + 240;
     521        }
     522
     523        // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
     524        // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
     525        if ( diff === 0 ) {
     526                s = 0;
     527        } else if ( l <= 0.5 ) {
     528                s = diff / add;
     529        } else {
     530                s = diff / ( 2 - add );
     531        }
     532        return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
     533};
     534
     535spaces.hsla.from = function( hsla ) {
     536        if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
     537                return [ null, null, null, hsla[ 3 ] ];
     538        }
     539        var h = hsla[ 0 ] / 360,
     540                s = hsla[ 1 ],
     541                l = hsla[ 2 ],
     542                a = hsla[ 3 ],
     543                q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
     544                p = 2 * l - q;
     545
     546        return [
     547                Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
     548                Math.round( hue2rgb( p, q, h ) * 255 ),
     549                Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
     550                a
     551        ];
     552};
     553
     554each( spaces, function( spaceName, space ) {
     555        var props = space.props,
     556                cache = space.cache,
     557                to = space.to,
     558                from = space.from;
     559
     560        // Makes rgba() and hsla()
     561        color.fn[ spaceName ] = function( value ) {
     562
     563                // Generate a cache for this space if it doesn't exist
     564                if ( to && !this[ cache ] ) {
     565                        this[ cache ] = to( this._rgba );
     566                }
     567                if ( value === undefined ) {
     568                        return this[ cache ].slice();
     569                }
     570
     571                var ret,
     572                        type = jQuery.type( value ),
     573                        arr = ( type === "array" || type === "object" ) ? value : arguments,
     574                        local = this[ cache ].slice();
     575
     576                each( props, function( key, prop ) {
     577                        var val = arr[ type === "object" ? key : prop.idx ];
     578                        if ( val == null ) {
     579                                val = local[ prop.idx ];
     580                        }
     581                        local[ prop.idx ] = clamp( val, prop );
     582                } );
     583
     584                if ( from ) {
     585                        ret = color( from( local ) );
     586                        ret[ cache ] = local;
     587                        return ret;
     588                } else {
     589                        return color( local );
     590                }
     591        };
     592
     593        // Makes red() green() blue() alpha() hue() saturation() lightness()
     594        each( props, function( key, prop ) {
     595
     596                // Alpha is included in more than one space
     597                if ( color.fn[ key ] ) {
     598                        return;
     599                }
     600                color.fn[ key ] = function( value ) {
     601                        var vtype = jQuery.type( value ),
     602                                fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
     603                                local = this[ fn ](),
     604                                cur = local[ prop.idx ],
     605                                match;
     606
     607                        if ( vtype === "undefined" ) {
     608                                return cur;
     609                        }
     610
     611                        if ( vtype === "function" ) {
     612                                value = value.call( this, cur );
     613                                vtype = jQuery.type( value );
     614                        }
     615                        if ( value == null && prop.empty ) {
     616                                return this;
     617                        }
     618                        if ( vtype === "string" ) {
     619                                match = rplusequals.exec( value );
     620                                if ( match ) {
     621                                        value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
     622                                }
     623                        }
     624                        local[ prop.idx ] = value;
     625                        return this[ fn ]( local );
     626                };
     627        } );
     628} );
     629
     630// Add cssHook and .fx.step function for each named hook.
     631// accept a space separated string of properties
     632color.hook = function( hook ) {
     633        var hooks = hook.split( " " );
     634        each( hooks, function( i, hook ) {
     635                jQuery.cssHooks[ hook ] = {
     636                        set: function( elem, value ) {
     637                                var parsed, curElem,
     638                                        backgroundColor = "";
     639
     640                                if ( value !== "transparent" && ( jQuery.type( value ) !== "string" ||
     641                                                ( parsed = stringParse( value ) ) ) ) {
     642                                        value = color( parsed || value );
     643                                        if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
     644                                                curElem = hook === "backgroundColor" ? elem.parentNode : elem;
     645                                                while (
     646                                                        ( backgroundColor === "" || backgroundColor === "transparent" ) &&
     647                                                        curElem && curElem.style
     648                                                ) {
     649                                                        try {
     650                                                                backgroundColor = jQuery.css( curElem, "backgroundColor" );
     651                                                                curElem = curElem.parentNode;
     652                                                        } catch ( e ) {
     653                                                        }
     654                                                }
     655
     656                                                value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
     657                                                        backgroundColor :
     658                                                        "_default" );
     659                                        }
     660
     661                                        value = value.toRgbaString();
     662                                }
     663                                try {
     664                                        elem.style[ hook ] = value;
     665                                } catch ( e ) {
     666
     667                                        // Wrapped to prevent IE from throwing errors on "invalid" values like
     668                                        // 'auto' or 'inherit'
     669                                }
     670                        }
     671                };
     672                jQuery.fx.step[ hook ] = function( fx ) {
     673                        if ( !fx.colorInit ) {
     674                                fx.start = color( fx.elem, hook );
     675                                fx.end = color( fx.end );
     676                                fx.colorInit = true;
     677                        }
     678                        jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
     679                };
     680        } );
     681
     682};
     683
     684color.hook( stepHooks );
     685
     686jQuery.cssHooks.borderColor = {
     687        expand: function( value ) {
     688                var expanded = {};
     689
     690                each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
     691                        expanded[ "border" + part + "Color" ] = value;
     692                } );
     693                return expanded;
     694        }
     695};
     696
     697// Basic color names only.
     698// Usage of any of the other color names requires adding yourself or including
     699// jquery.color.svg-names.js.
     700colors = jQuery.Color.names = {
     701
     702        // 4.1. Basic color keywords
     703        aqua: "#00ffff",
     704        black: "#000000",
     705        blue: "#0000ff",
     706        fuchsia: "#ff00ff",
     707        gray: "#808080",
     708        green: "#008000",
     709        lime: "#00ff00",
     710        maroon: "#800000",
     711        navy: "#000080",
     712        olive: "#808000",
     713        purple: "#800080",
     714        red: "#ff0000",
     715        silver: "#c0c0c0",
     716        teal: "#008080",
     717        white: "#ffffff",
     718        yellow: "#ffff00",
     719
     720        // 4.2.3. "transparent" color keyword
     721        transparent: [ null, null, null, 0 ],
     722
     723        _default: "#ffffff"
     724};
     725
     726} )( jQuery );
     727
     728/******************************************************************************/
     729/****************************** CLASS ANIMATIONS ******************************/
     730/******************************************************************************/
     731( function() {
     732
     733var classAnimationActions = [ "add", "remove", "toggle" ],
     734        shorthandStyles = {
     735                border: 1,
     736                borderBottom: 1,
     737                borderColor: 1,
     738                borderLeft: 1,
     739                borderRight: 1,
     740                borderTop: 1,
     741                borderWidth: 1,
     742                margin: 1,
     743                padding: 1
     744        };
     745
     746$.each(
     747        [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
     748        function( _, prop ) {
     749                $.fx.step[ prop ] = function( fx ) {
     750                        if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
     751                                jQuery.style( fx.elem, prop, fx.end );
     752                                fx.setAttr = true;
     753                        }
     754                };
     755        }
     756);
     757
     758function getElementStyles( elem ) {
     759        var key, len,
     760                style = elem.ownerDocument.defaultView ?
     761                        elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
     762                        elem.currentStyle,
     763                styles = {};
     764
     765        if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
     766                len = style.length;
     767                while ( len-- ) {
     768                        key = style[ len ];
     769                        if ( typeof style[ key ] === "string" ) {
     770                                styles[ $.camelCase( key ) ] = style[ key ];
     771                        }
     772                }
     773
     774        // Support: Opera, IE <9
     775        } else {
     776                for ( key in style ) {
     777                        if ( typeof style[ key ] === "string" ) {
     778                                styles[ key ] = style[ key ];
     779                        }
     780                }
     781        }
     782
     783        return styles;
     784}
     785
     786function styleDifference( oldStyle, newStyle ) {
     787        var diff = {},
     788                name, value;
     789
     790        for ( name in newStyle ) {
     791                value = newStyle[ name ];
     792                if ( oldStyle[ name ] !== value ) {
     793                        if ( !shorthandStyles[ name ] ) {
     794                                if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
     795                                        diff[ name ] = value;
     796                                }
     797                        }
     798                }
     799        }
     800
     801        return diff;
     802}
     803
     804// Support: jQuery <1.8
     805if ( !$.fn.addBack ) {
     806        $.fn.addBack = function( selector ) {
     807                return this.add( selector == null ?
     808                        this.prevObject : this.prevObject.filter( selector )
     809                );
     810        };
     811}
     812
     813$.effects.animateClass = function( value, duration, easing, callback ) {
     814        var o = $.speed( duration, easing, callback );
     815
     816        return this.queue( function() {
     817                var animated = $( this ),
     818                        baseClass = animated.attr( "class" ) || "",
     819                        applyClassChange,
     820                        allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
     821
     822                // Map the animated objects to store the original styles.
     823                allAnimations = allAnimations.map( function() {
     824                        var el = $( this );
     825                        return {
     826                                el: el,
     827                                start: getElementStyles( this )
     828                        };
     829                } );
     830
     831                // Apply class change
     832                applyClassChange = function() {
     833                        $.each( classAnimationActions, function( i, action ) {
     834                                if ( value[ action ] ) {
     835                                        animated[ action + "Class" ]( value[ action ] );
     836                                }
     837                        } );
     838                };
     839                applyClassChange();
     840
     841                // Map all animated objects again - calculate new styles and diff
     842                allAnimations = allAnimations.map( function() {
     843                        this.end = getElementStyles( this.el[ 0 ] );
     844                        this.diff = styleDifference( this.start, this.end );
     845                        return this;
     846                } );
     847
     848                // Apply original class
     849                animated.attr( "class", baseClass );
     850
     851                // Map all animated objects again - this time collecting a promise
     852                allAnimations = allAnimations.map( function() {
     853                        var styleInfo = this,
     854                                dfd = $.Deferred(),
     855                                opts = $.extend( {}, o, {
     856                                        queue: false,
     857                                        complete: function() {
     858                                                dfd.resolve( styleInfo );
     859                                        }
     860                                } );
     861
     862                        this.el.animate( this.diff, opts );
     863                        return dfd.promise();
     864                } );
     865
     866                // Once all animations have completed:
     867                $.when.apply( $, allAnimations.get() ).done( function() {
     868
     869                        // Set the final class
     870                        applyClassChange();
     871
     872                        // For each animated element,
     873                        // clear all css properties that were animated
     874                        $.each( arguments, function() {
     875                                var el = this.el;
     876                                $.each( this.diff, function( key ) {
     877                                        el.css( key, "" );
     878                                } );
     879                        } );
     880
     881                        // This is guarnteed to be there if you use jQuery.speed()
     882                        // it also handles dequeuing the next anim...
     883                        o.complete.call( animated[ 0 ] );
     884                } );
     885        } );
     886};
     887
     888$.fn.extend( {
     889        addClass: ( function( orig ) {
     890                return function( classNames, speed, easing, callback ) {
     891                        return speed ?
     892                                $.effects.animateClass.call( this,
     893                                        { add: classNames }, speed, easing, callback ) :
     894                                orig.apply( this, arguments );
     895                };
     896        } )( $.fn.addClass ),
     897
     898        removeClass: ( function( orig ) {
     899                return function( classNames, speed, easing, callback ) {
     900                        return arguments.length > 1 ?
     901                                $.effects.animateClass.call( this,
     902                                        { remove: classNames }, speed, easing, callback ) :
     903                                orig.apply( this, arguments );
     904                };
     905        } )( $.fn.removeClass ),
     906
     907        toggleClass: ( function( orig ) {
     908                return function( classNames, force, speed, easing, callback ) {
     909                        if ( typeof force === "boolean" || force === undefined ) {
     910                                if ( !speed ) {
     911
     912                                        // Without speed parameter
     913                                        return orig.apply( this, arguments );
     914                                } else {
     915                                        return $.effects.animateClass.call( this,
     916                                                ( force ? { add: classNames } : { remove: classNames } ),
     917                                                speed, easing, callback );
     918                                }
     919                        } else {
     920
     921                                // Without force parameter
     922                                return $.effects.animateClass.call( this,
     923                                        { toggle: classNames }, force, speed, easing );
     924                        }
     925                };
     926        } )( $.fn.toggleClass ),
     927
     928        switchClass: function( remove, add, speed, easing, callback ) {
     929                return $.effects.animateClass.call( this, {
     930                        add: add,
     931                        remove: remove
     932                }, speed, easing, callback );
     933        }
     934} );
     935
     936} )();
     937
     938/******************************************************************************/
     939/*********************************** EFFECTS **********************************/
     940/******************************************************************************/
     941
     942( function() {
     943
     944if ( $.expr && $.expr.filters && $.expr.filters.animated ) {
     945        $.expr.filters.animated = ( function( orig ) {
     946                return function( elem ) {
     947                        return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
     948                };
     949        } )( $.expr.filters.animated );
     950}
     951
     952if ( $.uiBackCompat !== false ) {
     953        $.extend( $.effects, {
     954
     955                // Saves a set of properties in a data storage
     956                save: function( element, set ) {
     957                        var i = 0, length = set.length;
     958                        for ( ; i < length; i++ ) {
     959                                if ( set[ i ] !== null ) {
     960                                        element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
     961                                }
     962                        }
     963                },
     964
     965                // Restores a set of previously saved properties from a data storage
     966                restore: function( element, set ) {
     967                        var val, i = 0, length = set.length;
     968                        for ( ; i < length; i++ ) {
     969                                if ( set[ i ] !== null ) {
     970                                        val = element.data( dataSpace + set[ i ] );
     971                                        element.css( set[ i ], val );
     972                                }
     973                        }
     974                },
     975
     976                setMode: function( el, mode ) {
     977                        if ( mode === "toggle" ) {
     978                                mode = el.is( ":hidden" ) ? "show" : "hide";
     979                        }
     980                        return mode;
     981                },
     982
     983                // Wraps the element around a wrapper that copies position properties
     984                createWrapper: function( element ) {
     985
     986                        // If the element is already wrapped, return it
     987                        if ( element.parent().is( ".ui-effects-wrapper" ) ) {
     988                                return element.parent();
     989                        }
     990
     991                        // Wrap the element
     992                        var props = {
     993                                        width: element.outerWidth( true ),
     994                                        height: element.outerHeight( true ),
     995                                        "float": element.css( "float" )
     996                                },
     997                                wrapper = $( "<div></div>" )
     998                                        .addClass( "ui-effects-wrapper" )
     999                                        .css( {
     1000                                                fontSize: "100%",
     1001                                                background: "transparent",
     1002                                                border: "none",
     1003                                                margin: 0,
     1004                                                padding: 0
     1005                                        } ),
     1006
     1007                                // Store the size in case width/height are defined in % - Fixes #5245
     1008                                size = {
     1009                                        width: element.width(),
     1010                                        height: element.height()
     1011                                },
     1012                                active = document.activeElement;
     1013
     1014                        // Support: Firefox
     1015                        // Firefox incorrectly exposes anonymous content
     1016                        // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
     1017                        try {
     1018                                active.id;
     1019                        } catch ( e ) {
     1020                                active = document.body;
     1021                        }
     1022
     1023                        element.wrap( wrapper );
     1024
     1025                        // Fixes #7595 - Elements lose focus when wrapped.
     1026                        if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
     1027                                $( active ).trigger( "focus" );
     1028                        }
     1029
     1030                        // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
     1031                        // lose the reference to the wrapped element
     1032                        wrapper = element.parent();
     1033
     1034                        // Transfer positioning properties to the wrapper
     1035                        if ( element.css( "position" ) === "static" ) {
     1036                                wrapper.css( { position: "relative" } );
     1037                                element.css( { position: "relative" } );
     1038                        } else {
     1039                                $.extend( props, {
     1040                                        position: element.css( "position" ),
     1041                                        zIndex: element.css( "z-index" )
     1042                                } );
     1043                                $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
     1044                                        props[ pos ] = element.css( pos );
     1045                                        if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
     1046                                                props[ pos ] = "auto";
     1047                                        }
     1048                                } );
     1049                                element.css( {
     1050                                        position: "relative",
     1051                                        top: 0,
     1052                                        left: 0,
     1053                                        right: "auto",
     1054                                        bottom: "auto"
     1055                                } );
     1056                        }
     1057                        element.css( size );
     1058
     1059                        return wrapper.css( props ).show();
     1060                },
     1061
     1062                removeWrapper: function( element ) {
     1063                        var active = document.activeElement;
     1064
     1065                        if ( element.parent().is( ".ui-effects-wrapper" ) ) {
     1066                                element.parent().replaceWith( element );
     1067
     1068                                // Fixes #7595 - Elements lose focus when wrapped.
     1069                                if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
     1070                                        $( active ).trigger( "focus" );
     1071                                }
     1072                        }
     1073
     1074                        return element;
     1075                }
     1076        } );
     1077}
     1078
     1079$.extend( $.effects, {
     1080        version: "1.12.1",
     1081
     1082        define: function( name, mode, effect ) {
     1083                if ( !effect ) {
     1084                        effect = mode;
     1085                        mode = "effect";
     1086                }
     1087
     1088                $.effects.effect[ name ] = effect;
     1089                $.effects.effect[ name ].mode = mode;
     1090
     1091                return effect;
     1092        },
     1093
     1094        scaledDimensions: function( element, percent, direction ) {
     1095                if ( percent === 0 ) {
     1096                        return {
     1097                                height: 0,
     1098                                width: 0,
     1099                                outerHeight: 0,
     1100                                outerWidth: 0
     1101                        };
     1102                }
     1103
     1104                var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
     1105                        y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
     1106
     1107                return {
     1108                        height: element.height() * y,
     1109                        width: element.width() * x,
     1110                        outerHeight: element.outerHeight() * y,
     1111                        outerWidth: element.outerWidth() * x
     1112                };
     1113
     1114        },
     1115
     1116        clipToBox: function( animation ) {
     1117                return {
     1118                        width: animation.clip.right - animation.clip.left,
     1119                        height: animation.clip.bottom - animation.clip.top,
     1120                        left: animation.clip.left,
     1121                        top: animation.clip.top
     1122                };
     1123        },
     1124
     1125        // Injects recently queued functions to be first in line (after "inprogress")
     1126        unshift: function( element, queueLength, count ) {
     1127                var queue = element.queue();
     1128
     1129                if ( queueLength > 1 ) {
     1130                        queue.splice.apply( queue,
     1131                                [ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
     1132                }
     1133                element.dequeue();
     1134        },
     1135
     1136        saveStyle: function( element ) {
     1137                element.data( dataSpaceStyle, element[ 0 ].style.cssText );
     1138        },
     1139
     1140        restoreStyle: function( element ) {
     1141                element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
     1142                element.removeData( dataSpaceStyle );
     1143        },
     1144
     1145        mode: function( element, mode ) {
     1146                var hidden = element.is( ":hidden" );
     1147
     1148                if ( mode === "toggle" ) {
     1149                        mode = hidden ? "show" : "hide";
     1150                }
     1151                if ( hidden ? mode === "hide" : mode === "show" ) {
     1152                        mode = "none";
     1153                }
     1154                return mode;
     1155        },
     1156
     1157        // Translates a [top,left] array into a baseline value
     1158        getBaseline: function( origin, original ) {
     1159                var y, x;
     1160
     1161                switch ( origin[ 0 ] ) {
     1162                case "top":
     1163                        y = 0;
     1164                        break;
     1165                case "middle":
     1166                        y = 0.5;
     1167                        break;
     1168                case "bottom":
     1169                        y = 1;
     1170                        break;
     1171                default:
     1172                        y = origin[ 0 ] / original.height;
     1173                }
     1174
     1175                switch ( origin[ 1 ] ) {
     1176                case "left":
     1177                        x = 0;
     1178                        break;
     1179                case "center":
     1180                        x = 0.5;
     1181                        break;
     1182                case "right":
     1183                        x = 1;
     1184                        break;
     1185                default:
     1186                        x = origin[ 1 ] / original.width;
     1187                }
     1188
     1189                return {
     1190                        x: x,
     1191                        y: y
     1192                };
     1193        },
     1194
     1195        // Creates a placeholder element so that the original element can be made absolute
     1196        createPlaceholder: function( element ) {
     1197                var placeholder,
     1198                        cssPosition = element.css( "position" ),
     1199                        position = element.position();
     1200
     1201                // Lock in margins first to account for form elements, which
     1202                // will change margin if you explicitly set height
     1203                // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
     1204                // Support: Safari
     1205                element.css( {
     1206                        marginTop: element.css( "marginTop" ),
     1207                        marginBottom: element.css( "marginBottom" ),
     1208                        marginLeft: element.css( "marginLeft" ),
     1209                        marginRight: element.css( "marginRight" )
     1210                } )
     1211                .outerWidth( element.outerWidth() )
     1212                .outerHeight( element.outerHeight() );
     1213
     1214                if ( /^(static|relative)/.test( cssPosition ) ) {
     1215                        cssPosition = "absolute";
     1216
     1217                        placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
     1218
     1219                                // Convert inline to inline block to account for inline elements
     1220                                // that turn to inline block based on content (like img)
     1221                                display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
     1222                                        "inline-block" :
     1223                                        "block",
     1224                                visibility: "hidden",
     1225
     1226                                // Margins need to be set to account for margin collapse
     1227                                marginTop: element.css( "marginTop" ),
     1228                                marginBottom: element.css( "marginBottom" ),
     1229                                marginLeft: element.css( "marginLeft" ),
     1230                                marginRight: element.css( "marginRight" ),
     1231                                "float": element.css( "float" )
     1232                        } )
     1233                        .outerWidth( element.outerWidth() )
     1234                        .outerHeight( element.outerHeight() )
     1235                        .addClass( "ui-effects-placeholder" );
     1236
     1237                        element.data( dataSpace + "placeholder", placeholder );
     1238                }
     1239
     1240                element.css( {
     1241                        position: cssPosition,
     1242                        left: position.left,
     1243                        top: position.top
     1244                } );
     1245
     1246                return placeholder;
     1247        },
     1248
     1249        removePlaceholder: function( element ) {
     1250                var dataKey = dataSpace + "placeholder",
     1251                                placeholder = element.data( dataKey );
     1252
     1253                if ( placeholder ) {
     1254                        placeholder.remove();
     1255                        element.removeData( dataKey );
     1256                }
     1257        },
     1258
     1259        // Removes a placeholder if it exists and restores
     1260        // properties that were modified during placeholder creation
     1261        cleanUp: function( element ) {
     1262                $.effects.restoreStyle( element );
     1263                $.effects.removePlaceholder( element );
     1264        },
     1265
     1266        setTransition: function( element, list, factor, value ) {
     1267                value = value || {};
     1268                $.each( list, function( i, x ) {
     1269                        var unit = element.cssUnit( x );
     1270                        if ( unit[ 0 ] > 0 ) {
     1271                                value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
     1272                        }
     1273                } );
     1274                return value;
     1275        }
     1276} );
     1277
     1278// Return an effect options object for the given parameters:
     1279function _normalizeArguments( effect, options, speed, callback ) {
     1280
     1281        // Allow passing all options as the first parameter
     1282        if ( $.isPlainObject( effect ) ) {
     1283                options = effect;
     1284                effect = effect.effect;
     1285        }
     1286
     1287        // Convert to an object
     1288        effect = { effect: effect };
     1289
     1290        // Catch (effect, null, ...)
     1291        if ( options == null ) {
     1292                options = {};
     1293        }
     1294
     1295        // Catch (effect, callback)
     1296        if ( $.isFunction( options ) ) {
     1297                callback = options;
     1298                speed = null;
     1299                options = {};
     1300        }
     1301
     1302        // Catch (effect, speed, ?)
     1303        if ( typeof options === "number" || $.fx.speeds[ options ] ) {
     1304                callback = speed;
     1305                speed = options;
     1306                options = {};
     1307        }
     1308
     1309        // Catch (effect, options, callback)
     1310        if ( $.isFunction( speed ) ) {
     1311                callback = speed;
     1312                speed = null;
     1313        }
     1314
     1315        // Add options to effect
     1316        if ( options ) {
     1317                $.extend( effect, options );
     1318        }
     1319
     1320        speed = speed || options.duration;
     1321        effect.duration = $.fx.off ? 0 :
     1322                typeof speed === "number" ? speed :
     1323                speed in $.fx.speeds ? $.fx.speeds[ speed ] :
     1324                $.fx.speeds._default;
     1325
     1326        effect.complete = callback || options.complete;
     1327
     1328        return effect;
     1329}
     1330
     1331function standardAnimationOption( option ) {
     1332
     1333        // Valid standard speeds (nothing, number, named speed)
     1334        if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
     1335                return true;
     1336        }
     1337
     1338        // Invalid strings - treat as "normal" speed
     1339        if ( typeof option === "string" && !$.effects.effect[ option ] ) {
     1340                return true;
     1341        }
     1342
     1343        // Complete callback
     1344        if ( $.isFunction( option ) ) {
     1345                return true;
     1346        }
     1347
     1348        // Options hash (but not naming an effect)
     1349        if ( typeof option === "object" && !option.effect ) {
     1350                return true;
     1351        }
     1352
     1353        // Didn't match any standard API
     1354        return false;
     1355}
     1356
     1357$.fn.extend( {
     1358        effect: function( /* effect, options, speed, callback */ ) {
     1359                var args = _normalizeArguments.apply( this, arguments ),
     1360                        effectMethod = $.effects.effect[ args.effect ],
     1361                        defaultMode = effectMethod.mode,
     1362                        queue = args.queue,
     1363                        queueName = queue || "fx",
     1364                        complete = args.complete,
     1365                        mode = args.mode,
     1366                        modes = [],
     1367                        prefilter = function( next ) {
     1368                                var el = $( this ),
     1369                                        normalizedMode = $.effects.mode( el, mode ) || defaultMode;
     1370
     1371                                // Sentinel for duck-punching the :animated psuedo-selector
     1372                                el.data( dataSpaceAnimated, true );
     1373
     1374                                // Save effect mode for later use,
     1375                                // we can't just call $.effects.mode again later,
     1376                                // as the .show() below destroys the initial state
     1377                                modes.push( normalizedMode );
     1378
     1379                                // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13
     1380                                if ( defaultMode && ( normalizedMode === "show" ||
     1381                                                ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
     1382                                        el.show();
     1383                                }
     1384
     1385                                if ( !defaultMode || normalizedMode !== "none" ) {
     1386                                        $.effects.saveStyle( el );
     1387                                }
     1388
     1389                                if ( $.isFunction( next ) ) {
     1390                                        next();
     1391                                }
     1392                        };
     1393
     1394                if ( $.fx.off || !effectMethod ) {
     1395
     1396                        // Delegate to the original method (e.g., .show()) if possible
     1397                        if ( mode ) {
     1398                                return this[ mode ]( args.duration, complete );
     1399                        } else {
     1400                                return this.each( function() {
     1401                                        if ( complete ) {
     1402                                                complete.call( this );
     1403                                        }
     1404                                } );
     1405                        }
     1406                }
     1407
     1408                function run( next ) {
     1409                        var elem = $( this );
     1410
     1411                        function cleanup() {
     1412                                elem.removeData( dataSpaceAnimated );
     1413
     1414                                $.effects.cleanUp( elem );
     1415
     1416                                if ( args.mode === "hide" ) {
     1417                                        elem.hide();
     1418                                }
     1419
     1420                                done();
     1421                        }
     1422
     1423                        function done() {
     1424                                if ( $.isFunction( complete ) ) {
     1425                                        complete.call( elem[ 0 ] );
     1426                                }
     1427
     1428                                if ( $.isFunction( next ) ) {
     1429                                        next();
     1430                                }
     1431                        }
     1432
     1433                        // Override mode option on a per element basis,
     1434                        // as toggle can be either show or hide depending on element state
     1435                        args.mode = modes.shift();
     1436
     1437                        if ( $.uiBackCompat !== false && !defaultMode ) {
     1438                                if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
     1439
     1440                                        // Call the core method to track "olddisplay" properly
     1441                                        elem[ mode ]();
     1442                                        done();
     1443                                } else {
     1444                                        effectMethod.call( elem[ 0 ], args, done );
     1445                                }
     1446                        } else {
     1447                                if ( args.mode === "none" ) {
     1448
     1449                                        // Call the core method to track "olddisplay" properly
     1450                                        elem[ mode ]();
     1451                                        done();
     1452                                } else {
     1453                                        effectMethod.call( elem[ 0 ], args, cleanup );
     1454                                }
     1455                        }
     1456                }
     1457
     1458                // Run prefilter on all elements first to ensure that
     1459                // any showing or hiding happens before placeholder creation,
     1460                // which ensures that any layout changes are correctly captured.
     1461                return queue === false ?
     1462                        this.each( prefilter ).each( run ) :
     1463                        this.queue( queueName, prefilter ).queue( queueName, run );
     1464        },
     1465
     1466        show: ( function( orig ) {
     1467                return function( option ) {
     1468                        if ( standardAnimationOption( option ) ) {
     1469                                return orig.apply( this, arguments );
     1470                        } else {
     1471                                var args = _normalizeArguments.apply( this, arguments );
     1472                                args.mode = "show";
     1473                                return this.effect.call( this, args );
     1474                        }
     1475                };
     1476        } )( $.fn.show ),
     1477
     1478        hide: ( function( orig ) {
     1479                return function( option ) {
     1480                        if ( standardAnimationOption( option ) ) {
     1481                                return orig.apply( this, arguments );
     1482                        } else {
     1483                                var args = _normalizeArguments.apply( this, arguments );
     1484                                args.mode = "hide";
     1485                                return this.effect.call( this, args );
     1486                        }
     1487                };
     1488        } )( $.fn.hide ),
     1489
     1490        toggle: ( function( orig ) {
     1491                return function( option ) {
     1492                        if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
     1493                                return orig.apply( this, arguments );
     1494                        } else {
     1495                                var args = _normalizeArguments.apply( this, arguments );
     1496                                args.mode = "toggle";
     1497                                return this.effect.call( this, args );
     1498                        }
     1499                };
     1500        } )( $.fn.toggle ),
     1501
     1502        cssUnit: function( key ) {
     1503                var style = this.css( key ),
     1504                        val = [];
     1505
     1506                $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
     1507                        if ( style.indexOf( unit ) > 0 ) {
     1508                                val = [ parseFloat( style ), unit ];
     1509                        }
     1510                } );
     1511                return val;
     1512        },
     1513
     1514        cssClip: function( clipObj ) {
     1515                if ( clipObj ) {
     1516                        return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
     1517                                clipObj.bottom + "px " + clipObj.left + "px)" );
     1518                }
     1519                return parseClip( this.css( "clip" ), this );
     1520        },
     1521
     1522        transfer: function( options, done ) {
     1523                var element = $( this ),
     1524                        target = $( options.to ),
     1525                        targetFixed = target.css( "position" ) === "fixed",
     1526                        body = $( "body" ),
     1527                        fixTop = targetFixed ? body.scrollTop() : 0,
     1528                        fixLeft = targetFixed ? body.scrollLeft() : 0,
     1529                        endPosition = target.offset(),
     1530                        animation = {
     1531                                top: endPosition.top - fixTop,
     1532                                left: endPosition.left - fixLeft,
     1533                                height: target.innerHeight(),
     1534                                width: target.innerWidth()
     1535                        },
     1536                        startPosition = element.offset(),
     1537                        transfer = $( "<div class='ui-effects-transfer'></div>" )
     1538                                .appendTo( "body" )
     1539                                .addClass( options.className )
     1540                                .css( {
     1541                                        top: startPosition.top - fixTop,
     1542                                        left: startPosition.left - fixLeft,
     1543                                        height: element.innerHeight(),
     1544                                        width: element.innerWidth(),
     1545                                        position: targetFixed ? "fixed" : "absolute"
     1546                                } )
     1547                                .animate( animation, options.duration, options.easing, function() {
     1548                                        transfer.remove();
     1549                                        if ( $.isFunction( done ) ) {
     1550                                                done();
     1551                                        }
     1552                                } );
     1553        }
     1554} );
     1555
     1556function parseClip( str, element ) {
     1557                var outerWidth = element.outerWidth(),
     1558                        outerHeight = element.outerHeight(),
     1559                        clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
     1560                        values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
     1561
     1562                return {
     1563                        top: parseFloat( values[ 1 ] ) || 0,
     1564                        right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
     1565                        bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
     1566                        left: parseFloat( values[ 4 ] ) || 0
     1567                };
     1568}
     1569
     1570$.fx.step.clip = function( fx ) {
     1571        if ( !fx.clipInit ) {
     1572                fx.start = $( fx.elem ).cssClip();
     1573                if ( typeof fx.end === "string" ) {
     1574                        fx.end = parseClip( fx.end, fx.elem );
     1575                }
     1576                fx.clipInit = true;
     1577        }
     1578
     1579        $( fx.elem ).cssClip( {
     1580                top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
     1581                right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
     1582                bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
     1583                left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
     1584        } );
     1585};
     1586
     1587} )();
     1588
     1589/******************************************************************************/
     1590/*********************************** EASING ***********************************/
     1591/******************************************************************************/
     1592
     1593( function() {
     1594
     1595// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
     1596
     1597var baseEasings = {};
     1598
     1599$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
     1600        baseEasings[ name ] = function( p ) {
     1601                return Math.pow( p, i + 2 );
     1602        };
     1603} );
     1604
     1605$.extend( baseEasings, {
     1606        Sine: function( p ) {
     1607                return 1 - Math.cos( p * Math.PI / 2 );
     1608        },
     1609        Circ: function( p ) {
     1610                return 1 - Math.sqrt( 1 - p * p );
     1611        },
     1612        Elastic: function( p ) {
     1613                return p === 0 || p === 1 ? p :
     1614                        -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
     1615        },
     1616        Back: function( p ) {
     1617                return p * p * ( 3 * p - 2 );
     1618        },
     1619        Bounce: function( p ) {
     1620                var pow2,
     1621                        bounce = 4;
     1622
     1623                while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
     1624                return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
     1625        }
     1626} );
     1627
     1628$.each( baseEasings, function( name, easeIn ) {
     1629        $.easing[ "easeIn" + name ] = easeIn;
     1630        $.easing[ "easeOut" + name ] = function( p ) {
     1631                return 1 - easeIn( 1 - p );
     1632        };
     1633        $.easing[ "easeInOut" + name ] = function( p ) {
     1634                return p < 0.5 ?
     1635                        easeIn( p * 2 ) / 2 :
     1636                        1 - easeIn( p * -2 + 2 ) / 2;
     1637        };
     1638} );
     1639
     1640} )();
     1641
     1642var effect = $.effects;
     1643
     1644
     1645/*!
     1646 * jQuery UI Effects Blind 1.12.1
     1647 * http://jqueryui.com
     1648 *
     1649 * Copyright jQuery Foundation and other contributors
     1650 * Released under the MIT license.
     1651 * http://jquery.org/license
     1652 */
     1653
     1654//>>label: Blind Effect
     1655//>>group: Effects
     1656//>>description: Blinds the element.
     1657//>>docs: http://api.jqueryui.com/blind-effect/
     1658//>>demos: http://jqueryui.com/effect/
     1659
     1660
     1661
     1662var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) {
     1663        var map = {
     1664                        up: [ "bottom", "top" ],
     1665                        vertical: [ "bottom", "top" ],
     1666                        down: [ "top", "bottom" ],
     1667                        left: [ "right", "left" ],
     1668                        horizontal: [ "right", "left" ],
     1669                        right: [ "left", "right" ]
     1670                },
     1671                element = $( this ),
     1672                direction = options.direction || "up",
     1673                start = element.cssClip(),
     1674                animate = { clip: $.extend( {}, start ) },
     1675                placeholder = $.effects.createPlaceholder( element );
     1676
     1677        animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
     1678
     1679        if ( options.mode === "show" ) {
     1680                element.cssClip( animate.clip );
     1681                if ( placeholder ) {
     1682                        placeholder.css( $.effects.clipToBox( animate ) );
     1683                }
     1684
     1685                animate.clip = start;
     1686        }
     1687
     1688        if ( placeholder ) {
     1689                placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
     1690        }
     1691
     1692        element.animate( animate, {
     1693                queue: false,
     1694                duration: options.duration,
     1695                easing: options.easing,
     1696                complete: done
     1697        } );
     1698} );
     1699
     1700
     1701/*!
     1702 * jQuery UI Effects Bounce 1.12.1
     1703 * http://jqueryui.com
     1704 *
     1705 * Copyright jQuery Foundation and other contributors
     1706 * Released under the MIT license.
     1707 * http://jquery.org/license
     1708 */
     1709
     1710//>>label: Bounce Effect
     1711//>>group: Effects
     1712//>>description: Bounces an element horizontally or vertically n times.
     1713//>>docs: http://api.jqueryui.com/bounce-effect/
     1714//>>demos: http://jqueryui.com/effect/
     1715
     1716
     1717
     1718var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) {
     1719        var upAnim, downAnim, refValue,
     1720                element = $( this ),
     1721
     1722                // Defaults:
     1723                mode = options.mode,
     1724                hide = mode === "hide",
     1725                show = mode === "show",
     1726                direction = options.direction || "up",
     1727                distance = options.distance,
     1728                times = options.times || 5,
     1729
     1730                // Number of internal animations
     1731                anims = times * 2 + ( show || hide ? 1 : 0 ),
     1732                speed = options.duration / anims,
     1733                easing = options.easing,
     1734
     1735                // Utility:
     1736                ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
     1737                motion = ( direction === "up" || direction === "left" ),
     1738                i = 0,
     1739
     1740                queuelen = element.queue().length;
     1741
     1742        $.effects.createPlaceholder( element );
     1743
     1744        refValue = element.css( ref );
     1745
     1746        // Default distance for the BIGGEST bounce is the outer Distance / 3
     1747        if ( !distance ) {
     1748                distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
     1749        }
     1750
     1751        if ( show ) {
     1752                downAnim = { opacity: 1 };
     1753                downAnim[ ref ] = refValue;
     1754
     1755                // If we are showing, force opacity 0 and set the initial position
     1756                // then do the "first" animation
     1757                element
     1758                        .css( "opacity", 0 )
     1759                        .css( ref, motion ? -distance * 2 : distance * 2 )
     1760                        .animate( downAnim, speed, easing );
     1761        }
     1762
     1763        // Start at the smallest distance if we are hiding
     1764        if ( hide ) {
     1765                distance = distance / Math.pow( 2, times - 1 );
     1766        }
     1767
     1768        downAnim = {};
     1769        downAnim[ ref ] = refValue;
     1770
     1771        // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
     1772        for ( ; i < times; i++ ) {
     1773                upAnim = {};
     1774                upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
     1775
     1776                element
     1777                        .animate( upAnim, speed, easing )
     1778                        .animate( downAnim, speed, easing );
     1779
     1780                distance = hide ? distance * 2 : distance / 2;
     1781        }
     1782
     1783        // Last Bounce when Hiding
     1784        if ( hide ) {
     1785                upAnim = { opacity: 0 };
     1786                upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
     1787
     1788                element.animate( upAnim, speed, easing );
     1789        }
     1790
     1791        element.queue( done );
     1792
     1793        $.effects.unshift( element, queuelen, anims + 1 );
     1794} );
     1795
     1796
     1797/*!
     1798 * jQuery UI Effects Clip 1.12.1
     1799 * http://jqueryui.com
     1800 *
     1801 * Copyright jQuery Foundation and other contributors
     1802 * Released under the MIT license.
     1803 * http://jquery.org/license
     1804 */
     1805
     1806//>>label: Clip Effect
     1807//>>group: Effects
     1808//>>description: Clips the element on and off like an old TV.
     1809//>>docs: http://api.jqueryui.com/clip-effect/
     1810//>>demos: http://jqueryui.com/effect/
     1811
     1812
     1813
     1814var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) {
     1815        var start,
     1816                animate = {},
     1817                element = $( this ),
     1818                direction = options.direction || "vertical",
     1819                both = direction === "both",
     1820                horizontal = both || direction === "horizontal",
     1821                vertical = both || direction === "vertical";
     1822
     1823        start = element.cssClip();
     1824        animate.clip = {
     1825                top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
     1826                right: horizontal ? ( start.right - start.left ) / 2 : start.right,
     1827                bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
     1828                left: horizontal ? ( start.right - start.left ) / 2 : start.left
     1829        };
     1830
     1831        $.effects.createPlaceholder( element );
     1832
     1833        if ( options.mode === "show" ) {
     1834                element.cssClip( animate.clip );
     1835                animate.clip = start;
     1836        }
     1837
     1838        element.animate( animate, {
     1839                queue: false,
     1840                duration: options.duration,
     1841                easing: options.easing,
     1842                complete: done
     1843        } );
     1844
     1845} );
     1846
     1847
     1848/*!
     1849 * jQuery UI Effects Drop 1.12.1
     1850 * http://jqueryui.com
     1851 *
     1852 * Copyright jQuery Foundation and other contributors
     1853 * Released under the MIT license.
     1854 * http://jquery.org/license
     1855 */
     1856
     1857//>>label: Drop Effect
     1858//>>group: Effects
     1859//>>description: Moves an element in one direction and hides it at the same time.
     1860//>>docs: http://api.jqueryui.com/drop-effect/
     1861//>>demos: http://jqueryui.com/effect/
     1862
     1863
     1864
     1865var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) {
     1866
     1867        var distance,
     1868                element = $( this ),
     1869                mode = options.mode,
     1870                show = mode === "show",
     1871                direction = options.direction || "left",
     1872                ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
     1873                motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
     1874                oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
     1875                animation = {
     1876                        opacity: 0
     1877                };
     1878
     1879        $.effects.createPlaceholder( element );
     1880
     1881        distance = options.distance ||
     1882                element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
     1883
     1884        animation[ ref ] = motion + distance;
     1885
     1886        if ( show ) {
     1887                element.css( animation );
     1888
     1889                animation[ ref ] = oppositeMotion + distance;
     1890                animation.opacity = 1;
     1891        }
     1892
     1893        // Animate
     1894        element.animate( animation, {
     1895                queue: false,
     1896                duration: options.duration,
     1897                easing: options.easing,
     1898                complete: done
     1899        } );
     1900} );
     1901
     1902
     1903/*!
     1904 * jQuery UI Effects Explode 1.12.1
     1905 * http://jqueryui.com
     1906 *
     1907 * Copyright jQuery Foundation and other contributors
     1908 * Released under the MIT license.
     1909 * http://jquery.org/license
     1910 */
     1911
     1912//>>label: Explode Effect
     1913//>>group: Effects
     1914// jscs:disable maximumLineLength
     1915//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
     1916// jscs:enable maximumLineLength
     1917//>>docs: http://api.jqueryui.com/explode-effect/
     1918//>>demos: http://jqueryui.com/effect/
     1919
     1920
     1921
     1922var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) {
     1923
     1924        var i, j, left, top, mx, my,
     1925                rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
     1926                cells = rows,
     1927                element = $( this ),
     1928                mode = options.mode,
     1929                show = mode === "show",
     1930
     1931                // Show and then visibility:hidden the element before calculating offset
     1932                offset = element.show().css( "visibility", "hidden" ).offset(),
     1933
     1934                // Width and height of a piece
     1935                width = Math.ceil( element.outerWidth() / cells ),
     1936                height = Math.ceil( element.outerHeight() / rows ),
     1937                pieces = [];
     1938
     1939        // Children animate complete:
     1940        function childComplete() {
     1941                pieces.push( this );
     1942                if ( pieces.length === rows * cells ) {
     1943                        animComplete();
     1944                }
     1945        }
     1946
     1947        // Clone the element for each row and cell.
     1948        for ( i = 0; i < rows; i++ ) { // ===>
     1949                top = offset.top + i * height;
     1950                my = i - ( rows - 1 ) / 2;
     1951
     1952                for ( j = 0; j < cells; j++ ) { // |||
     1953                        left = offset.left + j * width;
     1954                        mx = j - ( cells - 1 ) / 2;
     1955
     1956                        // Create a clone of the now hidden main element that will be absolute positioned
     1957                        // within a wrapper div off the -left and -top equal to size of our pieces
     1958                        element
     1959                                .clone()
     1960                                .appendTo( "body" )
     1961                                .wrap( "<div></div>" )
     1962                                .css( {
     1963                                        position: "absolute",
     1964                                        visibility: "visible",
     1965                                        left: -j * width,
     1966                                        top: -i * height
     1967                                } )
     1968
     1969                                // Select the wrapper - make it overflow: hidden and absolute positioned based on
     1970                                // where the original was located +left and +top equal to the size of pieces
     1971                                .parent()
     1972                                        .addClass( "ui-effects-explode" )
     1973                                        .css( {
     1974                                                position: "absolute",
     1975                                                overflow: "hidden",
     1976                                                width: width,
     1977                                                height: height,
     1978                                                left: left + ( show ? mx * width : 0 ),
     1979                                                top: top + ( show ? my * height : 0 ),
     1980                                                opacity: show ? 0 : 1
     1981                                        } )
     1982                                        .animate( {
     1983                                                left: left + ( show ? 0 : mx * width ),
     1984                                                top: top + ( show ? 0 : my * height ),
     1985                                                opacity: show ? 1 : 0
     1986                                        }, options.duration || 500, options.easing, childComplete );
     1987                }
     1988        }
     1989
     1990        function animComplete() {
     1991                element.css( {
     1992                        visibility: "visible"
     1993                } );
     1994                $( pieces ).remove();
     1995                done();
     1996        }
     1997} );
     1998
     1999
     2000/*!
     2001 * jQuery UI Effects Fade 1.12.1
     2002 * http://jqueryui.com
     2003 *
     2004 * Copyright jQuery Foundation and other contributors
     2005 * Released under the MIT license.
     2006 * http://jquery.org/license
     2007 */
     2008
     2009//>>label: Fade Effect
     2010//>>group: Effects
     2011//>>description: Fades the element.
     2012//>>docs: http://api.jqueryui.com/fade-effect/
     2013//>>demos: http://jqueryui.com/effect/
     2014
     2015
     2016
     2017var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) {
     2018        var show = options.mode === "show";
     2019
     2020        $( this )
     2021                .css( "opacity", show ? 0 : 1 )
     2022                .animate( {
     2023                        opacity: show ? 1 : 0
     2024                }, {
     2025                        queue: false,
     2026                        duration: options.duration,
     2027                        easing: options.easing,
     2028                        complete: done
     2029                } );
     2030} );
     2031
     2032
     2033/*!
     2034 * jQuery UI Effects Fold 1.12.1
     2035 * http://jqueryui.com
     2036 *
     2037 * Copyright jQuery Foundation and other contributors
     2038 * Released under the MIT license.
     2039 * http://jquery.org/license
     2040 */
     2041
     2042//>>label: Fold Effect
     2043//>>group: Effects
     2044//>>description: Folds an element first horizontally and then vertically.
     2045//>>docs: http://api.jqueryui.com/fold-effect/
     2046//>>demos: http://jqueryui.com/effect/
     2047
     2048
     2049
     2050var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) {
     2051
     2052        // Create element
     2053        var element = $( this ),
     2054                mode = options.mode,
     2055                show = mode === "show",
     2056                hide = mode === "hide",
     2057                size = options.size || 15,
     2058                percent = /([0-9]+)%/.exec( size ),
     2059                horizFirst = !!options.horizFirst,
     2060                ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
     2061                duration = options.duration / 2,
     2062
     2063                placeholder = $.effects.createPlaceholder( element ),
     2064
     2065                start = element.cssClip(),
     2066                animation1 = { clip: $.extend( {}, start ) },
     2067                animation2 = { clip: $.extend( {}, start ) },
     2068
     2069                distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
     2070
     2071                queuelen = element.queue().length;
     2072
     2073        if ( percent ) {
     2074                size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
     2075        }
     2076        animation1.clip[ ref[ 0 ] ] = size;
     2077        animation2.clip[ ref[ 0 ] ] = size;
     2078        animation2.clip[ ref[ 1 ] ] = 0;
     2079
     2080        if ( show ) {
     2081                element.cssClip( animation2.clip );
     2082                if ( placeholder ) {
     2083                        placeholder.css( $.effects.clipToBox( animation2 ) );
     2084                }
     2085
     2086                animation2.clip = start;
     2087        }
     2088
     2089        // Animate
     2090        element
     2091                .queue( function( next ) {
     2092                        if ( placeholder ) {
     2093                                placeholder
     2094                                        .animate( $.effects.clipToBox( animation1 ), duration, options.easing )
     2095                                        .animate( $.effects.clipToBox( animation2 ), duration, options.easing );
     2096                        }
     2097
     2098                        next();
     2099                } )
     2100                .animate( animation1, duration, options.easing )
     2101                .animate( animation2, duration, options.easing )
     2102                .queue( done );
     2103
     2104        $.effects.unshift( element, queuelen, 4 );
     2105} );
     2106
     2107
     2108/*!
     2109 * jQuery UI Effects Highlight 1.12.1
     2110 * http://jqueryui.com
     2111 *
     2112 * Copyright jQuery Foundation and other contributors
     2113 * Released under the MIT license.
     2114 * http://jquery.org/license
     2115 */
     2116
     2117//>>label: Highlight Effect
     2118//>>group: Effects
     2119//>>description: Highlights the background of an element in a defined color for a custom duration.
     2120//>>docs: http://api.jqueryui.com/highlight-effect/
     2121//>>demos: http://jqueryui.com/effect/
     2122
     2123
     2124
     2125var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) {
     2126        var element = $( this ),
     2127                animation = {
     2128                        backgroundColor: element.css( "backgroundColor" )
     2129                };
     2130
     2131        if ( options.mode === "hide" ) {
     2132                animation.opacity = 0;
     2133        }
     2134
     2135        $.effects.saveStyle( element );
     2136
     2137        element
     2138                .css( {
     2139                        backgroundImage: "none",
     2140                        backgroundColor: options.color || "#ffff99"
     2141                } )
     2142                .animate( animation, {
     2143                        queue: false,
     2144                        duration: options.duration,
     2145                        easing: options.easing,
     2146                        complete: done
     2147                } );
     2148} );
     2149
     2150
     2151/*!
     2152 * jQuery UI Effects Size 1.12.1
     2153 * http://jqueryui.com
     2154 *
     2155 * Copyright jQuery Foundation and other contributors
     2156 * Released under the MIT license.
     2157 * http://jquery.org/license
     2158 */
     2159
     2160//>>label: Size Effect
     2161//>>group: Effects
     2162//>>description: Resize an element to a specified width and height.
     2163//>>docs: http://api.jqueryui.com/size-effect/
     2164//>>demos: http://jqueryui.com/effect/
     2165
     2166
     2167
     2168var effectsEffectSize = $.effects.define( "size", function( options, done ) {
     2169
     2170        // Create element
     2171        var baseline, factor, temp,
     2172                element = $( this ),
     2173
     2174                // Copy for children
     2175                cProps = [ "fontSize" ],
     2176                vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
     2177                hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
     2178
     2179                // Set options
     2180                mode = options.mode,
     2181                restore = mode !== "effect",
     2182                scale = options.scale || "both",
     2183                origin = options.origin || [ "middle", "center" ],
     2184                position = element.css( "position" ),
     2185                pos = element.position(),
     2186                original = $.effects.scaledDimensions( element ),
     2187                from = options.from || original,
     2188                to = options.to || $.effects.scaledDimensions( element, 0 );
     2189
     2190        $.effects.createPlaceholder( element );
     2191
     2192        if ( mode === "show" ) {
     2193                temp = from;
     2194                from = to;
     2195                to = temp;
     2196        }
     2197
     2198        // Set scaling factor
     2199        factor = {
     2200                from: {
     2201                        y: from.height / original.height,
     2202                        x: from.width / original.width
     2203                },
     2204                to: {
     2205                        y: to.height / original.height,
     2206                        x: to.width / original.width
     2207                }
     2208        };
     2209
     2210        // Scale the css box
     2211        if ( scale === "box" || scale === "both" ) {
     2212
     2213                // Vertical props scaling
     2214                if ( factor.from.y !== factor.to.y ) {
     2215                        from = $.effects.setTransition( element, vProps, factor.from.y, from );
     2216                        to = $.effects.setTransition( element, vProps, factor.to.y, to );
     2217                }
     2218
     2219                // Horizontal props scaling
     2220                if ( factor.from.x !== factor.to.x ) {
     2221                        from = $.effects.setTransition( element, hProps, factor.from.x, from );
     2222                        to = $.effects.setTransition( element, hProps, factor.to.x, to );
     2223                }
     2224        }
     2225
     2226        // Scale the content
     2227        if ( scale === "content" || scale === "both" ) {
     2228
     2229                // Vertical props scaling
     2230                if ( factor.from.y !== factor.to.y ) {
     2231                        from = $.effects.setTransition( element, cProps, factor.from.y, from );
     2232                        to = $.effects.setTransition( element, cProps, factor.to.y, to );
     2233                }
     2234        }
     2235
     2236        // Adjust the position properties based on the provided origin points
     2237        if ( origin ) {
     2238                baseline = $.effects.getBaseline( origin, original );
     2239                from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
     2240                from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
     2241                to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
     2242                to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
     2243        }
     2244        element.css( from );
     2245
     2246        // Animate the children if desired
     2247        if ( scale === "content" || scale === "both" ) {
     2248
     2249                vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
     2250                hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
     2251
     2252                // Only animate children with width attributes specified
     2253                // TODO: is this right? should we include anything with css width specified as well
     2254                element.find( "*[width]" ).each( function() {
     2255                        var child = $( this ),
     2256                                childOriginal = $.effects.scaledDimensions( child ),
     2257                                childFrom = {
     2258                                        height: childOriginal.height * factor.from.y,
     2259                                        width: childOriginal.width * factor.from.x,
     2260                                        outerHeight: childOriginal.outerHeight * factor.from.y,
     2261                                        outerWidth: childOriginal.outerWidth * factor.from.x
     2262                                },
     2263                                childTo = {
     2264                                        height: childOriginal.height * factor.to.y,
     2265                                        width: childOriginal.width * factor.to.x,
     2266                                        outerHeight: childOriginal.height * factor.to.y,
     2267                                        outerWidth: childOriginal.width * factor.to.x
     2268                                };
     2269
     2270                        // Vertical props scaling
     2271                        if ( factor.from.y !== factor.to.y ) {
     2272                                childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
     2273                                childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
     2274                        }
     2275
     2276                        // Horizontal props scaling
     2277                        if ( factor.from.x !== factor.to.x ) {
     2278                                childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
     2279                                childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
     2280                        }
     2281
     2282                        if ( restore ) {
     2283                                $.effects.saveStyle( child );
     2284                        }
     2285
     2286                        // Animate children
     2287                        child.css( childFrom );
     2288                        child.animate( childTo, options.duration, options.easing, function() {
     2289
     2290                                // Restore children
     2291                                if ( restore ) {
     2292                                        $.effects.restoreStyle( child );
     2293                                }
     2294                        } );
     2295                } );
     2296        }
     2297
     2298        // Animate
     2299        element.animate( to, {
     2300                queue: false,
     2301                duration: options.duration,
     2302                easing: options.easing,
     2303                complete: function() {
     2304
     2305                        var offset = element.offset();
     2306
     2307                        if ( to.opacity === 0 ) {
     2308                                element.css( "opacity", from.opacity );
     2309                        }
     2310
     2311                        if ( !restore ) {
     2312                                element
     2313                                        .css( "position", position === "static" ? "relative" : position )
     2314                                        .offset( offset );
     2315
     2316                                // Need to save style here so that automatic style restoration
     2317                                // doesn't restore to the original styles from before the animation.
     2318                                $.effects.saveStyle( element );
     2319                        }
     2320
     2321                        done();
     2322                }
     2323        } );
     2324
     2325} );
     2326
     2327
     2328/*!
     2329 * jQuery UI Effects Scale 1.12.1
     2330 * http://jqueryui.com
     2331 *
     2332 * Copyright jQuery Foundation and other contributors
     2333 * Released under the MIT license.
     2334 * http://jquery.org/license
     2335 */
     2336
     2337//>>label: Scale Effect
     2338//>>group: Effects
     2339//>>description: Grows or shrinks an element and its content.
     2340//>>docs: http://api.jqueryui.com/scale-effect/
     2341//>>demos: http://jqueryui.com/effect/
     2342
     2343
     2344
     2345var effectsEffectScale = $.effects.define( "scale", function( options, done ) {
     2346
     2347        // Create element
     2348        var el = $( this ),
     2349                mode = options.mode,
     2350                percent = parseInt( options.percent, 10 ) ||
     2351                        ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
     2352
     2353                newOptions = $.extend( true, {
     2354                        from: $.effects.scaledDimensions( el ),
     2355                        to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
     2356                        origin: options.origin || [ "middle", "center" ]
     2357                }, options );
     2358
     2359        // Fade option to support puff
     2360        if ( options.fade ) {
     2361                newOptions.from.opacity = 1;
     2362                newOptions.to.opacity = 0;
     2363        }
     2364
     2365        $.effects.effect.size.call( this, newOptions, done );
     2366} );
     2367
     2368
     2369/*!
     2370 * jQuery UI Effects Puff 1.12.1
     2371 * http://jqueryui.com
     2372 *
     2373 * Copyright jQuery Foundation and other contributors
     2374 * Released under the MIT license.
     2375 * http://jquery.org/license
     2376 */
     2377
     2378//>>label: Puff Effect
     2379//>>group: Effects
     2380//>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
     2381//>>docs: http://api.jqueryui.com/puff-effect/
     2382//>>demos: http://jqueryui.com/effect/
     2383
     2384
     2385
     2386var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) {
     2387        var newOptions = $.extend( true, {}, options, {
     2388                fade: true,
     2389                percent: parseInt( options.percent, 10 ) || 150
     2390        } );
     2391
     2392        $.effects.effect.scale.call( this, newOptions, done );
     2393} );
     2394
     2395
     2396/*!
     2397 * jQuery UI Effects Pulsate 1.12.1
     2398 * http://jqueryui.com
     2399 *
     2400 * Copyright jQuery Foundation and other contributors
     2401 * Released under the MIT license.
     2402 * http://jquery.org/license
     2403 */
     2404
     2405//>>label: Pulsate Effect
     2406//>>group: Effects
     2407//>>description: Pulsates an element n times by changing the opacity to zero and back.
     2408//>>docs: http://api.jqueryui.com/pulsate-effect/
     2409//>>demos: http://jqueryui.com/effect/
     2410
     2411
     2412
     2413var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) {
     2414        var element = $( this ),
     2415                mode = options.mode,
     2416                show = mode === "show",
     2417                hide = mode === "hide",
     2418                showhide = show || hide,
     2419
     2420                // Showing or hiding leaves off the "last" animation
     2421                anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
     2422                duration = options.duration / anims,
     2423                animateTo = 0,
     2424                i = 1,
     2425                queuelen = element.queue().length;
     2426
     2427        if ( show || !element.is( ":visible" ) ) {
     2428                element.css( "opacity", 0 ).show();
     2429                animateTo = 1;
     2430        }
     2431
     2432        // Anims - 1 opacity "toggles"
     2433        for ( ; i < anims; i++ ) {
     2434                element.animate( { opacity: animateTo }, duration, options.easing );
     2435                animateTo = 1 - animateTo;
     2436        }
     2437
     2438        element.animate( { opacity: animateTo }, duration, options.easing );
     2439
     2440        element.queue( done );
     2441
     2442        $.effects.unshift( element, queuelen, anims + 1 );
     2443} );
     2444
     2445
     2446/*!
     2447 * jQuery UI Effects Shake 1.12.1
     2448 * http://jqueryui.com
     2449 *
     2450 * Copyright jQuery Foundation and other contributors
     2451 * Released under the MIT license.
     2452 * http://jquery.org/license
     2453 */
     2454
     2455//>>label: Shake Effect
     2456//>>group: Effects
     2457//>>description: Shakes an element horizontally or vertically n times.
     2458//>>docs: http://api.jqueryui.com/shake-effect/
     2459//>>demos: http://jqueryui.com/effect/
     2460
     2461
     2462
     2463var effectsEffectShake = $.effects.define( "shake", function( options, done ) {
     2464
     2465        var i = 1,
     2466                element = $( this ),
     2467                direction = options.direction || "left",
     2468                distance = options.distance || 20,
     2469                times = options.times || 3,
     2470                anims = times * 2 + 1,
     2471                speed = Math.round( options.duration / anims ),
     2472                ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
     2473                positiveMotion = ( direction === "up" || direction === "left" ),
     2474                animation = {},
     2475                animation1 = {},
     2476                animation2 = {},
     2477
     2478                queuelen = element.queue().length;
     2479
     2480        $.effects.createPlaceholder( element );
     2481
     2482        // Animation
     2483        animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
     2484        animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
     2485        animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
     2486
     2487        // Animate
     2488        element.animate( animation, speed, options.easing );
     2489
     2490        // Shakes
     2491        for ( ; i < times; i++ ) {
     2492                element
     2493                        .animate( animation1, speed, options.easing )
     2494                        .animate( animation2, speed, options.easing );
     2495        }
     2496
     2497        element
     2498                .animate( animation1, speed, options.easing )
     2499                .animate( animation, speed / 2, options.easing )
     2500                .queue( done );
     2501
     2502        $.effects.unshift( element, queuelen, anims + 1 );
     2503} );
     2504
     2505
     2506/*!
     2507 * jQuery UI Effects Slide 1.12.1
     2508 * http://jqueryui.com
     2509 *
     2510 * Copyright jQuery Foundation and other contributors
     2511 * Released under the MIT license.
     2512 * http://jquery.org/license
     2513 */
     2514
     2515//>>label: Slide Effect
     2516//>>group: Effects
     2517//>>description: Slides an element in and out of the viewport.
     2518//>>docs: http://api.jqueryui.com/slide-effect/
     2519//>>demos: http://jqueryui.com/effect/
     2520
     2521
     2522
     2523var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) {
     2524        var startClip, startRef,
     2525                element = $( this ),
     2526                map = {
     2527                        up: [ "bottom", "top" ],
     2528                        down: [ "top", "bottom" ],
     2529                        left: [ "right", "left" ],
     2530                        right: [ "left", "right" ]
     2531                },
     2532                mode = options.mode,
     2533                direction = options.direction || "left",
     2534                ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
     2535                positiveMotion = ( direction === "up" || direction === "left" ),
     2536                distance = options.distance ||
     2537                        element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
     2538                animation = {};
     2539
     2540        $.effects.createPlaceholder( element );
     2541
     2542        startClip = element.cssClip();
     2543        startRef = element.position()[ ref ];
     2544
     2545        // Define hide animation
     2546        animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
     2547        animation.clip = element.cssClip();
     2548        animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];
     2549
     2550        // Reverse the animation if we're showing
     2551        if ( mode === "show" ) {
     2552                element.cssClip( animation.clip );
     2553                element.css( ref, animation[ ref ] );
     2554                animation.clip = startClip;
     2555                animation[ ref ] = startRef;
     2556        }
     2557
     2558        // Actually animate
     2559        element.animate( animation, {
     2560                queue: false,
     2561                duration: options.duration,
     2562                easing: options.easing,
     2563                complete: done
     2564        } );
     2565} );
     2566
     2567
     2568/*!
     2569 * jQuery UI Effects Transfer 1.12.1
     2570 * http://jqueryui.com
     2571 *
     2572 * Copyright jQuery Foundation and other contributors
     2573 * Released under the MIT license.
     2574 * http://jquery.org/license
     2575 */
     2576
     2577//>>label: Transfer Effect
     2578//>>group: Effects
     2579//>>description: Displays a transfer effect from one element to another.
     2580//>>docs: http://api.jqueryui.com/transfer-effect/
     2581//>>demos: http://jqueryui.com/effect/
     2582
     2583
     2584
     2585var effect;
     2586if ( $.uiBackCompat !== false ) {
     2587        effect = $.effects.define( "transfer", function( options, done ) {
     2588                $( this ).transfer( options, done );
     2589        } );
     2590}
     2591var effectsEffectTransfer = effect;
     2592
     2593}));
  • src/js/_enqueues/vendor/jquery/ui/menu.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/effects-all.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Menu 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Menu
     11//>>group: Widgets
     12//>>description: Creates nestable menus.
     13//>>docs: http://api.jqueryui.com/menu/
     14//>>demos: http://jqueryui.com/menu/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/menu.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./keycode",
     26                        "./position",
     27                        "./safe-active-element",
     28                        "./unique-id",
     29                        "./version",
     30                        "./widget"
     31                ], factory );
     32        } else {
     33
     34                // Browser globals
     35                factory( jQuery );
     36        }
     37}( function( $ ) {
     38
     39return $.widget( "ui.menu", {
     40        version: "1.12.1",
     41        defaultElement: "<ul>",
     42        delay: 300,
     43        options: {
     44                icons: {
     45                        submenu: "ui-icon-caret-1-e"
     46                },
     47                items: "> *",
     48                menus: "ul",
     49                position: {
     50                        my: "left top",
     51                        at: "right top"
     52                },
     53                role: "menu",
     54
     55                // Callbacks
     56                blur: null,
     57                focus: null,
     58                select: null
     59        },
     60
     61        _create: function() {
     62                this.activeMenu = this.element;
     63
     64                // Flag used to prevent firing of the click handler
     65                // as the event bubbles up through nested menus
     66                this.mouseHandled = false;
     67                this.element
     68                        .uniqueId()
     69                        .attr( {
     70                                role: this.options.role,
     71                                tabIndex: 0
     72                        } );
     73
     74                this._addClass( "ui-menu", "ui-widget ui-widget-content" );
     75                this._on( {
     76
     77                        // Prevent focus from sticking to links inside menu after clicking
     78                        // them (focus should always stay on UL during navigation).
     79                        "mousedown .ui-menu-item": function( event ) {
     80                                event.preventDefault();
     81                        },
     82                        "click .ui-menu-item": function( event ) {
     83                                var target = $( event.target );
     84                                var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
     85                                if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
     86                                        this.select( event );
     87
     88                                        // Only set the mouseHandled flag if the event will bubble, see #9469.
     89                                        if ( !event.isPropagationStopped() ) {
     90                                                this.mouseHandled = true;
     91                                        }
     92
     93                                        // Open submenu on click
     94                                        if ( target.has( ".ui-menu" ).length ) {
     95                                                this.expand( event );
     96                                        } else if ( !this.element.is( ":focus" ) &&
     97                                                        active.closest( ".ui-menu" ).length ) {
     98
     99                                                // Redirect focus to the menu
     100                                                this.element.trigger( "focus", [ true ] );
     101
     102                                                // If the active item is on the top level, let it stay active.
     103                                                // Otherwise, blur the active item since it is no longer visible.
     104                                                if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
     105                                                        clearTimeout( this.timer );
     106                                                }
     107                                        }
     108                                }
     109                        },
     110                        "mouseenter .ui-menu-item": function( event ) {
     111
     112                                // Ignore mouse events while typeahead is active, see #10458.
     113                                // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
     114                                // is over an item in the menu
     115                                if ( this.previousFilter ) {
     116                                        return;
     117                                }
     118
     119                                var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
     120                                        target = $( event.currentTarget );
     121
     122                                // Ignore bubbled events on parent items, see #11641
     123                                if ( actualTarget[ 0 ] !== target[ 0 ] ) {
     124                                        return;
     125                                }
     126
     127                                // Remove ui-state-active class from siblings of the newly focused menu item
     128                                // to avoid a jump caused by adjacent elements both having a class with a border
     129                                this._removeClass( target.siblings().children( ".ui-state-active" ),
     130                                        null, "ui-state-active" );
     131                                this.focus( event, target );
     132                        },
     133                        mouseleave: "collapseAll",
     134                        "mouseleave .ui-menu": "collapseAll",
     135                        focus: function( event, keepActiveItem ) {
     136
     137                                // If there's already an active item, keep it active
     138                                // If not, activate the first item
     139                                var item = this.active || this.element.find( this.options.items ).eq( 0 );
     140
     141                                if ( !keepActiveItem ) {
     142                                        this.focus( event, item );
     143                                }
     144                        },
     145                        blur: function( event ) {
     146                                this._delay( function() {
     147                                        var notContained = !$.contains(
     148                                                this.element[ 0 ],
     149                                                $.ui.safeActiveElement( this.document[ 0 ] )
     150                                        );
     151                                        if ( notContained ) {
     152                                                this.collapseAll( event );
     153                                        }
     154                                } );
     155                        },
     156                        keydown: "_keydown"
     157                } );
     158
     159                this.refresh();
     160
     161                // Clicks outside of a menu collapse any open menus
     162                this._on( this.document, {
     163                        click: function( event ) {
     164                                if ( this._closeOnDocumentClick( event ) ) {
     165                                        this.collapseAll( event );
     166                                }
     167
     168                                // Reset the mouseHandled flag
     169                                this.mouseHandled = false;
     170                        }
     171                } );
     172        },
     173
     174        _destroy: function() {
     175                var items = this.element.find( ".ui-menu-item" )
     176                                .removeAttr( "role aria-disabled" ),
     177                        submenus = items.children( ".ui-menu-item-wrapper" )
     178                                .removeUniqueId()
     179                                .removeAttr( "tabIndex role aria-haspopup" );
     180
     181                // Destroy (sub)menus
     182                this.element
     183                        .removeAttr( "aria-activedescendant" )
     184                        .find( ".ui-menu" ).addBack()
     185                                .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
     186                                        "tabIndex" )
     187                                .removeUniqueId()
     188                                .show();
     189
     190                submenus.children().each( function() {
     191                        var elem = $( this );
     192                        if ( elem.data( "ui-menu-submenu-caret" ) ) {
     193                                elem.remove();
     194                        }
     195                } );
     196        },
     197
     198        _keydown: function( event ) {
     199                var match, prev, character, skip,
     200                        preventDefault = true;
     201
     202                switch ( event.keyCode ) {
     203                case $.ui.keyCode.PAGE_UP:
     204                        this.previousPage( event );
     205                        break;
     206                case $.ui.keyCode.PAGE_DOWN:
     207                        this.nextPage( event );
     208                        break;
     209                case $.ui.keyCode.HOME:
     210                        this._move( "first", "first", event );
     211                        break;
     212                case $.ui.keyCode.END:
     213                        this._move( "last", "last", event );
     214                        break;
     215                case $.ui.keyCode.UP:
     216                        this.previous( event );
     217                        break;
     218                case $.ui.keyCode.DOWN:
     219                        this.next( event );
     220                        break;
     221                case $.ui.keyCode.LEFT:
     222                        this.collapse( event );
     223                        break;
     224                case $.ui.keyCode.RIGHT:
     225                        if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
     226                                this.expand( event );
     227                        }
     228                        break;
     229                case $.ui.keyCode.ENTER:
     230                case $.ui.keyCode.SPACE:
     231                        this._activate( event );
     232                        break;
     233                case $.ui.keyCode.ESCAPE:
     234                        this.collapse( event );
     235                        break;
     236                default:
     237                        preventDefault = false;
     238                        prev = this.previousFilter || "";
     239                        skip = false;
     240
     241                        // Support number pad values
     242                        character = event.keyCode >= 96 && event.keyCode <= 105 ?
     243                                ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
     244
     245                        clearTimeout( this.filterTimer );
     246
     247                        if ( character === prev ) {
     248                                skip = true;
     249                        } else {
     250                                character = prev + character;
     251                        }
     252
     253                        match = this._filterMenuItems( character );
     254                        match = skip && match.index( this.active.next() ) !== -1 ?
     255                                this.active.nextAll( ".ui-menu-item" ) :
     256                                match;
     257
     258                        // If no matches on the current filter, reset to the last character pressed
     259                        // to move down the menu to the first item that starts with that character
     260                        if ( !match.length ) {
     261                                character = String.fromCharCode( event.keyCode );
     262                                match = this._filterMenuItems( character );
     263                        }
     264
     265                        if ( match.length ) {
     266                                this.focus( event, match );
     267                                this.previousFilter = character;
     268                                this.filterTimer = this._delay( function() {
     269                                        delete this.previousFilter;
     270                                }, 1000 );
     271                        } else {
     272                                delete this.previousFilter;
     273                        }
     274                }
     275
     276                if ( preventDefault ) {
     277                        event.preventDefault();
     278                }
     279        },
     280
     281        _activate: function( event ) {
     282                if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
     283                        if ( this.active.children( "[aria-haspopup='true']" ).length ) {
     284                                this.expand( event );
     285                        } else {
     286                                this.select( event );
     287                        }
     288                }
     289        },
     290
     291        refresh: function() {
     292                var menus, items, newSubmenus, newItems, newWrappers,
     293                        that = this,
     294                        icon = this.options.icons.submenu,
     295                        submenus = this.element.find( this.options.menus );
     296
     297                this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
     298
     299                // Initialize nested menus
     300                newSubmenus = submenus.filter( ":not(.ui-menu)" )
     301                        .hide()
     302                        .attr( {
     303                                role: this.options.role,
     304                                "aria-hidden": "true",
     305                                "aria-expanded": "false"
     306                        } )
     307                        .each( function() {
     308                                var menu = $( this ),
     309                                        item = menu.prev(),
     310                                        submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
     311
     312                                that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
     313                                item
     314                                        .attr( "aria-haspopup", "true" )
     315                                        .prepend( submenuCaret );
     316                                menu.attr( "aria-labelledby", item.attr( "id" ) );
     317                        } );
     318
     319                this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
     320
     321                menus = submenus.add( this.element );
     322                items = menus.find( this.options.items );
     323
     324                // Initialize menu-items containing spaces and/or dashes only as dividers
     325                items.not( ".ui-menu-item" ).each( function() {
     326                        var item = $( this );
     327                        if ( that._isDivider( item ) ) {
     328                                that._addClass( item, "ui-menu-divider", "ui-widget-content" );
     329                        }
     330                } );
     331
     332                // Don't refresh list items that are already adapted
     333                newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
     334                newWrappers = newItems.children()
     335                        .not( ".ui-menu" )
     336                                .uniqueId()
     337                                .attr( {
     338                                        tabIndex: -1,
     339                                        role: this._itemRole()
     340                                } );
     341                this._addClass( newItems, "ui-menu-item" )
     342                        ._addClass( newWrappers, "ui-menu-item-wrapper" );
     343
     344                // Add aria-disabled attribute to any disabled menu item
     345                items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
     346
     347                // If the active item has been removed, blur the menu
     348                if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
     349                        this.blur();
     350                }
     351        },
     352
     353        _itemRole: function() {
     354                return {
     355                        menu: "menuitem",
     356                        listbox: "option"
     357                }[ this.options.role ];
     358        },
     359
     360        _setOption: function( key, value ) {
     361                if ( key === "icons" ) {
     362                        var icons = this.element.find( ".ui-menu-icon" );
     363                        this._removeClass( icons, null, this.options.icons.submenu )
     364                                ._addClass( icons, null, value.submenu );
     365                }
     366                this._super( key, value );
     367        },
     368
     369        _setOptionDisabled: function( value ) {
     370                this._super( value );
     371
     372                this.element.attr( "aria-disabled", String( value ) );
     373                this._toggleClass( null, "ui-state-disabled", !!value );
     374        },
     375
     376        focus: function( event, item ) {
     377                var nested, focused, activeParent;
     378                this.blur( event, event && event.type === "focus" );
     379
     380                this._scrollIntoView( item );
     381
     382                this.active = item.first();
     383
     384                focused = this.active.children( ".ui-menu-item-wrapper" );
     385                this._addClass( focused, null, "ui-state-active" );
     386
     387                // Only update aria-activedescendant if there's a role
     388                // otherwise we assume focus is managed elsewhere
     389                if ( this.options.role ) {
     390                        this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
     391                }
     392
     393                // Highlight active parent menu item, if any
     394                activeParent = this.active
     395                        .parent()
     396                                .closest( ".ui-menu-item" )
     397                                        .children( ".ui-menu-item-wrapper" );
     398                this._addClass( activeParent, null, "ui-state-active" );
     399
     400                if ( event && event.type === "keydown" ) {
     401                        this._close();
     402                } else {
     403                        this.timer = this._delay( function() {
     404                                this._close();
     405                        }, this.delay );
     406                }
     407
     408                nested = item.children( ".ui-menu" );
     409                if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
     410                        this._startOpening( nested );
     411                }
     412                this.activeMenu = item.parent();
     413
     414                this._trigger( "focus", event, { item: item } );
     415        },
     416
     417        _scrollIntoView: function( item ) {
     418                var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
     419                if ( this._hasScroll() ) {
     420                        borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
     421                        paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
     422                        offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
     423                        scroll = this.activeMenu.scrollTop();
     424                        elementHeight = this.activeMenu.height();
     425                        itemHeight = item.outerHeight();
     426
     427                        if ( offset < 0 ) {
     428                                this.activeMenu.scrollTop( scroll + offset );
     429                        } else if ( offset + itemHeight > elementHeight ) {
     430                                this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
     431                        }
     432                }
     433        },
     434
     435        blur: function( event, fromFocus ) {
     436                if ( !fromFocus ) {
     437                        clearTimeout( this.timer );
     438                }
     439
     440                if ( !this.active ) {
     441                        return;
     442                }
     443
     444                this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
     445                        null, "ui-state-active" );
     446
     447                this._trigger( "blur", event, { item: this.active } );
     448                this.active = null;
     449        },
     450
     451        _startOpening: function( submenu ) {
     452                clearTimeout( this.timer );
     453
     454                // Don't open if already open fixes a Firefox bug that caused a .5 pixel
     455                // shift in the submenu position when mousing over the caret icon
     456                if ( submenu.attr( "aria-hidden" ) !== "true" ) {
     457                        return;
     458                }
     459
     460                this.timer = this._delay( function() {
     461                        this._close();
     462                        this._open( submenu );
     463                }, this.delay );
     464        },
     465
     466        _open: function( submenu ) {
     467                var position = $.extend( {
     468                        of: this.active
     469                }, this.options.position );
     470
     471                clearTimeout( this.timer );
     472                this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
     473                        .hide()
     474                        .attr( "aria-hidden", "true" );
     475
     476                submenu
     477                        .show()
     478                        .removeAttr( "aria-hidden" )
     479                        .attr( "aria-expanded", "true" )
     480                        .position( position );
     481        },
     482
     483        collapseAll: function( event, all ) {
     484                clearTimeout( this.timer );
     485                this.timer = this._delay( function() {
     486
     487                        // If we were passed an event, look for the submenu that contains the event
     488                        var currentMenu = all ? this.element :
     489                                $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
     490
     491                        // If we found no valid submenu ancestor, use the main menu to close all
     492                        // sub menus anyway
     493                        if ( !currentMenu.length ) {
     494                                currentMenu = this.element;
     495                        }
     496
     497                        this._close( currentMenu );
     498
     499                        this.blur( event );
     500
     501                        // Work around active item staying active after menu is blurred
     502                        this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
     503
     504                        this.activeMenu = currentMenu;
     505                }, this.delay );
     506        },
     507
     508        // With no arguments, closes the currently active menu - if nothing is active
     509        // it closes all menus.  If passed an argument, it will search for menus BELOW
     510        _close: function( startMenu ) {
     511                if ( !startMenu ) {
     512                        startMenu = this.active ? this.active.parent() : this.element;
     513                }
     514
     515                startMenu.find( ".ui-menu" )
     516                        .hide()
     517                        .attr( "aria-hidden", "true" )
     518                        .attr( "aria-expanded", "false" );
     519        },
     520
     521        _closeOnDocumentClick: function( event ) {
     522                return !$( event.target ).closest( ".ui-menu" ).length;
     523        },
     524
     525        _isDivider: function( item ) {
     526
     527                // Match hyphen, em dash, en dash
     528                return !/[^\-\u2014\u2013\s]/.test( item.text() );
     529        },
     530
     531        collapse: function( event ) {
     532                var newItem = this.active &&
     533                        this.active.parent().closest( ".ui-menu-item", this.element );
     534                if ( newItem && newItem.length ) {
     535                        this._close();
     536                        this.focus( event, newItem );
     537                }
     538        },
     539
     540        expand: function( event ) {
     541                var newItem = this.active &&
     542                        this.active
     543                                .children( ".ui-menu " )
     544                                        .find( this.options.items )
     545                                                .first();
     546
     547                if ( newItem && newItem.length ) {
     548                        this._open( newItem.parent() );
     549
     550                        // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
     551                        this._delay( function() {
     552                                this.focus( event, newItem );
     553                        } );
     554                }
     555        },
     556
     557        next: function( event ) {
     558                this._move( "next", "first", event );
     559        },
     560
     561        previous: function( event ) {
     562                this._move( "prev", "last", event );
     563        },
     564
     565        isFirstItem: function() {
     566                return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
     567        },
     568
     569        isLastItem: function() {
     570                return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
     571        },
     572
     573        _move: function( direction, filter, event ) {
     574                var next;
     575                if ( this.active ) {
     576                        if ( direction === "first" || direction === "last" ) {
     577                                next = this.active
     578                                        [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
     579                                        .eq( -1 );
     580                        } else {
     581                                next = this.active
     582                                        [ direction + "All" ]( ".ui-menu-item" )
     583                                        .eq( 0 );
     584                        }
     585                }
     586                if ( !next || !next.length || !this.active ) {
     587                        next = this.activeMenu.find( this.options.items )[ filter ]();
     588                }
     589
     590                this.focus( event, next );
     591        },
     592
     593        nextPage: function( event ) {
     594                var item, base, height;
     595
     596                if ( !this.active ) {
     597                        this.next( event );
     598                        return;
     599                }
     600                if ( this.isLastItem() ) {
     601                        return;
     602                }
     603                if ( this._hasScroll() ) {
     604                        base = this.active.offset().top;
     605                        height = this.element.height();
     606                        this.active.nextAll( ".ui-menu-item" ).each( function() {
     607                                item = $( this );
     608                                return item.offset().top - base - height < 0;
     609                        } );
     610
     611                        this.focus( event, item );
     612                } else {
     613                        this.focus( event, this.activeMenu.find( this.options.items )
     614                                [ !this.active ? "first" : "last" ]() );
     615                }
     616        },
     617
     618        previousPage: function( event ) {
     619                var item, base, height;
     620                if ( !this.active ) {
     621                        this.next( event );
     622                        return;
     623                }
     624                if ( this.isFirstItem() ) {
     625                        return;
     626                }
     627                if ( this._hasScroll() ) {
     628                        base = this.active.offset().top;
     629                        height = this.element.height();
     630                        this.active.prevAll( ".ui-menu-item" ).each( function() {
     631                                item = $( this );
     632                                return item.offset().top - base + height > 0;
     633                        } );
     634
     635                        this.focus( event, item );
     636                } else {
     637                        this.focus( event, this.activeMenu.find( this.options.items ).first() );
     638                }
     639        },
     640
     641        _hasScroll: function() {
     642                return this.element.outerHeight() < this.element.prop( "scrollHeight" );
     643        },
     644
     645        select: function( event ) {
     646
     647                // TODO: It should never be possible to not have an active item at this
     648                // point, but the tests don't trigger mouseenter before click.
     649                this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
     650                var ui = { item: this.active };
     651                if ( !this.active.has( ".ui-menu" ).length ) {
     652                        this.collapseAll( event, true );
     653                }
     654                this._trigger( "select", event, ui );
     655        },
     656
     657        _filterMenuItems: function( character ) {
     658                var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
     659                        regex = new RegExp( "^" + escapedCharacter, "i" );
     660
     661                return this.activeMenu
     662                        .find( this.options.items )
     663
     664                                // Only match on items, not dividers or other content (#10571)
     665                                .filter( ".ui-menu-item" )
     666                                        .filter( function() {
     667                                                return regex.test(
     668                                                        $.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
     669                                        } );
     670        }
     671} );
     672
     673} ) );
  • src/js/_enqueues/vendor/jquery/ui/mouse.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/menu.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Mouse 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Mouse
     11//>>group: Widgets
     12//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
     13//>>docs: http://api.jqueryui.com/mouse/
     14
     15( function( factory ) {
     16        if ( typeof define === "function" && define.amd ) {
     17
     18                // AMD. Register as an anonymous module.
     19                define( [
     20                        "jquery",
     21                        "./ie",
     22                        "./version",
     23                        "./widget"
     24                ], factory );
     25        } else {
     26
     27                // Browser globals
     28                factory( jQuery );
     29        }
     30}( function( $ ) {
     31
     32var mouseHandled = false;
     33$( document ).on( "mouseup", function() {
     34        mouseHandled = false;
     35} );
     36
     37return $.widget( "ui.mouse", {
     38        version: "1.12.1",
     39        options: {
     40                cancel: "input, textarea, button, select, option",
     41                distance: 1,
     42                delay: 0
     43        },
     44        _mouseInit: function() {
     45                var that = this;
     46
     47                this.element
     48                        .on( "mousedown." + this.widgetName, function( event ) {
     49                                return that._mouseDown( event );
     50                        } )
     51                        .on( "click." + this.widgetName, function( event ) {
     52                                if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
     53                                        $.removeData( event.target, that.widgetName + ".preventClickEvent" );
     54                                        event.stopImmediatePropagation();
     55                                        return false;
     56                                }
     57                        } );
     58
     59                this.started = false;
     60        },
     61
     62        // TODO: make sure destroying one instance of mouse doesn't mess with
     63        // other instances of mouse
     64        _mouseDestroy: function() {
     65                this.element.off( "." + this.widgetName );
     66                if ( this._mouseMoveDelegate ) {
     67                        this.document
     68                                .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
     69                                .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
     70                }
     71        },
     72
     73        _mouseDown: function( event ) {
     74
     75                // don't let more than one widget handle mouseStart
     76                if ( mouseHandled ) {
     77                        return;
     78                }
     79
     80                this._mouseMoved = false;
     81
     82                // We may have missed mouseup (out of window)
     83                ( this._mouseStarted && this._mouseUp( event ) );
     84
     85                this._mouseDownEvent = event;
     86
     87                var that = this,
     88                        btnIsLeft = ( event.which === 1 ),
     89
     90                        // event.target.nodeName works around a bug in IE 8 with
     91                        // disabled inputs (#7620)
     92                        elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
     93                                $( event.target ).closest( this.options.cancel ).length : false );
     94                if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
     95                        return true;
     96                }
     97
     98                this.mouseDelayMet = !this.options.delay;
     99                if ( !this.mouseDelayMet ) {
     100                        this._mouseDelayTimer = setTimeout( function() {
     101                                that.mouseDelayMet = true;
     102                        }, this.options.delay );
     103                }
     104
     105                if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
     106                        this._mouseStarted = ( this._mouseStart( event ) !== false );
     107                        if ( !this._mouseStarted ) {
     108                                event.preventDefault();
     109                                return true;
     110                        }
     111                }
     112
     113                // Click event may never have fired (Gecko & Opera)
     114                if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
     115                        $.removeData( event.target, this.widgetName + ".preventClickEvent" );
     116                }
     117
     118                // These delegates are required to keep context
     119                this._mouseMoveDelegate = function( event ) {
     120                        return that._mouseMove( event );
     121                };
     122                this._mouseUpDelegate = function( event ) {
     123                        return that._mouseUp( event );
     124                };
     125
     126                this.document
     127                        .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
     128                        .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
     129
     130                event.preventDefault();
     131
     132                mouseHandled = true;
     133                return true;
     134        },
     135
     136        _mouseMove: function( event ) {
     137
     138                // Only check for mouseups outside the document if you've moved inside the document
     139                // at least once. This prevents the firing of mouseup in the case of IE<9, which will
     140                // fire a mousemove event if content is placed under the cursor. See #7778
     141                // Support: IE <9
     142                if ( this._mouseMoved ) {
     143
     144                        // IE mouseup check - mouseup happened when mouse was out of window
     145                        if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
     146                                        !event.button ) {
     147                                return this._mouseUp( event );
     148
     149                        // Iframe mouseup check - mouseup occurred in another document
     150                        } else if ( !event.which ) {
     151
     152                                // Support: Safari <=8 - 9
     153                                // Safari sets which to 0 if you press any of the following keys
     154                                // during a drag (#14461)
     155                                if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
     156                                                event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
     157                                        this.ignoreMissingWhich = true;
     158                                } else if ( !this.ignoreMissingWhich ) {
     159                                        return this._mouseUp( event );
     160                                }
     161                        }
     162                }
     163
     164                if ( event.which || event.button ) {
     165                        this._mouseMoved = true;
     166                }
     167
     168                if ( this._mouseStarted ) {
     169                        this._mouseDrag( event );
     170                        return event.preventDefault();
     171                }
     172
     173                if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
     174                        this._mouseStarted =
     175                                ( this._mouseStart( this._mouseDownEvent, event ) !== false );
     176                        ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
     177                }
     178
     179                return !this._mouseStarted;
     180        },
     181
     182        _mouseUp: function( event ) {
     183                this.document
     184                        .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
     185                        .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
     186
     187                if ( this._mouseStarted ) {
     188                        this._mouseStarted = false;
     189
     190                        if ( event.target === this._mouseDownEvent.target ) {
     191                                $.data( event.target, this.widgetName + ".preventClickEvent", true );
     192                        }
     193
     194                        this._mouseStop( event );
     195                }
     196
     197                if ( this._mouseDelayTimer ) {
     198                        clearTimeout( this._mouseDelayTimer );
     199                        delete this._mouseDelayTimer;
     200                }
     201
     202                this.ignoreMissingWhich = false;
     203                mouseHandled = false;
     204                event.preventDefault();
     205        },
     206
     207        _mouseDistanceMet: function( event ) {
     208                return ( Math.max(
     209                                Math.abs( this._mouseDownEvent.pageX - event.pageX ),
     210                                Math.abs( this._mouseDownEvent.pageY - event.pageY )
     211                        ) >= this.options.distance
     212                );
     213        },
     214
     215        _mouseDelayMet: function( /* event */ ) {
     216                return this.mouseDelayMet;
     217        },
     218
     219        // These are placeholder methods, to be overriden by extending plugin
     220        _mouseStart: function( /* event */ ) {},
     221        _mouseDrag: function( /* event */ ) {},
     222        _mouseStop: function( /* event */ ) {},
     223        _mouseCapture: function( /* event */ ) { return true; }
     224} );
     225
     226} ) );
  • src/js/_enqueues/vendor/jquery/ui/progressbar.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/mouse.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Progressbar 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Progressbar
     11//>>group: Widgets
     12// jscs:disable maximumLineLength
     13//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
     14// jscs:enable maximumLineLength
     15//>>docs: http://api.jqueryui.com/progressbar/
     16//>>demos: http://jqueryui.com/progressbar/
     17//>>css.structure: ../../themes/base/core.css
     18//>>css.structure: ../../themes/base/progressbar.css
     19//>>css.theme: ../../themes/base/theme.css
     20
     21( function( factory ) {
     22        if ( typeof define === "function" && define.amd ) {
     23
     24                // AMD. Register as an anonymous module.
     25                define( [
     26                        "jquery",
     27                        "./version",
     28                        "./widget"
     29                ], factory );
     30        } else {
     31
     32                // Browser globals
     33                factory( jQuery );
     34        }
     35}( function( $ ) {
     36
     37return $.widget( "ui.progressbar", {
     38        version: "1.12.1",
     39        options: {
     40                classes: {
     41                        "ui-progressbar": "ui-corner-all",
     42                        "ui-progressbar-value": "ui-corner-left",
     43                        "ui-progressbar-complete": "ui-corner-right"
     44                },
     45                max: 100,
     46                value: 0,
     47
     48                change: null,
     49                complete: null
     50        },
     51
     52        min: 0,
     53
     54        _create: function() {
     55
     56                // Constrain initial value
     57                this.oldValue = this.options.value = this._constrainedValue();
     58
     59                this.element.attr( {
     60
     61                        // Only set static values; aria-valuenow and aria-valuemax are
     62                        // set inside _refreshValue()
     63                        role: "progressbar",
     64                        "aria-valuemin": this.min
     65                } );
     66                this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
     67
     68                this.valueDiv = $( "<div>" ).appendTo( this.element );
     69                this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
     70                this._refreshValue();
     71        },
     72
     73        _destroy: function() {
     74                this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
     75
     76                this.valueDiv.remove();
     77        },
     78
     79        value: function( newValue ) {
     80                if ( newValue === undefined ) {
     81                        return this.options.value;
     82                }
     83
     84                this.options.value = this._constrainedValue( newValue );
     85                this._refreshValue();
     86        },
     87
     88        _constrainedValue: function( newValue ) {
     89                if ( newValue === undefined ) {
     90                        newValue = this.options.value;
     91                }
     92
     93                this.indeterminate = newValue === false;
     94
     95                // Sanitize value
     96                if ( typeof newValue !== "number" ) {
     97                        newValue = 0;
     98                }
     99
     100                return this.indeterminate ? false :
     101                        Math.min( this.options.max, Math.max( this.min, newValue ) );
     102        },
     103
     104        _setOptions: function( options ) {
     105
     106                // Ensure "value" option is set after other values (like max)
     107                var value = options.value;
     108                delete options.value;
     109
     110                this._super( options );
     111
     112                this.options.value = this._constrainedValue( value );
     113                this._refreshValue();
     114        },
     115
     116        _setOption: function( key, value ) {
     117                if ( key === "max" ) {
     118
     119                        // Don't allow a max less than min
     120                        value = Math.max( this.min, value );
     121                }
     122                this._super( key, value );
     123        },
     124
     125        _setOptionDisabled: function( value ) {
     126                this._super( value );
     127
     128                this.element.attr( "aria-disabled", value );
     129                this._toggleClass( null, "ui-state-disabled", !!value );
     130        },
     131
     132        _percentage: function() {
     133                return this.indeterminate ?
     134                        100 :
     135                        100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
     136        },
     137
     138        _refreshValue: function() {
     139                var value = this.options.value,
     140                        percentage = this._percentage();
     141
     142                this.valueDiv
     143                        .toggle( this.indeterminate || value > this.min )
     144                        .width( percentage.toFixed( 0 ) + "%" );
     145
     146                this
     147                        ._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
     148                                value === this.options.max )
     149                        ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
     150
     151                if ( this.indeterminate ) {
     152                        this.element.removeAttr( "aria-valuenow" );
     153                        if ( !this.overlayDiv ) {
     154                                this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
     155                                this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
     156                        }
     157                } else {
     158                        this.element.attr( {
     159                                "aria-valuemax": this.options.max,
     160                                "aria-valuenow": value
     161                        } );
     162                        if ( this.overlayDiv ) {
     163                                this.overlayDiv.remove();
     164                                this.overlayDiv = null;
     165                        }
     166                }
     167
     168                if ( this.oldValue !== value ) {
     169                        this.oldValue = value;
     170                        this._trigger( "change" );
     171                }
     172                if ( value === this.options.max ) {
     173                        this._trigger( "complete" );
     174                }
     175        }
     176} );
     177
     178} ) );
  • src/js/_enqueues/vendor/jquery/ui/resizable.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/progressbar.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Resizable 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Resizable
     11//>>group: Interactions
     12//>>description: Enables resize functionality for any element.
     13//>>docs: http://api.jqueryui.com/resizable/
     14//>>demos: http://jqueryui.com/resizable/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/resizable.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./mouse",
     26                        "./disable-selection",
     27                        "./plugin",
     28                        "./version",
     29                        "./widget"
     30                ], factory );
     31        } else {
     32
     33                // Browser globals
     34                factory( jQuery );
     35        }
     36}( function( $ ) {
     37
     38$.widget( "ui.resizable", $.ui.mouse, {
     39        version: "1.12.1",
     40        widgetEventPrefix: "resize",
     41        options: {
     42                alsoResize: false,
     43                animate: false,
     44                animateDuration: "slow",
     45                animateEasing: "swing",
     46                aspectRatio: false,
     47                autoHide: false,
     48                classes: {
     49                        "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
     50                },
     51                containment: false,
     52                ghost: false,
     53                grid: false,
     54                handles: "e,s,se",
     55                helper: false,
     56                maxHeight: null,
     57                maxWidth: null,
     58                minHeight: 10,
     59                minWidth: 10,
     60
     61                // See #7960
     62                zIndex: 90,
     63
     64                // Callbacks
     65                resize: null,
     66                start: null,
     67                stop: null
     68        },
     69
     70        _num: function( value ) {
     71                return parseFloat( value ) || 0;
     72        },
     73
     74        _isNumber: function( value ) {
     75                return !isNaN( parseFloat( value ) );
     76        },
     77
     78        _hasScroll: function( el, a ) {
     79
     80                if ( $( el ).css( "overflow" ) === "hidden" ) {
     81                        return false;
     82                }
     83
     84                var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
     85                        has = false;
     86
     87                if ( el[ scroll ] > 0 ) {
     88                        return true;
     89                }
     90
     91                // TODO: determine which cases actually cause this to happen
     92                // if the element doesn't have the scroll set, see if it's possible to
     93                // set the scroll
     94                el[ scroll ] = 1;
     95                has = ( el[ scroll ] > 0 );
     96                el[ scroll ] = 0;
     97                return has;
     98        },
     99
     100        _create: function() {
     101
     102                var margins,
     103                        o = this.options,
     104                        that = this;
     105                this._addClass( "ui-resizable" );
     106
     107                $.extend( this, {
     108                        _aspectRatio: !!( o.aspectRatio ),
     109                        aspectRatio: o.aspectRatio,
     110                        originalElement: this.element,
     111                        _proportionallyResizeElements: [],
     112                        _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
     113                } );
     114
     115                // Wrap the element if it cannot hold child nodes
     116                if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
     117
     118                        this.element.wrap(
     119                                $( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( {
     120                                        position: this.element.css( "position" ),
     121                                        width: this.element.outerWidth(),
     122                                        height: this.element.outerHeight(),
     123                                        top: this.element.css( "top" ),
     124                                        left: this.element.css( "left" )
     125                                } )
     126                        );
     127
     128                        this.element = this.element.parent().data(
     129                                "ui-resizable", this.element.resizable( "instance" )
     130                        );
     131
     132                        this.elementIsWrapper = true;
     133
     134                        margins = {
     135                                marginTop: this.originalElement.css( "marginTop" ),
     136                                marginRight: this.originalElement.css( "marginRight" ),
     137                                marginBottom: this.originalElement.css( "marginBottom" ),
     138                                marginLeft: this.originalElement.css( "marginLeft" )
     139                        };
     140
     141                        this.element.css( margins );
     142                        this.originalElement.css( "margin", 0 );
     143
     144                        // support: Safari
     145                        // Prevent Safari textarea resize
     146                        this.originalResizeStyle = this.originalElement.css( "resize" );
     147                        this.originalElement.css( "resize", "none" );
     148
     149                        this._proportionallyResizeElements.push( this.originalElement.css( {
     150                                position: "static",
     151                                zoom: 1,
     152                                display: "block"
     153                        } ) );
     154
     155                        // Support: IE9
     156                        // avoid IE jump (hard set the margin)
     157                        this.originalElement.css( margins );
     158
     159                        this._proportionallyResize();
     160                }
     161
     162                this._setupHandles();
     163
     164                if ( o.autoHide ) {
     165                        $( this.element )
     166                                .on( "mouseenter", function() {
     167                                        if ( o.disabled ) {
     168                                                return;
     169                                        }
     170                                        that._removeClass( "ui-resizable-autohide" );
     171                                        that._handles.show();
     172                                } )
     173                                .on( "mouseleave", function() {
     174                                        if ( o.disabled ) {
     175                                                return;
     176                                        }
     177                                        if ( !that.resizing ) {
     178                                                that._addClass( "ui-resizable-autohide" );
     179                                                that._handles.hide();
     180                                        }
     181                                } );
     182                }
     183
     184                this._mouseInit();
     185        },
     186
     187        _destroy: function() {
     188
     189                this._mouseDestroy();
     190
     191                var wrapper,
     192                        _destroy = function( exp ) {
     193                                $( exp )
     194                                        .removeData( "resizable" )
     195                                        .removeData( "ui-resizable" )
     196                                        .off( ".resizable" )
     197                                        .find( ".ui-resizable-handle" )
     198                                                .remove();
     199                        };
     200
     201                // TODO: Unwrap at same DOM position
     202                if ( this.elementIsWrapper ) {
     203                        _destroy( this.element );
     204                        wrapper = this.element;
     205                        this.originalElement.css( {
     206                                position: wrapper.css( "position" ),
     207                                width: wrapper.outerWidth(),
     208                                height: wrapper.outerHeight(),
     209                                top: wrapper.css( "top" ),
     210                                left: wrapper.css( "left" )
     211                        } ).insertAfter( wrapper );
     212                        wrapper.remove();
     213                }
     214
     215                this.originalElement.css( "resize", this.originalResizeStyle );
     216                _destroy( this.originalElement );
     217
     218                return this;
     219        },
     220
     221        _setOption: function( key, value ) {
     222                this._super( key, value );
     223
     224                switch ( key ) {
     225                case "handles":
     226                        this._removeHandles();
     227                        this._setupHandles();
     228                        break;
     229                default:
     230                        break;
     231                }
     232        },
     233
     234        _setupHandles: function() {
     235                var o = this.options, handle, i, n, hname, axis, that = this;
     236                this.handles = o.handles ||
     237                        ( !$( ".ui-resizable-handle", this.element ).length ?
     238                                "e,s,se" : {
     239                                        n: ".ui-resizable-n",
     240                                        e: ".ui-resizable-e",
     241                                        s: ".ui-resizable-s",
     242                                        w: ".ui-resizable-w",
     243                                        se: ".ui-resizable-se",
     244                                        sw: ".ui-resizable-sw",
     245                                        ne: ".ui-resizable-ne",
     246                                        nw: ".ui-resizable-nw"
     247                                } );
     248
     249                this._handles = $();
     250                if ( this.handles.constructor === String ) {
     251
     252                        if ( this.handles === "all" ) {
     253                                this.handles = "n,e,s,w,se,sw,ne,nw";
     254                        }
     255
     256                        n = this.handles.split( "," );
     257                        this.handles = {};
     258
     259                        for ( i = 0; i < n.length; i++ ) {
     260
     261                                handle = $.trim( n[ i ] );
     262                                hname = "ui-resizable-" + handle;
     263                                axis = $( "<div>" );
     264                                this._addClass( axis, "ui-resizable-handle " + hname );
     265
     266                                axis.css( { zIndex: o.zIndex } );
     267
     268                                this.handles[ handle ] = ".ui-resizable-" + handle;
     269                                this.element.append( axis );
     270                        }
     271
     272                }
     273
     274                this._renderAxis = function( target ) {
     275
     276                        var i, axis, padPos, padWrapper;
     277
     278                        target = target || this.element;
     279
     280                        for ( i in this.handles ) {
     281
     282                                if ( this.handles[ i ].constructor === String ) {
     283                                        this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
     284                                } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
     285                                        this.handles[ i ] = $( this.handles[ i ] );
     286                                        this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
     287                                }
     288
     289                                if ( this.elementIsWrapper &&
     290                                                this.originalElement[ 0 ]
     291                                                        .nodeName
     292                                                        .match( /^(textarea|input|select|button)$/i ) ) {
     293                                        axis = $( this.handles[ i ], this.element );
     294
     295                                        padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
     296                                                axis.outerHeight() :
     297                                                axis.outerWidth();
     298
     299                                        padPos = [ "padding",
     300                                                /ne|nw|n/.test( i ) ? "Top" :
     301                                                /se|sw|s/.test( i ) ? "Bottom" :
     302                                                /^e$/.test( i ) ? "Right" : "Left" ].join( "" );
     303
     304                                        target.css( padPos, padWrapper );
     305
     306                                        this._proportionallyResize();
     307                                }
     308
     309                                this._handles = this._handles.add( this.handles[ i ] );
     310                        }
     311                };
     312
     313                // TODO: make renderAxis a prototype function
     314                this._renderAxis( this.element );
     315
     316                this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
     317                this._handles.disableSelection();
     318
     319                this._handles.on( "mouseover", function() {
     320                        if ( !that.resizing ) {
     321                                if ( this.className ) {
     322                                        axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
     323                                }
     324                                that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
     325                        }
     326                } );
     327
     328                if ( o.autoHide ) {
     329                        this._handles.hide();
     330                        this._addClass( "ui-resizable-autohide" );
     331                }
     332        },
     333
     334        _removeHandles: function() {
     335                this._handles.remove();
     336        },
     337
     338        _mouseCapture: function( event ) {
     339                var i, handle,
     340                        capture = false;
     341
     342                for ( i in this.handles ) {
     343                        handle = $( this.handles[ i ] )[ 0 ];
     344                        if ( handle === event.target || $.contains( handle, event.target ) ) {
     345                                capture = true;
     346                        }
     347                }
     348
     349                return !this.options.disabled && capture;
     350        },
     351
     352        _mouseStart: function( event ) {
     353
     354                var curleft, curtop, cursor,
     355                        o = this.options,
     356                        el = this.element;
     357
     358                this.resizing = true;
     359
     360                this._renderProxy();
     361
     362                curleft = this._num( this.helper.css( "left" ) );
     363                curtop = this._num( this.helper.css( "top" ) );
     364
     365                if ( o.containment ) {
     366                        curleft += $( o.containment ).scrollLeft() || 0;
     367                        curtop += $( o.containment ).scrollTop() || 0;
     368                }
     369
     370                this.offset = this.helper.offset();
     371                this.position = { left: curleft, top: curtop };
     372
     373                this.size = this._helper ? {
     374                                width: this.helper.width(),
     375                                height: this.helper.height()
     376                        } : {
     377                                width: el.width(),
     378                                height: el.height()
     379                        };
     380
     381                this.originalSize = this._helper ? {
     382                                width: el.outerWidth(),
     383                                height: el.outerHeight()
     384                        } : {
     385                                width: el.width(),
     386                                height: el.height()
     387                        };
     388
     389                this.sizeDiff = {
     390                        width: el.outerWidth() - el.width(),
     391                        height: el.outerHeight() - el.height()
     392                };
     393
     394                this.originalPosition = { left: curleft, top: curtop };
     395                this.originalMousePosition = { left: event.pageX, top: event.pageY };
     396
     397                this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
     398                        o.aspectRatio :
     399                        ( ( this.originalSize.width / this.originalSize.height ) || 1 );
     400
     401                cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
     402                $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
     403
     404                this._addClass( "ui-resizable-resizing" );
     405                this._propagate( "start", event );
     406                return true;
     407        },
     408
     409        _mouseDrag: function( event ) {
     410
     411                var data, props,
     412                        smp = this.originalMousePosition,
     413                        a = this.axis,
     414                        dx = ( event.pageX - smp.left ) || 0,
     415                        dy = ( event.pageY - smp.top ) || 0,
     416                        trigger = this._change[ a ];
     417
     418                this._updatePrevProperties();
     419
     420                if ( !trigger ) {
     421                        return false;
     422                }
     423
     424                data = trigger.apply( this, [ event, dx, dy ] );
     425
     426                this._updateVirtualBoundaries( event.shiftKey );
     427                if ( this._aspectRatio || event.shiftKey ) {
     428                        data = this._updateRatio( data, event );
     429                }
     430
     431                data = this._respectSize( data, event );
     432
     433                this._updateCache( data );
     434
     435                this._propagate( "resize", event );
     436
     437                props = this._applyChanges();
     438
     439                if ( !this._helper && this._proportionallyResizeElements.length ) {
     440                        this._proportionallyResize();
     441                }
     442
     443                if ( !$.isEmptyObject( props ) ) {
     444                        this._updatePrevProperties();
     445                        this._trigger( "resize", event, this.ui() );
     446                        this._applyChanges();
     447                }
     448
     449                return false;
     450        },
     451
     452        _mouseStop: function( event ) {
     453
     454                this.resizing = false;
     455                var pr, ista, soffseth, soffsetw, s, left, top,
     456                        o = this.options, that = this;
     457
     458                if ( this._helper ) {
     459
     460                        pr = this._proportionallyResizeElements;
     461                        ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
     462                        soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
     463                        soffsetw = ista ? 0 : that.sizeDiff.width;
     464
     465                        s = {
     466                                width: ( that.helper.width()  - soffsetw ),
     467                                height: ( that.helper.height() - soffseth )
     468                        };
     469                        left = ( parseFloat( that.element.css( "left" ) ) +
     470                                ( that.position.left - that.originalPosition.left ) ) || null;
     471                        top = ( parseFloat( that.element.css( "top" ) ) +
     472                                ( that.position.top - that.originalPosition.top ) ) || null;
     473
     474                        if ( !o.animate ) {
     475                                this.element.css( $.extend( s, { top: top, left: left } ) );
     476                        }
     477
     478                        that.helper.height( that.size.height );
     479                        that.helper.width( that.size.width );
     480
     481                        if ( this._helper && !o.animate ) {
     482                                this._proportionallyResize();
     483                        }
     484                }
     485
     486                $( "body" ).css( "cursor", "auto" );
     487
     488                this._removeClass( "ui-resizable-resizing" );
     489
     490                this._propagate( "stop", event );
     491
     492                if ( this._helper ) {
     493                        this.helper.remove();
     494                }
     495
     496                return false;
     497
     498        },
     499
     500        _updatePrevProperties: function() {
     501                this.prevPosition = {
     502                        top: this.position.top,
     503                        left: this.position.left
     504                };
     505                this.prevSize = {
     506                        width: this.size.width,
     507                        height: this.size.height
     508                };
     509        },
     510
     511        _applyChanges: function() {
     512                var props = {};
     513
     514                if ( this.position.top !== this.prevPosition.top ) {
     515                        props.top = this.position.top + "px";
     516                }
     517                if ( this.position.left !== this.prevPosition.left ) {
     518                        props.left = this.position.left + "px";
     519                }
     520                if ( this.size.width !== this.prevSize.width ) {
     521                        props.width = this.size.width + "px";
     522                }
     523                if ( this.size.height !== this.prevSize.height ) {
     524                        props.height = this.size.height + "px";
     525                }
     526
     527                this.helper.css( props );
     528
     529                return props;
     530        },
     531
     532        _updateVirtualBoundaries: function( forceAspectRatio ) {
     533                var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
     534                        o = this.options;
     535
     536                b = {
     537                        minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
     538                        maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
     539                        minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
     540                        maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
     541                };
     542
     543                if ( this._aspectRatio || forceAspectRatio ) {
     544                        pMinWidth = b.minHeight * this.aspectRatio;
     545                        pMinHeight = b.minWidth / this.aspectRatio;
     546                        pMaxWidth = b.maxHeight * this.aspectRatio;
     547                        pMaxHeight = b.maxWidth / this.aspectRatio;
     548
     549                        if ( pMinWidth > b.minWidth ) {
     550                                b.minWidth = pMinWidth;
     551                        }
     552                        if ( pMinHeight > b.minHeight ) {
     553                                b.minHeight = pMinHeight;
     554                        }
     555                        if ( pMaxWidth < b.maxWidth ) {
     556                                b.maxWidth = pMaxWidth;
     557                        }
     558                        if ( pMaxHeight < b.maxHeight ) {
     559                                b.maxHeight = pMaxHeight;
     560                        }
     561                }
     562                this._vBoundaries = b;
     563        },
     564
     565        _updateCache: function( data ) {
     566                this.offset = this.helper.offset();
     567                if ( this._isNumber( data.left ) ) {
     568                        this.position.left = data.left;
     569                }
     570                if ( this._isNumber( data.top ) ) {
     571                        this.position.top = data.top;
     572                }
     573                if ( this._isNumber( data.height ) ) {
     574                        this.size.height = data.height;
     575                }
     576                if ( this._isNumber( data.width ) ) {
     577                        this.size.width = data.width;
     578                }
     579        },
     580
     581        _updateRatio: function( data ) {
     582
     583                var cpos = this.position,
     584                        csize = this.size,
     585                        a = this.axis;
     586
     587                if ( this._isNumber( data.height ) ) {
     588                        data.width = ( data.height * this.aspectRatio );
     589                } else if ( this._isNumber( data.width ) ) {
     590                        data.height = ( data.width / this.aspectRatio );
     591                }
     592
     593                if ( a === "sw" ) {
     594                        data.left = cpos.left + ( csize.width - data.width );
     595                        data.top = null;
     596                }
     597                if ( a === "nw" ) {
     598                        data.top = cpos.top + ( csize.height - data.height );
     599                        data.left = cpos.left + ( csize.width - data.width );
     600                }
     601
     602                return data;
     603        },
     604
     605        _respectSize: function( data ) {
     606
     607                var o = this._vBoundaries,
     608                        a = this.axis,
     609                        ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
     610                        ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
     611                        isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
     612                        isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
     613                        dw = this.originalPosition.left + this.originalSize.width,
     614                        dh = this.originalPosition.top + this.originalSize.height,
     615                        cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
     616                if ( isminw ) {
     617                        data.width = o.minWidth;
     618                }
     619                if ( isminh ) {
     620                        data.height = o.minHeight;
     621                }
     622                if ( ismaxw ) {
     623                        data.width = o.maxWidth;
     624                }
     625                if ( ismaxh ) {
     626                        data.height = o.maxHeight;
     627                }
     628
     629                if ( isminw && cw ) {
     630                        data.left = dw - o.minWidth;
     631                }
     632                if ( ismaxw && cw ) {
     633                        data.left = dw - o.maxWidth;
     634                }
     635                if ( isminh && ch ) {
     636                        data.top = dh - o.minHeight;
     637                }
     638                if ( ismaxh && ch ) {
     639                        data.top = dh - o.maxHeight;
     640                }
     641
     642                // Fixing jump error on top/left - bug #2330
     643                if ( !data.width && !data.height && !data.left && data.top ) {
     644                        data.top = null;
     645                } else if ( !data.width && !data.height && !data.top && data.left ) {
     646                        data.left = null;
     647                }
     648
     649                return data;
     650        },
     651
     652        _getPaddingPlusBorderDimensions: function( element ) {
     653                var i = 0,
     654                        widths = [],
     655                        borders = [
     656                                element.css( "borderTopWidth" ),
     657                                element.css( "borderRightWidth" ),
     658                                element.css( "borderBottomWidth" ),
     659                                element.css( "borderLeftWidth" )
     660                        ],
     661                        paddings = [
     662                                element.css( "paddingTop" ),
     663                                element.css( "paddingRight" ),
     664                                element.css( "paddingBottom" ),
     665                                element.css( "paddingLeft" )
     666                        ];
     667
     668                for ( ; i < 4; i++ ) {
     669                        widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
     670                        widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
     671                }
     672
     673                return {
     674                        height: widths[ 0 ] + widths[ 2 ],
     675                        width: widths[ 1 ] + widths[ 3 ]
     676                };
     677        },
     678
     679        _proportionallyResize: function() {
     680
     681                if ( !this._proportionallyResizeElements.length ) {
     682                        return;
     683                }
     684
     685                var prel,
     686                        i = 0,
     687                        element = this.helper || this.element;
     688
     689                for ( ; i < this._proportionallyResizeElements.length; i++ ) {
     690
     691                        prel = this._proportionallyResizeElements[ i ];
     692
     693                        // TODO: Seems like a bug to cache this.outerDimensions
     694                        // considering that we are in a loop.
     695                        if ( !this.outerDimensions ) {
     696                                this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
     697                        }
     698
     699                        prel.css( {
     700                                height: ( element.height() - this.outerDimensions.height ) || 0,
     701                                width: ( element.width() - this.outerDimensions.width ) || 0
     702                        } );
     703
     704                }
     705
     706        },
     707
     708        _renderProxy: function() {
     709
     710                var el = this.element, o = this.options;
     711                this.elementOffset = el.offset();
     712
     713                if ( this._helper ) {
     714
     715                        this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" );
     716
     717                        this._addClass( this.helper, this._helper );
     718                        this.helper.css( {
     719                                width: this.element.outerWidth(),
     720                                height: this.element.outerHeight(),
     721                                position: "absolute",
     722                                left: this.elementOffset.left + "px",
     723                                top: this.elementOffset.top + "px",
     724                                zIndex: ++o.zIndex //TODO: Don't modify option
     725                        } );
     726
     727                        this.helper
     728                                .appendTo( "body" )
     729                                .disableSelection();
     730
     731                } else {
     732                        this.helper = this.element;
     733                }
     734
     735        },
     736
     737        _change: {
     738                e: function( event, dx ) {
     739                        return { width: this.originalSize.width + dx };
     740                },
     741                w: function( event, dx ) {
     742                        var cs = this.originalSize, sp = this.originalPosition;
     743                        return { left: sp.left + dx, width: cs.width - dx };
     744                },
     745                n: function( event, dx, dy ) {
     746                        var cs = this.originalSize, sp = this.originalPosition;
     747                        return { top: sp.top + dy, height: cs.height - dy };
     748                },
     749                s: function( event, dx, dy ) {
     750                        return { height: this.originalSize.height + dy };
     751                },
     752                se: function( event, dx, dy ) {
     753                        return $.extend( this._change.s.apply( this, arguments ),
     754                                this._change.e.apply( this, [ event, dx, dy ] ) );
     755                },
     756                sw: function( event, dx, dy ) {
     757                        return $.extend( this._change.s.apply( this, arguments ),
     758                                this._change.w.apply( this, [ event, dx, dy ] ) );
     759                },
     760                ne: function( event, dx, dy ) {
     761                        return $.extend( this._change.n.apply( this, arguments ),
     762                                this._change.e.apply( this, [ event, dx, dy ] ) );
     763                },
     764                nw: function( event, dx, dy ) {
     765                        return $.extend( this._change.n.apply( this, arguments ),
     766                                this._change.w.apply( this, [ event, dx, dy ] ) );
     767                }
     768        },
     769
     770        _propagate: function( n, event ) {
     771                $.ui.plugin.call( this, n, [ event, this.ui() ] );
     772                ( n !== "resize" && this._trigger( n, event, this.ui() ) );
     773        },
     774
     775        plugins: {},
     776
     777        ui: function() {
     778                return {
     779                        originalElement: this.originalElement,
     780                        element: this.element,
     781                        helper: this.helper,
     782                        position: this.position,
     783                        size: this.size,
     784                        originalSize: this.originalSize,
     785                        originalPosition: this.originalPosition
     786                };
     787        }
     788
     789} );
     790
     791/*
     792 * Resizable Extensions
     793 */
     794
     795$.ui.plugin.add( "resizable", "animate", {
     796
     797        stop: function( event ) {
     798                var that = $( this ).resizable( "instance" ),
     799                        o = that.options,
     800                        pr = that._proportionallyResizeElements,
     801                        ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
     802                        soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
     803                        soffsetw = ista ? 0 : that.sizeDiff.width,
     804                        style = {
     805                                width: ( that.size.width - soffsetw ),
     806                                height: ( that.size.height - soffseth )
     807                        },
     808                        left = ( parseFloat( that.element.css( "left" ) ) +
     809                                ( that.position.left - that.originalPosition.left ) ) || null,
     810                        top = ( parseFloat( that.element.css( "top" ) ) +
     811                                ( that.position.top - that.originalPosition.top ) ) || null;
     812
     813                that.element.animate(
     814                        $.extend( style, top && left ? { top: top, left: left } : {} ), {
     815                                duration: o.animateDuration,
     816                                easing: o.animateEasing,
     817                                step: function() {
     818
     819                                        var data = {
     820                                                width: parseFloat( that.element.css( "width" ) ),
     821                                                height: parseFloat( that.element.css( "height" ) ),
     822                                                top: parseFloat( that.element.css( "top" ) ),
     823                                                left: parseFloat( that.element.css( "left" ) )
     824                                        };
     825
     826                                        if ( pr && pr.length ) {
     827                                                $( pr[ 0 ] ).css( { width: data.width, height: data.height } );
     828                                        }
     829
     830                                        // Propagating resize, and updating values for each animation step
     831                                        that._updateCache( data );
     832                                        that._propagate( "resize", event );
     833
     834                                }
     835                        }
     836                );
     837        }
     838
     839} );
     840
     841$.ui.plugin.add( "resizable", "containment", {
     842
     843        start: function() {
     844                var element, p, co, ch, cw, width, height,
     845                        that = $( this ).resizable( "instance" ),
     846                        o = that.options,
     847                        el = that.element,
     848                        oc = o.containment,
     849                        ce = ( oc instanceof $ ) ?
     850                                oc.get( 0 ) :
     851                                ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
     852
     853                if ( !ce ) {
     854                        return;
     855                }
     856
     857                that.containerElement = $( ce );
     858
     859                if ( /document/.test( oc ) || oc === document ) {
     860                        that.containerOffset = {
     861                                left: 0,
     862                                top: 0
     863                        };
     864                        that.containerPosition = {
     865                                left: 0,
     866                                top: 0
     867                        };
     868
     869                        that.parentData = {
     870                                element: $( document ),
     871                                left: 0,
     872                                top: 0,
     873                                width: $( document ).width(),
     874                                height: $( document ).height() || document.body.parentNode.scrollHeight
     875                        };
     876                } else {
     877                        element = $( ce );
     878                        p = [];
     879                        $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
     880                                p[ i ] = that._num( element.css( "padding" + name ) );
     881                        } );
     882
     883                        that.containerOffset = element.offset();
     884                        that.containerPosition = element.position();
     885                        that.containerSize = {
     886                                height: ( element.innerHeight() - p[ 3 ] ),
     887                                width: ( element.innerWidth() - p[ 1 ] )
     888                        };
     889
     890                        co = that.containerOffset;
     891                        ch = that.containerSize.height;
     892                        cw = that.containerSize.width;
     893                        width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
     894                        height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
     895
     896                        that.parentData = {
     897                                element: ce,
     898                                left: co.left,
     899                                top: co.top,
     900                                width: width,
     901                                height: height
     902                        };
     903                }
     904        },
     905
     906        resize: function( event ) {
     907                var woset, hoset, isParent, isOffsetRelative,
     908                        that = $( this ).resizable( "instance" ),
     909                        o = that.options,
     910                        co = that.containerOffset,
     911                        cp = that.position,
     912                        pRatio = that._aspectRatio || event.shiftKey,
     913                        cop = {
     914                                top: 0,
     915                                left: 0
     916                        },
     917                        ce = that.containerElement,
     918                        continueResize = true;
     919
     920                if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
     921                        cop = co;
     922                }
     923
     924                if ( cp.left < ( that._helper ? co.left : 0 ) ) {
     925                        that.size.width = that.size.width +
     926                                ( that._helper ?
     927                                        ( that.position.left - co.left ) :
     928                                        ( that.position.left - cop.left ) );
     929
     930                        if ( pRatio ) {
     931                                that.size.height = that.size.width / that.aspectRatio;
     932                                continueResize = false;
     933                        }
     934                        that.position.left = o.helper ? co.left : 0;
     935                }
     936
     937                if ( cp.top < ( that._helper ? co.top : 0 ) ) {
     938                        that.size.height = that.size.height +
     939                                ( that._helper ?
     940                                        ( that.position.top - co.top ) :
     941                                        that.position.top );
     942
     943                        if ( pRatio ) {
     944                                that.size.width = that.size.height * that.aspectRatio;
     945                                continueResize = false;
     946                        }
     947                        that.position.top = that._helper ? co.top : 0;
     948                }
     949
     950                isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
     951                isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
     952
     953                if ( isParent && isOffsetRelative ) {
     954                        that.offset.left = that.parentData.left + that.position.left;
     955                        that.offset.top = that.parentData.top + that.position.top;
     956                } else {
     957                        that.offset.left = that.element.offset().left;
     958                        that.offset.top = that.element.offset().top;
     959                }
     960
     961                woset = Math.abs( that.sizeDiff.width +
     962                        ( that._helper ?
     963                                that.offset.left - cop.left :
     964                                ( that.offset.left - co.left ) ) );
     965
     966                hoset = Math.abs( that.sizeDiff.height +
     967                        ( that._helper ?
     968                                that.offset.top - cop.top :
     969                                ( that.offset.top - co.top ) ) );
     970
     971                if ( woset + that.size.width >= that.parentData.width ) {
     972                        that.size.width = that.parentData.width - woset;
     973                        if ( pRatio ) {
     974                                that.size.height = that.size.width / that.aspectRatio;
     975                                continueResize = false;
     976                        }
     977                }
     978
     979                if ( hoset + that.size.height >= that.parentData.height ) {
     980                        that.size.height = that.parentData.height - hoset;
     981                        if ( pRatio ) {
     982                                that.size.width = that.size.height * that.aspectRatio;
     983                                continueResize = false;
     984                        }
     985                }
     986
     987                if ( !continueResize ) {
     988                        that.position.left = that.prevPosition.left;
     989                        that.position.top = that.prevPosition.top;
     990                        that.size.width = that.prevSize.width;
     991                        that.size.height = that.prevSize.height;
     992                }
     993        },
     994
     995        stop: function() {
     996                var that = $( this ).resizable( "instance" ),
     997                        o = that.options,
     998                        co = that.containerOffset,
     999                        cop = that.containerPosition,
     1000                        ce = that.containerElement,
     1001                        helper = $( that.helper ),
     1002                        ho = helper.offset(),
     1003                        w = helper.outerWidth() - that.sizeDiff.width,
     1004                        h = helper.outerHeight() - that.sizeDiff.height;
     1005
     1006                if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
     1007                        $( this ).css( {
     1008                                left: ho.left - cop.left - co.left,
     1009                                width: w,
     1010                                height: h
     1011                        } );
     1012                }
     1013
     1014                if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
     1015                        $( this ).css( {
     1016                                left: ho.left - cop.left - co.left,
     1017                                width: w,
     1018                                height: h
     1019                        } );
     1020                }
     1021        }
     1022} );
     1023
     1024$.ui.plugin.add( "resizable", "alsoResize", {
     1025
     1026        start: function() {
     1027                var that = $( this ).resizable( "instance" ),
     1028                        o = that.options;
     1029
     1030                $( o.alsoResize ).each( function() {
     1031                        var el = $( this );
     1032                        el.data( "ui-resizable-alsoresize", {
     1033                                width: parseFloat( el.width() ), height: parseFloat( el.height() ),
     1034                                left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
     1035                        } );
     1036                } );
     1037        },
     1038
     1039        resize: function( event, ui ) {
     1040                var that = $( this ).resizable( "instance" ),
     1041                        o = that.options,
     1042                        os = that.originalSize,
     1043                        op = that.originalPosition,
     1044                        delta = {
     1045                                height: ( that.size.height - os.height ) || 0,
     1046                                width: ( that.size.width - os.width ) || 0,
     1047                                top: ( that.position.top - op.top ) || 0,
     1048                                left: ( that.position.left - op.left ) || 0
     1049                        };
     1050
     1051                        $( o.alsoResize ).each( function() {
     1052                                var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
     1053                                        css = el.parents( ui.originalElement[ 0 ] ).length ?
     1054                                                        [ "width", "height" ] :
     1055                                                        [ "width", "height", "top", "left" ];
     1056
     1057                                $.each( css, function( i, prop ) {
     1058                                        var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
     1059                                        if ( sum && sum >= 0 ) {
     1060                                                style[ prop ] = sum || null;
     1061                                        }
     1062                                } );
     1063
     1064                                el.css( style );
     1065                        } );
     1066        },
     1067
     1068        stop: function() {
     1069                $( this ).removeData( "ui-resizable-alsoresize" );
     1070        }
     1071} );
     1072
     1073$.ui.plugin.add( "resizable", "ghost", {
     1074
     1075        start: function() {
     1076
     1077                var that = $( this ).resizable( "instance" ), cs = that.size;
     1078
     1079                that.ghost = that.originalElement.clone();
     1080                that.ghost.css( {
     1081                        opacity: 0.25,
     1082                        display: "block",
     1083                        position: "relative",
     1084                        height: cs.height,
     1085                        width: cs.width,
     1086                        margin: 0,
     1087                        left: 0,
     1088                        top: 0
     1089                } );
     1090
     1091                that._addClass( that.ghost, "ui-resizable-ghost" );
     1092
     1093                // DEPRECATED
     1094                // TODO: remove after 1.12
     1095                if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
     1096
     1097                        // Ghost option
     1098                        that.ghost.addClass( this.options.ghost );
     1099                }
     1100
     1101                that.ghost.appendTo( that.helper );
     1102
     1103        },
     1104
     1105        resize: function() {
     1106                var that = $( this ).resizable( "instance" );
     1107                if ( that.ghost ) {
     1108                        that.ghost.css( {
     1109                                position: "relative",
     1110                                height: that.size.height,
     1111                                width: that.size.width
     1112                        } );
     1113                }
     1114        },
     1115
     1116        stop: function() {
     1117                var that = $( this ).resizable( "instance" );
     1118                if ( that.ghost && that.helper ) {
     1119                        that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
     1120                }
     1121        }
     1122
     1123} );
     1124
     1125$.ui.plugin.add( "resizable", "grid", {
     1126
     1127        resize: function() {
     1128                var outerDimensions,
     1129                        that = $( this ).resizable( "instance" ),
     1130                        o = that.options,
     1131                        cs = that.size,
     1132                        os = that.originalSize,
     1133                        op = that.originalPosition,
     1134                        a = that.axis,
     1135                        grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
     1136                        gridX = ( grid[ 0 ] || 1 ),
     1137                        gridY = ( grid[ 1 ] || 1 ),
     1138                        ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
     1139                        oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
     1140                        newWidth = os.width + ox,
     1141                        newHeight = os.height + oy,
     1142                        isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
     1143                        isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
     1144                        isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
     1145                        isMinHeight = o.minHeight && ( o.minHeight > newHeight );
     1146
     1147                o.grid = grid;
     1148
     1149                if ( isMinWidth ) {
     1150                        newWidth += gridX;
     1151                }
     1152                if ( isMinHeight ) {
     1153                        newHeight += gridY;
     1154                }
     1155                if ( isMaxWidth ) {
     1156                        newWidth -= gridX;
     1157                }
     1158                if ( isMaxHeight ) {
     1159                        newHeight -= gridY;
     1160                }
     1161
     1162                if ( /^(se|s|e)$/.test( a ) ) {
     1163                        that.size.width = newWidth;
     1164                        that.size.height = newHeight;
     1165                } else if ( /^(ne)$/.test( a ) ) {
     1166                        that.size.width = newWidth;
     1167                        that.size.height = newHeight;
     1168                        that.position.top = op.top - oy;
     1169                } else if ( /^(sw)$/.test( a ) ) {
     1170                        that.size.width = newWidth;
     1171                        that.size.height = newHeight;
     1172                        that.position.left = op.left - ox;
     1173                } else {
     1174                        if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
     1175                                outerDimensions = that._getPaddingPlusBorderDimensions( this );
     1176                        }
     1177
     1178                        if ( newHeight - gridY > 0 ) {
     1179                                that.size.height = newHeight;
     1180                                that.position.top = op.top - oy;
     1181                        } else {
     1182                                newHeight = gridY - outerDimensions.height;
     1183                                that.size.height = newHeight;
     1184                                that.position.top = op.top + os.height - newHeight;
     1185                        }
     1186                        if ( newWidth - gridX > 0 ) {
     1187                                that.size.width = newWidth;
     1188                                that.position.left = op.left - ox;
     1189                        } else {
     1190                                newWidth = gridX - outerDimensions.width;
     1191                                that.size.width = newWidth;
     1192                                that.position.left = op.left + os.width - newWidth;
     1193                        }
     1194                }
     1195        }
     1196
     1197} );
     1198
     1199return $.ui.resizable;
     1200
     1201} ) );
  • src/js/_enqueues/vendor/jquery/ui/selectable.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/resizable.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Selectable 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Selectable
     11//>>group: Interactions
     12//>>description: Allows groups of elements to be selected with the mouse.
     13//>>docs: http://api.jqueryui.com/selectable/
     14//>>demos: http://jqueryui.com/selectable/
     15//>>css.structure: ../../themes/base/selectable.css
     16
     17( function( factory ) {
     18        if ( typeof define === "function" && define.amd ) {
     19
     20                // AMD. Register as an anonymous module.
     21                define( [
     22                        "jquery",
     23                        "./mouse",
     24                        "./version",
     25                        "./widget"
     26                ], factory );
     27        } else {
     28
     29                // Browser globals
     30                factory( jQuery );
     31        }
     32}( function( $ ) {
     33
     34return $.widget( "ui.selectable", $.ui.mouse, {
     35        version: "1.12.1",
     36        options: {
     37                appendTo: "body",
     38                autoRefresh: true,
     39                distance: 0,
     40                filter: "*",
     41                tolerance: "touch",
     42
     43                // Callbacks
     44                selected: null,
     45                selecting: null,
     46                start: null,
     47                stop: null,
     48                unselected: null,
     49                unselecting: null
     50        },
     51        _create: function() {
     52                var that = this;
     53
     54                this._addClass( "ui-selectable" );
     55
     56                this.dragged = false;
     57
     58                // Cache selectee children based on filter
     59                this.refresh = function() {
     60                        that.elementPos = $( that.element[ 0 ] ).offset();
     61                        that.selectees = $( that.options.filter, that.element[ 0 ] );
     62                        that._addClass( that.selectees, "ui-selectee" );
     63                        that.selectees.each( function() {
     64                                var $this = $( this ),
     65                                        selecteeOffset = $this.offset(),
     66                                        pos = {
     67                                                left: selecteeOffset.left - that.elementPos.left,
     68                                                top: selecteeOffset.top - that.elementPos.top
     69                                        };
     70                                $.data( this, "selectable-item", {
     71                                        element: this,
     72                                        $element: $this,
     73                                        left: pos.left,
     74                                        top: pos.top,
     75                                        right: pos.left + $this.outerWidth(),
     76                                        bottom: pos.top + $this.outerHeight(),
     77                                        startselected: false,
     78                                        selected: $this.hasClass( "ui-selected" ),
     79                                        selecting: $this.hasClass( "ui-selecting" ),
     80                                        unselecting: $this.hasClass( "ui-unselecting" )
     81                                } );
     82                        } );
     83                };
     84                this.refresh();
     85
     86                this._mouseInit();
     87
     88                this.helper = $( "<div>" );
     89                this._addClass( this.helper, "ui-selectable-helper" );
     90        },
     91
     92        _destroy: function() {
     93                this.selectees.removeData( "selectable-item" );
     94                this._mouseDestroy();
     95        },
     96
     97        _mouseStart: function( event ) {
     98                var that = this,
     99                        options = this.options;
     100
     101                this.opos = [ event.pageX, event.pageY ];
     102                this.elementPos = $( this.element[ 0 ] ).offset();
     103
     104                if ( this.options.disabled ) {
     105                        return;
     106                }
     107
     108                this.selectees = $( options.filter, this.element[ 0 ] );
     109
     110                this._trigger( "start", event );
     111
     112                $( options.appendTo ).append( this.helper );
     113
     114                // position helper (lasso)
     115                this.helper.css( {
     116                        "left": event.pageX,
     117                        "top": event.pageY,
     118                        "width": 0,
     119                        "height": 0
     120                } );
     121
     122                if ( options.autoRefresh ) {
     123                        this.refresh();
     124                }
     125
     126                this.selectees.filter( ".ui-selected" ).each( function() {
     127                        var selectee = $.data( this, "selectable-item" );
     128                        selectee.startselected = true;
     129                        if ( !event.metaKey && !event.ctrlKey ) {
     130                                that._removeClass( selectee.$element, "ui-selected" );
     131                                selectee.selected = false;
     132                                that._addClass( selectee.$element, "ui-unselecting" );
     133                                selectee.unselecting = true;
     134
     135                                // selectable UNSELECTING callback
     136                                that._trigger( "unselecting", event, {
     137                                        unselecting: selectee.element
     138                                } );
     139                        }
     140                } );
     141
     142                $( event.target ).parents().addBack().each( function() {
     143                        var doSelect,
     144                                selectee = $.data( this, "selectable-item" );
     145                        if ( selectee ) {
     146                                doSelect = ( !event.metaKey && !event.ctrlKey ) ||
     147                                        !selectee.$element.hasClass( "ui-selected" );
     148                                that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
     149                                        ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
     150                                selectee.unselecting = !doSelect;
     151                                selectee.selecting = doSelect;
     152                                selectee.selected = doSelect;
     153
     154                                // selectable (UN)SELECTING callback
     155                                if ( doSelect ) {
     156                                        that._trigger( "selecting", event, {
     157                                                selecting: selectee.element
     158                                        } );
     159                                } else {
     160                                        that._trigger( "unselecting", event, {
     161                                                unselecting: selectee.element
     162                                        } );
     163                                }
     164                                return false;
     165                        }
     166                } );
     167
     168        },
     169
     170        _mouseDrag: function( event ) {
     171
     172                this.dragged = true;
     173
     174                if ( this.options.disabled ) {
     175                        return;
     176                }
     177
     178                var tmp,
     179                        that = this,
     180                        options = this.options,
     181                        x1 = this.opos[ 0 ],
     182                        y1 = this.opos[ 1 ],
     183                        x2 = event.pageX,
     184                        y2 = event.pageY;
     185
     186                if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; }
     187                if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; }
     188                this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
     189
     190                this.selectees.each( function() {
     191                        var selectee = $.data( this, "selectable-item" ),
     192                                hit = false,
     193                                offset = {};
     194
     195                        //prevent helper from being selected if appendTo: selectable
     196                        if ( !selectee || selectee.element === that.element[ 0 ] ) {
     197                                return;
     198                        }
     199
     200                        offset.left   = selectee.left   + that.elementPos.left;
     201                        offset.right  = selectee.right  + that.elementPos.left;
     202                        offset.top    = selectee.top    + that.elementPos.top;
     203                        offset.bottom = selectee.bottom + that.elementPos.top;
     204
     205                        if ( options.tolerance === "touch" ) {
     206                                hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
     207                    offset.bottom < y1 ) );
     208                        } else if ( options.tolerance === "fit" ) {
     209                                hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
     210                    offset.bottom < y2 );
     211                        }
     212
     213                        if ( hit ) {
     214
     215                                // SELECT
     216                                if ( selectee.selected ) {
     217                                        that._removeClass( selectee.$element, "ui-selected" );
     218                                        selectee.selected = false;
     219                                }
     220                                if ( selectee.unselecting ) {
     221                                        that._removeClass( selectee.$element, "ui-unselecting" );
     222                                        selectee.unselecting = false;
     223                                }
     224                                if ( !selectee.selecting ) {
     225                                        that._addClass( selectee.$element, "ui-selecting" );
     226                                        selectee.selecting = true;
     227
     228                                        // selectable SELECTING callback
     229                                        that._trigger( "selecting", event, {
     230                                                selecting: selectee.element
     231                                        } );
     232                                }
     233                        } else {
     234
     235                                // UNSELECT
     236                                if ( selectee.selecting ) {
     237                                        if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
     238                                                that._removeClass( selectee.$element, "ui-selecting" );
     239                                                selectee.selecting = false;
     240                                                that._addClass( selectee.$element, "ui-selected" );
     241                                                selectee.selected = true;
     242                                        } else {
     243                                                that._removeClass( selectee.$element, "ui-selecting" );
     244                                                selectee.selecting = false;
     245                                                if ( selectee.startselected ) {
     246                                                        that._addClass( selectee.$element, "ui-unselecting" );
     247                                                        selectee.unselecting = true;
     248                                                }
     249
     250                                                // selectable UNSELECTING callback
     251                                                that._trigger( "unselecting", event, {
     252                                                        unselecting: selectee.element
     253                                                } );
     254                                        }
     255                                }
     256                                if ( selectee.selected ) {
     257                                        if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
     258                                                that._removeClass( selectee.$element, "ui-selected" );
     259                                                selectee.selected = false;
     260
     261                                                that._addClass( selectee.$element, "ui-unselecting" );
     262                                                selectee.unselecting = true;
     263
     264                                                // selectable UNSELECTING callback
     265                                                that._trigger( "unselecting", event, {
     266                                                        unselecting: selectee.element
     267                                                } );
     268                                        }
     269                                }
     270                        }
     271                } );
     272
     273                return false;
     274        },
     275
     276        _mouseStop: function( event ) {
     277                var that = this;
     278
     279                this.dragged = false;
     280
     281                $( ".ui-unselecting", this.element[ 0 ] ).each( function() {
     282                        var selectee = $.data( this, "selectable-item" );
     283                        that._removeClass( selectee.$element, "ui-unselecting" );
     284                        selectee.unselecting = false;
     285                        selectee.startselected = false;
     286                        that._trigger( "unselected", event, {
     287                                unselected: selectee.element
     288                        } );
     289                } );
     290                $( ".ui-selecting", this.element[ 0 ] ).each( function() {
     291                        var selectee = $.data( this, "selectable-item" );
     292                        that._removeClass( selectee.$element, "ui-selecting" )
     293                                ._addClass( selectee.$element, "ui-selected" );
     294                        selectee.selecting = false;
     295                        selectee.selected = true;
     296                        selectee.startselected = true;
     297                        that._trigger( "selected", event, {
     298                                selected: selectee.element
     299                        } );
     300                } );
     301                this._trigger( "stop", event );
     302
     303                this.helper.remove();
     304
     305                return false;
     306        }
     307
     308} );
     309
     310} ) );
  • src/js/_enqueues/vendor/jquery/ui/selectmenu.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/selectable.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Selectmenu 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Selectmenu
     11//>>group: Widgets
     12// jscs:disable maximumLineLength
     13//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
     14// jscs:enable maximumLineLength
     15//>>docs: http://api.jqueryui.com/selectmenu/
     16//>>demos: http://jqueryui.com/selectmenu/
     17//>>css.structure: ../../themes/base/core.css
     18//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
     19//>>css.theme: ../../themes/base/theme.css
     20
     21( function( factory ) {
     22        if ( typeof define === "function" && define.amd ) {
     23
     24                // AMD. Register as an anonymous module.
     25                define( [
     26                        "jquery",
     27                        "./menu",
     28                        "./escape-selector",
     29                        "./form-reset-mixin",
     30                        "./keycode",
     31                        "./labels",
     32                        "./position",
     33                        "./unique-id",
     34                        "./version",
     35                        "./widget"
     36                ], factory );
     37        } else {
     38
     39                // Browser globals
     40                factory( jQuery );
     41        }
     42}( function( $ ) {
     43
     44return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
     45        version: "1.12.1",
     46        defaultElement: "<select>",
     47        options: {
     48                appendTo: null,
     49                classes: {
     50                        "ui-selectmenu-button-open": "ui-corner-top",
     51                        "ui-selectmenu-button-closed": "ui-corner-all"
     52                },
     53                disabled: null,
     54                icons: {
     55                        button: "ui-icon-triangle-1-s"
     56                },
     57                position: {
     58                        my: "left top",
     59                        at: "left bottom",
     60                        collision: "none"
     61                },
     62                width: false,
     63
     64                // Callbacks
     65                change: null,
     66                close: null,
     67                focus: null,
     68                open: null,
     69                select: null
     70        },
     71
     72        _create: function() {
     73                var selectmenuId = this.element.uniqueId().attr( "id" );
     74                this.ids = {
     75                        element: selectmenuId,
     76                        button: selectmenuId + "-button",
     77                        menu: selectmenuId + "-menu"
     78                };
     79
     80                this._drawButton();
     81                this._drawMenu();
     82                this._bindFormResetHandler();
     83
     84                this._rendered = false;
     85                this.menuItems = $();
     86        },
     87
     88        _drawButton: function() {
     89                var icon,
     90                        that = this,
     91                        item = this._parseOption(
     92                                this.element.find( "option:selected" ),
     93                                this.element[ 0 ].selectedIndex
     94                        );
     95
     96                // Associate existing label with the new button
     97                this.labels = this.element.labels().attr( "for", this.ids.button );
     98                this._on( this.labels, {
     99                        click: function( event ) {
     100                                this.button.focus();
     101                                event.preventDefault();
     102                        }
     103                } );
     104
     105                // Hide original select element
     106                this.element.hide();
     107
     108                // Create button
     109                this.button = $( "<span>", {
     110                        tabindex: this.options.disabled ? -1 : 0,
     111                        id: this.ids.button,
     112                        role: "combobox",
     113                        "aria-expanded": "false",
     114                        "aria-autocomplete": "list",
     115                        "aria-owns": this.ids.menu,
     116                        "aria-haspopup": "true",
     117                        title: this.element.attr( "title" )
     118                } )
     119                        .insertAfter( this.element );
     120
     121                this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
     122                        "ui-button ui-widget" );
     123
     124                icon = $( "<span>" ).appendTo( this.button );
     125                this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
     126                this.buttonItem = this._renderButtonItem( item )
     127                        .appendTo( this.button );
     128
     129                if ( this.options.width !== false ) {
     130                        this._resizeButton();
     131                }
     132
     133                this._on( this.button, this._buttonEvents );
     134                this.button.one( "focusin", function() {
     135
     136                        // Delay rendering the menu items until the button receives focus.
     137                        // The menu may have already been rendered via a programmatic open.
     138                        if ( !that._rendered ) {
     139                                that._refreshMenu();
     140                        }
     141                } );
     142        },
     143
     144        _drawMenu: function() {
     145                var that = this;
     146
     147                // Create menu
     148                this.menu = $( "<ul>", {
     149                        "aria-hidden": "true",
     150                        "aria-labelledby": this.ids.button,
     151                        id: this.ids.menu
     152                } );
     153
     154                // Wrap menu
     155                this.menuWrap = $( "<div>" ).append( this.menu );
     156                this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
     157                this.menuWrap.appendTo( this._appendTo() );
     158
     159                // Initialize menu widget
     160                this.menuInstance = this.menu
     161                        .menu( {
     162                                classes: {
     163                                        "ui-menu": "ui-corner-bottom"
     164                                },
     165                                role: "listbox",
     166                                select: function( event, ui ) {
     167                                        event.preventDefault();
     168
     169                                        // Support: IE8
     170                                        // If the item was selected via a click, the text selection
     171                                        // will be destroyed in IE
     172                                        that._setSelection();
     173
     174                                        that._select( ui.item.data( "ui-selectmenu-item" ), event );
     175                                },
     176                                focus: function( event, ui ) {
     177                                        var item = ui.item.data( "ui-selectmenu-item" );
     178
     179                                        // Prevent inital focus from firing and check if its a newly focused item
     180                                        if ( that.focusIndex != null && item.index !== that.focusIndex ) {
     181                                                that._trigger( "focus", event, { item: item } );
     182                                                if ( !that.isOpen ) {
     183                                                        that._select( item, event );
     184                                                }
     185                                        }
     186                                        that.focusIndex = item.index;
     187
     188                                        that.button.attr( "aria-activedescendant",
     189                                                that.menuItems.eq( item.index ).attr( "id" ) );
     190                                }
     191                        } )
     192                        .menu( "instance" );
     193
     194                // Don't close the menu on mouseleave
     195                this.menuInstance._off( this.menu, "mouseleave" );
     196
     197                // Cancel the menu's collapseAll on document click
     198                this.menuInstance._closeOnDocumentClick = function() {
     199                        return false;
     200                };
     201
     202                // Selects often contain empty items, but never contain dividers
     203                this.menuInstance._isDivider = function() {
     204                        return false;
     205                };
     206        },
     207
     208        refresh: function() {
     209                this._refreshMenu();
     210                this.buttonItem.replaceWith(
     211                        this.buttonItem = this._renderButtonItem(
     212
     213                                // Fall back to an empty object in case there are no options
     214                                this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
     215                        )
     216                );
     217                if ( this.options.width === null ) {
     218                        this._resizeButton();
     219                }
     220        },
     221
     222        _refreshMenu: function() {
     223                var item,
     224                        options = this.element.find( "option" );
     225
     226                this.menu.empty();
     227
     228                this._parseOptions( options );
     229                this._renderMenu( this.menu, this.items );
     230
     231                this.menuInstance.refresh();
     232                this.menuItems = this.menu.find( "li" )
     233                        .not( ".ui-selectmenu-optgroup" )
     234                                .find( ".ui-menu-item-wrapper" );
     235
     236                this._rendered = true;
     237
     238                if ( !options.length ) {
     239                        return;
     240                }
     241
     242                item = this._getSelectedItem();
     243
     244                // Update the menu to have the correct item focused
     245                this.menuInstance.focus( null, item );
     246                this._setAria( item.data( "ui-selectmenu-item" ) );
     247
     248                // Set disabled state
     249                this._setOption( "disabled", this.element.prop( "disabled" ) );
     250        },
     251
     252        open: function( event ) {
     253                if ( this.options.disabled ) {
     254                        return;
     255                }
     256
     257                // If this is the first time the menu is being opened, render the items
     258                if ( !this._rendered ) {
     259                        this._refreshMenu();
     260                } else {
     261
     262                        // Menu clears focus on close, reset focus to selected item
     263                        this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
     264                        this.menuInstance.focus( null, this._getSelectedItem() );
     265                }
     266
     267                // If there are no options, don't open the menu
     268                if ( !this.menuItems.length ) {
     269                        return;
     270                }
     271
     272                this.isOpen = true;
     273                this._toggleAttr();
     274                this._resizeMenu();
     275                this._position();
     276
     277                this._on( this.document, this._documentClick );
     278
     279                this._trigger( "open", event );
     280        },
     281
     282        _position: function() {
     283                this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
     284        },
     285
     286        close: function( event ) {
     287                if ( !this.isOpen ) {
     288                        return;
     289                }
     290
     291                this.isOpen = false;
     292                this._toggleAttr();
     293
     294                this.range = null;
     295                this._off( this.document );
     296
     297                this._trigger( "close", event );
     298        },
     299
     300        widget: function() {
     301                return this.button;
     302        },
     303
     304        menuWidget: function() {
     305                return this.menu;
     306        },
     307
     308        _renderButtonItem: function( item ) {
     309                var buttonItem = $( "<span>" );
     310
     311                this._setText( buttonItem, item.label );
     312                this._addClass( buttonItem, "ui-selectmenu-text" );
     313
     314                return buttonItem;
     315        },
     316
     317        _renderMenu: function( ul, items ) {
     318                var that = this,
     319                        currentOptgroup = "";
     320
     321                $.each( items, function( index, item ) {
     322                        var li;
     323
     324                        if ( item.optgroup !== currentOptgroup ) {
     325                                li = $( "<li>", {
     326                                        text: item.optgroup
     327                                } );
     328                                that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
     329                                        ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
     330                                                " ui-state-disabled" :
     331                                                "" ) );
     332
     333                                li.appendTo( ul );
     334
     335                                currentOptgroup = item.optgroup;
     336                        }
     337
     338                        that._renderItemData( ul, item );
     339                } );
     340        },
     341
     342        _renderItemData: function( ul, item ) {
     343                return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
     344        },
     345
     346        _renderItem: function( ul, item ) {
     347                var li = $( "<li>" ),
     348                        wrapper = $( "<div>", {
     349                                title: item.element.attr( "title" )
     350                        } );
     351
     352                if ( item.disabled ) {
     353                        this._addClass( li, null, "ui-state-disabled" );
     354                }
     355                this._setText( wrapper, item.label );
     356
     357                return li.append( wrapper ).appendTo( ul );
     358        },
     359
     360        _setText: function( element, value ) {
     361                if ( value ) {
     362                        element.text( value );
     363                } else {
     364                        element.html( "&#160;" );
     365                }
     366        },
     367
     368        _move: function( direction, event ) {
     369                var item, next,
     370                        filter = ".ui-menu-item";
     371
     372                if ( this.isOpen ) {
     373                        item = this.menuItems.eq( this.focusIndex ).parent( "li" );
     374                } else {
     375                        item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
     376                        filter += ":not(.ui-state-disabled)";
     377                }
     378
     379                if ( direction === "first" || direction === "last" ) {
     380                        next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
     381                } else {
     382                        next = item[ direction + "All" ]( filter ).eq( 0 );
     383                }
     384
     385                if ( next.length ) {
     386                        this.menuInstance.focus( event, next );
     387                }
     388        },
     389
     390        _getSelectedItem: function() {
     391                return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
     392        },
     393
     394        _toggle: function( event ) {
     395                this[ this.isOpen ? "close" : "open" ]( event );
     396        },
     397
     398        _setSelection: function() {
     399                var selection;
     400
     401                if ( !this.range ) {
     402                        return;
     403                }
     404
     405                if ( window.getSelection ) {
     406                        selection = window.getSelection();
     407                        selection.removeAllRanges();
     408                        selection.addRange( this.range );
     409
     410                // Support: IE8
     411                } else {
     412                        this.range.select();
     413                }
     414
     415                // Support: IE
     416                // Setting the text selection kills the button focus in IE, but
     417                // restoring the focus doesn't kill the selection.
     418                this.button.focus();
     419        },
     420
     421        _documentClick: {
     422                mousedown: function( event ) {
     423                        if ( !this.isOpen ) {
     424                                return;
     425                        }
     426
     427                        if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
     428                                        $.ui.escapeSelector( this.ids.button ) ).length ) {
     429                                this.close( event );
     430                        }
     431                }
     432        },
     433
     434        _buttonEvents: {
     435
     436                // Prevent text selection from being reset when interacting with the selectmenu (#10144)
     437                mousedown: function() {
     438                        var selection;
     439
     440                        if ( window.getSelection ) {
     441                                selection = window.getSelection();
     442                                if ( selection.rangeCount ) {
     443                                        this.range = selection.getRangeAt( 0 );
     444                                }
     445
     446                        // Support: IE8
     447                        } else {
     448                                this.range = document.selection.createRange();
     449                        }
     450                },
     451
     452                click: function( event ) {
     453                        this._setSelection();
     454                        this._toggle( event );
     455                },
     456
     457                keydown: function( event ) {
     458                        var preventDefault = true;
     459                        switch ( event.keyCode ) {
     460                        case $.ui.keyCode.TAB:
     461                        case $.ui.keyCode.ESCAPE:
     462                                this.close( event );
     463                                preventDefault = false;
     464                                break;
     465                        case $.ui.keyCode.ENTER:
     466                                if ( this.isOpen ) {
     467                                        this._selectFocusedItem( event );
     468                                }
     469                                break;
     470                        case $.ui.keyCode.UP:
     471                                if ( event.altKey ) {
     472                                        this._toggle( event );
     473                                } else {
     474                                        this._move( "prev", event );
     475                                }
     476                                break;
     477                        case $.ui.keyCode.DOWN:
     478                                if ( event.altKey ) {
     479                                        this._toggle( event );
     480                                } else {
     481                                        this._move( "next", event );
     482                                }
     483                                break;
     484                        case $.ui.keyCode.SPACE:
     485                                if ( this.isOpen ) {
     486                                        this._selectFocusedItem( event );
     487                                } else {
     488                                        this._toggle( event );
     489                                }
     490                                break;
     491                        case $.ui.keyCode.LEFT:
     492                                this._move( "prev", event );
     493                                break;
     494                        case $.ui.keyCode.RIGHT:
     495                                this._move( "next", event );
     496                                break;
     497                        case $.ui.keyCode.HOME:
     498                        case $.ui.keyCode.PAGE_UP:
     499                                this._move( "first", event );
     500                                break;
     501                        case $.ui.keyCode.END:
     502                        case $.ui.keyCode.PAGE_DOWN:
     503                                this._move( "last", event );
     504                                break;
     505                        default:
     506                                this.menu.trigger( event );
     507                                preventDefault = false;
     508                        }
     509
     510                        if ( preventDefault ) {
     511                                event.preventDefault();
     512                        }
     513                }
     514        },
     515
     516        _selectFocusedItem: function( event ) {
     517                var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
     518                if ( !item.hasClass( "ui-state-disabled" ) ) {
     519                        this._select( item.data( "ui-selectmenu-item" ), event );
     520                }
     521        },
     522
     523        _select: function( item, event ) {
     524                var oldIndex = this.element[ 0 ].selectedIndex;
     525
     526                // Change native select element
     527                this.element[ 0 ].selectedIndex = item.index;
     528                this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
     529                this._setAria( item );
     530                this._trigger( "select", event, { item: item } );
     531
     532                if ( item.index !== oldIndex ) {
     533                        this._trigger( "change", event, { item: item } );
     534                }
     535
     536                this.close( event );
     537        },
     538
     539        _setAria: function( item ) {
     540                var id = this.menuItems.eq( item.index ).attr( "id" );
     541
     542                this.button.attr( {
     543                        "aria-labelledby": id,
     544                        "aria-activedescendant": id
     545                } );
     546                this.menu.attr( "aria-activedescendant", id );
     547        },
     548
     549        _setOption: function( key, value ) {
     550                if ( key === "icons" ) {
     551                        var icon = this.button.find( "span.ui-icon" );
     552                        this._removeClass( icon, null, this.options.icons.button )
     553                                ._addClass( icon, null, value.button );
     554                }
     555
     556                this._super( key, value );
     557
     558                if ( key === "appendTo" ) {
     559                        this.menuWrap.appendTo( this._appendTo() );
     560                }
     561
     562                if ( key === "width" ) {
     563                        this._resizeButton();
     564                }
     565        },
     566
     567        _setOptionDisabled: function( value ) {
     568                this._super( value );
     569
     570                this.menuInstance.option( "disabled", value );
     571                this.button.attr( "aria-disabled", value );
     572                this._toggleClass( this.button, null, "ui-state-disabled", value );
     573
     574                this.element.prop( "disabled", value );
     575                if ( value ) {
     576                        this.button.attr( "tabindex", -1 );
     577                        this.close();
     578                } else {
     579                        this.button.attr( "tabindex", 0 );
     580                }
     581        },
     582
     583        _appendTo: function() {
     584                var element = this.options.appendTo;
     585
     586                if ( element ) {
     587                        element = element.jquery || element.nodeType ?
     588                                $( element ) :
     589                                this.document.find( element ).eq( 0 );
     590                }
     591
     592                if ( !element || !element[ 0 ] ) {
     593                        element = this.element.closest( ".ui-front, dialog" );
     594                }
     595
     596                if ( !element.length ) {
     597                        element = this.document[ 0 ].body;
     598                }
     599
     600                return element;
     601        },
     602
     603        _toggleAttr: function() {
     604                this.button.attr( "aria-expanded", this.isOpen );
     605
     606                // We can't use two _toggleClass() calls here, because we need to make sure
     607                // we always remove classes first and add them second, otherwise if both classes have the
     608                // same theme class, it will be removed after we add it.
     609                this._removeClass( this.button, "ui-selectmenu-button-" +
     610                        ( this.isOpen ? "closed" : "open" ) )
     611                        ._addClass( this.button, "ui-selectmenu-button-" +
     612                                ( this.isOpen ? "open" : "closed" ) )
     613                        ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );
     614
     615                this.menu.attr( "aria-hidden", !this.isOpen );
     616        },
     617
     618        _resizeButton: function() {
     619                var width = this.options.width;
     620
     621                // For `width: false`, just remove inline style and stop
     622                if ( width === false ) {
     623                        this.button.css( "width", "" );
     624                        return;
     625                }
     626
     627                // For `width: null`, match the width of the original element
     628                if ( width === null ) {
     629                        width = this.element.show().outerWidth();
     630                        this.element.hide();
     631                }
     632
     633                this.button.outerWidth( width );
     634        },
     635
     636        _resizeMenu: function() {
     637                this.menu.outerWidth( Math.max(
     638                        this.button.outerWidth(),
     639
     640                        // Support: IE10
     641                        // IE10 wraps long text (possibly a rounding bug)
     642                        // so we add 1px to avoid the wrapping
     643                        this.menu.width( "" ).outerWidth() + 1
     644                ) );
     645        },
     646
     647        _getCreateOptions: function() {
     648                var options = this._super();
     649
     650                options.disabled = this.element.prop( "disabled" );
     651
     652                return options;
     653        },
     654
     655        _parseOptions: function( options ) {
     656                var that = this,
     657                        data = [];
     658                options.each( function( index, item ) {
     659                        data.push( that._parseOption( $( item ), index ) );
     660                } );
     661                this.items = data;
     662        },
     663
     664        _parseOption: function( option, index ) {
     665                var optgroup = option.parent( "optgroup" );
     666
     667                return {
     668                        element: option,
     669                        index: index,
     670                        value: option.val(),
     671                        label: option.text(),
     672                        optgroup: optgroup.attr( "label" ) || "",
     673                        disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
     674                };
     675        },
     676
     677        _destroy: function() {
     678                this._unbindFormResetHandler();
     679                this.menuWrap.remove();
     680                this.button.remove();
     681                this.element.show();
     682                this.element.removeUniqueId();
     683                this.labels.attr( "for", this.ids.element );
     684        }
     685} ] );
     686
     687} ) );
  • src/js/_enqueues/vendor/jquery/ui/slider.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/selectmenu.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Slider 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Slider
     11//>>group: Widgets
     12//>>description: Displays a flexible slider with ranges and accessibility via keyboard.
     13//>>docs: http://api.jqueryui.com/slider/
     14//>>demos: http://jqueryui.com/slider/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/slider.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./mouse",
     26                        "./keycode",
     27                        "./version",
     28                        "./widget"
     29                ], factory );
     30        } else {
     31
     32                // Browser globals
     33                factory( jQuery );
     34        }
     35}( function( $ ) {
     36
     37return $.widget( "ui.slider", $.ui.mouse, {
     38        version: "1.12.1",
     39        widgetEventPrefix: "slide",
     40
     41        options: {
     42                animate: false,
     43                classes: {
     44                        "ui-slider": "ui-corner-all",
     45                        "ui-slider-handle": "ui-corner-all",
     46
     47                        // Note: ui-widget-header isn't the most fittingly semantic framework class for this
     48                        // element, but worked best visually with a variety of themes
     49                        "ui-slider-range": "ui-corner-all ui-widget-header"
     50                },
     51                distance: 0,
     52                max: 100,
     53                min: 0,
     54                orientation: "horizontal",
     55                range: false,
     56                step: 1,
     57                value: 0,
     58                values: null,
     59
     60                // Callbacks
     61                change: null,
     62                slide: null,
     63                start: null,
     64                stop: null
     65        },
     66
     67        // Number of pages in a slider
     68        // (how many times can you page up/down to go through the whole range)
     69        numPages: 5,
     70
     71        _create: function() {
     72                this._keySliding = false;
     73                this._mouseSliding = false;
     74                this._animateOff = true;
     75                this._handleIndex = null;
     76                this._detectOrientation();
     77                this._mouseInit();
     78                this._calculateNewMax();
     79
     80                this._addClass( "ui-slider ui-slider-" + this.orientation,
     81                        "ui-widget ui-widget-content" );
     82
     83                this._refresh();
     84
     85                this._animateOff = false;
     86        },
     87
     88        _refresh: function() {
     89                this._createRange();
     90                this._createHandles();
     91                this._setupEvents();
     92                this._refreshValue();
     93        },
     94
     95        _createHandles: function() {
     96                var i, handleCount,
     97                        options = this.options,
     98                        existingHandles = this.element.find( ".ui-slider-handle" ),
     99                        handle = "<span tabindex='0'></span>",
     100                        handles = [];
     101
     102                handleCount = ( options.values && options.values.length ) || 1;
     103
     104                if ( existingHandles.length > handleCount ) {
     105                        existingHandles.slice( handleCount ).remove();
     106                        existingHandles = existingHandles.slice( 0, handleCount );
     107                }
     108
     109                for ( i = existingHandles.length; i < handleCount; i++ ) {
     110                        handles.push( handle );
     111                }
     112
     113                this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
     114
     115                this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
     116
     117                this.handle = this.handles.eq( 0 );
     118
     119                this.handles.each( function( i ) {
     120                        $( this )
     121                                .data( "ui-slider-handle-index", i )
     122                                .attr( "tabIndex", 0 );
     123                } );
     124        },
     125
     126        _createRange: function() {
     127                var options = this.options;
     128
     129                if ( options.range ) {
     130                        if ( options.range === true ) {
     131                                if ( !options.values ) {
     132                                        options.values = [ this._valueMin(), this._valueMin() ];
     133                                } else if ( options.values.length && options.values.length !== 2 ) {
     134                                        options.values = [ options.values[ 0 ], options.values[ 0 ] ];
     135                                } else if ( $.isArray( options.values ) ) {
     136                                        options.values = options.values.slice( 0 );
     137                                }
     138                        }
     139
     140                        if ( !this.range || !this.range.length ) {
     141                                this.range = $( "<div>" )
     142                                        .appendTo( this.element );
     143
     144                                this._addClass( this.range, "ui-slider-range" );
     145                        } else {
     146                                this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
     147
     148                                // Handle range switching from true to min/max
     149                                this.range.css( {
     150                                        "left": "",
     151                                        "bottom": ""
     152                                } );
     153                        }
     154                        if ( options.range === "min" || options.range === "max" ) {
     155                                this._addClass( this.range, "ui-slider-range-" + options.range );
     156                        }
     157                } else {
     158                        if ( this.range ) {
     159                                this.range.remove();
     160                        }
     161                        this.range = null;
     162                }
     163        },
     164
     165        _setupEvents: function() {
     166                this._off( this.handles );
     167                this._on( this.handles, this._handleEvents );
     168                this._hoverable( this.handles );
     169                this._focusable( this.handles );
     170        },
     171
     172        _destroy: function() {
     173                this.handles.remove();
     174                if ( this.range ) {
     175                        this.range.remove();
     176                }
     177
     178                this._mouseDestroy();
     179        },
     180
     181        _mouseCapture: function( event ) {
     182                var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
     183                        that = this,
     184                        o = this.options;
     185
     186                if ( o.disabled ) {
     187                        return false;
     188                }
     189
     190                this.elementSize = {
     191                        width: this.element.outerWidth(),
     192                        height: this.element.outerHeight()
     193                };
     194                this.elementOffset = this.element.offset();
     195
     196                position = { x: event.pageX, y: event.pageY };
     197                normValue = this._normValueFromMouse( position );
     198                distance = this._valueMax() - this._valueMin() + 1;
     199                this.handles.each( function( i ) {
     200                        var thisDistance = Math.abs( normValue - that.values( i ) );
     201                        if ( ( distance > thisDistance ) ||
     202                                ( distance === thisDistance &&
     203                                        ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
     204                                distance = thisDistance;
     205                                closestHandle = $( this );
     206                                index = i;
     207                        }
     208                } );
     209
     210                allowed = this._start( event, index );
     211                if ( allowed === false ) {
     212                        return false;
     213                }
     214                this._mouseSliding = true;
     215
     216                this._handleIndex = index;
     217
     218                this._addClass( closestHandle, null, "ui-state-active" );
     219                closestHandle.trigger( "focus" );
     220
     221                offset = closestHandle.offset();
     222                mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
     223                this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
     224                        left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
     225                        top: event.pageY - offset.top -
     226                                ( closestHandle.height() / 2 ) -
     227                                ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
     228                                ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
     229                                ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
     230                };
     231
     232                if ( !this.handles.hasClass( "ui-state-hover" ) ) {
     233                        this._slide( event, index, normValue );
     234                }
     235                this._animateOff = true;
     236                return true;
     237        },
     238
     239        _mouseStart: function() {
     240                return true;
     241        },
     242
     243        _mouseDrag: function( event ) {
     244                var position = { x: event.pageX, y: event.pageY },
     245                        normValue = this._normValueFromMouse( position );
     246
     247                this._slide( event, this._handleIndex, normValue );
     248
     249                return false;
     250        },
     251
     252        _mouseStop: function( event ) {
     253                this._removeClass( this.handles, null, "ui-state-active" );
     254                this._mouseSliding = false;
     255
     256                this._stop( event, this._handleIndex );
     257                this._change( event, this._handleIndex );
     258
     259                this._handleIndex = null;
     260                this._clickOffset = null;
     261                this._animateOff = false;
     262
     263                return false;
     264        },
     265
     266        _detectOrientation: function() {
     267                this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
     268        },
     269
     270        _normValueFromMouse: function( position ) {
     271                var pixelTotal,
     272                        pixelMouse,
     273                        percentMouse,
     274                        valueTotal,
     275                        valueMouse;
     276
     277                if ( this.orientation === "horizontal" ) {
     278                        pixelTotal = this.elementSize.width;
     279                        pixelMouse = position.x - this.elementOffset.left -
     280                                ( this._clickOffset ? this._clickOffset.left : 0 );
     281                } else {
     282                        pixelTotal = this.elementSize.height;
     283                        pixelMouse = position.y - this.elementOffset.top -
     284                                ( this._clickOffset ? this._clickOffset.top : 0 );
     285                }
     286
     287                percentMouse = ( pixelMouse / pixelTotal );
     288                if ( percentMouse > 1 ) {
     289                        percentMouse = 1;
     290                }
     291                if ( percentMouse < 0 ) {
     292                        percentMouse = 0;
     293                }
     294                if ( this.orientation === "vertical" ) {
     295                        percentMouse = 1 - percentMouse;
     296                }
     297
     298                valueTotal = this._valueMax() - this._valueMin();
     299                valueMouse = this._valueMin() + percentMouse * valueTotal;
     300
     301                return this._trimAlignValue( valueMouse );
     302        },
     303
     304        _uiHash: function( index, value, values ) {
     305                var uiHash = {
     306                        handle: this.handles[ index ],
     307                        handleIndex: index,
     308                        value: value !== undefined ? value : this.value()
     309                };
     310
     311                if ( this._hasMultipleValues() ) {
     312                        uiHash.value = value !== undefined ? value : this.values( index );
     313                        uiHash.values = values || this.values();
     314                }
     315
     316                return uiHash;
     317        },
     318
     319        _hasMultipleValues: function() {
     320                return this.options.values && this.options.values.length;
     321        },
     322
     323        _start: function( event, index ) {
     324                return this._trigger( "start", event, this._uiHash( index ) );
     325        },
     326
     327        _slide: function( event, index, newVal ) {
     328                var allowed, otherVal,
     329                        currentValue = this.value(),
     330                        newValues = this.values();
     331
     332                if ( this._hasMultipleValues() ) {
     333                        otherVal = this.values( index ? 0 : 1 );
     334                        currentValue = this.values( index );
     335
     336                        if ( this.options.values.length === 2 && this.options.range === true ) {
     337                                newVal =  index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
     338                        }
     339
     340                        newValues[ index ] = newVal;
     341                }
     342
     343                if ( newVal === currentValue ) {
     344                        return;
     345                }
     346
     347                allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
     348
     349                // A slide can be canceled by returning false from the slide callback
     350                if ( allowed === false ) {
     351                        return;
     352                }
     353
     354                if ( this._hasMultipleValues() ) {
     355                        this.values( index, newVal );
     356                } else {
     357                        this.value( newVal );
     358                }
     359        },
     360
     361        _stop: function( event, index ) {
     362                this._trigger( "stop", event, this._uiHash( index ) );
     363        },
     364
     365        _change: function( event, index ) {
     366                if ( !this._keySliding && !this._mouseSliding ) {
     367
     368                        //store the last changed value index for reference when handles overlap
     369                        this._lastChangedValue = index;
     370                        this._trigger( "change", event, this._uiHash( index ) );
     371                }
     372        },
     373
     374        value: function( newValue ) {
     375                if ( arguments.length ) {
     376                        this.options.value = this._trimAlignValue( newValue );
     377                        this._refreshValue();
     378                        this._change( null, 0 );
     379                        return;
     380                }
     381
     382                return this._value();
     383        },
     384
     385        values: function( index, newValue ) {
     386                var vals,
     387                        newValues,
     388                        i;
     389
     390                if ( arguments.length > 1 ) {
     391                        this.options.values[ index ] = this._trimAlignValue( newValue );
     392                        this._refreshValue();
     393                        this._change( null, index );
     394                        return;
     395                }
     396
     397                if ( arguments.length ) {
     398                        if ( $.isArray( arguments[ 0 ] ) ) {
     399                                vals = this.options.values;
     400                                newValues = arguments[ 0 ];
     401                                for ( i = 0; i < vals.length; i += 1 ) {
     402                                        vals[ i ] = this._trimAlignValue( newValues[ i ] );
     403                                        this._change( null, i );
     404                                }
     405                                this._refreshValue();
     406                        } else {
     407                                if ( this._hasMultipleValues() ) {
     408                                        return this._values( index );
     409                                } else {
     410                                        return this.value();
     411                                }
     412                        }
     413                } else {
     414                        return this._values();
     415                }
     416        },
     417
     418        _setOption: function( key, value ) {
     419                var i,
     420                        valsLength = 0;
     421
     422                if ( key === "range" && this.options.range === true ) {
     423                        if ( value === "min" ) {
     424                                this.options.value = this._values( 0 );
     425                                this.options.values = null;
     426                        } else if ( value === "max" ) {
     427                                this.options.value = this._values( this.options.values.length - 1 );
     428                                this.options.values = null;
     429                        }
     430                }
     431
     432                if ( $.isArray( this.options.values ) ) {
     433                        valsLength = this.options.values.length;
     434                }
     435
     436                this._super( key, value );
     437
     438                switch ( key ) {
     439                        case "orientation":
     440                                this._detectOrientation();
     441                                this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
     442                                        ._addClass( "ui-slider-" + this.orientation );
     443                                this._refreshValue();
     444                                if ( this.options.range ) {
     445                                        this._refreshRange( value );
     446                                }
     447
     448                                // Reset positioning from previous orientation
     449                                this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
     450                                break;
     451                        case "value":
     452                                this._animateOff = true;
     453                                this._refreshValue();
     454                                this._change( null, 0 );
     455                                this._animateOff = false;
     456                                break;
     457                        case "values":
     458                                this._animateOff = true;
     459                                this._refreshValue();
     460
     461                                // Start from the last handle to prevent unreachable handles (#9046)
     462                                for ( i = valsLength - 1; i >= 0; i-- ) {
     463                                        this._change( null, i );
     464                                }
     465                                this._animateOff = false;
     466                                break;
     467                        case "step":
     468                        case "min":
     469                        case "max":
     470                                this._animateOff = true;
     471                                this._calculateNewMax();
     472                                this._refreshValue();
     473                                this._animateOff = false;
     474                                break;
     475                        case "range":
     476                                this._animateOff = true;
     477                                this._refresh();
     478                                this._animateOff = false;
     479                                break;
     480                }
     481        },
     482
     483        _setOptionDisabled: function( value ) {
     484                this._super( value );
     485
     486                this._toggleClass( null, "ui-state-disabled", !!value );
     487        },
     488
     489        //internal value getter
     490        // _value() returns value trimmed by min and max, aligned by step
     491        _value: function() {
     492                var val = this.options.value;
     493                val = this._trimAlignValue( val );
     494
     495                return val;
     496        },
     497
     498        //internal values getter
     499        // _values() returns array of values trimmed by min and max, aligned by step
     500        // _values( index ) returns single value trimmed by min and max, aligned by step
     501        _values: function( index ) {
     502                var val,
     503                        vals,
     504                        i;
     505
     506                if ( arguments.length ) {
     507                        val = this.options.values[ index ];
     508                        val = this._trimAlignValue( val );
     509
     510                        return val;
     511                } else if ( this._hasMultipleValues() ) {
     512
     513                        // .slice() creates a copy of the array
     514                        // this copy gets trimmed by min and max and then returned
     515                        vals = this.options.values.slice();
     516                        for ( i = 0; i < vals.length; i += 1 ) {
     517                                vals[ i ] = this._trimAlignValue( vals[ i ] );
     518                        }
     519
     520                        return vals;
     521                } else {
     522                        return [];
     523                }
     524        },
     525
     526        // Returns the step-aligned value that val is closest to, between (inclusive) min and max
     527        _trimAlignValue: function( val ) {
     528                if ( val <= this._valueMin() ) {
     529                        return this._valueMin();
     530                }
     531                if ( val >= this._valueMax() ) {
     532                        return this._valueMax();
     533                }
     534                var step = ( this.options.step > 0 ) ? this.options.step : 1,
     535                        valModStep = ( val - this._valueMin() ) % step,
     536                        alignValue = val - valModStep;
     537
     538                if ( Math.abs( valModStep ) * 2 >= step ) {
     539                        alignValue += ( valModStep > 0 ) ? step : ( -step );
     540                }
     541
     542                // Since JavaScript has problems with large floats, round
     543                // the final value to 5 digits after the decimal point (see #4124)
     544                return parseFloat( alignValue.toFixed( 5 ) );
     545        },
     546
     547        _calculateNewMax: function() {
     548                var max = this.options.max,
     549                        min = this._valueMin(),
     550                        step = this.options.step,
     551                        aboveMin = Math.round( ( max - min ) / step ) * step;
     552                max = aboveMin + min;
     553                if ( max > this.options.max ) {
     554
     555                        //If max is not divisible by step, rounding off may increase its value
     556                        max -= step;
     557                }
     558                this.max = parseFloat( max.toFixed( this._precision() ) );
     559        },
     560
     561        _precision: function() {
     562                var precision = this._precisionOf( this.options.step );
     563                if ( this.options.min !== null ) {
     564                        precision = Math.max( precision, this._precisionOf( this.options.min ) );
     565                }
     566                return precision;
     567        },
     568
     569        _precisionOf: function( num ) {
     570                var str = num.toString(),
     571                        decimal = str.indexOf( "." );
     572                return decimal === -1 ? 0 : str.length - decimal - 1;
     573        },
     574
     575        _valueMin: function() {
     576                return this.options.min;
     577        },
     578
     579        _valueMax: function() {
     580                return this.max;
     581        },
     582
     583        _refreshRange: function( orientation ) {
     584                if ( orientation === "vertical" ) {
     585                        this.range.css( { "width": "", "left": "" } );
     586                }
     587                if ( orientation === "horizontal" ) {
     588                        this.range.css( { "height": "", "bottom": "" } );
     589                }
     590        },
     591
     592        _refreshValue: function() {
     593                var lastValPercent, valPercent, value, valueMin, valueMax,
     594                        oRange = this.options.range,
     595                        o = this.options,
     596                        that = this,
     597                        animate = ( !this._animateOff ) ? o.animate : false,
     598                        _set = {};
     599
     600                if ( this._hasMultipleValues() ) {
     601                        this.handles.each( function( i ) {
     602                                valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
     603                                        that._valueMin() ) * 100;
     604                                _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
     605                                $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
     606                                if ( that.options.range === true ) {
     607                                        if ( that.orientation === "horizontal" ) {
     608                                                if ( i === 0 ) {
     609                                                        that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
     610                                                                left: valPercent + "%"
     611                                                        }, o.animate );
     612                                                }
     613                                                if ( i === 1 ) {
     614                                                        that.range[ animate ? "animate" : "css" ]( {
     615                                                                width: ( valPercent - lastValPercent ) + "%"
     616                                                        }, {
     617                                                                queue: false,
     618                                                                duration: o.animate
     619                                                        } );
     620                                                }
     621                                        } else {
     622                                                if ( i === 0 ) {
     623                                                        that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
     624                                                                bottom: ( valPercent ) + "%"
     625                                                        }, o.animate );
     626                                                }
     627                                                if ( i === 1 ) {
     628                                                        that.range[ animate ? "animate" : "css" ]( {
     629                                                                height: ( valPercent - lastValPercent ) + "%"
     630                                                        }, {
     631                                                                queue: false,
     632                                                                duration: o.animate
     633                                                        } );
     634                                                }
     635                                        }
     636                                }
     637                                lastValPercent = valPercent;
     638                        } );
     639                } else {
     640                        value = this.value();
     641                        valueMin = this._valueMin();
     642                        valueMax = this._valueMax();
     643                        valPercent = ( valueMax !== valueMin ) ?
     644                                        ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
     645                                        0;
     646                        _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
     647                        this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
     648
     649                        if ( oRange === "min" && this.orientation === "horizontal" ) {
     650                                this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
     651                                        width: valPercent + "%"
     652                                }, o.animate );
     653                        }
     654                        if ( oRange === "max" && this.orientation === "horizontal" ) {
     655                                this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
     656                                        width: ( 100 - valPercent ) + "%"
     657                                }, o.animate );
     658                        }
     659                        if ( oRange === "min" && this.orientation === "vertical" ) {
     660                                this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
     661                                        height: valPercent + "%"
     662                                }, o.animate );
     663                        }
     664                        if ( oRange === "max" && this.orientation === "vertical" ) {
     665                                this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
     666                                        height: ( 100 - valPercent ) + "%"
     667                                }, o.animate );
     668                        }
     669                }
     670        },
     671
     672        _handleEvents: {
     673                keydown: function( event ) {
     674                        var allowed, curVal, newVal, step,
     675                                index = $( event.target ).data( "ui-slider-handle-index" );
     676
     677                        switch ( event.keyCode ) {
     678                                case $.ui.keyCode.HOME:
     679                                case $.ui.keyCode.END:
     680                                case $.ui.keyCode.PAGE_UP:
     681                                case $.ui.keyCode.PAGE_DOWN:
     682                                case $.ui.keyCode.UP:
     683                                case $.ui.keyCode.RIGHT:
     684                                case $.ui.keyCode.DOWN:
     685                                case $.ui.keyCode.LEFT:
     686                                        event.preventDefault();
     687                                        if ( !this._keySliding ) {
     688                                                this._keySliding = true;
     689                                                this._addClass( $( event.target ), null, "ui-state-active" );
     690                                                allowed = this._start( event, index );
     691                                                if ( allowed === false ) {
     692                                                        return;
     693                                                }
     694                                        }
     695                                        break;
     696                        }
     697
     698                        step = this.options.step;
     699                        if ( this._hasMultipleValues() ) {
     700                                curVal = newVal = this.values( index );
     701                        } else {
     702                                curVal = newVal = this.value();
     703                        }
     704
     705                        switch ( event.keyCode ) {
     706                                case $.ui.keyCode.HOME:
     707                                        newVal = this._valueMin();
     708                                        break;
     709                                case $.ui.keyCode.END:
     710                                        newVal = this._valueMax();
     711                                        break;
     712                                case $.ui.keyCode.PAGE_UP:
     713                                        newVal = this._trimAlignValue(
     714                                                curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
     715                                        );
     716                                        break;
     717                                case $.ui.keyCode.PAGE_DOWN:
     718                                        newVal = this._trimAlignValue(
     719                                                curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
     720                                        break;
     721                                case $.ui.keyCode.UP:
     722                                case $.ui.keyCode.RIGHT:
     723                                        if ( curVal === this._valueMax() ) {
     724                                                return;
     725                                        }
     726                                        newVal = this._trimAlignValue( curVal + step );
     727                                        break;
     728                                case $.ui.keyCode.DOWN:
     729                                case $.ui.keyCode.LEFT:
     730                                        if ( curVal === this._valueMin() ) {
     731                                                return;
     732                                        }
     733                                        newVal = this._trimAlignValue( curVal - step );
     734                                        break;
     735                        }
     736
     737                        this._slide( event, index, newVal );
     738                },
     739                keyup: function( event ) {
     740                        var index = $( event.target ).data( "ui-slider-handle-index" );
     741
     742                        if ( this._keySliding ) {
     743                                this._keySliding = false;
     744                                this._stop( event, index );
     745                                this._change( event, index );
     746                                this._removeClass( $( event.target ), null, "ui-state-active" );
     747                        }
     748                }
     749        }
     750} );
     751
     752} ) );
  • src/js/_enqueues/vendor/jquery/ui/sortable.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/slider.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Sortable 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Sortable
     11//>>group: Interactions
     12//>>description: Enables items in a list to be sorted using the mouse.
     13//>>docs: http://api.jqueryui.com/sortable/
     14//>>demos: http://jqueryui.com/sortable/
     15//>>css.structure: ../../themes/base/sortable.css
     16
     17( function( factory ) {
     18        if ( typeof define === "function" && define.amd ) {
     19
     20                // AMD. Register as an anonymous module.
     21                define( [
     22                        "jquery",
     23                        "./mouse",
     24                        "./data",
     25                        "./ie",
     26                        "./scroll-parent",
     27                        "./version",
     28                        "./widget"
     29                ], factory );
     30        } else {
     31
     32                // Browser globals
     33                factory( jQuery );
     34        }
     35}( function( $ ) {
     36
     37return $.widget( "ui.sortable", $.ui.mouse, {
     38        version: "1.12.1",
     39        widgetEventPrefix: "sort",
     40        ready: false,
     41        options: {
     42                appendTo: "parent",
     43                axis: false,
     44                connectWith: false,
     45                containment: false,
     46                cursor: "auto",
     47                cursorAt: false,
     48                dropOnEmpty: true,
     49                forcePlaceholderSize: false,
     50                forceHelperSize: false,
     51                grid: false,
     52                handle: false,
     53                helper: "original",
     54                items: "> *",
     55                opacity: false,
     56                placeholder: false,
     57                revert: false,
     58                scroll: true,
     59                scrollSensitivity: 20,
     60                scrollSpeed: 20,
     61                scope: "default",
     62                tolerance: "intersect",
     63                zIndex: 1000,
     64
     65                // Callbacks
     66                activate: null,
     67                beforeStop: null,
     68                change: null,
     69                deactivate: null,
     70                out: null,
     71                over: null,
     72                receive: null,
     73                remove: null,
     74                sort: null,
     75                start: null,
     76                stop: null,
     77                update: null
     78        },
     79
     80        _isOverAxis: function( x, reference, size ) {
     81                return ( x >= reference ) && ( x < ( reference + size ) );
     82        },
     83
     84        _isFloating: function( item ) {
     85                return ( /left|right/ ).test( item.css( "float" ) ) ||
     86                        ( /inline|table-cell/ ).test( item.css( "display" ) );
     87        },
     88
     89        _create: function() {
     90                this.containerCache = {};
     91                this._addClass( "ui-sortable" );
     92
     93                //Get the items
     94                this.refresh();
     95
     96                //Let's determine the parent's offset
     97                this.offset = this.element.offset();
     98
     99                //Initialize mouse events for interaction
     100                this._mouseInit();
     101
     102                this._setHandleClassName();
     103
     104                //We're ready to go
     105                this.ready = true;
     106
     107        },
     108
     109        _setOption: function( key, value ) {
     110                this._super( key, value );
     111
     112                if ( key === "handle" ) {
     113                        this._setHandleClassName();
     114                }
     115        },
     116
     117        _setHandleClassName: function() {
     118                var that = this;
     119                this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
     120                $.each( this.items, function() {
     121                        that._addClass(
     122                                this.instance.options.handle ?
     123                                        this.item.find( this.instance.options.handle ) :
     124                                        this.item,
     125                                "ui-sortable-handle"
     126                        );
     127                } );
     128        },
     129
     130        _destroy: function() {
     131                this._mouseDestroy();
     132
     133                for ( var i = this.items.length - 1; i >= 0; i-- ) {
     134                        this.items[ i ].item.removeData( this.widgetName + "-item" );
     135                }
     136
     137                return this;
     138        },
     139
     140        _mouseCapture: function( event, overrideHandle ) {
     141                var currentItem = null,
     142                        validHandle = false,
     143                        that = this;
     144
     145                if ( this.reverting ) {
     146                        return false;
     147                }
     148
     149                if ( this.options.disabled || this.options.type === "static" ) {
     150                        return false;
     151                }
     152
     153                //We have to refresh the items data once first
     154                this._refreshItems( event );
     155
     156                //Find out if the clicked node (or one of its parents) is a actual item in this.items
     157                $( event.target ).parents().each( function() {
     158                        if ( $.data( this, that.widgetName + "-item" ) === that ) {
     159                                currentItem = $( this );
     160                                return false;
     161                        }
     162                } );
     163                if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
     164                        currentItem = $( event.target );
     165                }
     166
     167                if ( !currentItem ) {
     168                        return false;
     169                }
     170                if ( this.options.handle && !overrideHandle ) {
     171                        $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
     172                                if ( this === event.target ) {
     173                                        validHandle = true;
     174                                }
     175                        } );
     176                        if ( !validHandle ) {
     177                                return false;
     178                        }
     179                }
     180
     181                this.currentItem = currentItem;
     182                this._removeCurrentsFromItems();
     183                return true;
     184
     185        },
     186
     187        _mouseStart: function( event, overrideHandle, noActivation ) {
     188
     189                var i, body,
     190                        o = this.options;
     191
     192                this.currentContainer = this;
     193
     194                //We only need to call refreshPositions, because the refreshItems call has been moved to
     195                // mouseCapture
     196                this.refreshPositions();
     197
     198                //Create and append the visible helper
     199                this.helper = this._createHelper( event );
     200
     201                //Cache the helper size
     202                this._cacheHelperProportions();
     203
     204                /*
     205                 * - Position generation -
     206                 * This block generates everything position related - it's the core of draggables.
     207                 */
     208
     209                //Cache the margins of the original element
     210                this._cacheMargins();
     211
     212                //Get the next scrolling parent
     213                this.scrollParent = this.helper.scrollParent();
     214
     215                //The element's absolute position on the page minus margins
     216                this.offset = this.currentItem.offset();
     217                this.offset = {
     218                        top: this.offset.top - this.margins.top,
     219                        left: this.offset.left - this.margins.left
     220                };
     221
     222                $.extend( this.offset, {
     223                        click: { //Where the click happened, relative to the element
     224                                left: event.pageX - this.offset.left,
     225                                top: event.pageY - this.offset.top
     226                        },
     227                        parent: this._getParentOffset(),
     228
     229                        // This is a relative to absolute position minus the actual position calculation -
     230                        // only used for relative positioned helper
     231                        relative: this._getRelativeOffset()
     232                } );
     233
     234                // Only after we got the offset, we can change the helper's position to absolute
     235                // TODO: Still need to figure out a way to make relative sorting possible
     236                this.helper.css( "position", "absolute" );
     237                this.cssPosition = this.helper.css( "position" );
     238
     239                //Generate the original position
     240                this.originalPosition = this._generatePosition( event );
     241                this.originalPageX = event.pageX;
     242                this.originalPageY = event.pageY;
     243
     244                //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
     245                ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
     246
     247                //Cache the former DOM position
     248                this.domPosition = {
     249                        prev: this.currentItem.prev()[ 0 ],
     250                        parent: this.currentItem.parent()[ 0 ]
     251                };
     252
     253                // If the helper is not the original, hide the original so it's not playing any role during
     254                // the drag, won't cause anything bad this way
     255                if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
     256                        this.currentItem.hide();
     257                }
     258
     259                //Create the placeholder
     260                this._createPlaceholder();
     261
     262                //Set a containment if given in the options
     263                if ( o.containment ) {
     264                        this._setContainment();
     265                }
     266
     267                if ( o.cursor && o.cursor !== "auto" ) { // cursor option
     268                        body = this.document.find( "body" );
     269
     270                        // Support: IE
     271                        this.storedCursor = body.css( "cursor" );
     272                        body.css( "cursor", o.cursor );
     273
     274                        this.storedStylesheet =
     275                                $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
     276                }
     277
     278                if ( o.opacity ) { // opacity option
     279                        if ( this.helper.css( "opacity" ) ) {
     280                                this._storedOpacity = this.helper.css( "opacity" );
     281                        }
     282                        this.helper.css( "opacity", o.opacity );
     283                }
     284
     285                if ( o.zIndex ) { // zIndex option
     286                        if ( this.helper.css( "zIndex" ) ) {
     287                                this._storedZIndex = this.helper.css( "zIndex" );
     288                        }
     289                        this.helper.css( "zIndex", o.zIndex );
     290                }
     291
     292                //Prepare scrolling
     293                if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
     294                                this.scrollParent[ 0 ].tagName !== "HTML" ) {
     295                        this.overflowOffset = this.scrollParent.offset();
     296                }
     297
     298                //Call callbacks
     299                this._trigger( "start", event, this._uiHash() );
     300
     301                //Recache the helper size
     302                if ( !this._preserveHelperProportions ) {
     303                        this._cacheHelperProportions();
     304                }
     305
     306                //Post "activate" events to possible containers
     307                if ( !noActivation ) {
     308                        for ( i = this.containers.length - 1; i >= 0; i-- ) {
     309                                this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
     310                        }
     311                }
     312
     313                //Prepare possible droppables
     314                if ( $.ui.ddmanager ) {
     315                        $.ui.ddmanager.current = this;
     316                }
     317
     318                if ( $.ui.ddmanager && !o.dropBehaviour ) {
     319                        $.ui.ddmanager.prepareOffsets( this, event );
     320                }
     321
     322                this.dragging = true;
     323
     324                this._addClass( this.helper, "ui-sortable-helper" );
     325
     326                // Execute the drag once - this causes the helper not to be visiblebefore getting its
     327                // correct position
     328                this._mouseDrag( event );
     329                return true;
     330
     331        },
     332
     333        _mouseDrag: function( event ) {
     334                var i, item, itemElement, intersection,
     335                        o = this.options,
     336                        scrolled = false;
     337
     338                //Compute the helpers position
     339                this.position = this._generatePosition( event );
     340                this.positionAbs = this._convertPositionTo( "absolute" );
     341
     342                if ( !this.lastPositionAbs ) {
     343                        this.lastPositionAbs = this.positionAbs;
     344                }
     345
     346                //Do scrolling
     347                if ( this.options.scroll ) {
     348                        if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
     349                                        this.scrollParent[ 0 ].tagName !== "HTML" ) {
     350
     351                                if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
     352                                                event.pageY < o.scrollSensitivity ) {
     353                                        this.scrollParent[ 0 ].scrollTop =
     354                                                scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
     355                                } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
     356                                        this.scrollParent[ 0 ].scrollTop =
     357                                                scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
     358                                }
     359
     360                                if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
     361                                                event.pageX < o.scrollSensitivity ) {
     362                                        this.scrollParent[ 0 ].scrollLeft = scrolled =
     363                                                this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
     364                                } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
     365                                        this.scrollParent[ 0 ].scrollLeft = scrolled =
     366                                                this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
     367                                }
     368
     369                        } else {
     370
     371                                if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
     372                                        scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
     373                                } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
     374                                                o.scrollSensitivity ) {
     375                                        scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
     376                                }
     377
     378                                if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
     379                                        scrolled = this.document.scrollLeft(
     380                                                this.document.scrollLeft() - o.scrollSpeed
     381                                        );
     382                                } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
     383                                                o.scrollSensitivity ) {
     384                                        scrolled = this.document.scrollLeft(
     385                                                this.document.scrollLeft() + o.scrollSpeed
     386                                        );
     387                                }
     388
     389                        }
     390
     391                        if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
     392                                $.ui.ddmanager.prepareOffsets( this, event );
     393                        }
     394                }
     395
     396                //Regenerate the absolute position used for position checks
     397                this.positionAbs = this._convertPositionTo( "absolute" );
     398
     399                //Set the helper position
     400                if ( !this.options.axis || this.options.axis !== "y" ) {
     401                        this.helper[ 0 ].style.left = this.position.left + "px";
     402                }
     403                if ( !this.options.axis || this.options.axis !== "x" ) {
     404                        this.helper[ 0 ].style.top = this.position.top + "px";
     405                }
     406
     407                //Rearrange
     408                for ( i = this.items.length - 1; i >= 0; i-- ) {
     409
     410                        //Cache variables and intersection, continue if no intersection
     411                        item = this.items[ i ];
     412                        itemElement = item.item[ 0 ];
     413                        intersection = this._intersectsWithPointer( item );
     414                        if ( !intersection ) {
     415                                continue;
     416                        }
     417
     418                        // Only put the placeholder inside the current Container, skip all
     419                        // items from other containers. This works because when moving
     420                        // an item from one container to another the
     421                        // currentContainer is switched before the placeholder is moved.
     422                        //
     423                        // Without this, moving items in "sub-sortables" can cause
     424                        // the placeholder to jitter between the outer and inner container.
     425                        if ( item.instance !== this.currentContainer ) {
     426                                continue;
     427                        }
     428
     429                        // Cannot intersect with itself
     430                        // no useless actions that have been done before
     431                        // no action if the item moved is the parent of the item checked
     432                        if ( itemElement !== this.currentItem[ 0 ] &&
     433                                this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
     434                                !$.contains( this.placeholder[ 0 ], itemElement ) &&
     435                                ( this.options.type === "semi-dynamic" ?
     436                                        !$.contains( this.element[ 0 ], itemElement ) :
     437                                        true
     438                                )
     439                        ) {
     440
     441                                this.direction = intersection === 1 ? "down" : "up";
     442
     443                                if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
     444                                        this._rearrange( event, item );
     445                                } else {
     446                                        break;
     447                                }
     448
     449                                this._trigger( "change", event, this._uiHash() );
     450                                break;
     451                        }
     452                }
     453
     454                //Post events to containers
     455                this._contactContainers( event );
     456
     457                //Interconnect with droppables
     458                if ( $.ui.ddmanager ) {
     459                        $.ui.ddmanager.drag( this, event );
     460                }
     461
     462                //Call callbacks
     463                this._trigger( "sort", event, this._uiHash() );
     464
     465                this.lastPositionAbs = this.positionAbs;
     466                return false;
     467
     468        },
     469
     470        _mouseStop: function( event, noPropagation ) {
     471
     472                if ( !event ) {
     473                        return;
     474                }
     475
     476                //If we are using droppables, inform the manager about the drop
     477                if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
     478                        $.ui.ddmanager.drop( this, event );
     479                }
     480
     481                if ( this.options.revert ) {
     482                        var that = this,
     483                                cur = this.placeholder.offset(),
     484                                axis = this.options.axis,
     485                                animation = {};
     486
     487                        if ( !axis || axis === "x" ) {
     488                                animation.left = cur.left - this.offset.parent.left - this.margins.left +
     489                                        ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
     490                                                0 :
     491                                                this.offsetParent[ 0 ].scrollLeft
     492                                        );
     493                        }
     494                        if ( !axis || axis === "y" ) {
     495                                animation.top = cur.top - this.offset.parent.top - this.margins.top +
     496                                        ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
     497                                                0 :
     498                                                this.offsetParent[ 0 ].scrollTop
     499                                        );
     500                        }
     501                        this.reverting = true;
     502                        $( this.helper ).animate(
     503                                animation,
     504                                parseInt( this.options.revert, 10 ) || 500,
     505                                function() {
     506                                        that._clear( event );
     507                                }
     508                        );
     509                } else {
     510                        this._clear( event, noPropagation );
     511                }
     512
     513                return false;
     514
     515        },
     516
     517        cancel: function() {
     518
     519                if ( this.dragging ) {
     520
     521                        this._mouseUp( new $.Event( "mouseup", { target: null } ) );
     522
     523                        if ( this.options.helper === "original" ) {
     524                                this.currentItem.css( this._storedCSS );
     525                                this._removeClass( this.currentItem, "ui-sortable-helper" );
     526                        } else {
     527                                this.currentItem.show();
     528                        }
     529
     530                        //Post deactivating events to containers
     531                        for ( var i = this.containers.length - 1; i >= 0; i-- ) {
     532                                this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
     533                                if ( this.containers[ i ].containerCache.over ) {
     534                                        this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
     535                                        this.containers[ i ].containerCache.over = 0;
     536                                }
     537                        }
     538
     539                }
     540
     541                if ( this.placeholder ) {
     542
     543                        //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
     544                        // it unbinds ALL events from the original node!
     545                        if ( this.placeholder[ 0 ].parentNode ) {
     546                                this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
     547                        }
     548                        if ( this.options.helper !== "original" && this.helper &&
     549                                        this.helper[ 0 ].parentNode ) {
     550                                this.helper.remove();
     551                        }
     552
     553                        $.extend( this, {
     554                                helper: null,
     555                                dragging: false,
     556                                reverting: false,
     557                                _noFinalSort: null
     558                        } );
     559
     560                        if ( this.domPosition.prev ) {
     561                                $( this.domPosition.prev ).after( this.currentItem );
     562                        } else {
     563                                $( this.domPosition.parent ).prepend( this.currentItem );
     564                        }
     565                }
     566
     567                return this;
     568
     569        },
     570
     571        serialize: function( o ) {
     572
     573                var items = this._getItemsAsjQuery( o && o.connected ),
     574                        str = [];
     575                o = o || {};
     576
     577                $( items ).each( function() {
     578                        var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
     579                                .match( o.expression || ( /(.+)[\-=_](.+)/ ) );
     580                        if ( res ) {
     581                                str.push(
     582                                        ( o.key || res[ 1 ] + "[]" ) +
     583                                        "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
     584                        }
     585                } );
     586
     587                if ( !str.length && o.key ) {
     588                        str.push( o.key + "=" );
     589                }
     590
     591                return str.join( "&" );
     592
     593        },
     594
     595        toArray: function( o ) {
     596
     597                var items = this._getItemsAsjQuery( o && o.connected ),
     598                        ret = [];
     599
     600                o = o || {};
     601
     602                items.each( function() {
     603                        ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
     604                } );
     605                return ret;
     606
     607        },
     608
     609        /* Be careful with the following core functions */
     610        _intersectsWith: function( item ) {
     611
     612                var x1 = this.positionAbs.left,
     613                        x2 = x1 + this.helperProportions.width,
     614                        y1 = this.positionAbs.top,
     615                        y2 = y1 + this.helperProportions.height,
     616                        l = item.left,
     617                        r = l + item.width,
     618                        t = item.top,
     619                        b = t + item.height,
     620                        dyClick = this.offset.click.top,
     621                        dxClick = this.offset.click.left,
     622                        isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
     623                                ( y1 + dyClick ) < b ),
     624                        isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
     625                                ( x1 + dxClick ) < r ),
     626                        isOverElement = isOverElementHeight && isOverElementWidth;
     627
     628                if ( this.options.tolerance === "pointer" ||
     629                        this.options.forcePointerForContainers ||
     630                        ( this.options.tolerance !== "pointer" &&
     631                                this.helperProportions[ this.floating ? "width" : "height" ] >
     632                                item[ this.floating ? "width" : "height" ] )
     633                ) {
     634                        return isOverElement;
     635                } else {
     636
     637                        return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
     638                                x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
     639                                t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
     640                                y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
     641
     642                }
     643        },
     644
     645        _intersectsWithPointer: function( item ) {
     646                var verticalDirection, horizontalDirection,
     647                        isOverElementHeight = ( this.options.axis === "x" ) ||
     648                                this._isOverAxis(
     649                                        this.positionAbs.top + this.offset.click.top, item.top, item.height ),
     650                        isOverElementWidth = ( this.options.axis === "y" ) ||
     651                                this._isOverAxis(
     652                                        this.positionAbs.left + this.offset.click.left, item.left, item.width ),
     653                        isOverElement = isOverElementHeight && isOverElementWidth;
     654
     655                if ( !isOverElement ) {
     656                        return false;
     657                }
     658
     659                verticalDirection = this._getDragVerticalDirection();
     660                horizontalDirection = this._getDragHorizontalDirection();
     661
     662                return this.floating ?
     663                        ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
     664                        : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
     665
     666        },
     667
     668        _intersectsWithSides: function( item ) {
     669
     670                var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
     671                                this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
     672                        isOverRightHalf = this._isOverAxis( this.positionAbs.left +
     673                                this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
     674                        verticalDirection = this._getDragVerticalDirection(),
     675                        horizontalDirection = this._getDragHorizontalDirection();
     676
     677                if ( this.floating && horizontalDirection ) {
     678                        return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
     679                                ( horizontalDirection === "left" && !isOverRightHalf ) );
     680                } else {
     681                        return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
     682                                ( verticalDirection === "up" && !isOverBottomHalf ) );
     683                }
     684
     685        },
     686
     687        _getDragVerticalDirection: function() {
     688                var delta = this.positionAbs.top - this.lastPositionAbs.top;
     689                return delta !== 0 && ( delta > 0 ? "down" : "up" );
     690        },
     691
     692        _getDragHorizontalDirection: function() {
     693                var delta = this.positionAbs.left - this.lastPositionAbs.left;
     694                return delta !== 0 && ( delta > 0 ? "right" : "left" );
     695        },
     696
     697        refresh: function( event ) {
     698                this._refreshItems( event );
     699                this._setHandleClassName();
     700                this.refreshPositions();
     701                return this;
     702        },
     703
     704        _connectWith: function() {
     705                var options = this.options;
     706                return options.connectWith.constructor === String ?
     707                        [ options.connectWith ] :
     708                        options.connectWith;
     709        },
     710
     711        _getItemsAsjQuery: function( connected ) {
     712
     713                var i, j, cur, inst,
     714                        items = [],
     715                        queries = [],
     716                        connectWith = this._connectWith();
     717
     718                if ( connectWith && connected ) {
     719                        for ( i = connectWith.length - 1; i >= 0; i-- ) {
     720                                cur = $( connectWith[ i ], this.document[ 0 ] );
     721                                for ( j = cur.length - 1; j >= 0; j-- ) {
     722                                        inst = $.data( cur[ j ], this.widgetFullName );
     723                                        if ( inst && inst !== this && !inst.options.disabled ) {
     724                                                queries.push( [ $.isFunction( inst.options.items ) ?
     725                                                        inst.options.items.call( inst.element ) :
     726                                                        $( inst.options.items, inst.element )
     727                                                                .not( ".ui-sortable-helper" )
     728                                                                .not( ".ui-sortable-placeholder" ), inst ] );
     729                                        }
     730                                }
     731                        }
     732                }
     733
     734                queries.push( [ $.isFunction( this.options.items ) ?
     735                        this.options.items
     736                                .call( this.element, null, { options: this.options, item: this.currentItem } ) :
     737                        $( this.options.items, this.element )
     738                                .not( ".ui-sortable-helper" )
     739                                .not( ".ui-sortable-placeholder" ), this ] );
     740
     741                function addItems() {
     742                        items.push( this );
     743                }
     744                for ( i = queries.length - 1; i >= 0; i-- ) {
     745                        queries[ i ][ 0 ].each( addItems );
     746                }
     747
     748                return $( items );
     749
     750        },
     751
     752        _removeCurrentsFromItems: function() {
     753
     754                var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
     755
     756                this.items = $.grep( this.items, function( item ) {
     757                        for ( var j = 0; j < list.length; j++ ) {
     758                                if ( list[ j ] === item.item[ 0 ] ) {
     759                                        return false;
     760                                }
     761                        }
     762                        return true;
     763                } );
     764
     765        },
     766
     767        _refreshItems: function( event ) {
     768
     769                this.items = [];
     770                this.containers = [ this ];
     771
     772                var i, j, cur, inst, targetData, _queries, item, queriesLength,
     773                        items = this.items,
     774                        queries = [ [ $.isFunction( this.options.items ) ?
     775                                this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
     776                                $( this.options.items, this.element ), this ] ],
     777                        connectWith = this._connectWith();
     778
     779                //Shouldn't be run the first time through due to massive slow-down
     780                if ( connectWith && this.ready ) {
     781                        for ( i = connectWith.length - 1; i >= 0; i-- ) {
     782                                cur = $( connectWith[ i ], this.document[ 0 ] );
     783                                for ( j = cur.length - 1; j >= 0; j-- ) {
     784                                        inst = $.data( cur[ j ], this.widgetFullName );
     785                                        if ( inst && inst !== this && !inst.options.disabled ) {
     786                                                queries.push( [ $.isFunction( inst.options.items ) ?
     787                                                        inst.options.items
     788                                                                .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
     789                                                        $( inst.options.items, inst.element ), inst ] );
     790                                                this.containers.push( inst );
     791                                        }
     792                                }
     793                        }
     794                }
     795
     796                for ( i = queries.length - 1; i >= 0; i-- ) {
     797                        targetData = queries[ i ][ 1 ];
     798                        _queries = queries[ i ][ 0 ];
     799
     800                        for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
     801                                item = $( _queries[ j ] );
     802
     803                                // Data for target checking (mouse manager)
     804                                item.data( this.widgetName + "-item", targetData );
     805
     806                                items.push( {
     807                                        item: item,
     808                                        instance: targetData,
     809                                        width: 0, height: 0,
     810                                        left: 0, top: 0
     811                                } );
     812                        }
     813                }
     814
     815        },
     816
     817        refreshPositions: function( fast ) {
     818
     819                // Determine whether items are being displayed horizontally
     820                this.floating = this.items.length ?
     821                        this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
     822                        false;
     823
     824                //This has to be redone because due to the item being moved out/into the offsetParent,
     825                // the offsetParent's position will change
     826                if ( this.offsetParent && this.helper ) {
     827                        this.offset.parent = this._getParentOffset();
     828                }
     829
     830                var i, item, t, p;
     831
     832                for ( i = this.items.length - 1; i >= 0; i-- ) {
     833                        item = this.items[ i ];
     834
     835                        //We ignore calculating positions of all connected containers when we're not over them
     836                        if ( item.instance !== this.currentContainer && this.currentContainer &&
     837                                        item.item[ 0 ] !== this.currentItem[ 0 ] ) {
     838                                continue;
     839                        }
     840
     841                        t = this.options.toleranceElement ?
     842                                $( this.options.toleranceElement, item.item ) :
     843                                item.item;
     844
     845                        if ( !fast ) {
     846                                item.width = t.outerWidth();
     847                                item.height = t.outerHeight();
     848                        }
     849
     850                        p = t.offset();
     851                        item.left = p.left;
     852                        item.top = p.top;
     853                }
     854
     855                if ( this.options.custom && this.options.custom.refreshContainers ) {
     856                        this.options.custom.refreshContainers.call( this );
     857                } else {
     858                        for ( i = this.containers.length - 1; i >= 0; i-- ) {
     859                                p = this.containers[ i ].element.offset();
     860                                this.containers[ i ].containerCache.left = p.left;
     861                                this.containers[ i ].containerCache.top = p.top;
     862                                this.containers[ i ].containerCache.width =
     863                                        this.containers[ i ].element.outerWidth();
     864                                this.containers[ i ].containerCache.height =
     865                                        this.containers[ i ].element.outerHeight();
     866                        }
     867                }
     868
     869                return this;
     870        },
     871
     872        _createPlaceholder: function( that ) {
     873                that = that || this;
     874                var className,
     875                        o = that.options;
     876
     877                if ( !o.placeholder || o.placeholder.constructor === String ) {
     878                        className = o.placeholder;
     879                        o.placeholder = {
     880                                element: function() {
     881
     882                                        var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
     883                                                element = $( "<" + nodeName + ">", that.document[ 0 ] );
     884
     885                                                that._addClass( element, "ui-sortable-placeholder",
     886                                                                className || that.currentItem[ 0 ].className )
     887                                                        ._removeClass( element, "ui-sortable-helper" );
     888
     889                                        if ( nodeName === "tbody" ) {
     890                                                that._createTrPlaceholder(
     891                                                        that.currentItem.find( "tr" ).eq( 0 ),
     892                                                        $( "<tr>", that.document[ 0 ] ).appendTo( element )
     893                                                );
     894                                        } else if ( nodeName === "tr" ) {
     895                                                that._createTrPlaceholder( that.currentItem, element );
     896                                        } else if ( nodeName === "img" ) {
     897                                                element.attr( "src", that.currentItem.attr( "src" ) );
     898                                        }
     899
     900                                        if ( !className ) {
     901                                                element.css( "visibility", "hidden" );
     902                                        }
     903
     904                                        return element;
     905                                },
     906                                update: function( container, p ) {
     907
     908                                        // 1. If a className is set as 'placeholder option, we don't force sizes -
     909                                        // the class is responsible for that
     910                                        // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
     911                                        // class name is specified
     912                                        if ( className && !o.forcePlaceholderSize ) {
     913                                                return;
     914                                        }
     915
     916                                        //If the element doesn't have a actual height by itself (without styles coming
     917                                        // from a stylesheet), it receives the inline height from the dragged item
     918                                        if ( !p.height() ) {
     919                                                p.height(
     920                                                        that.currentItem.innerHeight() -
     921                                                        parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
     922                                                        parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
     923                                        }
     924                                        if ( !p.width() ) {
     925                                                p.width(
     926                                                        that.currentItem.innerWidth() -
     927                                                        parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
     928                                                        parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
     929                                        }
     930                                }
     931                        };
     932                }
     933
     934                //Create the placeholder
     935                that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
     936
     937                //Append it after the actual current item
     938                that.currentItem.after( that.placeholder );
     939
     940                //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
     941                o.placeholder.update( that, that.placeholder );
     942
     943        },
     944
     945        _createTrPlaceholder: function( sourceTr, targetTr ) {
     946                var that = this;
     947
     948                sourceTr.children().each( function() {
     949                        $( "<td>&#160;</td>", that.document[ 0 ] )
     950                                .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
     951                                .appendTo( targetTr );
     952                } );
     953        },
     954
     955        _contactContainers: function( event ) {
     956                var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
     957                        floating, axis,
     958                        innermostContainer = null,
     959                        innermostIndex = null;
     960
     961                // Get innermost container that intersects with item
     962                for ( i = this.containers.length - 1; i >= 0; i-- ) {
     963
     964                        // Never consider a container that's located within the item itself
     965                        if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
     966                                continue;
     967                        }
     968
     969                        if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
     970
     971                                // If we've already found a container and it's more "inner" than this, then continue
     972                                if ( innermostContainer &&
     973                                                $.contains(
     974                                                        this.containers[ i ].element[ 0 ],
     975                                                        innermostContainer.element[ 0 ] ) ) {
     976                                        continue;
     977                                }
     978
     979                                innermostContainer = this.containers[ i ];
     980                                innermostIndex = i;
     981
     982                        } else {
     983
     984                                // container doesn't intersect. trigger "out" event if necessary
     985                                if ( this.containers[ i ].containerCache.over ) {
     986                                        this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
     987                                        this.containers[ i ].containerCache.over = 0;
     988                                }
     989                        }
     990
     991                }
     992
     993                // If no intersecting containers found, return
     994                if ( !innermostContainer ) {
     995                        return;
     996                }
     997
     998                // Move the item into the container if it's not there already
     999                if ( this.containers.length === 1 ) {
     1000                        if ( !this.containers[ innermostIndex ].containerCache.over ) {
     1001                                this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
     1002                                this.containers[ innermostIndex ].containerCache.over = 1;
     1003                        }
     1004                } else {
     1005
     1006                        // When entering a new container, we will find the item with the least distance and
     1007                        // append our item near it
     1008                        dist = 10000;
     1009                        itemWithLeastDistance = null;
     1010                        floating = innermostContainer.floating || this._isFloating( this.currentItem );
     1011                        posProperty = floating ? "left" : "top";
     1012                        sizeProperty = floating ? "width" : "height";
     1013                        axis = floating ? "pageX" : "pageY";
     1014
     1015                        for ( j = this.items.length - 1; j >= 0; j-- ) {
     1016                                if ( !$.contains(
     1017                                                this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
     1018                                ) {
     1019                                        continue;
     1020                                }
     1021                                if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
     1022                                        continue;
     1023                                }
     1024
     1025                                cur = this.items[ j ].item.offset()[ posProperty ];
     1026                                nearBottom = false;
     1027                                if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
     1028                                        nearBottom = true;
     1029                                }
     1030
     1031                                if ( Math.abs( event[ axis ] - cur ) < dist ) {
     1032                                        dist = Math.abs( event[ axis ] - cur );
     1033                                        itemWithLeastDistance = this.items[ j ];
     1034                                        this.direction = nearBottom ? "up" : "down";
     1035                                }
     1036                        }
     1037
     1038                        //Check if dropOnEmpty is enabled
     1039                        if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
     1040                                return;
     1041                        }
     1042
     1043                        if ( this.currentContainer === this.containers[ innermostIndex ] ) {
     1044                                if ( !this.currentContainer.containerCache.over ) {
     1045                                        this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
     1046                                        this.currentContainer.containerCache.over = 1;
     1047                                }
     1048                                return;
     1049                        }
     1050
     1051                        itemWithLeastDistance ?
     1052                                this._rearrange( event, itemWithLeastDistance, null, true ) :
     1053                                this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
     1054                        this._trigger( "change", event, this._uiHash() );
     1055                        this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
     1056                        this.currentContainer = this.containers[ innermostIndex ];
     1057
     1058                        //Update the placeholder
     1059                        this.options.placeholder.update( this.currentContainer, this.placeholder );
     1060
     1061                        this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
     1062                        this.containers[ innermostIndex ].containerCache.over = 1;
     1063                }
     1064
     1065        },
     1066
     1067        _createHelper: function( event ) {
     1068
     1069                var o = this.options,
     1070                        helper = $.isFunction( o.helper ) ?
     1071                                $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
     1072                                ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
     1073
     1074                //Add the helper to the DOM if that didn't happen already
     1075                if ( !helper.parents( "body" ).length ) {
     1076                        $( o.appendTo !== "parent" ?
     1077                                o.appendTo :
     1078                                this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
     1079                }
     1080
     1081                if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
     1082                        this._storedCSS = {
     1083                                width: this.currentItem[ 0 ].style.width,
     1084                                height: this.currentItem[ 0 ].style.height,
     1085                                position: this.currentItem.css( "position" ),
     1086                                top: this.currentItem.css( "top" ),
     1087                                left: this.currentItem.css( "left" )
     1088                        };
     1089                }
     1090
     1091                if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
     1092                        helper.width( this.currentItem.width() );
     1093                }
     1094                if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
     1095                        helper.height( this.currentItem.height() );
     1096                }
     1097
     1098                return helper;
     1099
     1100        },
     1101
     1102        _adjustOffsetFromHelper: function( obj ) {
     1103                if ( typeof obj === "string" ) {
     1104                        obj = obj.split( " " );
     1105                }
     1106                if ( $.isArray( obj ) ) {
     1107                        obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
     1108                }
     1109                if ( "left" in obj ) {
     1110                        this.offset.click.left = obj.left + this.margins.left;
     1111                }
     1112                if ( "right" in obj ) {
     1113                        this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
     1114                }
     1115                if ( "top" in obj ) {
     1116                        this.offset.click.top = obj.top + this.margins.top;
     1117                }
     1118                if ( "bottom" in obj ) {
     1119                        this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
     1120                }
     1121        },
     1122
     1123        _getParentOffset: function() {
     1124
     1125                //Get the offsetParent and cache its position
     1126                this.offsetParent = this.helper.offsetParent();
     1127                var po = this.offsetParent.offset();
     1128
     1129                // This is a special case where we need to modify a offset calculated on start, since the
     1130                // following happened:
     1131                // 1. The position of the helper is absolute, so it's position is calculated based on the
     1132                // next positioned parent
     1133                // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
     1134                // the document, which means that the scroll is included in the initial calculation of the
     1135                // offset of the parent, and never recalculated upon drag
     1136                if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
     1137                                $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
     1138                        po.left += this.scrollParent.scrollLeft();
     1139                        po.top += this.scrollParent.scrollTop();
     1140                }
     1141
     1142                // This needs to be actually done for all browsers, since pageX/pageY includes this
     1143                // information with an ugly IE fix
     1144                if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
     1145                                ( this.offsetParent[ 0 ].tagName &&
     1146                                this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
     1147                        po = { top: 0, left: 0 };
     1148                }
     1149
     1150                return {
     1151                        top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
     1152                        left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
     1153                };
     1154
     1155        },
     1156
     1157        _getRelativeOffset: function() {
     1158
     1159                if ( this.cssPosition === "relative" ) {
     1160                        var p = this.currentItem.position();
     1161                        return {
     1162                                top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
     1163                                        this.scrollParent.scrollTop(),
     1164                                left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
     1165                                        this.scrollParent.scrollLeft()
     1166                        };
     1167                } else {
     1168                        return { top: 0, left: 0 };
     1169                }
     1170
     1171        },
     1172
     1173        _cacheMargins: function() {
     1174                this.margins = {
     1175                        left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
     1176                        top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
     1177                };
     1178        },
     1179
     1180        _cacheHelperProportions: function() {
     1181                this.helperProportions = {
     1182                        width: this.helper.outerWidth(),
     1183                        height: this.helper.outerHeight()
     1184                };
     1185        },
     1186
     1187        _setContainment: function() {
     1188
     1189                var ce, co, over,
     1190                        o = this.options;
     1191                if ( o.containment === "parent" ) {
     1192                        o.containment = this.helper[ 0 ].parentNode;
     1193                }
     1194                if ( o.containment === "document" || o.containment === "window" ) {
     1195                        this.containment = [
     1196                                0 - this.offset.relative.left - this.offset.parent.left,
     1197                                0 - this.offset.relative.top - this.offset.parent.top,
     1198                                o.containment === "document" ?
     1199                                        this.document.width() :
     1200                                        this.window.width() - this.helperProportions.width - this.margins.left,
     1201                                ( o.containment === "document" ?
     1202                                        ( this.document.height() || document.body.parentNode.scrollHeight ) :
     1203                                        this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
     1204                                ) - this.helperProportions.height - this.margins.top
     1205                        ];
     1206                }
     1207
     1208                if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
     1209                        ce = $( o.containment )[ 0 ];
     1210                        co = $( o.containment ).offset();
     1211                        over = ( $( ce ).css( "overflow" ) !== "hidden" );
     1212
     1213                        this.containment = [
     1214                                co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
     1215                                        ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
     1216                                co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
     1217                                        ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
     1218                                co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
     1219                                        ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
     1220                                        ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
     1221                                        this.helperProportions.width - this.margins.left,
     1222                                co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
     1223                                        ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
     1224                                        ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
     1225                                        this.helperProportions.height - this.margins.top
     1226                        ];
     1227                }
     1228
     1229        },
     1230
     1231        _convertPositionTo: function( d, pos ) {
     1232
     1233                if ( !pos ) {
     1234                        pos = this.position;
     1235                }
     1236                var mod = d === "absolute" ? 1 : -1,
     1237                        scroll = this.cssPosition === "absolute" &&
     1238                                !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
     1239                                $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
     1240                                        this.offsetParent :
     1241                                        this.scrollParent,
     1242                        scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
     1243
     1244                return {
     1245                        top: (
     1246
     1247                                // The absolute mouse position
     1248                                pos.top +
     1249
     1250                                // Only for relative positioned nodes: Relative offset from element to offset parent
     1251                                this.offset.relative.top * mod +
     1252
     1253                                // The offsetParent's offset without borders (offset + border)
     1254                                this.offset.parent.top * mod -
     1255                                ( ( this.cssPosition === "fixed" ?
     1256                                        -this.scrollParent.scrollTop() :
     1257                                        ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
     1258                        ),
     1259                        left: (
     1260
     1261                                // The absolute mouse position
     1262                                pos.left +
     1263
     1264                                // Only for relative positioned nodes: Relative offset from element to offset parent
     1265                                this.offset.relative.left * mod +
     1266
     1267                                // The offsetParent's offset without borders (offset + border)
     1268                                this.offset.parent.left * mod   -
     1269                                ( ( this.cssPosition === "fixed" ?
     1270                                        -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
     1271                                        scroll.scrollLeft() ) * mod )
     1272                        )
     1273                };
     1274
     1275        },
     1276
     1277        _generatePosition: function( event ) {
     1278
     1279                var top, left,
     1280                        o = this.options,
     1281                        pageX = event.pageX,
     1282                        pageY = event.pageY,
     1283                        scroll = this.cssPosition === "absolute" &&
     1284                                !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
     1285                                $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
     1286                                        this.offsetParent :
     1287                                        this.scrollParent,
     1288                                scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
     1289
     1290                // This is another very weird special case that only happens for relative elements:
     1291                // 1. If the css position is relative
     1292                // 2. and the scroll parent is the document or similar to the offset parent
     1293                // we have to refresh the relative offset during the scroll so there are no jumps
     1294                if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
     1295                                this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
     1296                        this.offset.relative = this._getRelativeOffset();
     1297                }
     1298
     1299                /*
     1300                 * - Position constraining -
     1301                 * Constrain the position to a mix of grid, containment.
     1302                 */
     1303
     1304                if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
     1305
     1306                        if ( this.containment ) {
     1307                                if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
     1308                                        pageX = this.containment[ 0 ] + this.offset.click.left;
     1309                                }
     1310                                if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
     1311                                        pageY = this.containment[ 1 ] + this.offset.click.top;
     1312                                }
     1313                                if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
     1314                                        pageX = this.containment[ 2 ] + this.offset.click.left;
     1315                                }
     1316                                if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
     1317                                        pageY = this.containment[ 3 ] + this.offset.click.top;
     1318                                }
     1319                        }
     1320
     1321                        if ( o.grid ) {
     1322                                top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
     1323                                        o.grid[ 1 ] ) * o.grid[ 1 ];
     1324                                pageY = this.containment ?
     1325                                        ( ( top - this.offset.click.top >= this.containment[ 1 ] &&
     1326                                                top - this.offset.click.top <= this.containment[ 3 ] ) ?
     1327                                                        top :
     1328                                                        ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
     1329                                                                top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
     1330                                                                top;
     1331
     1332                                left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
     1333                                        o.grid[ 0 ] ) * o.grid[ 0 ];
     1334                                pageX = this.containment ?
     1335                                        ( ( left - this.offset.click.left >= this.containment[ 0 ] &&
     1336                                                left - this.offset.click.left <= this.containment[ 2 ] ) ?
     1337                                                        left :
     1338                                                        ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
     1339                                                                left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
     1340                                                                left;
     1341                        }
     1342
     1343                }
     1344
     1345                return {
     1346                        top: (
     1347
     1348                                // The absolute mouse position
     1349                                pageY -
     1350
     1351                                // Click offset (relative to the element)
     1352                                this.offset.click.top -
     1353
     1354                                // Only for relative positioned nodes: Relative offset from element to offset parent
     1355                                this.offset.relative.top -
     1356
     1357                                // The offsetParent's offset without borders (offset + border)
     1358                                this.offset.parent.top +
     1359                                ( ( this.cssPosition === "fixed" ?
     1360                                        -this.scrollParent.scrollTop() :
     1361                                        ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
     1362                        ),
     1363                        left: (
     1364
     1365                                // The absolute mouse position
     1366                                pageX -
     1367
     1368                                // Click offset (relative to the element)
     1369                                this.offset.click.left -
     1370
     1371                                // Only for relative positioned nodes: Relative offset from element to offset parent
     1372                                this.offset.relative.left -
     1373
     1374                                // The offsetParent's offset without borders (offset + border)
     1375                                this.offset.parent.left +
     1376                                ( ( this.cssPosition === "fixed" ?
     1377                                        -this.scrollParent.scrollLeft() :
     1378                                        scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
     1379                        )
     1380                };
     1381
     1382        },
     1383
     1384        _rearrange: function( event, i, a, hardRefresh ) {
     1385
     1386                a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
     1387                        i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
     1388                                ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
     1389
     1390                //Various things done here to improve the performance:
     1391                // 1. we create a setTimeout, that calls refreshPositions
     1392                // 2. on the instance, we have a counter variable, that get's higher after every append
     1393                // 3. on the local scope, we copy the counter variable, and check in the timeout,
     1394                // if it's still the same
     1395                // 4. this lets only the last addition to the timeout stack through
     1396                this.counter = this.counter ? ++this.counter : 1;
     1397                var counter = this.counter;
     1398
     1399                this._delay( function() {
     1400                        if ( counter === this.counter ) {
     1401
     1402                                //Precompute after each DOM insertion, NOT on mousemove
     1403                                this.refreshPositions( !hardRefresh );
     1404                        }
     1405                } );
     1406
     1407        },
     1408
     1409        _clear: function( event, noPropagation ) {
     1410
     1411                this.reverting = false;
     1412
     1413                // We delay all events that have to be triggered to after the point where the placeholder
     1414                // has been removed and everything else normalized again
     1415                var i,
     1416                        delayedTriggers = [];
     1417
     1418                // We first have to update the dom position of the actual currentItem
     1419                // Note: don't do it if the current item is already removed (by a user), or it gets
     1420                // reappended (see #4088)
     1421                if ( !this._noFinalSort && this.currentItem.parent().length ) {
     1422                        this.placeholder.before( this.currentItem );
     1423                }
     1424                this._noFinalSort = null;
     1425
     1426                if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
     1427                        for ( i in this._storedCSS ) {
     1428                                if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
     1429                                        this._storedCSS[ i ] = "";
     1430                                }
     1431                        }
     1432                        this.currentItem.css( this._storedCSS );
     1433                        this._removeClass( this.currentItem, "ui-sortable-helper" );
     1434                } else {
     1435                        this.currentItem.show();
     1436                }
     1437
     1438                if ( this.fromOutside && !noPropagation ) {
     1439                        delayedTriggers.push( function( event ) {
     1440                                this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
     1441                        } );
     1442                }
     1443                if ( ( this.fromOutside ||
     1444                                this.domPosition.prev !==
     1445                                this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
     1446                                this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
     1447
     1448                        // Trigger update callback if the DOM position has changed
     1449                        delayedTriggers.push( function( event ) {
     1450                                this._trigger( "update", event, this._uiHash() );
     1451                        } );
     1452                }
     1453
     1454                // Check if the items Container has Changed and trigger appropriate
     1455                // events.
     1456                if ( this !== this.currentContainer ) {
     1457                        if ( !noPropagation ) {
     1458                                delayedTriggers.push( function( event ) {
     1459                                        this._trigger( "remove", event, this._uiHash() );
     1460                                } );
     1461                                delayedTriggers.push( ( function( c ) {
     1462                                        return function( event ) {
     1463                                                c._trigger( "receive", event, this._uiHash( this ) );
     1464                                        };
     1465                                } ).call( this, this.currentContainer ) );
     1466                                delayedTriggers.push( ( function( c ) {
     1467                                        return function( event ) {
     1468                                                c._trigger( "update", event, this._uiHash( this ) );
     1469                                        };
     1470                                } ).call( this, this.currentContainer ) );
     1471                        }
     1472                }
     1473
     1474                //Post events to containers
     1475                function delayEvent( type, instance, container ) {
     1476                        return function( event ) {
     1477                                container._trigger( type, event, instance._uiHash( instance ) );
     1478                        };
     1479                }
     1480                for ( i = this.containers.length - 1; i >= 0; i-- ) {
     1481                        if ( !noPropagation ) {
     1482                                delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
     1483                        }
     1484                        if ( this.containers[ i ].containerCache.over ) {
     1485                                delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
     1486                                this.containers[ i ].containerCache.over = 0;
     1487                        }
     1488                }
     1489
     1490                //Do what was originally in plugins
     1491                if ( this.storedCursor ) {
     1492                        this.document.find( "body" ).css( "cursor", this.storedCursor );
     1493                        this.storedStylesheet.remove();
     1494                }
     1495                if ( this._storedOpacity ) {
     1496                        this.helper.css( "opacity", this._storedOpacity );
     1497                }
     1498                if ( this._storedZIndex ) {
     1499                        this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
     1500                }
     1501
     1502                this.dragging = false;
     1503
     1504                if ( !noPropagation ) {
     1505                        this._trigger( "beforeStop", event, this._uiHash() );
     1506                }
     1507
     1508                //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
     1509                // it unbinds ALL events from the original node!
     1510                this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
     1511
     1512                if ( !this.cancelHelperRemoval ) {
     1513                        if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
     1514                                this.helper.remove();
     1515                        }
     1516                        this.helper = null;
     1517                }
     1518
     1519                if ( !noPropagation ) {
     1520                        for ( i = 0; i < delayedTriggers.length; i++ ) {
     1521
     1522                                // Trigger all delayed events
     1523                                delayedTriggers[ i ].call( this, event );
     1524                        }
     1525                        this._trigger( "stop", event, this._uiHash() );
     1526                }
     1527
     1528                this.fromOutside = false;
     1529                return !this.cancelHelperRemoval;
     1530
     1531        },
     1532
     1533        _trigger: function() {
     1534                if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
     1535                        this.cancel();
     1536                }
     1537        },
     1538
     1539        _uiHash: function( _inst ) {
     1540                var inst = _inst || this;
     1541                return {
     1542                        helper: inst.helper,
     1543                        placeholder: inst.placeholder || $( [] ),
     1544                        position: inst.position,
     1545                        originalPosition: inst.originalPosition,
     1546                        offset: inst.positionAbs,
     1547                        item: inst.currentItem,
     1548                        sender: _inst ? _inst.element : null
     1549                };
     1550        }
     1551
     1552} );
     1553
     1554} ) );
  • src/js/_enqueues/vendor/jquery/ui/spinner.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/sortable.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Spinner 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Spinner
     11//>>group: Widgets
     12//>>description: Displays buttons to easily input numbers via the keyboard or mouse.
     13//>>docs: http://api.jqueryui.com/spinner/
     14//>>demos: http://jqueryui.com/spinner/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/spinner.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./button",
     26                        "./version",
     27                        "./keycode",
     28                        "./safe-active-element",
     29                        "./widget"
     30                ], factory );
     31        } else {
     32
     33                // Browser globals
     34                factory( jQuery );
     35        }
     36}( function( $ ) {
     37
     38function spinnerModifer( fn ) {
     39        return function() {
     40                var previous = this.element.val();
     41                fn.apply( this, arguments );
     42                this._refresh();
     43                if ( previous !== this.element.val() ) {
     44                        this._trigger( "change" );
     45                }
     46        };
     47}
     48
     49$.widget( "ui.spinner", {
     50        version: "1.12.1",
     51        defaultElement: "<input>",
     52        widgetEventPrefix: "spin",
     53        options: {
     54                classes: {
     55                        "ui-spinner": "ui-corner-all",
     56                        "ui-spinner-down": "ui-corner-br",
     57                        "ui-spinner-up": "ui-corner-tr"
     58                },
     59                culture: null,
     60                icons: {
     61                        down: "ui-icon-triangle-1-s",
     62                        up: "ui-icon-triangle-1-n"
     63                },
     64                incremental: true,
     65                max: null,
     66                min: null,
     67                numberFormat: null,
     68                page: 10,
     69                step: 1,
     70
     71                change: null,
     72                spin: null,
     73                start: null,
     74                stop: null
     75        },
     76
     77        _create: function() {
     78
     79                // handle string values that need to be parsed
     80                this._setOption( "max", this.options.max );
     81                this._setOption( "min", this.options.min );
     82                this._setOption( "step", this.options.step );
     83
     84                // Only format if there is a value, prevents the field from being marked
     85                // as invalid in Firefox, see #9573.
     86                if ( this.value() !== "" ) {
     87
     88                        // Format the value, but don't constrain.
     89                        this._value( this.element.val(), true );
     90                }
     91
     92                this._draw();
     93                this._on( this._events );
     94                this._refresh();
     95
     96                // Turning off autocomplete prevents the browser from remembering the
     97                // value when navigating through history, so we re-enable autocomplete
     98                // if the page is unloaded before the widget is destroyed. #7790
     99                this._on( this.window, {
     100                        beforeunload: function() {
     101                                this.element.removeAttr( "autocomplete" );
     102                        }
     103                } );
     104        },
     105
     106        _getCreateOptions: function() {
     107                var options = this._super();
     108                var element = this.element;
     109
     110                $.each( [ "min", "max", "step" ], function( i, option ) {
     111                        var value = element.attr( option );
     112                        if ( value != null && value.length ) {
     113                                options[ option ] = value;
     114                        }
     115                } );
     116
     117                return options;
     118        },
     119
     120        _events: {
     121                keydown: function( event ) {
     122                        if ( this._start( event ) && this._keydown( event ) ) {
     123                                event.preventDefault();
     124                        }
     125                },
     126                keyup: "_stop",
     127                focus: function() {
     128                        this.previous = this.element.val();
     129                },
     130                blur: function( event ) {
     131                        if ( this.cancelBlur ) {
     132                                delete this.cancelBlur;
     133                                return;
     134                        }
     135
     136                        this._stop();
     137                        this._refresh();
     138                        if ( this.previous !== this.element.val() ) {
     139                                this._trigger( "change", event );
     140                        }
     141                },
     142                mousewheel: function( event, delta ) {
     143                        if ( !delta ) {
     144                                return;
     145                        }
     146                        if ( !this.spinning && !this._start( event ) ) {
     147                                return false;
     148                        }
     149
     150                        this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
     151                        clearTimeout( this.mousewheelTimer );
     152                        this.mousewheelTimer = this._delay( function() {
     153                                if ( this.spinning ) {
     154                                        this._stop( event );
     155                                }
     156                        }, 100 );
     157                        event.preventDefault();
     158                },
     159                "mousedown .ui-spinner-button": function( event ) {
     160                        var previous;
     161
     162                        // We never want the buttons to have focus; whenever the user is
     163                        // interacting with the spinner, the focus should be on the input.
     164                        // If the input is focused then this.previous is properly set from
     165                        // when the input first received focus. If the input is not focused
     166                        // then we need to set this.previous based on the value before spinning.
     167                        previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
     168                                this.previous : this.element.val();
     169                        function checkFocus() {
     170                                var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
     171                                if ( !isActive ) {
     172                                        this.element.trigger( "focus" );
     173                                        this.previous = previous;
     174
     175                                        // support: IE
     176                                        // IE sets focus asynchronously, so we need to check if focus
     177                                        // moved off of the input because the user clicked on the button.
     178                                        this._delay( function() {
     179                                                this.previous = previous;
     180                                        } );
     181                                }
     182                        }
     183
     184                        // Ensure focus is on (or stays on) the text field
     185                        event.preventDefault();
     186                        checkFocus.call( this );
     187
     188                        // Support: IE
     189                        // IE doesn't prevent moving focus even with event.preventDefault()
     190                        // so we set a flag to know when we should ignore the blur event
     191                        // and check (again) if focus moved off of the input.
     192                        this.cancelBlur = true;
     193                        this._delay( function() {
     194                                delete this.cancelBlur;
     195                                checkFocus.call( this );
     196                        } );
     197
     198                        if ( this._start( event ) === false ) {
     199                                return;
     200                        }
     201
     202                        this._repeat( null, $( event.currentTarget )
     203                                .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
     204                },
     205                "mouseup .ui-spinner-button": "_stop",
     206                "mouseenter .ui-spinner-button": function( event ) {
     207
     208                        // button will add ui-state-active if mouse was down while mouseleave and kept down
     209                        if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
     210                                return;
     211                        }
     212
     213                        if ( this._start( event ) === false ) {
     214                                return false;
     215                        }
     216                        this._repeat( null, $( event.currentTarget )
     217                                .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
     218                },
     219
     220                // TODO: do we really want to consider this a stop?
     221                // shouldn't we just stop the repeater and wait until mouseup before
     222                // we trigger the stop event?
     223                "mouseleave .ui-spinner-button": "_stop"
     224        },
     225
     226        // Support mobile enhanced option and make backcompat more sane
     227        _enhance: function() {
     228                this.uiSpinner = this.element
     229                        .attr( "autocomplete", "off" )
     230                        .wrap( "<span>" )
     231                        .parent()
     232
     233                                // Add buttons
     234                                .append(
     235                                        "<a></a><a></a>"
     236                                );
     237        },
     238
     239        _draw: function() {
     240                this._enhance();
     241
     242                this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
     243                this._addClass( "ui-spinner-input" );
     244
     245                this.element.attr( "role", "spinbutton" );
     246
     247                // Button bindings
     248                this.buttons = this.uiSpinner.children( "a" )
     249                        .attr( "tabIndex", -1 )
     250                        .attr( "aria-hidden", true )
     251                        .button( {
     252                                classes: {
     253                                        "ui-button": ""
     254                                }
     255                        } );
     256
     257                // TODO: Right now button does not support classes this is already updated in button PR
     258                this._removeClass( this.buttons, "ui-corner-all" );
     259
     260                this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
     261                this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
     262                this.buttons.first().button( {
     263                        "icon": this.options.icons.up,
     264                        "showLabel": false
     265                } );
     266                this.buttons.last().button( {
     267                        "icon": this.options.icons.down,
     268                        "showLabel": false
     269                } );
     270
     271                // IE 6 doesn't understand height: 50% for the buttons
     272                // unless the wrapper has an explicit height
     273                if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
     274                                this.uiSpinner.height() > 0 ) {
     275                        this.uiSpinner.height( this.uiSpinner.height() );
     276                }
     277        },
     278
     279        _keydown: function( event ) {
     280                var options = this.options,
     281                        keyCode = $.ui.keyCode;
     282
     283                switch ( event.keyCode ) {
     284                case keyCode.UP:
     285                        this._repeat( null, 1, event );
     286                        return true;
     287                case keyCode.DOWN:
     288                        this._repeat( null, -1, event );
     289                        return true;
     290                case keyCode.PAGE_UP:
     291                        this._repeat( null, options.page, event );
     292                        return true;
     293                case keyCode.PAGE_DOWN:
     294                        this._repeat( null, -options.page, event );
     295                        return true;
     296                }
     297
     298                return false;
     299        },
     300
     301        _start: function( event ) {
     302                if ( !this.spinning && this._trigger( "start", event ) === false ) {
     303                        return false;
     304                }
     305
     306                if ( !this.counter ) {
     307                        this.counter = 1;
     308                }
     309                this.spinning = true;
     310                return true;
     311        },
     312
     313        _repeat: function( i, steps, event ) {
     314                i = i || 500;
     315
     316                clearTimeout( this.timer );
     317                this.timer = this._delay( function() {
     318                        this._repeat( 40, steps, event );
     319                }, i );
     320
     321                this._spin( steps * this.options.step, event );
     322        },
     323
     324        _spin: function( step, event ) {
     325                var value = this.value() || 0;
     326
     327                if ( !this.counter ) {
     328                        this.counter = 1;
     329                }
     330
     331                value = this._adjustValue( value + step * this._increment( this.counter ) );
     332
     333                if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
     334                        this._value( value );
     335                        this.counter++;
     336                }
     337        },
     338
     339        _increment: function( i ) {
     340                var incremental = this.options.incremental;
     341
     342                if ( incremental ) {
     343                        return $.isFunction( incremental ) ?
     344                                incremental( i ) :
     345                                Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
     346                }
     347
     348                return 1;
     349        },
     350
     351        _precision: function() {
     352                var precision = this._precisionOf( this.options.step );
     353                if ( this.options.min !== null ) {
     354                        precision = Math.max( precision, this._precisionOf( this.options.min ) );
     355                }
     356                return precision;
     357        },
     358
     359        _precisionOf: function( num ) {
     360                var str = num.toString(),
     361                        decimal = str.indexOf( "." );
     362                return decimal === -1 ? 0 : str.length - decimal - 1;
     363        },
     364
     365        _adjustValue: function( value ) {
     366                var base, aboveMin,
     367                        options = this.options;
     368
     369                // Make sure we're at a valid step
     370                // - find out where we are relative to the base (min or 0)
     371                base = options.min !== null ? options.min : 0;
     372                aboveMin = value - base;
     373
     374                // - round to the nearest step
     375                aboveMin = Math.round( aboveMin / options.step ) * options.step;
     376
     377                // - rounding is based on 0, so adjust back to our base
     378                value = base + aboveMin;
     379
     380                // Fix precision from bad JS floating point math
     381                value = parseFloat( value.toFixed( this._precision() ) );
     382
     383                // Clamp the value
     384                if ( options.max !== null && value > options.max ) {
     385                        return options.max;
     386                }
     387                if ( options.min !== null && value < options.min ) {
     388                        return options.min;
     389                }
     390
     391                return value;
     392        },
     393
     394        _stop: function( event ) {
     395                if ( !this.spinning ) {
     396                        return;
     397                }
     398
     399                clearTimeout( this.timer );
     400                clearTimeout( this.mousewheelTimer );
     401                this.counter = 0;
     402                this.spinning = false;
     403                this._trigger( "stop", event );
     404        },
     405
     406        _setOption: function( key, value ) {
     407                var prevValue, first, last;
     408
     409                if ( key === "culture" || key === "numberFormat" ) {
     410                        prevValue = this._parse( this.element.val() );
     411                        this.options[ key ] = value;
     412                        this.element.val( this._format( prevValue ) );
     413                        return;
     414                }
     415
     416                if ( key === "max" || key === "min" || key === "step" ) {
     417                        if ( typeof value === "string" ) {
     418                                value = this._parse( value );
     419                        }
     420                }
     421                if ( key === "icons" ) {
     422                        first = this.buttons.first().find( ".ui-icon" );
     423                        this._removeClass( first, null, this.options.icons.up );
     424                        this._addClass( first, null, value.up );
     425                        last = this.buttons.last().find( ".ui-icon" );
     426                        this._removeClass( last, null, this.options.icons.down );
     427                        this._addClass( last, null, value.down );
     428                }
     429
     430                this._super( key, value );
     431        },
     432
     433        _setOptionDisabled: function( value ) {
     434                this._super( value );
     435
     436                this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
     437                this.element.prop( "disabled", !!value );
     438                this.buttons.button( value ? "disable" : "enable" );
     439        },
     440
     441        _setOptions: spinnerModifer( function( options ) {
     442                this._super( options );
     443        } ),
     444
     445        _parse: function( val ) {
     446                if ( typeof val === "string" && val !== "" ) {
     447                        val = window.Globalize && this.options.numberFormat ?
     448                                Globalize.parseFloat( val, 10, this.options.culture ) : +val;
     449                }
     450                return val === "" || isNaN( val ) ? null : val;
     451        },
     452
     453        _format: function( value ) {
     454                if ( value === "" ) {
     455                        return "";
     456                }
     457                return window.Globalize && this.options.numberFormat ?
     458                        Globalize.format( value, this.options.numberFormat, this.options.culture ) :
     459                        value;
     460        },
     461
     462        _refresh: function() {
     463                this.element.attr( {
     464                        "aria-valuemin": this.options.min,
     465                        "aria-valuemax": this.options.max,
     466
     467                        // TODO: what should we do with values that can't be parsed?
     468                        "aria-valuenow": this._parse( this.element.val() )
     469                } );
     470        },
     471
     472        isValid: function() {
     473                var value = this.value();
     474
     475                // Null is invalid
     476                if ( value === null ) {
     477                        return false;
     478                }
     479
     480                // If value gets adjusted, it's invalid
     481                return value === this._adjustValue( value );
     482        },
     483
     484        // Update the value without triggering change
     485        _value: function( value, allowAny ) {
     486                var parsed;
     487                if ( value !== "" ) {
     488                        parsed = this._parse( value );
     489                        if ( parsed !== null ) {
     490                                if ( !allowAny ) {
     491                                        parsed = this._adjustValue( parsed );
     492                                }
     493                                value = this._format( parsed );
     494                        }
     495                }
     496                this.element.val( value );
     497                this._refresh();
     498        },
     499
     500        _destroy: function() {
     501                this.element
     502                        .prop( "disabled", false )
     503                        .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
     504
     505                this.uiSpinner.replaceWith( this.element );
     506        },
     507
     508        stepUp: spinnerModifer( function( steps ) {
     509                this._stepUp( steps );
     510        } ),
     511        _stepUp: function( steps ) {
     512                if ( this._start() ) {
     513                        this._spin( ( steps || 1 ) * this.options.step );
     514                        this._stop();
     515                }
     516        },
     517
     518        stepDown: spinnerModifer( function( steps ) {
     519                this._stepDown( steps );
     520        } ),
     521        _stepDown: function( steps ) {
     522                if ( this._start() ) {
     523                        this._spin( ( steps || 1 ) * -this.options.step );
     524                        this._stop();
     525                }
     526        },
     527
     528        pageUp: spinnerModifer( function( pages ) {
     529                this._stepUp( ( pages || 1 ) * this.options.page );
     530        } ),
     531
     532        pageDown: spinnerModifer( function( pages ) {
     533                this._stepDown( ( pages || 1 ) * this.options.page );
     534        } ),
     535
     536        value: function( newVal ) {
     537                if ( !arguments.length ) {
     538                        return this._parse( this.element.val() );
     539                }
     540                spinnerModifer( this._value ).call( this, newVal );
     541        },
     542
     543        widget: function() {
     544                return this.uiSpinner;
     545        }
     546} );
     547
     548// DEPRECATED
     549// TODO: switch return back to widget declaration at top of file when this is removed
     550if ( $.uiBackCompat !== false ) {
     551
     552        // Backcompat for spinner html extension points
     553        $.widget( "ui.spinner", $.ui.spinner, {
     554                _enhance: function() {
     555                        this.uiSpinner = this.element
     556                                .attr( "autocomplete", "off" )
     557                                .wrap( this._uiSpinnerHtml() )
     558                                .parent()
     559
     560                                        // Add buttons
     561                                        .append( this._buttonHtml() );
     562                },
     563                _uiSpinnerHtml: function() {
     564                        return "<span>";
     565                },
     566
     567                _buttonHtml: function() {
     568                        return "<a></a><a></a>";
     569                }
     570        } );
     571}
     572
     573return $.ui.spinner;
     574
     575} ) );
  • src/js/_enqueues/vendor/jquery/ui/tabs.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/spinner.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Tabs 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Tabs
     11//>>group: Widgets
     12//>>description: Transforms a set of container elements into a tab structure.
     13//>>docs: http://api.jqueryui.com/tabs/
     14//>>demos: http://jqueryui.com/tabs/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/tabs.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./escape-selector",
     26                        "./keycode",
     27                        "./safe-active-element",
     28                        "./unique-id",
     29                        "./version",
     30                        "./widget"
     31                ], factory );
     32        } else {
     33
     34                // Browser globals
     35                factory( jQuery );
     36        }
     37}( function( $ ) {
     38
     39$.widget( "ui.tabs", {
     40        version: "1.12.1",
     41        delay: 300,
     42        options: {
     43                active: null,
     44                classes: {
     45                        "ui-tabs": "ui-corner-all",
     46                        "ui-tabs-nav": "ui-corner-all",
     47                        "ui-tabs-panel": "ui-corner-bottom",
     48                        "ui-tabs-tab": "ui-corner-top"
     49                },
     50                collapsible: false,
     51                event: "click",
     52                heightStyle: "content",
     53                hide: null,
     54                show: null,
     55
     56                // Callbacks
     57                activate: null,
     58                beforeActivate: null,
     59                beforeLoad: null,
     60                load: null
     61        },
     62
     63        _isLocal: ( function() {
     64                var rhash = /#.*$/;
     65
     66                return function( anchor ) {
     67                        var anchorUrl, locationUrl;
     68
     69                        anchorUrl = anchor.href.replace( rhash, "" );
     70                        locationUrl = location.href.replace( rhash, "" );
     71
     72                        // Decoding may throw an error if the URL isn't UTF-8 (#9518)
     73                        try {
     74                                anchorUrl = decodeURIComponent( anchorUrl );
     75                        } catch ( error ) {}
     76                        try {
     77                                locationUrl = decodeURIComponent( locationUrl );
     78                        } catch ( error ) {}
     79
     80                        return anchor.hash.length > 1 && anchorUrl === locationUrl;
     81                };
     82        } )(),
     83
     84        _create: function() {
     85                var that = this,
     86                        options = this.options;
     87
     88                this.running = false;
     89
     90                this._addClass( "ui-tabs", "ui-widget ui-widget-content" );
     91                this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );
     92
     93                this._processTabs();
     94                options.active = this._initialActive();
     95
     96                // Take disabling tabs via class attribute from HTML
     97                // into account and update option properly.
     98                if ( $.isArray( options.disabled ) ) {
     99                        options.disabled = $.unique( options.disabled.concat(
     100                                $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
     101                                        return that.tabs.index( li );
     102                                } )
     103                        ) ).sort();
     104                }
     105
     106                // Check for length avoids error when initializing empty list
     107                if ( this.options.active !== false && this.anchors.length ) {
     108                        this.active = this._findActive( options.active );
     109                } else {
     110                        this.active = $();
     111                }
     112
     113                this._refresh();
     114
     115                if ( this.active.length ) {
     116                        this.load( options.active );
     117                }
     118        },
     119
     120        _initialActive: function() {
     121                var active = this.options.active,
     122                        collapsible = this.options.collapsible,
     123                        locationHash = location.hash.substring( 1 );
     124
     125                if ( active === null ) {
     126
     127                        // check the fragment identifier in the URL
     128                        if ( locationHash ) {
     129                                this.tabs.each( function( i, tab ) {
     130                                        if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
     131                                                active = i;
     132                                                return false;
     133                                        }
     134                                } );
     135                        }
     136
     137                        // Check for a tab marked active via a class
     138                        if ( active === null ) {
     139                                active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
     140                        }
     141
     142                        // No active tab, set to false
     143                        if ( active === null || active === -1 ) {
     144                                active = this.tabs.length ? 0 : false;
     145                        }
     146                }
     147
     148                // Handle numbers: negative, out of range
     149                if ( active !== false ) {
     150                        active = this.tabs.index( this.tabs.eq( active ) );
     151                        if ( active === -1 ) {
     152                                active = collapsible ? false : 0;
     153                        }
     154                }
     155
     156                // Don't allow collapsible: false and active: false
     157                if ( !collapsible && active === false && this.anchors.length ) {
     158                        active = 0;
     159                }
     160
     161                return active;
     162        },
     163
     164        _getCreateEventData: function() {
     165                return {
     166                        tab: this.active,
     167                        panel: !this.active.length ? $() : this._getPanelForTab( this.active )
     168                };
     169        },
     170
     171        _tabKeydown: function( event ) {
     172                var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
     173                        selectedIndex = this.tabs.index( focusedTab ),
     174                        goingForward = true;
     175
     176                if ( this._handlePageNav( event ) ) {
     177                        return;
     178                }
     179
     180                switch ( event.keyCode ) {
     181                case $.ui.keyCode.RIGHT:
     182                case $.ui.keyCode.DOWN:
     183                        selectedIndex++;
     184                        break;
     185                case $.ui.keyCode.UP:
     186                case $.ui.keyCode.LEFT:
     187                        goingForward = false;
     188                        selectedIndex--;
     189                        break;
     190                case $.ui.keyCode.END:
     191                        selectedIndex = this.anchors.length - 1;
     192                        break;
     193                case $.ui.keyCode.HOME:
     194                        selectedIndex = 0;
     195                        break;
     196                case $.ui.keyCode.SPACE:
     197
     198                        // Activate only, no collapsing
     199                        event.preventDefault();
     200                        clearTimeout( this.activating );
     201                        this._activate( selectedIndex );
     202                        return;
     203                case $.ui.keyCode.ENTER:
     204
     205                        // Toggle (cancel delayed activation, allow collapsing)
     206                        event.preventDefault();
     207                        clearTimeout( this.activating );
     208
     209                        // Determine if we should collapse or activate
     210                        this._activate( selectedIndex === this.options.active ? false : selectedIndex );
     211                        return;
     212                default:
     213                        return;
     214                }
     215
     216                // Focus the appropriate tab, based on which key was pressed
     217                event.preventDefault();
     218                clearTimeout( this.activating );
     219                selectedIndex = this._focusNextTab( selectedIndex, goingForward );
     220
     221                // Navigating with control/command key will prevent automatic activation
     222                if ( !event.ctrlKey && !event.metaKey ) {
     223
     224                        // Update aria-selected immediately so that AT think the tab is already selected.
     225                        // Otherwise AT may confuse the user by stating that they need to activate the tab,
     226                        // but the tab will already be activated by the time the announcement finishes.
     227                        focusedTab.attr( "aria-selected", "false" );
     228                        this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
     229
     230                        this.activating = this._delay( function() {
     231                                this.option( "active", selectedIndex );
     232                        }, this.delay );
     233                }
     234        },
     235
     236        _panelKeydown: function( event ) {
     237                if ( this._handlePageNav( event ) ) {
     238                        return;
     239                }
     240
     241                // Ctrl+up moves focus to the current tab
     242                if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
     243                        event.preventDefault();
     244                        this.active.trigger( "focus" );
     245                }
     246        },
     247
     248        // Alt+page up/down moves focus to the previous/next tab (and activates)
     249        _handlePageNav: function( event ) {
     250                if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
     251                        this._activate( this._focusNextTab( this.options.active - 1, false ) );
     252                        return true;
     253                }
     254                if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
     255                        this._activate( this._focusNextTab( this.options.active + 1, true ) );
     256                        return true;
     257                }
     258        },
     259
     260        _findNextTab: function( index, goingForward ) {
     261                var lastTabIndex = this.tabs.length - 1;
     262
     263                function constrain() {
     264                        if ( index > lastTabIndex ) {
     265                                index = 0;
     266                        }
     267                        if ( index < 0 ) {
     268                                index = lastTabIndex;
     269                        }
     270                        return index;
     271                }
     272
     273                while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
     274                        index = goingForward ? index + 1 : index - 1;
     275                }
     276
     277                return index;
     278        },
     279
     280        _focusNextTab: function( index, goingForward ) {
     281                index = this._findNextTab( index, goingForward );
     282                this.tabs.eq( index ).trigger( "focus" );
     283                return index;
     284        },
     285
     286        _setOption: function( key, value ) {
     287                if ( key === "active" ) {
     288
     289                        // _activate() will handle invalid values and update this.options
     290                        this._activate( value );
     291                        return;
     292                }
     293
     294                this._super( key, value );
     295
     296                if ( key === "collapsible" ) {
     297                        this._toggleClass( "ui-tabs-collapsible", null, value );
     298
     299                        // Setting collapsible: false while collapsed; open first panel
     300                        if ( !value && this.options.active === false ) {
     301                                this._activate( 0 );
     302                        }
     303                }
     304
     305                if ( key === "event" ) {
     306                        this._setupEvents( value );
     307                }
     308
     309                if ( key === "heightStyle" ) {
     310                        this._setupHeightStyle( value );
     311                }
     312        },
     313
     314        _sanitizeSelector: function( hash ) {
     315                return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
     316        },
     317
     318        refresh: function() {
     319                var options = this.options,
     320                        lis = this.tablist.children( ":has(a[href])" );
     321
     322                // Get disabled tabs from class attribute from HTML
     323                // this will get converted to a boolean if needed in _refresh()
     324                options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
     325                        return lis.index( tab );
     326                } );
     327
     328                this._processTabs();
     329
     330                // Was collapsed or no tabs
     331                if ( options.active === false || !this.anchors.length ) {
     332                        options.active = false;
     333                        this.active = $();
     334
     335                // was active, but active tab is gone
     336                } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
     337
     338                        // all remaining tabs are disabled
     339                        if ( this.tabs.length === options.disabled.length ) {
     340                                options.active = false;
     341                                this.active = $();
     342
     343                        // activate previous tab
     344                        } else {
     345                                this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
     346                        }
     347
     348                // was active, active tab still exists
     349                } else {
     350
     351                        // make sure active index is correct
     352                        options.active = this.tabs.index( this.active );
     353                }
     354
     355                this._refresh();
     356        },
     357
     358        _refresh: function() {
     359                this._setOptionDisabled( this.options.disabled );
     360                this._setupEvents( this.options.event );
     361                this._setupHeightStyle( this.options.heightStyle );
     362
     363                this.tabs.not( this.active ).attr( {
     364                        "aria-selected": "false",
     365                        "aria-expanded": "false",
     366                        tabIndex: -1
     367                } );
     368                this.panels.not( this._getPanelForTab( this.active ) )
     369                        .hide()
     370                        .attr( {
     371                                "aria-hidden": "true"
     372                        } );
     373
     374                // Make sure one tab is in the tab order
     375                if ( !this.active.length ) {
     376                        this.tabs.eq( 0 ).attr( "tabIndex", 0 );
     377                } else {
     378                        this.active
     379                                .attr( {
     380                                        "aria-selected": "true",
     381                                        "aria-expanded": "true",
     382                                        tabIndex: 0
     383                                } );
     384                        this._addClass( this.active, "ui-tabs-active", "ui-state-active" );
     385                        this._getPanelForTab( this.active )
     386                                .show()
     387                                .attr( {
     388                                        "aria-hidden": "false"
     389                                } );
     390                }
     391        },
     392
     393        _processTabs: function() {
     394                var that = this,
     395                        prevTabs = this.tabs,
     396                        prevAnchors = this.anchors,
     397                        prevPanels = this.panels;
     398
     399                this.tablist = this._getList().attr( "role", "tablist" );
     400                this._addClass( this.tablist, "ui-tabs-nav",
     401                        "ui-helper-reset ui-helper-clearfix ui-widget-header" );
     402
     403                // Prevent users from focusing disabled tabs via click
     404                this.tablist
     405                        .on( "mousedown" + this.eventNamespace, "> li", function( event ) {
     406                                if ( $( this ).is( ".ui-state-disabled" ) ) {
     407                                        event.preventDefault();
     408                                }
     409                        } )
     410
     411                        // Support: IE <9
     412                        // Preventing the default action in mousedown doesn't prevent IE
     413                        // from focusing the element, so if the anchor gets focused, blur.
     414                        // We don't have to worry about focusing the previously focused
     415                        // element since clicking on a non-focusable element should focus
     416                        // the body anyway.
     417                        .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
     418                                if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
     419                                        this.blur();
     420                                }
     421                        } );
     422
     423                this.tabs = this.tablist.find( "> li:has(a[href])" )
     424                        .attr( {
     425                                role: "tab",
     426                                tabIndex: -1
     427                        } );
     428                this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );
     429
     430                this.anchors = this.tabs.map( function() {
     431                        return $( "a", this )[ 0 ];
     432                } )
     433                        .attr( {
     434                                role: "presentation",
     435                                tabIndex: -1
     436                        } );
     437                this._addClass( this.anchors, "ui-tabs-anchor" );
     438
     439                this.panels = $();
     440
     441                this.anchors.each( function( i, anchor ) {
     442                        var selector, panel, panelId,
     443                                anchorId = $( anchor ).uniqueId().attr( "id" ),
     444                                tab = $( anchor ).closest( "li" ),
     445                                originalAriaControls = tab.attr( "aria-controls" );
     446
     447                        // Inline tab
     448                        if ( that._isLocal( anchor ) ) {
     449                                selector = anchor.hash;
     450                                panelId = selector.substring( 1 );
     451                                panel = that.element.find( that._sanitizeSelector( selector ) );
     452
     453                        // remote tab
     454                        } else {
     455
     456                                // If the tab doesn't already have aria-controls,
     457                                // generate an id by using a throw-away element
     458                                panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
     459                                selector = "#" + panelId;
     460                                panel = that.element.find( selector );
     461                                if ( !panel.length ) {
     462                                        panel = that._createPanel( panelId );
     463                                        panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
     464                                }
     465                                panel.attr( "aria-live", "polite" );
     466                        }
     467
     468                        if ( panel.length ) {
     469                                that.panels = that.panels.add( panel );
     470                        }
     471                        if ( originalAriaControls ) {
     472                                tab.data( "ui-tabs-aria-controls", originalAriaControls );
     473                        }
     474                        tab.attr( {
     475                                "aria-controls": panelId,
     476                                "aria-labelledby": anchorId
     477                        } );
     478                        panel.attr( "aria-labelledby", anchorId );
     479                } );
     480
     481                this.panels.attr( "role", "tabpanel" );
     482                this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );
     483
     484                // Avoid memory leaks (#10056)
     485                if ( prevTabs ) {
     486                        this._off( prevTabs.not( this.tabs ) );
     487                        this._off( prevAnchors.not( this.anchors ) );
     488                        this._off( prevPanels.not( this.panels ) );
     489                }
     490        },
     491
     492        // Allow overriding how to find the list for rare usage scenarios (#7715)
     493        _getList: function() {
     494                return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
     495        },
     496
     497        _createPanel: function( id ) {
     498                return $( "<div>" )
     499                        .attr( "id", id )
     500                        .data( "ui-tabs-destroy", true );
     501        },
     502
     503        _setOptionDisabled: function( disabled ) {
     504                var currentItem, li, i;
     505
     506                if ( $.isArray( disabled ) ) {
     507                        if ( !disabled.length ) {
     508                                disabled = false;
     509                        } else if ( disabled.length === this.anchors.length ) {
     510                                disabled = true;
     511                        }
     512                }
     513
     514                // Disable tabs
     515                for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
     516                        currentItem = $( li );
     517                        if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
     518                                currentItem.attr( "aria-disabled", "true" );
     519                                this._addClass( currentItem, null, "ui-state-disabled" );
     520                        } else {
     521                                currentItem.removeAttr( "aria-disabled" );
     522                                this._removeClass( currentItem, null, "ui-state-disabled" );
     523                        }
     524                }
     525
     526                this.options.disabled = disabled;
     527
     528                this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
     529                        disabled === true );
     530        },
     531
     532        _setupEvents: function( event ) {
     533                var events = {};
     534                if ( event ) {
     535                        $.each( event.split( " " ), function( index, eventName ) {
     536                                events[ eventName ] = "_eventHandler";
     537                        } );
     538                }
     539
     540                this._off( this.anchors.add( this.tabs ).add( this.panels ) );
     541
     542                // Always prevent the default action, even when disabled
     543                this._on( true, this.anchors, {
     544                        click: function( event ) {
     545                                event.preventDefault();
     546                        }
     547                } );
     548                this._on( this.anchors, events );
     549                this._on( this.tabs, { keydown: "_tabKeydown" } );
     550                this._on( this.panels, { keydown: "_panelKeydown" } );
     551
     552                this._focusable( this.tabs );
     553                this._hoverable( this.tabs );
     554        },
     555
     556        _setupHeightStyle: function( heightStyle ) {
     557                var maxHeight,
     558                        parent = this.element.parent();
     559
     560                if ( heightStyle === "fill" ) {
     561                        maxHeight = parent.height();
     562                        maxHeight -= this.element.outerHeight() - this.element.height();
     563
     564                        this.element.siblings( ":visible" ).each( function() {
     565                                var elem = $( this ),
     566                                        position = elem.css( "position" );
     567
     568                                if ( position === "absolute" || position === "fixed" ) {
     569                                        return;
     570                                }
     571                                maxHeight -= elem.outerHeight( true );
     572                        } );
     573
     574                        this.element.children().not( this.panels ).each( function() {
     575                                maxHeight -= $( this ).outerHeight( true );
     576                        } );
     577
     578                        this.panels.each( function() {
     579                                $( this ).height( Math.max( 0, maxHeight -
     580                                        $( this ).innerHeight() + $( this ).height() ) );
     581                        } )
     582                                .css( "overflow", "auto" );
     583                } else if ( heightStyle === "auto" ) {
     584                        maxHeight = 0;
     585                        this.panels.each( function() {
     586                                maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
     587                        } ).height( maxHeight );
     588                }
     589        },
     590
     591        _eventHandler: function( event ) {
     592                var options = this.options,
     593                        active = this.active,
     594                        anchor = $( event.currentTarget ),
     595                        tab = anchor.closest( "li" ),
     596                        clickedIsActive = tab[ 0 ] === active[ 0 ],
     597                        collapsing = clickedIsActive && options.collapsible,
     598                        toShow = collapsing ? $() : this._getPanelForTab( tab ),
     599                        toHide = !active.length ? $() : this._getPanelForTab( active ),
     600                        eventData = {
     601                                oldTab: active,
     602                                oldPanel: toHide,
     603                                newTab: collapsing ? $() : tab,
     604                                newPanel: toShow
     605                        };
     606
     607                event.preventDefault();
     608
     609                if ( tab.hasClass( "ui-state-disabled" ) ||
     610
     611                                // tab is already loading
     612                                tab.hasClass( "ui-tabs-loading" ) ||
     613
     614                                // can't switch durning an animation
     615                                this.running ||
     616
     617                                // click on active header, but not collapsible
     618                                ( clickedIsActive && !options.collapsible ) ||
     619
     620                                // allow canceling activation
     621                                ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
     622                        return;
     623                }
     624
     625                options.active = collapsing ? false : this.tabs.index( tab );
     626
     627                this.active = clickedIsActive ? $() : tab;
     628                if ( this.xhr ) {
     629                        this.xhr.abort();
     630                }
     631
     632                if ( !toHide.length && !toShow.length ) {
     633                        $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
     634                }
     635
     636                if ( toShow.length ) {
     637                        this.load( this.tabs.index( tab ), event );
     638                }
     639                this._toggle( event, eventData );
     640        },
     641
     642        // Handles show/hide for selecting tabs
     643        _toggle: function( event, eventData ) {
     644                var that = this,
     645                        toShow = eventData.newPanel,
     646                        toHide = eventData.oldPanel;
     647
     648                this.running = true;
     649
     650                function complete() {
     651                        that.running = false;
     652                        that._trigger( "activate", event, eventData );
     653                }
     654
     655                function show() {
     656                        that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );
     657
     658                        if ( toShow.length && that.options.show ) {
     659                                that._show( toShow, that.options.show, complete );
     660                        } else {
     661                                toShow.show();
     662                                complete();
     663                        }
     664                }
     665
     666                // Start out by hiding, then showing, then completing
     667                if ( toHide.length && this.options.hide ) {
     668                        this._hide( toHide, this.options.hide, function() {
     669                                that._removeClass( eventData.oldTab.closest( "li" ),
     670                                        "ui-tabs-active", "ui-state-active" );
     671                                show();
     672                        } );
     673                } else {
     674                        this._removeClass( eventData.oldTab.closest( "li" ),
     675                                "ui-tabs-active", "ui-state-active" );
     676                        toHide.hide();
     677                        show();
     678                }
     679
     680                toHide.attr( "aria-hidden", "true" );
     681                eventData.oldTab.attr( {
     682                        "aria-selected": "false",
     683                        "aria-expanded": "false"
     684                } );
     685
     686                // If we're switching tabs, remove the old tab from the tab order.
     687                // If we're opening from collapsed state, remove the previous tab from the tab order.
     688                // If we're collapsing, then keep the collapsing tab in the tab order.
     689                if ( toShow.length && toHide.length ) {
     690                        eventData.oldTab.attr( "tabIndex", -1 );
     691                } else if ( toShow.length ) {
     692                        this.tabs.filter( function() {
     693                                return $( this ).attr( "tabIndex" ) === 0;
     694                        } )
     695                                .attr( "tabIndex", -1 );
     696                }
     697
     698                toShow.attr( "aria-hidden", "false" );
     699                eventData.newTab.attr( {
     700                        "aria-selected": "true",
     701                        "aria-expanded": "true",
     702                        tabIndex: 0
     703                } );
     704        },
     705
     706        _activate: function( index ) {
     707                var anchor,
     708                        active = this._findActive( index );
     709
     710                // Trying to activate the already active panel
     711                if ( active[ 0 ] === this.active[ 0 ] ) {
     712                        return;
     713                }
     714
     715                // Trying to collapse, simulate a click on the current active header
     716                if ( !active.length ) {
     717                        active = this.active;
     718                }
     719
     720                anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
     721                this._eventHandler( {
     722                        target: anchor,
     723                        currentTarget: anchor,
     724                        preventDefault: $.noop
     725                } );
     726        },
     727
     728        _findActive: function( index ) {
     729                return index === false ? $() : this.tabs.eq( index );
     730        },
     731
     732        _getIndex: function( index ) {
     733
     734                // meta-function to give users option to provide a href string instead of a numerical index.
     735                if ( typeof index === "string" ) {
     736                        index = this.anchors.index( this.anchors.filter( "[href$='" +
     737                                $.ui.escapeSelector( index ) + "']" ) );
     738                }
     739
     740                return index;
     741        },
     742
     743        _destroy: function() {
     744                if ( this.xhr ) {
     745                        this.xhr.abort();
     746                }
     747
     748                this.tablist
     749                        .removeAttr( "role" )
     750                        .off( this.eventNamespace );
     751
     752                this.anchors
     753                        .removeAttr( "role tabIndex" )
     754                        .removeUniqueId();
     755
     756                this.tabs.add( this.panels ).each( function() {
     757                        if ( $.data( this, "ui-tabs-destroy" ) ) {
     758                                $( this ).remove();
     759                        } else {
     760                                $( this ).removeAttr( "role tabIndex " +
     761                                        "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
     762                        }
     763                } );
     764
     765                this.tabs.each( function() {
     766                        var li = $( this ),
     767                                prev = li.data( "ui-tabs-aria-controls" );
     768                        if ( prev ) {
     769                                li
     770                                        .attr( "aria-controls", prev )
     771                                        .removeData( "ui-tabs-aria-controls" );
     772                        } else {
     773                                li.removeAttr( "aria-controls" );
     774                        }
     775                } );
     776
     777                this.panels.show();
     778
     779                if ( this.options.heightStyle !== "content" ) {
     780                        this.panels.css( "height", "" );
     781                }
     782        },
     783
     784        enable: function( index ) {
     785                var disabled = this.options.disabled;
     786                if ( disabled === false ) {
     787                        return;
     788                }
     789
     790                if ( index === undefined ) {
     791                        disabled = false;
     792                } else {
     793                        index = this._getIndex( index );
     794                        if ( $.isArray( disabled ) ) {
     795                                disabled = $.map( disabled, function( num ) {
     796                                        return num !== index ? num : null;
     797                                } );
     798                        } else {
     799                                disabled = $.map( this.tabs, function( li, num ) {
     800                                        return num !== index ? num : null;
     801                                } );
     802                        }
     803                }
     804                this._setOptionDisabled( disabled );
     805        },
     806
     807        disable: function( index ) {
     808                var disabled = this.options.disabled;
     809                if ( disabled === true ) {
     810                        return;
     811                }
     812
     813                if ( index === undefined ) {
     814                        disabled = true;
     815                } else {
     816                        index = this._getIndex( index );
     817                        if ( $.inArray( index, disabled ) !== -1 ) {
     818                                return;
     819                        }
     820                        if ( $.isArray( disabled ) ) {
     821                                disabled = $.merge( [ index ], disabled ).sort();
     822                        } else {
     823                                disabled = [ index ];
     824                        }
     825                }
     826                this._setOptionDisabled( disabled );
     827        },
     828
     829        load: function( index, event ) {
     830                index = this._getIndex( index );
     831                var that = this,
     832                        tab = this.tabs.eq( index ),
     833                        anchor = tab.find( ".ui-tabs-anchor" ),
     834                        panel = this._getPanelForTab( tab ),
     835                        eventData = {
     836                                tab: tab,
     837                                panel: panel
     838                        },
     839                        complete = function( jqXHR, status ) {
     840                                if ( status === "abort" ) {
     841                                        that.panels.stop( false, true );
     842                                }
     843
     844                                that._removeClass( tab, "ui-tabs-loading" );
     845                                panel.removeAttr( "aria-busy" );
     846
     847                                if ( jqXHR === that.xhr ) {
     848                                        delete that.xhr;
     849                                }
     850                        };
     851
     852                // Not remote
     853                if ( this._isLocal( anchor[ 0 ] ) ) {
     854                        return;
     855                }
     856
     857                this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
     858
     859                // Support: jQuery <1.8
     860                // jQuery <1.8 returns false if the request is canceled in beforeSend,
     861                // but as of 1.8, $.ajax() always returns a jqXHR object.
     862                if ( this.xhr && this.xhr.statusText !== "canceled" ) {
     863                        this._addClass( tab, "ui-tabs-loading" );
     864                        panel.attr( "aria-busy", "true" );
     865
     866                        this.xhr
     867                                .done( function( response, status, jqXHR ) {
     868
     869                                        // support: jQuery <1.8
     870                                        // http://bugs.jquery.com/ticket/11778
     871                                        setTimeout( function() {
     872                                                panel.html( response );
     873                                                that._trigger( "load", event, eventData );
     874
     875                                                complete( jqXHR, status );
     876                                        }, 1 );
     877                                } )
     878                                .fail( function( jqXHR, status ) {
     879
     880                                        // support: jQuery <1.8
     881                                        // http://bugs.jquery.com/ticket/11778
     882                                        setTimeout( function() {
     883                                                complete( jqXHR, status );
     884                                        }, 1 );
     885                                } );
     886                }
     887        },
     888
     889        _ajaxSettings: function( anchor, event, eventData ) {
     890                var that = this;
     891                return {
     892
     893                        // Support: IE <11 only
     894                        // Strip any hash that exists to prevent errors with the Ajax request
     895                        url: anchor.attr( "href" ).replace( /#.*$/, "" ),
     896                        beforeSend: function( jqXHR, settings ) {
     897                                return that._trigger( "beforeLoad", event,
     898                                        $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
     899                        }
     900                };
     901        },
     902
     903        _getPanelForTab: function( tab ) {
     904                var id = $( tab ).attr( "aria-controls" );
     905                return this.element.find( this._sanitizeSelector( "#" + id ) );
     906        }
     907} );
     908
     909// DEPRECATED
     910// TODO: Switch return back to widget declaration at top of file when this is removed
     911if ( $.uiBackCompat !== false ) {
     912
     913        // Backcompat for ui-tab class (now ui-tabs-tab)
     914        $.widget( "ui.tabs", $.ui.tabs, {
     915                _processTabs: function() {
     916                        this._superApply( arguments );
     917                        this._addClass( this.tabs, "ui-tab" );
     918                }
     919        } );
     920}
     921
     922return $.ui.tabs;
     923
     924} ) );
  • src/js/_enqueues/vendor/jquery/ui/tooltip.js

    Property changes on: src/js/_enqueues/vendor/jquery/ui/tabs.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
     1/*!
     2 * jQuery UI Tooltip 1.12.1
     3 * http://jqueryui.com
     4 *
     5 * Copyright jQuery Foundation and other contributors
     6 * Released under the MIT license.
     7 * http://jquery.org/license
     8 */
     9
     10//>>label: Tooltip
     11//>>group: Widgets
     12//>>description: Shows additional information for any element on hover or focus.
     13//>>docs: http://api.jqueryui.com/tooltip/
     14//>>demos: http://jqueryui.com/tooltip/
     15//>>css.structure: ../../themes/base/core.css
     16//>>css.structure: ../../themes/base/tooltip.css
     17//>>css.theme: ../../themes/base/theme.css
     18
     19( function( factory ) {
     20        if ( typeof define === "function" && define.amd ) {
     21
     22                // AMD. Register as an anonymous module.
     23                define( [
     24                        "jquery",
     25                        "./keycode",
     26                        "./position",
     27                        "./unique-id",
     28                        "./version",
     29                        "./widget"
     30                ], factory );
     31        } else {
     32
     33                // Browser globals
     34                factory( jQuery );
     35        }
     36}( function( $ ) {
     37
     38$.widget( "ui.tooltip", {
     39        version: "1.12.1",
     40        options: {
     41                classes: {
     42                        "ui-tooltip": "ui-corner-all ui-widget-shadow"
     43                },
     44                content: function() {
     45
     46                        // support: IE<9, Opera in jQuery <1.7
     47                        // .text() can't accept undefined, so coerce to a string
     48                        var title = $( this ).attr( "title" ) || "";
     49
     50                        // Escape title, since we're going from an attribute to raw HTML
     51                        return $( "<a>" ).text( title ).html();
     52                },
     53                hide: true,
     54
     55                // Disabled elements have inconsistent behavior across browsers (#8661)
     56                items: "[title]:not([disabled])",
     57                position: {
     58                        my: "left top+15",
     59                        at: "left bottom",
     60                        collision: "flipfit flip"
     61                },
     62                show: true,
     63                track: false,
     64
     65                // Callbacks
     66                close: null,
     67                open: null
     68        },
     69
     70        _addDescribedBy: function( elem, id ) {
     71                var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
     72                describedby.push( id );
     73                elem
     74                        .data( "ui-tooltip-id", id )
     75                        .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
     76        },
     77
     78        _removeDescribedBy: function( elem ) {
     79                var id = elem.data( "ui-tooltip-id" ),
     80                        describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
     81                        index = $.inArray( id, describedby );
     82
     83                if ( index !== -1 ) {
     84                        describedby.splice( index, 1 );
     85                }
     86
     87                elem.removeData( "ui-tooltip-id" );
     88                describedby = $.trim( describedby.join( " " ) );
     89                if ( describedby ) {
     90                        elem.attr( "aria-describedby", describedby );
     91                } else {
     92                        elem.removeAttr( "aria-describedby" );
     93                }
     94        },
     95
     96        _create: function() {
     97                this._on( {
     98                        mouseover: "open",
     99                        focusin: "open"
     100                } );
     101
     102                // IDs of generated tooltips, needed for destroy
     103                this.tooltips = {};
     104
     105                // IDs of parent tooltips where we removed the title attribute
     106                this.parents = {};
     107
     108                // Append the aria-live region so tooltips announce correctly
     109                this.liveRegion = $( "<div>" )
     110                        .attr( {
     111                                role: "log",
     112                                "aria-live": "assertive",
     113                                "aria-relevant": "additions"
     114                        } )
     115                        .appendTo( this.document[ 0 ].body );
     116                this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
     117
     118                this.disabledTitles = $( [] );
     119        },
     120
     121        _setOption: function( key, value ) {
     122                var that = this;
     123
     124                this._super( key, value );
     125
     126                if ( key === "content" ) {
     127                        $.each( this.tooltips, function( id, tooltipData ) {
     128                                that._updateContent( tooltipData.element );
     129                        } );
     130                }
     131        },
     132
     133        _setOptionDisabled: function( value ) {
     134                this[ value ? "_disable" : "_enable" ]();
     135        },
     136
     137        _disable: function() {
     138                var that = this;
     139
     140                // Close open tooltips
     141                $.each( this.tooltips, function( id, tooltipData ) {
     142                        var event = $.Event( "blur" );
     143                        event.target = event.currentTarget = tooltipData.element[ 0 ];
     144                        that.close( event, true );
     145                } );
     146
     147                // Remove title attributes to prevent native tooltips
     148                this.disabledTitles = this.disabledTitles.add(
     149                        this.element.find( this.options.items ).addBack()
     150                                .filter( function() {
     151                                        var element = $( this );
     152                                        if ( element.is( "[title]" ) ) {
     153                                                return element
     154                                                        .data( "ui-tooltip-title", element.attr( "title" ) )
     155                                                        .removeAttr( "title" );
     156                                        }
     157                                } )
     158                );
     159        },
     160
     161        _enable: function() {
     162
     163                // restore title attributes
     164                this.disabledTitles.each( function() {
     165                        var element = $( this );
     166                        if ( element.data( "ui-tooltip-title" ) ) {
     167                                element.attr( "title", element.data( "ui-tooltip-title" ) );
     168                        }
     169                } );
     170                this.disabledTitles = $( [] );
     171        },
     172
     173        open: function( event ) {
     174                var that = this,
     175                        target = $( event ? event.target : this.element )
     176
     177                                // we need closest here due to mouseover bubbling,
     178                                // but always pointing at the same event target
     179                                .closest( this.options.items );
     180
     181                // No element to show a tooltip for or the tooltip is already open
     182                if ( !target.length || target.data( "ui-tooltip-id" ) ) {
     183                        return;
     184                }
     185
     186                if ( target.attr( "title" ) ) {
     187                        target.data( "ui-tooltip-title", target.attr( "title" ) );
     188                }
     189
     190                target.data( "ui-tooltip-open", true );
     191
     192                // Kill parent tooltips, custom or native, for hover
     193                if ( event && event.type === "mouseover" ) {
     194                        target.parents().each( function() {
     195                                var parent = $( this ),
     196                                        blurEvent;
     197                                if ( parent.data( "ui-tooltip-open" ) ) {
     198                                        blurEvent = $.Event( "blur" );
     199                                        blurEvent.target = blurEvent.currentTarget = this;
     200                                        that.close( blurEvent, true );
     201                                }
     202                                if ( parent.attr( "title" ) ) {
     203                                        parent.uniqueId();
     204                                        that.parents[ this.id ] = {
     205                                                element: this,
     206                                                title: parent.attr( "title" )
     207                                        };
     208                                        parent.attr( "title", "" );
     209                                }
     210                        } );
     211                }
     212
     213                this._registerCloseHandlers( event, target );
     214                this._updateContent( target, event );
     215        },
     216
     217        _updateContent: function( target, event ) {
     218                var content,
     219                        contentOption = this.options.content,
     220                        that = this,
     221                        eventType = event ? event.type : null;
     222
     223                if ( typeof contentOption === "string" || contentOption.nodeType ||
     224                                contentOption.jquery ) {
     225                        return this._open( event, target, contentOption );
     226                }
     227
     228                content = contentOption.call( target[ 0 ], function( response ) {
     229
     230                        // IE may instantly serve a cached response for ajax requests
     231                        // delay this call to _open so the other call to _open runs first
     232                        that._delay( function() {
     233
     234                                // Ignore async response if tooltip was closed already
     235                                if ( !target.data( "ui-tooltip-open" ) ) {
     236                                        return;
     237                                }
     238
     239                                // JQuery creates a special event for focusin when it doesn't
     240                                // exist natively. To improve performance, the native event
     241                                // object is reused and the type is changed. Therefore, we can't
     242                                // rely on the type being correct after the event finished
     243                                // bubbling, so we set it back to the previous value. (#8740)
     244                                if ( event ) {
     245                                        event.type = eventType;
     246                                }
     247                                this._open( event, target, response );
     248                        } );
     249                } );
     250                if ( content ) {
     251                        this._open( event, target, content );
     252                }
     253        },
     254
     255        _open: function( event, target, content ) {
     256                var tooltipData, tooltip, delayedShow, a11yContent,
     257                        positionOption = $.extend( {}, this.options.position );
     258
     259                if ( !content ) {
     260                        return;
     261                }
     262
     263                // Content can be updated multiple times. If the tooltip already
     264                // exists, then just update the content and bail.
     265                tooltipData = this._find( target );
     266                if ( tooltipData ) {
     267                        tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
     268                        return;
     269                }
     270
     271                // If we have a title, clear it to prevent the native tooltip
     272                // we have to check first to avoid defining a title if none exists
     273                // (we don't want to cause an element to start matching [title])
     274                //
     275                // We use removeAttr only for key events, to allow IE to export the correct
     276                // accessible attributes. For mouse events, set to empty string to avoid
     277                // native tooltip showing up (happens only when removing inside mouseover).
     278                if ( target.is( "[title]" ) ) {
     279                        if ( event && event.type === "mouseover" ) {
     280                                target.attr( "title", "" );
     281                        } else {
     282                                target.removeAttr( "title" );
     283                        }
     284                }
     285
     286                tooltipData = this._tooltip( target );
     287                tooltip = tooltipData.tooltip;
     288                this._addDescribedBy( target, tooltip.attr( "id" ) );
     289                tooltip.find( ".ui-tooltip-content" ).html( content );
     290
     291                // Support: Voiceover on OS X, JAWS on IE <= 9
     292                // JAWS announces deletions even when aria-relevant="additions"
     293                // Voiceover will sometimes re-read the entire log region's contents from the beginning
     294                this.liveRegion.children().hide();
     295                a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
     296                a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
     297                a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
     298                a11yContent.appendTo( this.liveRegion );
     299
     300                function position( event ) {
     301                        positionOption.of = event;
     302                        if ( tooltip.is( ":hidden" ) ) {
     303                                return;
     304                        }
     305                        tooltip.position( positionOption );
     306                }
     307                if ( this.options.track && event && /^mouse/.test( event.type ) ) {
     308                        this._on( this.document, {
     309                                mousemove: position
     310                        } );
     311
     312                        // trigger once to override element-relative positioning
     313                        position( event );
     314                } else {
     315                        tooltip.position( $.extend( {
     316                                of: target
     317                        }, this.options.position ) );
     318                }
     319
     320                tooltip.hide();
     321
     322                this._show( tooltip, this.options.show );
     323
     324                // Handle tracking tooltips that are shown with a delay (#8644). As soon
     325                // as the tooltip is visible, position the tooltip using the most recent
     326                // event.
     327                // Adds the check to add the timers only when both delay and track options are set (#14682)
     328                if ( this.options.track && this.options.show && this.options.show.delay ) {
     329                        delayedShow = this.delayedShow = setInterval( function() {
     330                                if ( tooltip.is( ":visible" ) ) {
     331                                        position( positionOption.of );
     332                                        clearInterval( delayedShow );
     333                                }
     334                        }, $.fx.interval );
     335                }
     336
     337                this._trigger( "open", event, { tooltip: tooltip } );
     338        },
     339
     340        _registerCloseHandlers: function( event, target ) {
     341                var events = {
     342                        keyup: function( event ) {
     343                                if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
     344                                        var fakeEvent = $.Event( event );
     345                                        fakeEvent.currentTarget = target[ 0 ];
     346                                        this.close( fakeEvent, true );
     347                                }
     348                        }
     349                };
     350
     351                // Only bind remove handler for delegated targets. Non-delegated
     352                // tooltips will handle this in destroy.
     353                if ( target[ 0 ] !== this.element[ 0 ] ) {
     354                        events.remove = function() {
     355                                this._removeTooltip( this._find( target ).tooltip );
     356                        };
     357                }
     358
     359                if ( !event || event.type === "mouseover" ) {
     360                        events.mouseleave = "close";
     361                }
     362                if ( !event || event.type === "focusin" ) {
     363                        events.focusout = "close";
     364                }
     365                this._on( true, target, events );
     366        },
     367
     368        close: function( event ) {
     369                var tooltip,
     370                        that = this,
     371                        target = $( event ? event.currentTarget : this.element ),
     372                        tooltipData = this._find( target );
     373
     374                // The tooltip may already be closed
     375                if ( !tooltipData ) {
     376
     377                        // We set ui-tooltip-open immediately upon open (in open()), but only set the
     378                        // additional data once there's actually content to show (in _open()). So even if the
     379                        // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
     380                        // the period between open() and _open().
     381                        target.removeData( "ui-tooltip-open" );
     382                        return;
     383                }
     384
     385                tooltip = tooltipData.tooltip;
     386
     387                // Disabling closes the tooltip, so we need to track when we're closing
     388                // to avoid an infinite loop in case the tooltip becomes disabled on close
     389                if ( tooltipData.closing ) {
     390                        return;
     391                }
     392
     393                // Clear the interval for delayed tracking tooltips
     394                clearInterval( this.delayedShow );
     395
     396                // Only set title if we had one before (see comment in _open())
     397                // If the title attribute has changed since open(), don't restore
     398                if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
     399                        target.attr( "title", target.data( "ui-tooltip-title" ) );
     400                }
     401
     402                this._removeDescribedBy( target );
     403
     404                tooltipData.hiding = true;
     405                tooltip.stop( true );
     406                this._hide( tooltip, this.options.hide, function() {
     407                        that._removeTooltip( $( this ) );
     408                } );
     409
     410                target.removeData( "ui-tooltip-open" );
     411                this._off( target, "mouseleave focusout keyup" );
     412
     413                // Remove 'remove' binding only on delegated targets
     414                if ( target[ 0 ] !== this.element[ 0 ] ) {
     415                        this._off( target, "remove" );
     416                }
     417                this._off( this.document, "mousemove" );
     418
     419                if ( event && event.type === "mouseleave" ) {
     420                        $.each( this.parents, function( id, parent ) {
     421                                $( parent.element ).attr( "title", parent.title );
     422                                delete that.parents[ id ];
     423                        } );
     424                }
     425
     426                tooltipData.closing = true;
     427                this._trigger( "close", event, { tooltip: tooltip } );
     428                if ( !tooltipData.hiding ) {
     429                        tooltipData.closing = false;
     430                }
     431        },
     432
     433        _tooltip: function( element ) {
     434                var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
     435                        content = $( "<div>" ).appendTo( tooltip ),
     436                        id = tooltip.uniqueId().attr( "id" );
     437
     438                this._addClass( content, "ui-tooltip-content" );
     439                this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
     440
     441                tooltip.appendTo( this._appendTo( element ) );
     442
     443                return this.tooltips[ id ] = {
     444                        element: element,
     445                        tooltip: tooltip
     446                };
     447        },
     448
     449        _find: function( target ) {
     450                var id = target.data( "ui-tooltip-id" );
     451                return id ? this.tooltips[ id ] : null;
     452        },
     453
     454        _removeTooltip: function( tooltip ) {
     455                tooltip.remove();
     456                delete this.tooltips[ tooltip.attr( "id" ) ];
     457        },
     458
     459        _appendTo: function( target ) {
     460                var element = target.closest( ".ui-front, dialog" );
     461
     462                if ( !element.length ) {
     463                        element = this.document[ 0 ].body;
     464                }
     465
     466                return element;
     467        },
     468
     469        _destroy: function() {
     470                var that = this;
     471
     472                // Close open tooltips
     473                $.each( this.tooltips, function( id, tooltipData ) {
     474
     475                        // Delegate to close method to handle common cleanup
     476                        var event = $.Event( "blur" ),
     477                                element = tooltipData.element;
     478                        event.target = event.currentTarget = element[ 0 ];
     479                        that.close( event, true );
     480
     481                        // Remove immediately; destroying an open tooltip doesn't use the
     482                        // hide animation
     483                        $( "#" + id ).remove();
     484
     485                        // Restore the title
     486                        if ( element.data( "ui-tooltip-title" ) ) {
     487
     488                                // If the title attribute has changed since open(), don't restore
     489                                if ( !element.attr( "title" ) ) {
     490                                        element.attr( "title", element.data( "ui-tooltip-title" ) );
     491                                }
     492                                element.removeData( "ui-tooltip-title" );
     493                        }
     494                } );
     495                this.liveRegion.remove();
     496        }
     497} );
     498
     499// DEPRECATED
     500// TODO: Switch return back to widget declaration at top of file when this is removed
     501if ( $.uiBackCompat !== false ) {
     502
     503        // Backcompat for tooltipClass option
     504        $.widget( "ui.tooltip", $.ui.tooltip, {
     505                options: {
     506                        tooltipClass: null
     507                },
     508                _tooltip: function() {
     509                        var tooltipData = this._superApply( arguments );
     510                        if ( this.options.tooltipClass ) {
     511                                tooltipData.tooltip.addClass( this.options.tooltipClass );
     512                        }
     513                        return tooltipData;
     514                }
     515        } );
     516}
     517
     518return $.ui.tooltip;
     519
     520} ) );
  • src/wp-includes/script-loader.php

    Property changes on: src/js/_enqueues/vendor/jquery/ui/tooltip.js
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
    680680                )
    681681        );
    682682
    683         $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), false, 1 );
     683        $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-core' ), false, 1 );
    684684        $scripts->set_translations( 'wp-pointer' );
    685685
    686686        $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
     
    719719        $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
    720720
    721721        // jQuery.
    722         $scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4-wp' );
    723         $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4-wp' );
    724         $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
     722        $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '3.5.1' );
     723        $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '3.5.1' );
     724        $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '3.3.1' );
    725725
    726726        // Full jQuery UI.
    727         $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
    728         $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
     727        // The building process in 1.12.1 has changed significantly.
     728        // In order to keep backwards compatibility, and to keep the optimized loading of only needed scripts,
     729        // the `jquery-ui.js` file was split in three parts:
     730        // - effects-all.js containing all effects (all files from "group: Effects").
     731        // - core.js now contains 'jquery-ui-position', 'jquery-ui-widget' and the rest of the files from "group: Core".
     732        // - The files from "group: Widgets" and "group: Interactions" are still separate to optimize loading.
     733        $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.12.1', 1 );
    729734
    730         $scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    731         $scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    732         $scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    733         $scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    734         $scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    735         $scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    736         $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    737         $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    738         $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.11.4', 1 );
    739         $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    740         $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.11.4', 1 );
    741         $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    742         $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    743         $scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
    744         $scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     735        // As of 1.12.1 the jQuery UI Effects are concatenated in `effects-all.js`.
     736        // Listed here for back-compat.
     737        $scripts->add( 'jquery-effects', "/wp-includes/js/jquery/ui/effect-all$dev_suffix.js", array( 'jquery' ), '1.12.1', 1 );
     738        $scripts->add( 'jquery-effects-core', false, array( 'jquery-effects' ), '1.12.1', 1 );
     739        $scripts->add( 'jquery-effects-blind', false, array( 'jquery-effects' ), '1.12.1', 1 );
     740        $scripts->add( 'jquery-effects-bounce', false, array( 'jquery-effects' ), '1.12.1', 1 );
     741        $scripts->add( 'jquery-effects-clip', false, array( 'jquery-effects' ), '1.12.1', 1 );
     742        $scripts->add( 'jquery-effects-drop', false, array( 'jquery-effects' ), '1.12.1', 1 );
     743        $scripts->add( 'jquery-effects-explode', false, array( 'jquery-effects' ), '1.12.1', 1 );
     744        $scripts->add( 'jquery-effects-fade', false, array( 'jquery-effects' ), '1.12.1', 1 );
     745        $scripts->add( 'jquery-effects-fold', false, array( 'jquery-effects' ), '1.12.1', 1 );
     746        $scripts->add( 'jquery-effects-highlight', false, array( 'jquery-effects' ), '1.12.1', 1 );
     747        $scripts->add( 'jquery-effects-puff', false, array( 'jquery-effects' ), '1.12.1', 1 );
     748        $scripts->add( 'jquery-effects-pulsate', false, array( 'jquery-effects' ), '1.12.1', 1 );
     749        $scripts->add( 'jquery-effects-scale', false, array( 'jquery-effects' ), '1.12.1', 1 );
     750        $scripts->add( 'jquery-effects-shake', false, array( 'jquery-effects' ), '1.12.1', 1 );
     751        $scripts->add( 'jquery-effects-size', false, array( 'jquery-effects' ), '1.12.1', 1 );
     752        $scripts->add( 'jquery-effects-slide', false, array( 'jquery-effects' ), '1.12.1', 1 );
     753        $scripts->add( 'jquery-effects-transfer', false, array( 'jquery-effects' ), '1.12.1', 1 );
    745754
    746         $scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    747         $scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 );
    748         $scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    749         $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array( 'jquery-ui-core' ), '1.11.4', 1 );
    750         $scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position' ), '1.11.4', 1 );
    751         $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
    752         $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array( 'jquery-ui-draggable' ), '1.11.4', 1 );
    753         $scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
    754         $scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    755         $scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
    756         $scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    757         $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
    758         $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
    759         $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array( 'jquery-ui-menu' ), '1.11.4', 1 );
    760         $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
    761         $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
    762         $scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 );
    763         $scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    764         $scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
    765         $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
     755        $scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     756        $scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.12.1', 1 );
     757        $scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-controlgroup', 'jquery-ui-checkboxradio' ), '1.12.1', 1 );
     758        $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     759        $scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button' ), '1.12.1', 1 );
     760        $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
     761        $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array( 'jquery-ui-draggable' ), '1.12.1', 1 );
     762        $scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     763        $scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     764        $scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     765        $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
     766        $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
     767        $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array( 'jquery-ui-menu' ), '1.12.1', 1 );
     768        $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
     769        $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.12.1', 1 );
     770        $scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.12.1', 1 );
     771        $scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     772        $scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
    766773
     774        // As of 1.12.1 `jquery-ui-position` and `jquery-ui-widget` are part of `jquery-ui-core`.
     775        // Listed here for back-compat.
     776        $scripts->add( 'jquery-ui-position', false, array( 'jquery-ui-core' ), '1.12.1', 1 );
     777        $scripts->add( 'jquery-ui-widget', false, array( 'jquery-ui-core' ), '1.12.1', 1 );
     778
     779        // New in 1.12.1
     780        $scripts->add( 'jquery-ui-checkboxradio', "/wp-includes/js/jquery/ui/checkboxradio$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     781        $scripts->add( 'jquery-ui-controlgroup', "/wp-includes/js/jquery/ui/controlgroup$dev_suffix.js", array( 'jquery-ui-core' ), '1.12.1', 1 );
     782
    767783        // Strings for 'jquery-ui-autocomplete' live region messages.
    768784        did_action( 'init' ) && $scripts->localize(
    769785                'jquery-ui-autocomplete',
     
    788804        $scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2', 1 );
    789805        $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 );
    790806        $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 );
    791         $scripts->add( 'jquery-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js', array( 'jquery-ui-widget', 'jquery-ui-mouse' ), '0.2.2', 1 );
     807        $scripts->add( 'jquery-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js', array( 'jquery-ui-core', 'jquery-ui-mouse' ), '0.2.2', 1 );
    792808
    793809        // Not used any more, registered for backward compatibility.
    794810        $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 );